Esempio n. 1
0
 def testStrings(self):
     self.assertEqual(hw.ind('i', 'well hi there'), 6,
                      "Make sure ind works for strings as well as lists")
Esempio n. 2
0
 def testEmptyList(self):
     self.assertEqual(hw.ind(1, []), 0,
                      "Make sure you can deal with the empty string")
Esempio n. 3
0
 def testStrangeTypes(self):
     self.assertEqual(
         hw.ind(42, ['42', [42, 42]]), 2,
         "'42' and 42 are not equal (the first is the string, the second is a number). Also make sure that you're not going down into inner lists"
     )
Esempio n. 4
0
 def testInListTwice(self):
     self.assertEqual(
         hw.ind(1, [0, 0, 999, -1, 1, 2, 3, 1]), 4,
         "Make sure that you're checking for the first instance of the number"
     )
Esempio n. 5
0
 def testNotInList(self):
     self.assertEqual(hw.ind(1, [5, 2, 3, 5]), 4,
                      "What happens if the element isn't in the list?")
 def testStrings(self):
     self.assertEqual(hw.ind('i', 'well hi there'), 6, "Make sure ind works for strings as well as lists")
 def testStrangeTypes(self):
     self.assertEqual(hw.ind(42,['42',[42,42]]), 2, "'42' and 42 are not equal (the first is the string, the second is a number). Also make sure that you're not going down into inner lists")
 def testEmptyList(self):
     self.assertEqual(hw.ind(1,[]), 0, "Make sure you can deal with the empty string")
 def testNotInList(self):
     self.assertEqual(hw.ind(1,[5,2,3,5]), 4, "What happens if the element isn't in the list?")
 def testInListTwice(self):
     self.assertEqual(hw.ind(1,[0,0,999,-1,1,2,3,1]), 4, "Make sure that you're checking for the first instance of the number")