-
-
Notifications
You must be signed in to change notification settings - Fork 242
Fix for diffing using iterable_compare_func with nested objects. #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9b70b2b
2672e47
89f1a72
81341e2
a3c0684
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -709,7 +709,7 @@ def _diff_iterable_in_order(self, level, parents_ids=frozenset(), _original_type | |
x, | ||
y, | ||
child_relationship_class=child_relationship_class, | ||
child_relationship_param=i) | ||
child_relationship_param=j) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change ensures that all indexes in the resulting diff are relative the t2 which is consistent with items added. If you are ignoring order I don't think this changes anything since |
||
self._diff(next_level, parents_ids_added) | ||
|
||
def _diff_str(self, level): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ordered-set>=4.1.0,<4.2.0 | ||
ordered-set>=4.0.2,<4.2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 5.8.1 | ||
current_version = 5.8.2 | ||
commit = True | ||
tag = True | ||
tag_name = {new_version} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,11 @@ | |
"root['Cars'][3]['production']" | ||
], | ||
"values_changed": { | ||
"root['Cars'][0]['dealers'][1]['quantity']": { | ||
"root['Cars'][2]['dealers'][0]['quantity']": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes to the existing unittests are because the output is now relative to t2 instead of t1 as mentioned in the above comment. |
||
"new_value": 50, | ||
"old_value": 20 | ||
}, | ||
"root['Cars'][2]['model_numbers'][2]": { | ||
"root['Cars'][1]['model_numbers'][2]": { | ||
"new_value": 3, | ||
"old_value": 4 | ||
}, | ||
|
@@ -20,20 +20,20 @@ | |
} | ||
}, | ||
"iterable_item_added": { | ||
"root['Cars'][0]['dealers'][1]": { | ||
"root['Cars'][2]['dealers'][1]": { | ||
"id": 200, | ||
"address": "200 Fake St", | ||
"quantity": 10 | ||
}, | ||
"root['Cars'][2]['model_numbers'][3]": 4, | ||
"root['Cars'][1]['model_numbers'][3]": 4, | ||
"root['Cars'][0]": { | ||
"id": "7", | ||
"make": "Toyota", | ||
"model": "8Runner" | ||
} | ||
}, | ||
"iterable_item_removed": { | ||
"root['Cars'][0]['dealers'][0]": { | ||
"root['Cars'][2]['dealers'][0]": { | ||
"id": 103, | ||
"address": "103 Fake St", | ||
"quantity": 50 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment pretty much explains why we made this change. But it has to do with the delta modifying data in place. If we didn't make this change, the nested items would get added twice, simply because the "moved" item has the new value that includes any additions. So moved items do not need to be replayed. This just sets the place holders so all the indexes are right when we go into adding items. Then we will actually replace the
None
with the real value after we replay the added items.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense!