Example #1
0
 def test_possibilities_can_called_with_protected_variables(self):
     for equations, protected in self.possibilities_with_protected.items():
         for protected_variables, known_possibilities in protected.items():
             protected_variables = set(protected_variables)
             known_possibilities = set(known_possibilities)
             possibilities_ = possibilities.possibilities(
                 equations,
                 [],
                 protected_variables=protected_variables)
             # print(tuple(set(p) for p in possibilities_))
             self.assertEqual(set(possibilities_), known_possibilities)
Example #2
0
    def make_possibilities(self):
        if not self.formulas:
            for compute in self.compute_list:
                self.formulas.append(compute['formula'])

        equations = possibilities.make_equations(self.formulas,
                                                 set(self.variable_list))
        self.possibilities = list(
            possibilities.possibilities(equations, self.variable_list,
                                        set(self.protected_variables)))
        shuffled_possibilities = self.possibilities[:]
        random.shuffle(shuffled_possibilities)
        self.possibilities_cycle = itertools.cycle(shuffled_possibilities)
Example #3
0
 def test_possibilities_can_be_called_with_two_arguments(self):
     for equations in self.possibilities:
         known_possibilities = set(self.possibilities[equations])
         possibilities_ = possibilities.possibilities(equations, [])
         # print(tuple(set(p) for p in possibilities_))
         self.assertEqual(set(possibilities_), known_possibilities)