test: 46 tests for the card display layer, plus one real crash found#28
Draft
ohad6k wants to merge 1 commit into
Draft
test: 46 tests for the card display layer, plus one real crash found#28ohad6k wants to merge 1 commit into
ohad6k wants to merge 1 commit into
Conversation
The card is the artifact users screenshot and post, and it renders model-written text into a fixed-width terminal frame and into HTML. Before this it had one happy-path subprocess test and one HTML label assertion; a stdlib line-coverage pass put emulo.py at 55.8% with print_card, _print_card_plain, load_card, show_card, _law_bar, fmt_tokens and months_between at 0% in-process. Adds tests/test_card_render.py: - fmt_tokens / months_between unit boundaries and unparseable dates - _law_bar width invariance, proportional fill, clamping, zero denominator, and the non-ratio counts a drifting reducer emits - HTML escaping of mined text in every slot, three-law cap, dropped stat cells, grade fallback, art path resolution - load_card stats.json-over-card.json merge precedence and the missing-card exit code and hint - the frame-closure invariant: every framed line is one width across eight terminal sizes, narrow and wide layouts, long wrapped laws - the UnicodeEncodeError -> ASCII fallback card - show_card writing card.html without opening a browser - strip_frontmatter / cursor_rule / install_destination edge cases Two tests are xfail, documenting a real bug left unfixed here: months_between catches (ValueError, IndexError) but not TypeError, so a card.json with `"first_date": null` tracebacks out of both print_card and render_card_html. emulo.py line coverage 55.8% -> 64.0%. Suite: 396 -> 442 tests, green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
46 tests for the card display layer in
emulo.py(months_between,fmt_tokens,_law_bar,load_card,print_card,_print_card_plain,render_card_html,show_card), which had one happy-path subprocess test and one HTML assertion covering it.How the target was chosen. No pytest or coverage tooling is installed and CI runs
unittest discover, so the agent wrote a throwawaysys.settraceline-coverage collector, ran the suite under it, and cross-referenced executed lines against AST statement lines per function.emulo.pymeasured 55.8%. Functions that only look uncovered becausetest_emulo.pydrives them throughsubprocesswere excluded.What the tests actually catch
<script>in an archetype._law_baragainst malformed counts:"5",None,"x/y","30/20","18/0".UnicodeEncodeErrorfallback to the ASCII renderer, asserting its rows also share a border width.load_cardmerge precedence betweencard.jsonandstats.json.Bug found, reported not fixed
months_between()catches(ValueError, IndexError)but notTypeError. Acard.jsonwith"first_date": nullmakesNone[:4]raise, and it escapes bothprint_cardandrender_card_html, soemulo --cardtracebacks instead of degrading. A reducer emittingnullinstead of""is a plausible real input. Two tests are marked@unittest.expectedFailurewith the explanation inline. The fix is addingTypeErrorto the except tuple.python -m unittest discover -s tests→ 442 tests, OK (skipped=3, expected failures=2). Coverage ofemulo.py55.8% → 64.0%.Written by an agent working in an isolated worktree, reviewed before push.