Exemplo n.º 1
0
def test_read_puzzle():
    """Test we can read data from a valid puzzle file"""
    with open('tests/valid_incomplete_9.txt') as inp:
        chunksize, puzzle = solver.read_puzzle(inp)
        assert chunksize == 3
        assert len(puzzle) == 9
        assert len(puzzle[0]) == 9
Exemplo n.º 2
0
def get_easy_incomplete():
    """Utility to open a valid incomplete puzzle file that has one empty cell"""
    with open('tests/easy_incomplete_9.txt') as inp:
        return solver.read_puzzle(inp)
Exemplo n.º 3
0
def get_invalid_incomplete():
    """Utility to open an invalid incomplete puzzle file"""
    with open('tests/invalid_incomplete_9.txt') as inp:
        return solver.read_puzzle(inp)
Exemplo n.º 4
0
def test_read_malformed_puzzle():
    """Ensure puzzle file with an error doens't work"""
    with open('tests/missing_row_9.txt') as inp:
        solver.read_puzzle(inp)