Skip to content

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

Closed

Description

@trac-mfraka

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.

Activity

  1. passitalong commented on Nov 21, 2024

    @passitalong

    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
    
  2. self-assigned this
    on Dec 15, 2024
  3. seperman commented on Dec 15, 2024

    @seperman
    Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions