Comments (1)
Hi @kfirc
Thanks for reporting this.
What is happening here is that exclude_regex_paths
is not working properly with report_repetition
:
In [1]: from deepdiff import DeepDiff, Delta
...:
...: d1 = {'a': [{'id': 1}, {'id': 2}, {'id': 3}]}
...: d2 = {'a': [{'id': 1}, {'id': 2}, {'id': 3}, {'id': 4}]}
...:
...: deep_diff_result = DeepDiff(d1, d2, exclude_regex_paths=[r"(?=root.*\['id'\])"], ignore_order=True, report_re
...: petition=True)
...:
In [2]: deep_diff_result
Out[2]:
{'repetition_change': {"root['a'][0]": {'old_repeat': 3,
'new_repeat': 4,
'old_indexes': [0, 1, 2],
'new_indexes': [0, 1, 2, 3],
'value': {'id': 1}}}}
In [3]: deep_diff_result = DeepDiff(d1, d2, ignore_order=True, report_repetition=True)
In [4]: deep_diff_result
Out[4]: {'iterable_item_added': {"root['a'][3]": {'id': 4}}
What delta object gets in your case is that {'id': 1}
needs to be repeated 4 times. That's why you get the unexpected result.
from deepdiff.
Related Issues (20)
- Unsupported Operation: readline + Debug Feature HOT 2
- iterable_compare_func not working properly HOT 4
- 6.4.0 - AttributeError: 'NoneType' object has no attribute '__version__' HOT 1
- 6.4.0 importing deepdiff results in none type error HOT 5
- Simple typo in test paths generation. HOT 1
- Delta.__add__ breaks with esoteric dict keys HOT 1
- Function `parse_path` doesn't exist but is referenced in the docs. HOT 1
- Keys containing "__a__" at the beginning will be ignored. HOT 1
- Diff does not work for attributes of a class that inherits from dict or collections.UserDict HOT 4
- DeepDiff raises decimal exception when using significant digits HOT 3
- Can't compare dicts with both single and double quotes in keys HOT 3
- Inconsistent Behavior with math_epsilon and ignore_order HOT 1
- max_diffs doesn't use ignore_nan_inequality flag
- Wrong diff on list of strings HOT 3
- DeepDiff fails when dictionary keys are unrepresentable and exclude_regex_paths is not None
- Errors with dictionary_item_removed and dictionary_item_added HOT 3
- Error on Delta With None Key and Removed Item from List
- Need to be able to see full path on all outputs HOT 1
- Error when subtracting Delta from a dictionary HOT 4
- Documentation on how to consume keys HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepdiff.