Exemplo n.º 1
0
 def test_encode_with_different_type(self):
     try:
         caesar_shift = CaesarShift(1)
         caesar_shift.encode(49)
         self.fail("This should not pass")
     except Exception as e:
         assert_that(e.message, equal_to("Parameter can only be a string"))
Exemplo n.º 2
0
 def test_giving_a_string_for_a_shift(self):
     try:
         CaesarShift("WOW")
         self.fail("This should not pass")
     except Exception as e:
         assert_that(e.message, equal_to(CAN_ONLY_BE_A_NUMBER_MSG))
Exemplo n.º 3
0
 def test_letter_z_with_shift_of_28():
     caesar_shift = CaesarShift(28)
     result = caesar_shift.encode("z")
     assert_that(result, equal_to("b"))
Exemplo n.º 4
0
 def test_letter_z_with_shift_of_26_times_4():
     caesar_shift = CaesarShift(26 * 4)
     result = caesar_shift.encode("z")
     assert_that(result, equal_to("z"))
Exemplo n.º 5
0
 def test_letter_a_with_shift_of_one():
     caesar_shift = CaesarShift(1)
     result = caesar_shift.encode("a")
     assert_that(result, equal_to("b"))
Exemplo n.º 6
0
 def test_empty_string_with_shift_of_zero():
     caesar_shift = CaesarShift(0)
     result = caesar_shift.encode("")
     assert_that(result, equal_to(""))