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

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

Open
mskhviyu opened this issue May 14, 2022 · 3 comments
Open

Comments

@mskhviyu
Copy link
Contributor

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())):
?

@seperman
Copy link
Owner

seperman commented May 14, 2022 via email

@mskhviyu
Copy link
Contributor Author

mskhviyu commented May 16, 2022

I mean if we have a reference element with which we will compare other elements, then we will not validate other elements, we will always get True because of the reference element

in fact, I don't quite understand in which cases we may need specifically OR

@seperman
Copy link
Owner

seperman commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants