Skip to content

Commit a4a56dc

Browse files
author
Codeflash Bot
committed
all tests fixed
1 parent ae5157b commit a4a56dc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

codeflash/discovery/discover_unit_tests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,13 @@ def visit_ImportFrom(self, node: ast.ImportFrom) -> None:
308308
return
309309

310310
# Check if any target function is a method of the imported class/module
311-
# e.g., importing Graph and looking for Graph.topologicalSort
311+
# Be conservative except when an alias is used (which requires exact method matching)
312312
for target_func in fnames:
313313
if "." in target_func:
314314
class_name, method_name = target_func.split(".", 1)
315-
if aname == class_name:
315+
if aname == class_name and not alias.asname:
316+
# If an alias is used, don't match conservatively
317+
# The actual method usage should be detected in visit_Attribute
316318
self.found_any_target_function = True
317319
self.found_qualified_name = target_func
318320
return

0 commit comments

Comments
 (0)