def test_correct_arguments_are_accepted(self):
     with self.assertRaises(ValueError):
         rotational_cipher.rotate(1234, "24")
     with self.assertRaises(ValueError):
         rotational_cipher.rotate(
             ["Text", "to", "put", "through the method"], "24")
     self.assertEqual(rotational_cipher.rotate('m', 14), 'a')
 def test_rotate_all_letters_in_a_very_long_string(self):
     self.assertEqual(
         rotational_cipher.rotate(
             "The quick brown fox jumps"
             " over the lazy dog."
             " The quick brown fox jumps"
             " over the lazy dog."
             " The quick brown fox jumps"
             " over the lazy dog.", 13),
         "Gur dhvpx oebja sbk whzcf bire gur ynml qbt. "
         "Gur dhvpx oebja sbk whzcf bire gur ynml qbt. "
         "Gur dhvpx oebja sbk whzcf bire gur ynml qbt.")
Ejemplo n.º 3
0
 def test_rotate_a_by_1(self):
     self.assertEqual(rotational_cipher.rotate('a', 1), 'b')
Ejemplo n.º 4
0
 def test_rotate_n_by_13_with_wrap_around_alphabet(self):
     self.assertEqual(rotational_cipher.rotate('n', 13), 'a')
Ejemplo n.º 5
0
 def test_rotate_numbers(self):
     self.assertEqual(
         rotational_cipher.rotate('Testing 1 2 3 testing', 4),
         'Xiwxmrk 1 2 3 xiwxmrk')
Ejemplo n.º 6
0
 def test_rotate_all_letters(self):
     self.assertEqual(
         rotational_cipher.rotate("The quick brown fox jumps"
                                  " over the lazy dog.", 13),
         "Gur dhvpx oebja sbk whzcf bire gur ynml qbt.")
Ejemplo n.º 7
0
def test_rotate_spaces():
    assert rotate("O M G", 5) == "T R L"
Ejemplo n.º 8
0
 def test_rotate_capital_letters(self):
     self.assertEqual(rotational_cipher.rotate('OMG', 5), 'TRL')
 def test_rotate_punctuation_with_a_high_value_key(self):
     self.assertEqual(rotational_cipher.rotate("Let's eat, Grandma!", 151),
                      "Gzo'n zvo, Bmviyhv!")
Ejemplo n.º 10
0
def test_rotate_a_by_0_same_output_as_input():
    assert rotate("a", 0) == "a"
Ejemplo n.º 11
0
def test_rotate_a_by_1():
    assert rotate("a", 1) == "b"
 def test_rotate_spaces_with_a_high_value_rotation_key(self):
     self.assertEqual(rotational_cipher.rotate('O M G', 57), 'T R L')
Ejemplo n.º 13
0
def test_rotate_all_letters():
    assert rotate("The quick brown fox jumps over the lazy dog", 13) == \
           "Gur dhvpx oebja sbk whzcf bire gur ynml qbt"
Ejemplo n.º 14
0
def test_rotate_punctuation():
    assert rotate("Let's eat, Grandma!", 21) == "Gzo'n zvo, Bmviyhv!"
Ejemplo n.º 15
0
def test_rotate_numbers():
    assert rotate("Testing 1 2 3 testing", 4) == "Xiwxmrk 1 2 3 xiwxmrk"
Ejemplo n.º 16
0
 def test_rotate_spaces(self):
     self.assertEqual(rotational_cipher.rotate('O M G', 5), 'T R L')
Ejemplo n.º 17
0
from rotational_cipher import rotate
import string

text = input('Mot à coder : ')
x = 0
while x == 0:
    key = input(
        'Saisissez un chiffre entre [0,26] (à retenir pour le décodage) : ')
    try:
        key = int(key)
        x = 1
    except ValueError:
        x = 0
    if not 0 <= key <= 26:
        x = 0

rotate(text, key)
Ejemplo n.º 18
0
 def test_rotate_punctuation(self):
     self.assertEqual(rotational_cipher.rotate("Let's eat, Grandma!", 21),
                      "Gzo'n zvo, Bmviyhv!")
Ejemplo n.º 19
0
 def test_rotate_m_by_13(self):
     self.assertEqual(rotational_cipher.rotate('m', 13), 'z')
Ejemplo n.º 20
0
 def test_rotate_all_letters(self):
     self.assertEqual(
         rotate("The quick brown fox jumps over the lazy dog.", 13),
         "Gur dhvpx oebja sbk whzcf bire gur ynml qbt.",
     )
Ejemplo n.º 21
0
def test_rotate_capital_letters():
    assert rotate("OMG", 5) == "TRL"
Ejemplo n.º 22
0
 def test_rotate_a_by_0(self):
     self.assertEqual(rotational_cipher.rotate('a', 0), 'a')
Ejemplo n.º 23
0
 def test_rotate_a_with_six_circles_and_plus_one(self):
     self.assertEqual(rotational_cipher.rotate('a', 26 * 6 + 1), 'b')
Ejemplo n.º 24
0
 def test_rotate_n_by_13_with_wrap_around_alphabet(self):
     self.assertEqual(rotational_cipher.rotate('n', 13), 'a')
Ejemplo n.º 25
0
 def test_rotate_a_by_1(self):
     self.assertEqual(rotate("a", 1), "b")
Ejemplo n.º 26
0
 def test_rotate_spaces(self):
     self.assertEqual(rotational_cipher.rotate('O M G', 5), 'T R L')
Ejemplo n.º 27
0
 def test_rotate_a_by_26_same_output_as_input(self):
     self.assertEqual(rotate("a", 26), "a")
Ejemplo n.º 28
0
 def test_rotate_punctuation(self):
     self.assertEqual(
         rotational_cipher.rotate("Let's eat, Grandma!", 21),
         "Gzo'n zvo, Bmviyhv!")
Ejemplo n.º 29
0
 def test_rotate_m_by_13(self):
     self.assertEqual(rotate("m", 13), "z")
Ejemplo n.º 30
0
 def test_rotate_a_by_1(self):
     self.assertEqual(rotational_cipher.rotate('a', 1), 'b')
Ejemplo n.º 31
0
 def test_rotate_n_by_13_with_wrap_around_alphabet(self):
     self.assertEqual(rotate("n", 13), "a")
Ejemplo n.º 32
0
 def test_rotate_m_by_13(self):
     self.assertEqual(rotational_cipher.rotate('m', 13), 'z')
Ejemplo n.º 33
0
 def test_rotate_capital_letters(self):
     self.assertEqual(rotate("OMG", 5), "TRL")
Ejemplo n.º 34
0
 def test_rotate_capital_letters(self):
     self.assertEqual(rotational_cipher.rotate('OMG', 5), 'TRL')
Ejemplo n.º 35
0
 def test_rotate_spaces(self):
     self.assertEqual(rotate("O M G", 5), "T R L")
Ejemplo n.º 36
0
 def test_rotate_numbers(self):
     self.assertEqual(rotational_cipher.rotate('Testing 1 2 3 testing', 4),
                      'Xiwxmrk 1 2 3 xiwxmrk')
Ejemplo n.º 37
0
 def test_rotate_numbers(self):
     self.assertEqual(rotate("Testing 1 2 3 testing", 4), "Xiwxmrk 1 2 3 xiwxmrk")
Ejemplo n.º 38
0
 def test_rotate_a_by_0(self):
     self.assertEqual(rotational_cipher.rotate('a', 0), 'a')
Ejemplo n.º 39
0
def test_rotate_for_spaces_and_specialCharacters():
    assert rotate("bla! h", 3) == "eod! k"