From e22d84d7f38d29c1b5c396d8762d7cbd59a77ef6 Mon Sep 17 00:00:00 2001 From: Daniel McCoy Stephenson Date: Fri, 9 Oct 2026 02:40:22 -0600 Subject: [PATCH 1/2] Pin the public gameDisplay attribute on both constructor paths Consumers such as Apex read graphik.gameDisplay directly rather than calling getGameDisplay(), so the attribute name is part of the public contract. No existing test referenced it: renaming it to a private name left the whole suite green. Co-Authored-By: Claude Opus 5.5 --- .../preponderous/graphik/test_graphik.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/python/preponderous/graphik/test_graphik.py b/src/test/python/preponderous/graphik/test_graphik.py index 2f8e2d6..15c1f3c 100644 --- a/src/test/python/preponderous/graphik/test_graphik.py +++ b/src/test/python/preponderous/graphik/test_graphik.py @@ -49,6 +49,24 @@ def test_no_arg_constructor_creates_default_display(): assert graphik.getGameDisplay().get_size() == (900, 600) +@pytest.mark.parametrize("supplied", [True, False], ids=["supplied_display", "default_display"]) +def test_game_display_attribute_is_the_bound_surface(supplied): + # Consumers read the gameDisplay attribute directly rather than going + # through getGameDisplay() -- Apex sizes its layout off + # graphik.gameDisplay.get_size() -- so the attribute name is part of the + # public contract. Renaming it to something private would leave every + # test above green while breaking those call sites, so pin it on both + # constructor paths. + pygame.display.init() + if supplied: + display = pygame.display.set_mode((10, 10)) + graphik = Graphik(display) + assert graphik.gameDisplay is display + else: + graphik = Graphik() + assert graphik.gameDisplay is graphik.getGameDisplay() + + def test_color_constants_are_reachable(): # The color constants used to be assigned only in an unreachable __init__; # they must now be present on both the class and any instance. From e731e01ea322bd7ba4baff1d9300d05c409cbedb Mon Sep 17 00:00:00 2001 From: Daniel McCoy Stephenson Date: Fri, 9 Oct 2026 02:41:14 -0600 Subject: [PATCH 2/2] Correct the scope claim in the gameDisplay test comment Co-Authored-By: Claude Opus 5.5 --- src/test/python/preponderous/graphik/test_graphik.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/python/preponderous/graphik/test_graphik.py b/src/test/python/preponderous/graphik/test_graphik.py index 15c1f3c..3d8a2aa 100644 --- a/src/test/python/preponderous/graphik/test_graphik.py +++ b/src/test/python/preponderous/graphik/test_graphik.py @@ -55,8 +55,8 @@ def test_game_display_attribute_is_the_bound_surface(supplied): # through getGameDisplay() -- Apex sizes its layout off # graphik.gameDisplay.get_size() -- so the attribute name is part of the # public contract. Renaming it to something private would leave every - # test above green while breaking those call sites, so pin it on both - # constructor paths. + # other test in this file green while breaking those call sites, so pin + # it on both constructor paths. pygame.display.init() if supplied: display = pygame.display.set_mode((10, 10))