Add t1_name/t2_name to rename t1/t2 labels in tree view repr - #618
Open
ChrisJr404 wants to merge 1 commit into
Open
Add t1_name/t2_name to rename t1/t2 labels in tree view repr#618ChrisJr404 wants to merge 1 commit into
ChrisJr404 wants to merge 1 commit into
Conversation
The DiffLevel string representation hardcodes the t1 and t2 labels, e.g. <root['a'] t1:1, t2:2>. These parameters let callers rename them to something meaningful such as before/after, which is clearer when the two compared objects have distinct roles. The labels default to t1/t2 so existing output is unchanged, and they only affect the tree view repr, not the text view or the comparison. Closes qlustered#531
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.
This adds
t1_nameandt2_nameparameters toDeepDiffso thet1/t2labels in the tree view's string representation can be renamed, as suggested in #531.Right now the
DiffLevelrepr hardcodes those labels:With the new parameters you can give the two objects meaningful names:
Notes on the implementation:
"t1"/"t2", so existing output is completely unchanged.reprof tree view levels. The text view result and the comparison itself are untouched.DiffLeveland propagate to child levels through the existingcreate_deeper/copymachinery (same pathverbose_levelalready uses), so nested nodes render with the custom labels too._parametersdicts that predate this change (and therefore don't include the keys) fall back to the defaults, so nothing breaks there.Added tests in
tests/test_model.pycovering the custom labels, propagation to nested levels, the unchanged defaults, and that the text view is unaffected. Also updated the tree view docs, the parameter reference,CHANGELOG.md, andAUTHORS.md.Closes #531