Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test generated by RoostGPT #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

harishagrawal
Copy link

Please pull these awesome changes in!
Test Name      - cloude-amazing-python
AI Type        - Claude AI
AI Model       - claude-3-opus-20240229
Test Type      - Unit test
Use Type       - ui
Language       - python
Test Framework - Pytest

Access Logs At - https://demo.roost.ai/roostgpt/logs?trigger_id=5e2c8606-742b-45a2-bd75-a3a61535b891

Using AI Model claude-3-opus-20240229
@mgdevstack
Copy link

29/32 TESTS PASS

vscode ➜ /workspaces/Amazing-Python-Scripts/text_encryption (roost-1713858777) $ python3 -m pytest
============================================================================================ test session starts =============================================================================================
platform linux -- Python 3.12.2, pytest-8.1.1, pluggy-1.5.0
rootdir: /workspaces/Amazing-Python-Scripts/text_encryption
collected 32 items                                                                                                                                                                                           

test_EncryptionMethodAffineCipherEncrypt.py ......                                                                                                                                                     [ 18%]
test_EncryptionMethodCaesarCipherEncrypt.py ......                                                                                                                                                     [ 37%]
test_EncryptionMethodMain.py .........                                                                                                                                                                 [ 65%]
test_EncryptionMethodSubstitutionCipherEncrypt.py ...FF                                                                                                                                                [ 81%]
test_EncryptionMethodTranspositionCipherEncrypt.py F.....                                                                                                                                              [100%]

================================================================================================== FAILURES ==================================================================================================
____________________________________________________________________________________ test_encrypt_with_repeated_key_chars ____________________________________________________________________________________

    def test_encrypt_with_repeated_key_chars():
        text = "Hello, World!"
        key = "QWERTYUIOPQWERTYUIOPZXCVBN"  # Key with repeated characters
        expected_encrypted_text = "Itssg, Vgksr!"  # Changed expected output to match the key
        encrypted_text = substitution_cipher_encrypt(text, key)
>       assert encrypted_text == expected_encrypted_text
E       AssertionError: assert 'Itwwt, Ctiwr!' == 'Itssg, Vgksr!'
E         
E         - Itssg, Vgksr!
E         + Itwwt, Ctiwr!

test_EncryptionMethodSubstitutionCipherEncrypt.py:113: AssertionError
____________________________________________________________________________________ test_encrypt_with_invalid_key_length ____________________________________________________________________________________

    def test_encrypt_with_invalid_key_length():
        text = "Hello, World!"
        key = "QWERTYUIOPASDFGHJKLZXCVB"  # Key length is 24 (should be 26)
        with pytest.raises(ValueError) as exc_info:
            substitution_cipher_encrypt(text, key)
>       assert str(exc_info.value) == "Invalid key length. Key length should be 26."  # Updated error message
E       AssertionError: assert 'the first tw... equal length' == 'Invalid key ...should be 26.'
E         
E         - Invalid key length. Key length should be 26.
E         + the first two maketrans arguments must have equal length

test_EncryptionMethodSubstitutionCipherEncrypt.py:120: AssertionError
_______________________________________________________________________________ test_transposition_cipher_encrypt_valid_input ________________________________________________________________________________

    def test_transposition_cipher_encrypt_valid_input():
        # Arrange
        text = "Hello, World!"
        key = 3
        expected_ciphertext = "Hoo!el,Wrdll "
    
        # Act
        ciphertext = transposition_cipher_encrypt(text, key)
    
        # Assert
>       assert ciphertext == expected_ciphertext
E       AssertionError: assert 'Hl r!eoWll,od' == 'Hoo!el,Wrdll '
E         
E         - Hoo!el,Wrdll 
E         + Hl r!eoWll,od

test_EncryptionMethodTranspositionCipherEncrypt.py:103: AssertionError
========================================================================================== short test summary info ===========================================================================================
FAILED test_EncryptionMethodSubstitutionCipherEncrypt.py::test_encrypt_with_repeated_key_chars - AssertionError: assert 'Itwwt, Ctiwr!' == 'Itssg, Vgksr!'
FAILED test_EncryptionMethodSubstitutionCipherEncrypt.py::test_encrypt_with_invalid_key_length - AssertionError: assert 'the first tw... equal length' == 'Invalid key ...should be 26.'
FAILED test_EncryptionMethodTranspositionCipherEncrypt.py::test_transposition_cipher_encrypt_valid_input - AssertionError: assert 'Hl r!eoWll,od' == 'Hoo!el,Wrdll '
======================================================================================== 3 failed, 29 passed in 0.35s ========================================================================================
vscode ➜ /workspaces/Amazing-Python-Scripts/text_encryption (roost-1713858777) $ 

@mgdevstack
Copy link

vscode ➜ /workspaces/Amazing-Python-Scripts/text_encryption (roost-1713858777) $ coverage report  -m 
Name                                                 Stmts   Miss  Cover   Missing
----------------------------------------------------------------------------------
encryption_method.py                                    83      6    93%   76-78, 122-123, 130
test_EncryptionMethodAffineCipherEncrypt.py             46      0   100%
test_EncryptionMethodCaesarCipherEncrypt.py             40      0   100%
test_EncryptionMethodMain.py                            41      0   100%
test_EncryptionMethodSubstitutionCipherEncrypt.py       34      0   100%
test_EncryptionMethodTranspositionCipherEncrypt.py      39      0   100%
----------------------------------------------------------------------------------
TOTAL                                                  283      6    98%
vscode ➜ /workspaces/Amazing-Python-Scripts/text_encryption (roost-1713858777) $ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants