Closed
Description
Describe the bug
When attempting to do a diff between two lists of dictionaries, if ignore_order is defined as True, and exclude_paths is provided, the exclude_paths appears to not be accounted for.
To Reproduce
Steps to reproduce the behavior:
- Here is the following code snippet I have been using to reproduce the error:
from deepdiff import DeepDiff
obj1 = {'a': 1, 'b': 'randomString', 'e': "1111"}
obj2 = {'c': 1, 'd': 'randomString', 'e': 'Cool'}
obj1a = {'a': 1, 'b': 'randomString', 'e': "2222"}
obj2a = {'c': 1, 'd': 'randomString', 'e': 'Cool'}
test1 = [obj1, obj2]
test2 = [obj2a, obj1a]
exclude_paths = ["root[0]['e']", "root[1]['e']"]
print(DeepDiff(test1, test2, ignore_order=True, report_repetition=True, verbose_level=2, exclude_paths=exclude_paths))
- Run the above script
- Result will show be:
{'iterable_item_added': {'root[1]': {'a': 1, 'b': 'AaPedDefault', 'e': '2222'}}, 'iterable_item_removed': {'root[0]': {'a': 1, 'b': 'AaPedDefault', 'e': '1111'}}}
- If you change the
e
field of obj1a to be the same as obj1['e'], DeepDiff will return an empty object, as expected.
Expected behavior
Output of the above should show no diff, as e should be excluded from the paths.
Expected output:
{}
OS, DeepDiff version and Python version (please complete the following information):
- OS: CentOs7
- DeepDiff Version: 4.2.0
- Python Version: Python 3.6.5