|
| 1 | +import pytest |
| 2 | +from isValidSudoku import Solution |
| 3 | + |
| 4 | +@pytest.fixture |
| 5 | +def inputs(): |
| 6 | + return [ |
| 7 | + ( |
| 8 | + [["5","3",".",".","7",".",".",".","."] |
| 9 | + ,["6",".",".","1","9","5",".",".","."] |
| 10 | + ,[".","9","8",".",".",".",".","6","."] |
| 11 | + ,["8",".",".",".","6",".",".",".","3"] |
| 12 | + ,["4",".",".","8",".","3",".",".","1"] |
| 13 | + ,["7",".",".",".","2",".",".",".","6"] |
| 14 | + ,[".","6",".",".",".",".","2","8","."] |
| 15 | + ,[".",".",".","4","1","9",".",".","5"] |
| 16 | + ,[".",".",".",".","8",".",".","7","9"]], |
| 17 | + True |
| 18 | + ), |
| 19 | + ( |
| 20 | + [["8","3",".",".","7",".",".",".","."] |
| 21 | + ,["6",".",".","1","9","5",".",".","."] |
| 22 | + ,[".","9","8",".",".",".",".","6","."] |
| 23 | + ,["8",".",".",".","6",".",".",".","3"] |
| 24 | + ,["4",".",".","8",".","3",".",".","1"] |
| 25 | + ,["7",".",".",".","2",".",".",".","6"] |
| 26 | + ,[".","6",".",".",".",".","2","8","."] |
| 27 | + ,[".",".",".","4","1","9",".",".","5"] |
| 28 | + ,[".",".",".",".","8",".",".","7","9"]], |
| 29 | + False |
| 30 | + ), |
| 31 | + ] |
| 32 | +def test_isValidSudoku(inputs): |
| 33 | + for board, expected in inputs: |
| 34 | + s = Solution() |
| 35 | + assert s.isValidSudoku(board) == expected |
0 commit comments