Esempio n. 1
0
def test_fruit_for_Samer():
    """
    Do encryption and test the result
    """
    expected = "bqqmft boe cbobobt"
    actual = encrypt("apples and bananas", 1)
    assert expected == actual
Esempio n. 2
0
def test_encryption():
    """
    Do encryption and test the result
    """
    expected = "Ymnx nx 956 u~ymts htzwxj"
    actual = encrypt("This is 401 python course", 5)
    assert expected == actual
Esempio n. 3
0
def test_decrypte_without_key():

    sentence = 'It was the best of times, it was the worst of times.'
    sentences_list = []
    for i in range(1, 27):
        sentences_list.append(encrypt(sentence, i))

    for i in range(len(sentences_list)):
        print(count_words(sentences_list[i]))

    assert most_likely(
        sentences_list
    ) == "it was the best of times  it was the worst of times ".upper()
def test_crack():
    code = encrypt('It was the best of times, it was the worst of times. ', 3)
    actual = crack(code)
    expected = 'It was the best of times, it was the worst of times. '
    assert actual == expected
def test_encrypt_shift_4():
    actual = encrypt('hello world', 4)
    expected = 'lipps asvph'
    assert actual == expected
def test_encrpyt_multAlpha_Upper():
    key = 25
    plain = 'AbCdEf'
    actual = encrypt(plain, key)
    expected = 'ZaBcDe'
    assert actual == expected
def test_encrypt_string_upper_and_lower():
    actual = encrypt('abcABC', 3)
    expected = 'defDEF'
    assert actual == expected
Esempio n. 8
0
def test_enc_nonalpha():
    assert encrypt(
        'It was the best of times, it was the worst of times.',
        732) == 'Fq txp qeb ybpq lc qfjbp, fq txp qeb tlopq lc qfjbp.'
def test_encrpyt_multAlpha_medShift():
    key = 12
    plain = 'abc'
    actual = encrypt(plain, key)
    expected = 'mno'
    assert actual == expected
Esempio n. 10
0
def test_encrypt_lower_case():
    actual = encrypt("cats", 3)
    expected = "fdwv"
    assert actual == expected
Esempio n. 11
0
def test_encrypt_upper_lower_nonAlpha():
    actual = encrypt("CatS & DogS!@%", 3)
    expected = "FdwV & GrjV!@%"
    assert actual == expected
Esempio n. 12
0
def test_encrypt_string_non_alpha():
    actual = encrypt('ABC 1 2', 4)
    expected = 'EFG 1 2'
    assert actual == expected
Esempio n. 13
0
def test_encrypt_shift_raise_integer_valueerror():
    with pytest.raises(ValueError):
        assert encrypt("hi", "hi")
Esempio n. 14
0
def test_encrypt():
    actual = encrypt(4, message)
    expected = 'RIFMCY'
    assert actual == expected
Esempio n. 15
0
from caesar_cipher import __version__


def test_version():
    assert __version__ == '0.1.0'


from caesar_cipher.caesar_cipher import encrypt, decrypt

message = 'nebiyu'
encrypted = encrypt(4, message)


def test_encrypt():
    actual = encrypt(4, message)
    expected = 'RIFMCY'
    assert actual == expected


def test_decrypt():
    actual = decrypt(4, encrypted)
    expected = 'NEBIYU'
    assert actual == expected


# def test_lower():
#     actual = encrypt(4, message)
#     expected = 'rifmcy'
#     assert actual == expected

# if __name__== '__main__':
def test_encrypt_special_character():
    actual=encrypt('a b!c',1)
    expected='bcd'
    assert actual==expected
def test_encrypt_function():
    actual=encrypt('abc',1)
    expected='bcd'
    assert actual==expected
Esempio n. 18
0
def test_encrypt_string():
    actual = encrypt('abc', 2)
    expected = 'cde'
    assert actual == expected
Esempio n. 19
0
def test_encrypt_shift_raise_string_valueerror():
    with pytest.raises(ValueError):
        assert encrypt(4, 3)
Esempio n. 20
0
def test_encrypt_passes():
    expected = "Udymts nx xsjfpd"
    actual = encrypt("Python is sneaky", 5)
    assert actual == expected
Esempio n. 21
0
def test_encrypt_upper_and_lower_case():
    actual = encrypt("CatS", 3)
    expected = "FdwV"
    assert actual == expected
Esempio n. 22
0
def test_decrypt():
    tester = encrypt(test, key)
    actual = decrypt(tester, key)
    expected = "Ravenala"
    assert actual == expected
Esempio n. 23
0
def test_enc_case():
    assert encrypt('It was the best of times',
                   732) == 'Fq txp qeb ybpq lc qfjbp'
Esempio n. 24
0
def test_crack_again():
    crack_test = encrypt(test2, key2)
    actual = crack(crack_test)
    expected = 'It was the best of times, it was the worst of times.'
    assert actual == expected
Esempio n. 25
0
def test_encrpyt():
    assert encrypt('best of times', 732) == 'ybpq lc qfjbp'
Esempio n. 26
0
def test_encrypt():
    actual = encrypt(test, key)
    expected = 'Tcxgpcnc'
    assert actual == expected
def test_encrpyt_multAlpha_bigShift():
    key = 25
    plain = 'abc'
    actual = encrypt(plain, key)
    expected = 'zab'
    assert actual == expected
Esempio n. 28
0
def test_encrypt_shift_4_upper_case():
    actual = encrypt('Hello World', 4)
    expected = 'Lipps Asvph'
    assert actual == expected
def test_encrpyt_oneAlpha_smallShift():
    key = 1
    plain = 'a'
    actual = encrypt(plain, key)
    expected = 'b'
    assert actual == expected
Esempio n. 30
0
def test_encrypt_special_character_and_white_space():
    actual = encrypt('hello.     world!', 4)
    expected = 'lipps.     asvph!'
    assert actual == expected