File tree Expand file tree Collapse file tree
exercises/practice/state-of-tic-tac-toe Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,3 +99,9 @@ reimplements = "b1dc8b13-46c4-47db-a96d-aa90eedc4e8d"
9999
100100[4801cda2-f5b7-4c36-8317-3cdd167ac22c ]
101101description = " Invalid boards -> Invalid board: players kept playing after a win"
102+
103+ [5a84757a-fc86-4328-aec9-a5759e6ed35d ]
104+ description = " Invalid boards -> Invalid board: O kept playing after X wins"
105+
106+ [cf25543d-583a-4656-b9ab-f82dc00a4a02 ]
107+ description = " Invalid boards -> Invalid board: X kept playing after O wins"
Original file line number Diff line number Diff line change 11# These tests are auto-generated with test data from:
22# https://github.com/exercism/problem-specifications/tree/main/exercises/state-of-tic-tac-toe/canonical-data.json
3- # File last updated on 2026-01 -30
3+ # File last updated on 2026-09 -30
44
55import unittest
66
@@ -243,3 +243,31 @@ def test_invalid_board_players_kept_playing_after_a_win(self):
243243 err .exception .args [0 ],
244244 "Impossible board: game should have ended after the game was won" ,
245245 )
246+
247+ def test_invalid_board_o_kept_playing_after_x_wins (self ):
248+ board = [
249+ "OO " ,
250+ "XXX" ,
251+ " O " ,
252+ ]
253+ with self .assertRaises (ValueError ) as err :
254+ gamestate (board )
255+ self .assertEqual (type (err .exception ), ValueError )
256+ self .assertEqual (
257+ err .exception .args [0 ],
258+ "Impossible board: game should have ended after the game was won" ,
259+ )
260+
261+ def test_invalid_board_x_kept_playing_after_o_wins (self ):
262+ board = [
263+ "XX " ,
264+ "OOO" ,
265+ " XX" ,
266+ ]
267+ with self .assertRaises (ValueError ) as err :
268+ gamestate (board )
269+ self .assertEqual (type (err .exception ), ValueError )
270+ self .assertEqual (
271+ err .exception .args [0 ],
272+ "Impossible board: game should have ended after the game was won" ,
273+ )
You can’t perform that action at this time.
0 commit comments