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

In version 8.0.1, accessing the affected_root_keys property on the diff object returned by DeepDiff fails when one of the dicts is empty #508

Open
trac-mfraka opened this issue Nov 19, 2024 · 2 comments
Assignees
Labels

Comments

@trac-mfraka
Copy link

Please checkout the F.A.Q page before creating a bug ticket to make sure it is not already addressed.

Describe the bug
Accessing the property affected_root_keys on the object returned by the DeepDiff function applied to two dicts one of which is empty fails with an AttributeError.

To Reproduce

  1. Create two dict objects one of which is empty and the other with at least one key/value pair.
  2. Call DeepDiff: result = deepdiff.DeepDiff(emptyDict, otherDict).
  3. Access result.affected_root_keys.

Expected behavior
Test whether a particular key is in result.afffected_root_keys.

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

  • OS: [e.g. Ubuntu]: Ubuntu
  • Version [e.g. 20LTS]: 22.04.5 LTS
  • Python Version [e.g. 3.9.12]: 3.12.1
  • DeepDiff Version [e.g. 5.8.0]: 8.0.1

Additional context
Add any other context about the problem here.

@passitalong
Copy link

Confirming this is a bug here too.

diff = DeepDiff({}, {1:1, 2:2})
diff.affected_root_keys

generates an AttributeError: 'NoneType' object has no attribute 'param'

Workaround is to force the old usage.

diff = DeepDiff({}, {1:1, 2:2}, threshold_to_diff_deeper=0)
diff.affected_root_keys

@seperman seperman self-assigned this Dec 15, 2024
@seperman seperman added the bug label Dec 15, 2024
@seperman
Copy link
Owner

Hi @trac-mfraka Thanks for reporting the bug.
Hi @passitalong thanks for the reproducible code.
Looking into it.

seperman added a commit that referenced this issue Dec 15, 2024
…turned by DeepDiff fails when one of the dicts is empty #508
@seperman seperman mentioned this issue Dec 15, 2024
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