Skip to content

Compare two sets as a library function and a command - #85

Merged
peterbjohnson merged 3 commits into
devfrom
wb/t55
Sep 21, 2026
Merged

peterbjohnson merged 3 commits into
devfrom
wb/t55

Conversation

@peterbjohnson

Copy link
Copy Markdown
Member

tests/test_against_convert.py holds the comparison of two sets - question by question, part by part, main text, part text and worked solution, with whitespace runs folded, image references compared by file name and a lone empty part dropped - and the differs.txt convention that records known differences per folder. The agent needs the same comparison to check a built set against the Lambda Feedback export it should reproduce, so it belongs in the package.

Move it into in2lambda.compare: differences(built: Set, expected: Set) -> list[str] returning the lines the test now builds (Question 1 "", part (a), worked solution: the draft says ... and convert says ..., with the two sides named by arguments left_name/right_name defaulting to "the draft" and "convert"), and known(path) -> list[str] reading a differs.txt with # ticket comments. Keep the normalisation rules as they are and document them in the module docstring; tests/test_against_convert.py imports both and loses its private copies. Add in2lambda compare BUILT_ZIP EXPORT_DIR [--known differs.txt] to the CLI, printing each difference and exiting 1 where the differences are not exactly the known ones, so a person can compare a set with an export by hand. A unit test in tests/test_compare.py covers the three normalisations and the known-differences check with two small sets built in the test. Done when the against-convert suite passes unchanged in outcome and the CLI compares the ME2 export fixture with itself as identical.


Workbench ticket t55.

@peterbjohnson
peterbjohnson merged commit 0f899a6 into dev Sep 21, 2026
6 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