Beispiel #1
0
 def test_odd_number_of_elements(self):
     with self.assertRaises(ValueError):
         puzzle2('1')
         puzzle2('123')
         puzzle2('12345')
Beispiel #2
0
 def test_not_a_digit(self):
     with self.assertRaises(ValueError):
         puzzle2('abc123')
Beispiel #3
0
 def test_no_matches(self):
     self.assertEqual(puzzle2('12'), 0)
     self.assertEqual(puzzle2('1221'), 0)
Beispiel #4
0
 def test_matches(self):
     self.assertEqual(puzzle2('1212'), 6)
     self.assertEqual(puzzle2('123425'), 4)
     self.assertEqual(puzzle2('123123'), 12)
     self.assertEqual(puzzle2('12131415'), 4)
Beispiel #5
0
 def test_empty(self):
     self.assertEqual(puzzle2(''), 0)