Exemplo n.º 1
0
 def test_decode_numbers(self):
     self.assertEqual(decode("odpoz ub123 odpoz ub", 25, 7),
                      "testing123testing")
Exemplo n.º 2
0
 def test_decode_exercism(self):
     self.assertEqual(decode("tytgn fjr", 3, 7), "exercism")
Exemplo n.º 3
0
 def test_decode_sentence(self):
     self.assertEqual(
         decode("qdwju nqcro muwhn odqun oppmd aunwd o", 19, 16),
         "anobstacleisoftenasteppingstone")
Exemplo n.º 4
0
 def test_decode_with_too_many_spaces(self):
     self.assertEqual(
         decode("vszzm    cly   yd cg    qdp", 15, 16), "jollygreengiant")
Exemplo n.º 5
0
 def test_decode_raises_meaningful_exception(self):
     with self.assertRaisesWithMessage(ValueError):
         decode("Test", 13, 5)
Exemplo n.º 6
0
 def test_decode_with_too_many_spaces(self):
     self.assertEqual(decode("vszzm    cly   yd cg    qdp", 15, 16),
                      "jollygreengiant")
Exemplo n.º 7
0
 def test_decode_all_the_letters2(self):
     self.assertEqual(
         decode("kqlfd jzvgy tpaet icdhm rtwly kqlon ubstx", 19, 13),
         "thequickbrownfoxjumpsoverthelazydog",
     )
Exemplo n.º 8
0
 def test_decode_sentence(self):
     self.assertEqual(
         decode("qdwju nqcro muwhn odqun oppmd aunwd o", 19, 16),
         "anobstacleisoftenasteppingstone")
Exemplo n.º 9
0
 def test_decode_numbers(self):
     self.assertEqual(decode("odpoz ub123 odpoz ub", 25, 7),
                      "testing123testing")
Exemplo n.º 10
0
 def test_decode_with_a_not_coprime_to_m(self):
     with self.assertRaisesWithMessage(ValueError):
         decode("Test", 13, 5)
Exemplo n.º 11
0
 def test_decode_exercism(self):
     self.assertEqual(decode("tytgn fjr", 3, 7), "exercism")
Exemplo n.º 12
0
 def test_decode_test(self):
     self.assertEqual(decode("ybty", 5, 7), "test")
Exemplo n.º 13
0
 def test_decode_with_a_not_coprime_to_m_2(self):
     with self.assertRaisesWithMessage(ValueError):
         decode("ybty", 18, 13)
Exemplo n.º 14
0
 def test_decode_with_no_spaces_in_input2(self):
     self.assertEqual(
         decode("AnObstacleIsOftenASteppingStone", 23, 31),
         "tgxknetbyjznxaejgtnejoozgrnexgj",
     )
Exemplo n.º 15
0
 def test_decode_all_the_letters(self):
     self.assertEqual(
         decode("swxtj npvyk lruol iejdc blaxk swxmh qzglf", 17, 33),
         "thequickbrownfoxjumpsoverthelazydog")
Exemplo n.º 16
0
 def test_decode_all_the_letters(self):
     self.assertEqual(
         decode("swxtj npvyk lruol iejdc blaxk swxmh qzglf", 17, 33),
         "thequickbrownfoxjumpsoverthelazydog")
Exemplo n.º 17
0
 def test_decode_with_no_spaces(self):
     self.assertEqual(decode("swxtjnpvyklruoliejdcblaxkswxmhqzglf", 17, 33),
                      "thequickbrownfoxjumpsoverthelazydog")
Exemplo n.º 18
0
 def test_decode_with_no_spaces(self):
     self.assertEqual(
         decode("swxtjnpvyklruoliejdcblaxkswxmhqzglf", 17, 33),
         "thequickbrownfoxjumpsoverthelazydog")
Exemplo n.º 19
0
 def test_decode_raises_meaningful_exception(self):
     with self.assertRaisesWithMessage(ValueError):
         decode("Test", 13, 5)
Exemplo n.º 20
0
 def test_decode_with_a_not_coprime_to_m(self):
     with self.assertRaises(ValueError) as err:
         decode("Test", 13, 5)
     self.assertEqual(type(err.exception), ValueError)
     self.assertEqual(err.exception.args[0], "a and m must be coprime.")