Beispiel #1
0
 def test_verses_2_to_4(self):
     self.assertEqual(
         Xmas.get_verses(2, 4),
         'On the second day of Christmas my true love gave to me: two Turtle Doves, and a Partridge in a Pear Tree.\n\n'
         'On the third day of Christmas my true love gave to me: three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n\n'
         'On the fourth day of Christmas my true love gave to me: four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.'
     )
Beispiel #2
0
 def test_verses_8_to_8(self):
     self.assertEqual(
         Xmas.get_verses(8, 8),
         'On the eighth day of Christmas my true love gave to me: eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.'
     )
Beispiel #3
0
 def test_verses_out_of_range(self):
     with self.assertRaises(IndexError):
         Xmas.get_verses(5, 14)
Beispiel #4
0
 def test_verses_wrong_type(self):
     with self.assertRaises(TypeError):
         Xmas.get_verses('2', '9')
Beispiel #5
0
 def test_verses_start_bigger_than_end(self):
     with self.assertRaises(ValueError):
         Xmas.get_verses(7, 2)