示例#1
0
 def test_case2(self):
     """
     Testing input with no return value
     """
     arr = []
     res = []
     self.assertEqual(ranges.ranges(arr), res)
示例#2
0
 def test_case3(self):
     """
     Testing input with multiple return values
     """
     arr = [1, 2, 3, 4, 5, 8, 9, 10]
     res = ["1->5", "8->10"]
     self.assertEqual(ranges.ranges(arr), res)
示例#3
0
 def test_case1(self):
     """
     Testing input with only 1 return value
     """
     arr = [1, 2]
     res = ["1->2"]
     self.assertEqual(ranges.ranges(arr), res)
示例#4
0
 def test1(self):
     """
     Tests a basic input that should only have 1 element in the list
     :return:
     """
     self.assertEqual(ranges([1, 2]), ['1->2'])
示例#5
0
 def test6(self):
     self.assertEqual(ranges([5, 6, 7, 10, 15, 18, 20, 21, 22]),
                      ['5->7', '20->22'])
示例#6
0
 def test5(self):
     self.assertEqual(ranges([5, 6, 9, 10, 12, 13, 15, 16, 18, 19, 25, 30]),
                      ['5->6', '9->10', '12->13', '15->16', '18->19'])
示例#7
0
 def test4(self):
     self.assertEqual(ranges([5, 6, 7, 20, 21, 22, 25]), ['5->7', '20->22'])
示例#8
0
 def test3(self):
     self.assertEqual(ranges([1, 2, 3, 4, 5, 8, 9, 10]), ['1->5', '8->10'])
示例#9
0
 def test2(self):
     """
     Tests a case in which the return value should contain no elements
     :return:
     """
     self.assertEqual(ranges([1]), [])