Skip to content

Commit b072ba6

Browse files
authored
Added tests for validate_sudoku_board.py (#11108)
1 parent 79a327f commit b072ba6

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

matrix/validate_sudoku_board.py

+60
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,66 @@ def is_valid_sudoku_board(sudoku_board: list[list[str]]) -> bool:
5454
... ,[".",".",".",".","8",".",".","7","9"]
5555
... ])
5656
False
57+
>>> is_valid_sudoku_board([
58+
... ["1","2","3","4","5","6","7","8","9"]
59+
... ,["4","5","6","7","8","9","1","2","3"]
60+
... ,["7","8","9","1","2","3","4","5","6"]
61+
... ,[".",".",".",".",".",".",".",".","."]
62+
... ,[".",".",".",".",".",".",".",".","."]
63+
... ,[".",".",".",".",".",".",".",".","."]
64+
... ,[".",".",".",".",".",".",".",".","."]
65+
... ,[".",".",".",".",".",".",".",".","."]
66+
... ,[".",".",".",".",".",".",".",".","."]
67+
... ])
68+
True
69+
>>> is_valid_sudoku_board([
70+
... ["1","2","3",".",".",".",".",".","."]
71+
... ,["4","5","6",".",".",".",".",".","."]
72+
... ,["7","8","9",".",".",".",".",".","."]
73+
... ,[".",".",".","4","5","6",".",".","."]
74+
... ,[".",".",".","7","8","9",".",".","."]
75+
... ,[".",".",".","1","2","3",".",".","."]
76+
... ,[".",".",".",".",".",".","7","8","9"]
77+
... ,[".",".",".",".",".",".","1","2","3"]
78+
... ,[".",".",".",".",".",".","4","5","6"]
79+
... ])
80+
True
81+
>>> is_valid_sudoku_board([
82+
... ["1","2","3",".",".",".","5","6","4"]
83+
... ,["4","5","6",".",".",".","8","9","7"]
84+
... ,["7","8","9",".",".",".","2","3","1"]
85+
... ,[".",".",".","4","5","6",".",".","."]
86+
... ,[".",".",".","7","8","9",".",".","."]
87+
... ,[".",".",".","1","2","3",".",".","."]
88+
... ,["3","1","2",".",".",".","7","8","9"]
89+
... ,["6","4","5",".",".",".","1","2","3"]
90+
... ,["9","7","8",".",".",".","4","5","6"]
91+
... ])
92+
True
93+
>>> is_valid_sudoku_board([
94+
... ["1","2","3","4","5","6","7","8","9"]
95+
... ,["2",".",".",".",".",".",".",".","8"]
96+
... ,["3",".",".",".",".",".",".",".","7"]
97+
... ,["4",".",".",".",".",".",".",".","6"]
98+
... ,["5",".",".",".",".",".",".",".","5"]
99+
... ,["6",".",".",".",".",".",".",".","4"]
100+
... ,["7",".",".",".",".",".",".",".","3"]
101+
... ,["8",".",".",".",".",".",".",".","2"]
102+
... ,["9","8","7","6","5","4","3","2","1"]
103+
... ])
104+
False
105+
>>> is_valid_sudoku_board([
106+
... ["1","2","3","8","9","7","5","6","4"]
107+
... ,["4","5","6","2","3","1","8","9","7"]
108+
... ,["7","8","9","5","6","4","2","3","1"]
109+
... ,["2","3","1","4","5","6","9","7","8"]
110+
... ,["5","6","4","7","8","9","3","1","2"]
111+
... ,["8","9","7","1","2","3","6","4","5"]
112+
... ,["3","1","2","6","4","5","7","8","9"]
113+
... ,["6","4","5","9","7","8","1","2","3"]
114+
... ,["9","7","8","3","1","2","4","5","6"]
115+
... ])
116+
True
57117
>>> is_valid_sudoku_board([["1", "2", "3", "4", "5", "6", "7", "8", "9"]])
58118
Traceback (most recent call last):
59119
...

0 commit comments

Comments
 (0)