Skip to content
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

deepdiff works wrong while comparing two list[dict] #344

Open
linkhao380 opened this issue Aug 31, 2022 · 5 comments
Open

deepdiff works wrong while comparing two list[dict] #344

linkhao380 opened this issue Aug 31, 2022 · 5 comments
Labels

Comments

@linkhao380
Copy link

linkhao380 commented Aug 31, 2022

Describe the bug
When a list[dict] contains a duplicate object, deepdiff will works wrong.

To Reproduce

expect_value = [{"id": 1}, {"id": 1}, {"id": 1}]
actual_value = [{"id": 1, "name": 1}]
DeepDiff(
        expect_value,
        actual_value,
        view="tree",
        ignore_order=True,
        report_repetition=True,
        cutoff_intersection_for_pairs=1,
        cutoff_distance_for_pairs=1,
    )

Buggy Output = {'dictionary_item_added': [<root[0]['name'] t1:not present, t2:1>, <root[1]['name'] t1:not present, t2:1>, <root[2]['name'] t1:not present, t2:1>]}
Expected behavior
It is supposed to output contains 'iterable_item_removed' report_type.

Expected Output: {'dictionary_item_added': [<root[0]['name'] t1:not present, t2:1>], 'iterable_item_removed': [<root[1] t1:{'id': 1}, t2:not present>, <root[2] t1:{'id': 1}, t2:not present>]}

OS, DeepDiff version and Python version (please complete the following information):

  • OS: Windows
  • Version 10
  • Python Version 3.10.6
  • DeepDiff Version 5.8.1

Additional context

@linkhao380 linkhao380 changed the title deepdiif works wrong while comparing two list[dict] deepdiff works wrong while comparing two list[dict] Aug 31, 2022
@seperman
Copy link
Owner

Hi @linkhao380
Yes this is a bug. It does have a problem with identical dictionaries as you have noted above.

@seperman seperman added the bug label Dec 12, 2022
@dengmingcong
Copy link

Hi @seperman

Is there any updates on this bug?

@seperman
Copy link
Owner

seperman commented Jun 3, 2023 via email

@seperman
Copy link
Owner

seperman commented Jun 5, 2023

Note: this is a bug with report_repetition=True. It is not about generic issue when comparing two list of dictionaries.

@dengmingcong
Copy link

report_repetition

Got it, thanks for your rapid response, is there plan to fix this bug?

munir131 added a commit to Improwised/deepdiff that referenced this issue Nov 25, 2023
seperman added a commit that referenced this issue Nov 27, 2023
seperman added a commit that referenced this issue Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants