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