Skip to content

Commit a2c40da

Browse files
author
Codeflash Bot
committed
tests galore
1 parent b0bcfb2 commit a2c40da

File tree

3 files changed

+375
-2
lines changed

3 files changed

+375
-2
lines changed

code_to_optimize/topological_sort.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ def topologicalSort(self):
2828
if visited[i] == False:
2929
self.topologicalSortUtil(i, visited, stack)
3030

31-
return stack, str(sorting_id)
31+
return stack, str(sorting_id)

codeflash/discovery/discover_unit_tests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,16 @@ def visit_ImportFrom(self, node: ast.ImportFrom) -> None:
307307
self.found_qualified_name = qname
308308
return
309309

310+
# Check if any target function is a method of the imported class/module
311+
# e.g., importing Graph and looking for Graph.topologicalSort
312+
for target_func in fnames:
313+
if "." in target_func:
314+
class_name, method_name = target_func.split(".", 1)
315+
if aname == class_name:
316+
self.found_any_target_function = True
317+
self.found_qualified_name = target_func
318+
return
319+
310320
prefix = qname + "."
311321
# Only bother if one of the targets startswith the prefix-root
312322
candidates = proots.get(qname, ())

0 commit comments

Comments
 (0)