Skip to content

Commit 78afdb1

Browse files
committed
Update match count logic in PythonParser and adjust test case for occurrence count
1 parent 82a34ac commit 78afdb1

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

codetide/parsers/python_parser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,5 @@ def _find_references(
619619
)
620620
)
621621

622-
# TODO deactivate count
623-
# if matches_found >= matches_count:
624-
# break
622+
if matches_found > matches_count:
623+
break

tests/parsers/test_python_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_skip_init_paths(self, path, expected):
3838
("def func():\n pass\nfunc()", "func", 2),
3939
("test(test)", "test", 2),
4040
("class MyTest: pass", "MyTest", 1),
41-
("a.b.c(b)", "b", 1),
41+
("a.b.c(b)", "b", 2),
4242
])
4343
def test_count_occurences_in_code(self, code, substring, count):
4444
"""Tests the regex-based word occurrence counter."""

0 commit comments

Comments
 (0)