Пример #1
0
 def test_uppercase_decipher(self):
     cipher_suite = VigenereCipher("LEMON")
     eq_(cipher_suite.decipher("LXFOPV"), "ATTACK")
Пример #2
0
 def test_lowercase_decipher(self):
     cipher_suite = VigenereCipher("lemon")
     eq_(cipher_suite.decipher("lxfopv"), "ATTACK")
Пример #3
0
 def test_lowercase_encipher(self):
     cipher_suite = VigenereCipher("lemon")
     eq_(cipher_suite.encipher("attack"), "LXFOPV")
Пример #4
0
    def test_empty_key(self):
        with assert_raises(ValueError):
            VigenereCipher("")

        with assert_raises(ValueError):
            VigenereCipher("123!")
Пример #5
0
 def test_decipher_non_alphabetic_characters(self):
     cipher_suite = VigenereCipher(PANGRAM)
     eq_(
         cipher_suite.decipher("KEOQAU TG BNKSE HNZANC, VSYUA BF ILK!"),
         PANGRAM.upper(),
     )
Пример #6
0
 def test_encipher_non_alphabetic_characters(self):
     cipher_suite = VigenereCipher(PANGRAM)
     eq_(cipher_suite.encipher(PANGRAM),
         "KEOQAU TG BNKSE HNZANC, VSYUA BF ILK!")
Пример #7
0
def pytest_funcarg__cipher(request):
    return VigenereCipher("TRAIN")