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

extraneous warning when path excluded and ignore_order=True #293

Closed
wfaulk opened this issue Jan 26, 2022 · 2 comments
Closed

extraneous warning when path excluded and ignore_order=True #293

wfaulk opened this issue Jan 26, 2022 · 2 comments
Assignees

Comments

@wfaulk
Copy link

wfaulk commented Jan 26, 2022

Describe the bug
When a path is excluded and ignore_order is True, DeepDiff prints out a warning:

Can not produce a hash for <object>. Not counting this object.
 '<value> is not one of the hashed items.'

I don't think that this will ever produce bad results, since the object is being excluded, but I could be wrong.

To Reproduce

from deepdiff import DeepDiff
import re

t1 = { 'x': 0, 'y': [ 0, 'a', 'b', 'c' ] }
t2 = { 'x': 1, 'y': [ 1, 'c', 'b', 'a' ] }

exclude = [ re.compile(r"\['x'\]"), re.compile(r"\['y'\]\[0\]") ]

print(DeepDiff(t1,t2, exclude_regex_paths=exclude))
print(DeepDiff(t1,t2, ignore_order=True))
print(DeepDiff(t1,t2, ignore_order=True, exclude_regex_paths=exclude))

This produces:

{'values_changed': {"root['y'][1]": {'new_value': 'c', 'old_value': 'a'}, "root['y'][3]": {'new_value': 'a', 'old_value': 'c'}}}
{'values_changed': {"root['x']": {'new_value': 1, 'old_value': 0}, "root['y'][0]": {'new_value': 1, 'old_value': 0}}}
Can not produce a hash for root['y'].Not counting this object.
 '0 is not one of the hashed items.'
Can not produce a hash for root['y'].Not counting this object.
 '1 is not one of the hashed items.'
{}

Expected behavior
Shouldn't produce the warnings. Should just be:

{'values_changed': {"root['y'][1]": {'new_value': 'c', 'old_value': 'a'}, "root['y'][3]": {'new_value': 'a', 'old_value': 'c'}}}
{'values_changed': {"root['x']": {'new_value': 1, 'old_value': 0}, "root['y'][0]": {'new_value': 1, 'old_value': 0}}}
{}

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

  • OS: MacOS 11.6.1
  • Python: 3.9.9
  • DeepDiff: 5.7.0
@seperman
Copy link
Owner

@wfaulk Good point. I will take care of removing these warning messages that you brought up.

@seperman
Copy link
Owner

@wfaulk DeepDiff 5.8.0 is published and this issues is resolved.

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

No branches or pull requests

2 participants