Skip to content

exclude_obj_callback excludes when the condition is true for one variable  #315

Open
@mskhviyu

Description

@mskhviyu
def func(obj, path):
    return True if isinstance(obj, int) else False

t1 = {"x": "12"}
t2 = {"x": 1}
print(DeepDiff(t1, t2, exclude_obj_callback=func))

return
{}

func returns True only for t2, but exclude_obj_callback excludes objects from the result. Is this a bug or a feature?
Maybe need to use AND instead of OR here:

(self.exclude_obj_callback(level.t1, level.path()) or self.exclude_obj_callback(level.t2, level.path())):
?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions