test: pin five documented behaviors that no test covered - #41
Conversation
Adds characterization tests for behavior the docstrings, README and source comments already promise but the suite never exercised: the 900x600 default display size, the package __getattr__ miss path, the per-path image cache, drawRectangle's exact fill bounds, and the font cache surviving a resize. Each was confirmed to fail against a mutated source before landing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The new test asserted a strict superset of test_no_arg_constructor_creates_ default_display, so keep one test and add the size assertion to it rather than leaving two tests covering the same constructor call. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Self-review rubric
FindingsTwo observations are recorded rather than fixed, both judgment calls:
One cross-cutting note that is out of this diff's scope: three of the five behaviors pinned here are asserted only by their own source comment or a README line, which is what made them easy to miss. A short convention that a documented invariant carries a test would prevent the next one, but that belongs in the repository's contributing guidance rather than in this PR. This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
Summary
Five behaviors are already promised by the docstrings, the README, or a source
comment, but were not exercised by any test. They are pinned here as
characterization tests. No production code is changed.
Graphik()is documented as falling back to a900x600 window; the existing test only asserted that some display was
created. The size assertion was folded into that existing test rather than
added as a second one, since it strictly subsumes it.
__getattr__miss path. Defining__getattr__onpreponderous.graphiktakes over every failed attribute lookup, so the misspath has to keep raising
AttributeError. Nothing covered that branch.drawImagecaches are keyed onfilePathalone. A second asset getting its own entry — rather than evicting the first
or being served the first's surface — was untested.
drawRectanglefill bounds.drawButton's hit test is written againstxposthroughxpos + width - 1(see PR fix: make drawButton's clickable region match the box it draws #37), but the bounds were onlypinned on the button, not on the fill they are anchored to.
objects, and
set_modereturns the same object when only the size changes.That is what keeps a resize from discarding the font cache, and the existing
invalidation tests pass either way.
Each addition was confirmed to bite: the source was temporarily mutated (default
size changed, the
AttributeErrorreplaced withreturn None, the image cachekey made constant, the rectangle fill narrowed by a pixel, the session check
forced to always invalidate) and every corresponding test failed, then passed
again once the source was restored. The working tree was verified clean
afterwards.
Deferred issues
The three open issues were all skipped this cycle, each for a reason recorded
here rather than as a comment on the issue:
vprefix) — the fix is a maintainerdecision between two directions, and touches
.github/workflows/and therelease process.
test.ymlheader comment overstates its triggers) — the fix iscorrect and small, but it edits
.github/workflows/, which is excluded fromautonomous change here.
preponderous/__init__.py) — the issue states its ownprerequisite (which namespace-package convention the sibling
Preponderous-Software projects follow) is not determinable from inside this
repository.
Test plan
python -m pytest— 41 passed (37 before; four tests added and oneassertion folded into an existing test), headless via
conftest.py.python -m py_compile src/main/python/preponderous/graphik/graphik.pyimport preponderous.graphikprints0.3.0.dev20260808.test.yml) green across Python 3.9–3.13.No tracking issue — this is a test-expansion cycle, so nothing is auto-closed.
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson