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

TypeError is thrown when comparing bool and str #275

Closed
dmitryalferov opened this issue Oct 21, 2021 · 2 comments
Closed

TypeError is thrown when comparing bool and str #275

dmitryalferov opened this issue Oct 21, 2021 · 2 comments
Assignees
Labels

Comments

@dmitryalferov
Copy link

Describe the bug
Encountered strange behavior while comparing boolean and string values.
I was expecting deepdiff to behave in a somewhat symmetric fashion while exchanging first two arguments, but got a TypeError.

To Reproduce

import json
from deepdiff import DeepDiff

src = json.loads('{"default": true}')
dst = json.loads('{"default": "true"}')

# Works as expected:
# {'values_changed': {"root['default']": {'new_value': 'true', 'old_value': True}}}
diff = DeepDiff(src, dst,
        ignore_type_in_groups=[(bool,str), (str,bool)],
        ignore_string_type_changes=True)
print(diff)

# Throws
# TypeError: argument of type 'bool' is not iterable
#  Expected something like: {'values_changed': {"root['default']": {'new_value': True, 'old_value': "true"}}}
diff = DeepDiff(dst, src,
        ignore_type_in_groups=[(bool,str), (str,bool)],
        ignore_string_type_changes=True)
print(diff)

Expected behavior
A clear and concise description of what you expected to happen.

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

  • OS: Ubuntu 21.04
  • Python 3.9.5
  • Deepdiff 5.6.0
@seperman seperman self-assigned this Oct 21, 2021
@seperman seperman added the bug label Oct 21, 2021
@seperman
Copy link
Owner

Thanks for reporting this bug. I will take a look when I can.

@seperman seperman mentioned this issue Apr 10, 2022
7 tasks
@seperman
Copy link
Owner

@dmitryalferov 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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants