コード例 #1
0
ファイル: hw1pr3tests.py プロジェクト: raxod502/HMC-Grader
 def testStrings(self):
     self.assertEqual(hw.ind('i', 'well hi there'), 6,
                      "Make sure ind works for strings as well as lists")
コード例 #2
0
ファイル: hw1pr3tests.py プロジェクト: raxod502/HMC-Grader
 def testEmptyList(self):
     self.assertEqual(hw.ind(1, []), 0,
                      "Make sure you can deal with the empty string")
コード例 #3
0
ファイル: hw1pr3tests.py プロジェクト: raxod502/HMC-Grader
 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"
     )
コード例 #4
0
ファイル: hw1pr3tests.py プロジェクト: raxod502/HMC-Grader
 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"
     )
コード例 #5
0
ファイル: hw1pr3tests.py プロジェクト: raxod502/HMC-Grader
 def testNotInList(self):
     self.assertEqual(hw.ind(1, [5, 2, 3, 5]), 4,
                      "What happens if the element isn't in the list?")
コード例 #6
0
 def testStrings(self):
     self.assertEqual(hw.ind('i', 'well hi there'), 6, "Make sure ind works for strings as well as lists")
コード例 #7
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")
コード例 #8
0
 def testEmptyList(self):
     self.assertEqual(hw.ind(1,[]), 0, "Make sure you can deal with the empty string")
コード例 #9
0
 def testNotInList(self):
     self.assertEqual(hw.ind(1,[5,2,3,5]), 4, "What happens if the element isn't in the list?")
コード例 #10
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")