deepdiff icon indicating copy to clipboard operation
deepdiff copied to clipboard

exclude_regex_paths is not longer working with default threshold_to_diff_deeper

Open wreggyl opened this issue 1 year ago • 2 comments

Describe the bug The exclude_regex_paths is not working if the keys are different and would be filtered out. Only working if the threshold_to_diff_deeper is set to 0

To Reproduce t1 = {'a': [1, 2, [3, {'foo1': 'bar'}]]} t2 = {'a': [1, 2, [3, {'foo2': 'bar'}]]} diff = deepdiff.DeepDiff(t1, t2, exclude_regex_paths="['foo.']")

Expected behavior Diff is expected to be empty

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

  • OS: [MAC OS, Windows]
  • Version [14.6.1, 11]
  • Python Version [3.12, 3.9.2]
  • DeepDiff Version [8.0.1]

Additional context Example from: https://zepworks.com/deepdiff/current/exclude_paths.html diff = deepdiff.DeepDiff(t1, t2, exclude_regex_paths="['foo.']", threshold_to_diff_deeper=0) is working and produces empty diff

wreggyl avatar Sep 17 '24 14:09 wreggyl

I face the same problem. Regex comportement with exclude_regex_paths has completely changed. Exemples shown in official documentation are not working in Python 3.12 I'm using DeepDiff Version [8.4.2]

akarray avatar Mar 23 '25 12:03 akarray

@seperman I face the same problem.

php_data = {"main_category":[{"class":3,"article_id":70518358,"ID":453},{"class":2,"article_id":70518358,"ID":175},{"class":1,"article_id":70518358,"ID":163}]} go_data= {"main_category":[{"article_id":70518358,"ID":453},{"article_id":70518358,"ID":175},{"article_id":70518358,"ID":163}]}

diff = deepdiff.DeepDiff(php_data, go_data, exclude_regex_paths=r"root[main_category][\d+]['class']", ignore_order=True) diff return values_changed

cuihaohao1220 avatar Mar 25 '25 03:03 cuihaohao1220