Exemple #1
0
 def test_two_pieces(self):
     inputs = ["nail", "shoe"]
     expected = "\n".join([
         "For want of a nail the shoe was lost.",
         "And all for the want of a nail."
     ])
     self.assertEqual(proverb(inputs), expected)
Exemple #2
0
 def test_four_pieces_modernised(self):
     inputs = ["pin", "gun", "soldier", "battle"]
     expected = "\n".join(["For want of a pin the gun was lost.",
                           "For want of a gun the soldier was lost.",
                           "For want of a soldier the battle was lost.",
                           "And all for the want of a pin."])
     self.assertEqual(proverb(inputs), expected)
Exemple #3
0
 def test_four_pieces_modernised(self):
     inputs = ["pin", "gun", "soldier", "battle"]
     expected = "\n".join([
         "For want of a pin the gun was lost.",
         "For want of a gun the soldier was lost.",
         "For want of a soldier the battle was lost.",
         "And all for the want of a pin."
     ])
     self.assertEqual(proverb(inputs), expected)
 def test_whole_proverb(self):
     expected = 'For want of a nail the shoe was lost.\n'\
                'For want of a shoe the horse was lost.\n'\
                'For want of a horse the rider was lost.\n'\
                'For want of a rider the message was lost.\n'\
                'For want of a message the battle was lost.\n'\
                'For want of a battle the kingdom was lost.\n'\
                'And all for the want of a nail.'
     self.assertEqual(expected, proverb(['nail', 'shoe', 'horse', 'rider',
                                         'message', 'battle', 'kingdom']))
Exemple #5
0
 def test_full_proverb(self):
     inputs = ["nail", "shoe", "horse", "rider",
               "message", "battle", "kingdom"]
     expected = "\n".join(["For want of a nail the shoe was lost.",
                           "For want of a shoe the horse was lost.",
                           "For want of a horse the rider was lost.",
                           "For want of a rider the message was lost.",
                           "For want of a message the battle was lost.",
                           "For want of a battle the kingdom was lost.",
                           "And all for the want of a nail."])
     self.assertEqual(proverb(inputs), expected)
Exemple #6
0
 def test_whole_proverb(self):
     expected = 'For want of a nail the shoe was lost.\n'\
                'For want of a shoe the horse was lost.\n'\
                'For want of a horse the rider was lost.\n'\
                'For want of a rider the message was lost.\n'\
                'For want of a message the battle was lost.\n'\
                'For want of a battle the kingdom was lost.\n'\
                'And all for the want of a nail.'
     self.assertEqual(
         expected,
         proverb([
             'nail', 'shoe', 'horse', 'rider', 'message', 'battle',
             'kingdom'
         ]))
Exemple #7
0
 def test_full_proverb(self):
     inputs = [
         "nail", "shoe", "horse", "rider", "message", "battle", "kingdom"
     ]
     expected = "\n".join([
         "For want of a nail the shoe was lost.",
         "For want of a shoe the horse was lost.",
         "For want of a horse the rider was lost.",
         "For want of a rider the message was lost.",
         "For want of a message the battle was lost.",
         "For want of a battle the kingdom was lost.",
         "And all for the want of a nail."
     ])
     self.assertEqual(proverb(inputs), expected)
Exemple #8
0
 def test_short_list(self):
     expected = 'For want of a nail the shoe was lost.\n'\
                'For want of a shoe the horse was lost.\n'\
                'And all for the want of a nail.'
     self.assertEqual(proverb(['nail', 'shoe', 'horse']), expected)
Exemple #9
0
 def test_zero_pieces(self):
     self.assertEqual(proverb([]), "")
Exemple #10
0
 def test_three_pieces(self):
     inputs = ["nail", "shoe", "horse"]
     expected = "\n".join(["For want of a nail the shoe was lost.",
                           "For want of a shoe the horse was lost.",
                           "And all for the want of a nail."])
     self.assertEqual(proverb(inputs), expected)
Exemple #11
0
 def test_new_itens(self):
     expected = 'For want of a key the value was lost.\n'\
                'And all for the want of a key.'
     self.assertEqual(expected, proverb(['key', 'value']))
Exemple #12
0
 def test_long_list(self):
     expected = 'For want of a nail the shoe was lost.\n'\
                'For want of a shoe the horse was lost.\n'\
                'For want of a horse the rider was lost.\n'\
                'And all for the want of a nail.'
     self.assertEqual(expected, proverb(['nail', 'shoe', 'horse', 'rider']))
Exemple #13
0
 def test_zero_pieces(self):
     self.assertEqual(proverb([]), "")
 def test_long_list(self):
     expected = 'For want of a nail the shoe was lost.\n'\
                'For want of a shoe the horse was lost.\n'\
                'For want of a horse the rider was lost.\n'\
                'And all for the want of a nail.'
     self.assertEqual(expected, proverb(['nail', 'shoe', 'horse', 'rider']))
Exemple #15
0
 def test_a_single_consequence(self):
     expected = 'For want of a nail the shoe was lost.\n'\
                'And all for the want of a nail.'
     self.assertEqual(expected, proverb(['nail', 'shoe']))
 def test_new_itens(self):
     expected = 'For want of a key the value was lost.\n'\
                'And all for the want of a key.'
     self.assertEqual(expected, proverb(['key', 'value']))
Exemple #17
0
 def test_one_piece(self):
     inputs = ["nail"]
     expected = "And all for the want of a nail."
     self.assertEqual(proverb(inputs), expected)
 def test_a_single_consequence(self):
     expected = 'For want of a nail the shoe was lost.\n'\
                'And all for the want of a nail.'
     self.assertEqual(expected, proverb(['nail', 'shoe']))
Exemple #19
0
 def test_one_piece(self):
     inputs = ["nail"]
     expected = "And all for the want of a nail."
     self.assertEqual(proverb(inputs), expected)