Example #1
0
 def testVariableProductDict(self):
   u1 = self.prog.NewVariable([1, 2], [], self.current_location)
   u2 = self.prog.NewVariable([3, 4], [], self.current_location)
   product = utils.variable_product_dict({"a": u1, "b": u2})
   pairs = [{k: a.data for k, a in d.items()} for d in product]
   self.assertItemsEqual(pairs, [
       {"a": 1, "b": 3},
       {"a": 1, "b": 4},
       {"a": 2, "b": 3},
       {"a": 2, "b": 4},
   ])
Example #2
0
 def testVariableProductDict(self):
   u1 = self.prog.NewVariable("u1", [1, 2], [], self.current_location)
   u2 = self.prog.NewVariable("u2", [3, 4], [], self.current_location)
   product = utils.variable_product_dict({"a": u1, "b": u2})
   pairs = [{k: a.data for k, a in d.iteritems()}
            for d in product]
   self.assertItemsEqual(pairs, [
       {"a": 1, "b": 3},
       {"a": 1, "b": 4},
       {"a": 2, "b": 3},
       {"a": 2, "b": 4},
   ])