from unittest import TestCase

from pseudoku.grid import Grid

class SimpleGridTestCase(TestCase):
    """Tests the solving integrity of some puzzles that can be solved using
    only elimination and uniqueness.
    """

    def _test_single_puzzle(self, puzzle, msg=None):
        """Solves a single puzzle and verifies that the result is, at least,
        not incorrect.
        """
        
        grid = Grid.from_string(puzzle)
        grid.solve()
        self.assertTrue(grid.is_filled(), msg)

    def test_simple(self):
        self._test_single_puzzle("""
            ...69.... 9.5..876. ..4..1.2.
            6...5...3 38.....49 7...3...2
            .7.9..3.. .231..4.8 ....83...
        """)
