We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please checkout the F.A.Q page before creating a bug ticket to make sure it is not already addressed.
Describe the bug
To Reproduce
def compare_func(x, y, level=None): return x["id"] == y["id"] # First test case A = {'array': [{'id': 1, 'x': 'a1'}, {'id': 2, 'x': 'b1'}]} B = {'array': [{'id': 1, 'x': 'a1'}, {'id': 2, 'x': 'b0'}, {'id': 3, 'x': 'c1'}]} DeepDiff(A, B, ignore_order=True, report_repetition=True, verbose_level=2, iterable_compare_func=compare_func) # {'values_changed': {"root['array'][1]['x']": {'new_value': 'b0', 'old_value': 'b1'}}, # 'iterable_item_added': {"root['array'][2]": {'id': 3, 'x': 'c1'}}} # → 1 changed, 1 added: Good and expected # Second test case A = {'array': [{'id': 1, 'x': 'a1'}]} B = {'array': [{'id': 1, 'x': 'a0'}, {'id': 2, 'x': 'b1'}]} DeepDiff(A, B, ignore_order=True, report_repetition=True, verbose_level=2, iterable_compare_func=compare_func) # {'iterable_item_added': {"root['array'][0]": {'id': 1, 'x': 'a0'}, "root['array'][1]": {'id': 2, 'x': 'b1'}}, # 'iterable_item_removed': {"root['array'][0]": {'id': 1, 'x': 'a1'}}} # → 2 added, 1 removed: unexpected result # moreover, the compare_func was not executed at all # if I remove report_repetition=True, it kind of works but still does not used the specified compare_func DeepDiff(A, B, ignore_order=True, verbose_level=2, iterable_compare_func=compare_func) # {'values_changed': {"root['array'][0]": {'new_value': {'id': 1, 'x': 'a0'}, 'old_value': {'id': 1, 'x': 'a1'}}}, # 'iterable_item_added': {"root['array'][1]": {'id': 2, 'x': 'b1'}}}
Expected behavior I expected the second test case to return one 'values_changed' and one 'iterable_item_added', e.g.,
{'values_changed': {"root['array'][0]['x']": {'new_value': 'a0', 'old_value': 'a1'}}, 'iterable_item_added': {"root['array'][1]": {'id': 2, 'x': 'b1'}}}
The compare_func should also be called in the second test case
compare_func
OS, DeepDiff version and Python version (please complete the following information):
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Please checkout the F.A.Q page before creating a bug ticket to make sure it is not already addressed.
Describe the bug
To Reproduce
Expected behavior
I expected the second test case to return one 'values_changed' and one 'iterable_item_added', e.g.,
{'values_changed': {"root['array'][0]['x']": {'new_value': 'a0', 'old_value': 'a1'}}, 'iterable_item_added': {"root['array'][1]": {'id': 2, 'x': 'b1'}}}
The
compare_func
should also be called in the second test caseOS, DeepDiff version and Python version (please complete the following information):
The text was updated successfully, but these errors were encountered: