TypeError is thrown when comparing bool and str
Closed this issue · 2 comments
dmitryalferov commented
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 commented
Thanks for reporting this bug. I will take a look when I can.
seperman commented
@dmitryalferov DeepDiff 5.8.0 is published and this issues is resolved.