示例#1
0
 def test_decode_numbers(self):
     self.assertEqual(decode("odpoz ub123 odpoz ub", 25, 7),
                      "testing123testing")
示例#2
0
 def test_decode_exercism(self):
     self.assertEqual(decode("tytgn fjr", 3, 7), "exercism")
示例#3
0
 def test_decode_sentence(self):
     self.assertEqual(
         decode("qdwju nqcro muwhn odqun oppmd aunwd o", 19, 16),
         "anobstacleisoftenasteppingstone")
示例#4
0
 def test_decode_with_too_many_spaces(self):
     self.assertEqual(
         decode("vszzm    cly   yd cg    qdp", 15, 16), "jollygreengiant")
示例#5
0
 def test_decode_raises_meaningful_exception(self):
     with self.assertRaisesWithMessage(ValueError):
         decode("Test", 13, 5)
示例#6
0
 def test_decode_with_too_many_spaces(self):
     self.assertEqual(decode("vszzm    cly   yd cg    qdp", 15, 16),
                      "jollygreengiant")
示例#7
0
 def test_decode_all_the_letters2(self):
     self.assertEqual(
         decode("kqlfd jzvgy tpaet icdhm rtwly kqlon ubstx", 19, 13),
         "thequickbrownfoxjumpsoverthelazydog",
     )
示例#8
0
 def test_decode_sentence(self):
     self.assertEqual(
         decode("qdwju nqcro muwhn odqun oppmd aunwd o", 19, 16),
         "anobstacleisoftenasteppingstone")
示例#9
0
 def test_decode_numbers(self):
     self.assertEqual(decode("odpoz ub123 odpoz ub", 25, 7),
                      "testing123testing")
示例#10
0
 def test_decode_with_a_not_coprime_to_m(self):
     with self.assertRaisesWithMessage(ValueError):
         decode("Test", 13, 5)
示例#11
0
 def test_decode_exercism(self):
     self.assertEqual(decode("tytgn fjr", 3, 7), "exercism")
示例#12
0
 def test_decode_test(self):
     self.assertEqual(decode("ybty", 5, 7), "test")
示例#13
0
 def test_decode_with_a_not_coprime_to_m_2(self):
     with self.assertRaisesWithMessage(ValueError):
         decode("ybty", 18, 13)
示例#14
0
 def test_decode_with_no_spaces_in_input2(self):
     self.assertEqual(
         decode("AnObstacleIsOftenASteppingStone", 23, 31),
         "tgxknetbyjznxaejgtnejoozgrnexgj",
     )
示例#15
0
 def test_decode_all_the_letters(self):
     self.assertEqual(
         decode("swxtj npvyk lruol iejdc blaxk swxmh qzglf", 17, 33),
         "thequickbrownfoxjumpsoverthelazydog")
示例#16
0
 def test_decode_all_the_letters(self):
     self.assertEqual(
         decode("swxtj npvyk lruol iejdc blaxk swxmh qzglf", 17, 33),
         "thequickbrownfoxjumpsoverthelazydog")
示例#17
0
 def test_decode_with_no_spaces(self):
     self.assertEqual(decode("swxtjnpvyklruoliejdcblaxkswxmhqzglf", 17, 33),
                      "thequickbrownfoxjumpsoverthelazydog")
示例#18
0
 def test_decode_with_no_spaces(self):
     self.assertEqual(
         decode("swxtjnpvyklruoliejdcblaxkswxmhqzglf", 17, 33),
         "thequickbrownfoxjumpsoverthelazydog")
示例#19
0
 def test_decode_raises_meaningful_exception(self):
     with self.assertRaisesWithMessage(ValueError):
         decode("Test", 13, 5)
示例#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.")