Beispiel #1
0
 def test_list_cartesian_product(self):
     list_of_lists = [[0, 1], [2, 5, 4], [5]]
     self.assertEqual(
         _cartesian_product(lists=list_of_lists),
         [[0, 2, 5], [1, 2, 5], [0, 5, 5], [1, 5, 5], [0, 4, 5], [1, 4, 5]])
     list_of_lists = [[0, 1], [2, 5, 4], []]
     self.assertEqual(_cartesian_product(lists=list_of_lists), [])
     list_of_lists = [[1], [3], [2]]
     self.assertEqual(_cartesian_product(lists=list_of_lists), [[1, 3, 2]])
     list_of_lists = [[7]]
     self.assertEqual(_cartesian_product(lists=list_of_lists), [[7]])
Beispiel #2
0
 def test_list_cartesian_product(self):
     list_of_lists = [[0, 1], [2, 5, 4], [5]]
     self.assertEqual(_cartesian_product(lists=list_of_lists),
                      [[0, 2, 5], [1, 2, 5], [0, 5, 5], [1, 5, 5], [0, 4, 5], [1, 4, 5]])
     list_of_lists = [[0, 1], [2, 5, 4], []]
     self.assertEqual(_cartesian_product(lists=list_of_lists),
                      [])
     list_of_lists = [[1], [3], [2]]
     self.assertEqual(_cartesian_product(lists=list_of_lists),
                      [[1, 3, 2]])
     list_of_lists = [[7]]
     self.assertEqual(_cartesian_product(lists=list_of_lists),
                      [[7]])