From ac7cacceb1c8b76fd9a0e11546238591024532f8 Mon Sep 17 00:00:00 2001 From: BethanyG Date: Wed, 30 Sep 2026 04:16:22 -0700 Subject: [PATCH] Synced exercise to problem specs and regenerated tests. --- .../state-of-tic-tac-toe/.meta/tests.toml | 6 ++++ .../state_of_tic_tac_toe_test.py | 30 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/exercises/practice/state-of-tic-tac-toe/.meta/tests.toml b/exercises/practice/state-of-tic-tac-toe/.meta/tests.toml index 8fc25e2118d..5f574b2a124 100644 --- a/exercises/practice/state-of-tic-tac-toe/.meta/tests.toml +++ b/exercises/practice/state-of-tic-tac-toe/.meta/tests.toml @@ -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" diff --git a/exercises/practice/state-of-tic-tac-toe/state_of_tic_tac_toe_test.py b/exercises/practice/state-of-tic-tac-toe/state_of_tic_tac_toe_test.py index 173ecf887a0..e593d4bd651 100644 --- a/exercises/practice/state-of-tic-tac-toe/state_of_tic_tac_toe_test.py +++ b/exercises/practice/state-of-tic-tac-toe/state_of_tic_tac_toe_test.py @@ -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 @@ -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", + )