Repository navigation
test(diff): a worked example of the diff over two five-row tables - #316
Merged
Merged
Conversation
Two tables of five rows share three keys. One of the three is identical and two differ in c_float, and each table has two keys of its own. b_int is only in the before table and d_string only in the after table. The tests write the expected compare table out row by row, with the membership and equality codes named, so the diff can be checked by eye. No Buckaroo server, session or grid is involved. d_string never appears in the compare table (#275), so that expectation is a strict xfail that fails once #275 is fixed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What this adds
tests/test_diff_by_example.py: the diff of two five-row tables, written so that the code can be read and the result checked by eye. It changes no source.The tables are joined on
a_primary:Keys 1, 2 and 3 are in both: key 1 is identical, keys 2 and 3 differ in
c_float. Keys 10 and 11 are only before, keys 20 and 21 only after.b_intis only in before andd_stringonly in after, soc_floatis the one non-key column both sides have.test_the_diff_of_two_small_tableswrites the whole compare table (build_compare_expr's result) out row by row and compares it with the real one. The membership and equality codes are named constants (c_float_eqis the membership, plus 4 when the values are equal), soBOTH + EQUALreads as what it is.schema_diffnamingb_intas removed andd_stringas added, andd_stringappearing in the diff.xfailtied to a column added in the newer version never appears in the diff grid or a promoted diff: build_compare_expr and the column config loop over the a side only #275.build_compare_exprloops over the before side's columns, sod_stringnever reaches the compare table, and the expected table in the main test has nod_stringcolumn for the same reason. When a column added in the newer version never appears in the diff grid or a promoted diff: build_compare_expr and the column config loop over the a side only #275 is fixed the strict xfail fails, and the marker and the missing column can go.No Buckaroo server, session or grid is involved.
build_compare_exprimports one helper (_align_backends) from thebuckaroopackage, andtallyman_xorq.diff, which holdsschema_diff, importsbuckaroo.comparewhen it loads.Verification
Local:
tests/test_diff_by_example.pyandtests/test_diff.pytogether: 45 passed, 1 xfailed.uvx ruff check: clean. The rest of the suite is left to CI.The tests pass today, apart from the strict xfail, so there is no red commit.
🤖 Generated with Claude Code