Skip to content

Increase test coverage. - #85

Merged
psobot merged 1 commit into
masterfrom
psobot/more-test-coverage
Aug 8, 2026
Merged

psobot merged 1 commit into
masterfrom
psobot/more-test-coverage

Conversation

@psobot

@psobot psobot commented Aug 8, 2026 •

Copy link
Copy Markdown
Owner

Mostly Clauded, but reviewed carefully.

Coverage was 74%, with keynote_parser/command_line.py at 0% - the interface
nearly everyone actually uses had no tests at all, so argument wiring,
defaults and dispatch were unverified.

Four new files, parameterized in the style of the existing suite:

 - test_command_line.py: subcommand dispatch, argument wiring, output
   defaults (MyDeck.key -> MyDeck, MyDeck -> MyDeck.key), --version, bare
   invocation printing help, cat with and without --raw, and an unpack/pack
   round trip. 0% -> 97%.

 - test_replacement_files.py: parse_json, which reads the documented
   --replacements format. Covers key_path defaulting, unknown keys being
   ignored, and the error paths for incomplete entries and malformed JSON.

 - test_surrogate_pairs.py: from_surrogate_pair and to_surrogate_pair had no
   direct coverage. Includes the boundary codepoints, hex case handling, and
   the cases that must be left alone - lone surrogates, pairs in the wrong
   order, and adjacent BMP escapes that must not be merged.

 - test_styled_replacement.py: character-index bookkeeping when replacing
   text that spans several character styles. Per the note in replacement.py,
   getting this wrong leaves indices pointing past the end of the text, which
   makes Keynote render a text box 2^16 points tall and crash - so these
   assert the arithmetic rather than just that a replacement happened.

Coverage 74% -> 91%; replacement.py 67% -> 96%, unicode_utils 77% -> 95%.
Spot-checked by mutation rather than trusting line counts: breaking the
unpack output default, the replacement counter and the surrogate-pair bounds
check fails 1, 2 and 18 tests respectively.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0179M4xvAKPGrgKpy4AeCsM7
@psobot psobot changed the title Cover the command line, replacement files and surrogate pairs Increase test coverage. Aug 8, 2026
@psobot
psobot merged commit 9f201c0 into master Aug 8, 2026
4 checks passed
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