Exemple #1
0
    def test_value_poss_exclusive(self):

        c = Cell(9, 0, 0, 4)

        self.assertEqual(4, c.value())
        self.assertEqual(-1, c.possible_count())
        self.assertIsNone(c.possible_vals())

        c = Cell(9, 0, 0, poss_vals=frozenset({2, 3, 4}))

        self.assertIsNone(c.value())
        self.assertEqual({2, 3, 4}, c.possible_vals())
        self.assertEqual(3, c.possible_count())
Exemple #2
0
    def test_neither_set(self):
        c = Cell(9, 0, 0)
        self.assertIsNone(c.value())
        self.assertIsNotNone(c.possible_vals())
        self.assertEqual(9, c.possible_count())

        for x in self.__test_maxes:
            s = set(range(1, x + 1))
            c = Cell(x, 0, 0)
            self.assertEqual(s, c.possible_vals())
Exemple #3
0
    def test_possible_val_mod(self):
        # Change the set returned by the possible val method, make sure it stays the same.

        c = Cell(9, 0, 0, poss_vals=frozenset({2, 3, 4}))

        ret_set = c.possible_vals()
        ret_set.add(5)

        self.assertEqual(4, len(ret_set))
        self.assertEqual(3, len(c.possible_vals()))

        self.assertEqual(3, c.possible_count())