예제 #1
0
 def test_groups_of_3(self):
     list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
     list2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
     list3 = [1, 2, 3, 4, 5, 6, 7, 8]
     self.assertEqual(groups.groups_of_3(list1),
                      [[1, 2, 3], [4, 5, 6], [7, 8, 9]])
     self.assertEqual(groups.groups_of_3(list2),
                      [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])
     self.assertEqual(groups.groups_of_3(list3),
                      [[1, 2, 3], [4, 5, 6], [7, 8]])
예제 #2
0
 def test_groups_of_3_2(self):
     input = [1, 1, 1, 2, 2]
     expected = [[1, 1, 1], [2, 2]]
     self.assertEqual(groups.groups_of_3(input), expected)
예제 #3
0
 def test_groups_of_3(self):
     input = [1, 2, 3, 4, 5, 6]
     expected = [[1, 2, 3], [4, 5, 6]]
     self.assertEqual(groups.groups_of_3(input), expected)
예제 #4
0
 def test_groups_of_3_3(self):
     self.assertEqual(groups.groups_of_3(test3), ans3)
예제 #5
0
 def test_groups_of_3_2(self):
     self.assertEqual(groups.groups_of_3(test2), ans2)
예제 #6
0
 def test_groups_of_3_2(self):
     list = [7.0, 8.0, 9.0, 10.0, 11.0, 12.0]
     self.assertListAlmostEqual(groups.groups_of_3(list),
                                [[7.0, 8.0, 9.0], [10.0, 11.0, 12.0]])
예제 #7
0
 def test_groups_of_3_1(self):
     list = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
     self.assertListAlmostEqual(groups.groups_of_3(list),
                                [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])