Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions exercises/practice/state-of-tic-tac-toe/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,9 @@ reimplements = "b1dc8b13-46c4-47db-a96d-aa90eedc4e8d"

[4801cda2-f5b7-4c36-8317-3cdd167ac22c]
description = "Invalid boards -> Invalid board: players kept playing after a win"

[5a84757a-fc86-4328-aec9-a5759e6ed35d]
description = "Invalid boards -> Invalid board: O kept playing after X wins"

[cf25543d-583a-4656-b9ab-f82dc00a4a02]
description = "Invalid boards -> Invalid board: X kept playing after O wins"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/state-of-tic-tac-toe/canonical-data.json
# File last updated on 2026-01-30
# File last updated on 2026-09-30

import unittest

Expand Down Expand Up @@ -243,3 +243,31 @@ def test_invalid_board_players_kept_playing_after_a_win(self):
err.exception.args[0],
"Impossible board: game should have ended after the game was won",
)

def test_invalid_board_o_kept_playing_after_x_wins(self):
board = [
"OO ",
"XXX",
" O ",
]
with self.assertRaises(ValueError) as err:
gamestate(board)
self.assertEqual(type(err.exception), ValueError)
self.assertEqual(
err.exception.args[0],
"Impossible board: game should have ended after the game was won",
)

def test_invalid_board_x_kept_playing_after_o_wins(self):
board = [
"XX ",
"OOO",
" XX",
]
with self.assertRaises(ValueError) as err:
gamestate(board)
self.assertEqual(type(err.exception), ValueError)
self.assertEqual(
err.exception.args[0],
"Impossible board: game should have ended after the game was won",
)
Loading