From b48dc5b3eea878ae627c3629081da441475dc0c2 Mon Sep 17 00:00:00 2001 From: Vincent Gao Date: Mon, 22 Jun 2026 10:54:36 +0200 Subject: [PATCH] diff: continue after equal path-limited siblings --- dictdiffer/__init__.py | 2 +- tests/test_dictdiffer.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dictdiffer/__init__.py b/dictdiffer/__init__.py index debd78a..f438da1 100644 --- a/dictdiffer/__init__.py +++ b/dictdiffer/__init__.py @@ -205,7 +205,7 @@ def check(key): # otherwise, the change will be handled as `change` flag. if path_limit and path_limit.path_is_limit(_node + [key]): if _first[key] == _second[key]: - return + continue yield CHANGE, _node + [key], ( deepcopy(_first[key]), deepcopy(_second[key]) diff --git a/tests/test_dictdiffer.py b/tests/test_dictdiffer.py index c1152b8..d885e85 100644 --- a/tests/test_dictdiffer.py +++ b/tests/test_dictdiffer.py @@ -188,6 +188,19 @@ def test_path_limit_addition(self): for patch in res: assert patch in diffed + first = {'input': {}, 'output': {}, 'forward': {'WWW': {'port': 80}}} + second = { + 'input': {}, + 'output': {}, + 'forward': {'WWW': {'port': 80}, 'FTP': {'port': 21}}, + } + diffed = list(diff( + first, second, path_limit=[('*', '*')], dot_notation=False + )) + + res = [('add', ['forward'], [('FTP', {'port': 21})])] + assert res == diffed + def test_path_limit_deletion(self): first = {'author': {'last_name': 'Doe', 'first_name': 'John'}} second = {}