Skip to content

test: pin that Graphik() replaces an existing display mode - #56

Merged
dmccoystephenson merged 1 commit into
mainfrom
test/pin-no-arg-constructor-replaces-display
Oct 21, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
test/pin-no-arg-constructor-replaces-display

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • A characterization test is added for the no-argument Graphik() constructor when a display mode is already set. set_mode((900, 600)) is called unconditionally, so the existing display is replaced and the consumer's window is resized to 900x600 instead of being adopted. This was neither documented nor tested.
  • The constructor docstring and the README method list now state this behavior.
  • No production behavior is changed. The only edit to graphik.py is in the docstring.

Stage B (unit-test expansion) cycle, with the matching documentation update. No tracking issue exists; the gap was found during triage.

Test plan

  • python3 -m py_compile src/main/python/preponderous/graphik/graphik.py
  • pytest: 68 passed (67 before, plus the new test)
  • Mutation check: with the constructor temporarily changed to reuse pygame.display.get_surface(), the new test failed. The change was then reverted.

Deferred issues

All four open issues (#34, #39, #40, #46) were skipped. Each needs a change to .github/workflows/ or the release process, or a maintainer decision, as recorded in the issue bodies. Those areas are excluded from autonomous change.

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

The no-argument constructor calls set_mode unconditionally, so a display
mode the consumer already set is resized to 900x600 rather than adopted.
Pin that with a characterization test and document it in the constructor
docstring and the README method list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (anchored on CI Compile and test 3.9–3.13 green, plus a local pytest run where 68 tests passed):

  • Scope: PASS. Three files are touched: one new test, plus the constructor docstring and README lines that describe the pinned behavior. No unrelated churn.
  • Tests-new: PASS (N/A). No new public method was added.
  • Tests-fix: N/A. This is a characterization test, not a bug fix. A mutation check was run instead: with the constructor temporarily changed to pygame.display.get_surface() or set_mode(...), the new test failed. The change was then reverted.
  • Sibling structure: PASS. The test sits next to the other constructor tests and follows their pattern (pygame.display.init(), then set_mode, then Graphik(...), then assertions on get_size()), including the rationale comment style.
  • Sibling renames: N/A. Nothing was renamed.
  • Docs: PASS. The constructor docstring and the README Graphik(gameDisplay=None) bullet both state the replace-not-reuse behavior. RELEASING.md and pyproject.toml are unaffected.
  • Issue resolution: N/A. There is no Closes, because the gap was found during triage.
  • Manual validation: PASS. py_compile, the import smoke test, and pytest are green in CI on every matrix version.
  • camelCase / Backward-compat / No new deps: PASS. No code change, signature change or import was added. The only edit to graphik.py is in the docstring.
  • Headless: PASS. The test runs under the conftest dummy SDL driver.
  • Version sync: N/A. _version.py is unchanged.

Observation outside the diff: in the mutation run, the existing test_no_arg_constructor_creates_default_display (src/test/python/preponderous/graphik/test_graphik.py:42) also failed. That test does not set up its own display state; it implicitly relies on whatever display earlier tests left open. It still passes against the real code, so it is not a defect today, but the two constructor tests are not isolated from suite ordering. This is noted only; no change was made here.

This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit ce80f2c into main Oct 21, 2026
5 checks passed
@dmccoystephenson
dmccoystephenson deleted the test/pin-no-arg-constructor-replaces-display branch October 21, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant