コード例 #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
コード例 #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)
コード例 #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)
コード例 #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)