Skip to content

Commit 356c01c

Browse files
committed
Adding comments
1 parent c13d431 commit 356c01c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

deepdiff/search.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ def __search_obj(self,
130130
found = False
131131
if obj == item:
132132
found = True
133+
# We report the match but also continue inside the match to see if there are
134+
# furthur matches inside the `looped` object.
133135
self.__report(report_key='matched_values', key=parent, value=obj)
134-
136+
135137
try:
136138
if is_namedtuple:
137139
obj = obj._asdict()
@@ -143,7 +145,7 @@ def __search_obj(self,
143145
except AttributeError:
144146
if not found:
145147
self['unprocessed'].append("%s" % parent)
146-
148+
147149
return
148150

149151
self.__search_dict(

tests/test_search.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,16 +293,19 @@ def test_none(self):
293293
self.assertEqual(DeepSearch(obj, item, verbose_level=1), result)
294294

295295
def test_complex_obj(self):
296-
obj = datetime(2017, 5, 4, 1, 1, 1)
296+
obj = datetime(2017, 5, 4, 1, 1, 1)
297297
item = datetime(2017, 5, 4, 1, 1, 1)
298298
result = {'matched_values': {'root'}}
299299
self.assertEqual(DeepSearch(obj, item, verbose_level=1), result)
300300

301301
def test_keep_searching_after_obj_match(self):
302+
302303
class AlwaysEqual:
304+
303305
def __init__(self, recurse=True):
304306
if recurse:
305307
self.some_attr = AlwaysEqual(recurse=False)
308+
306309
def __eq__(self, other):
307310
return True
308311

0 commit comments

Comments
 (0)