Skip to content

Commit 6591a86

Browse files
authored
Python: Add test cases
I debated whether to add a `MISSING: use=moduleImport("builtins").getMember("print").getReturn()` annotation to the last line. Ultimately, I decided to add it, as we likely _do_ want this information to propagate into inner functions (even if the value of `var2` may change before `func4` is called).
1 parent e53b86f commit 6591a86

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

python/ql/test/experimental/dataflow/ApiGraphs/test_import_star.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,13 @@ def foo():
2323
def quux():
2424
global non_module_member
2525
non_module_member = 5
26+
27+
def func1():
28+
var() #$ use=moduleImport("unknown").getMember("var").getReturn()
29+
def func2():
30+
var = "FOO"
31+
32+
def func3():
33+
var2 = print #$ use=moduleImport("builtins").getMember("print")
34+
def func4():
35+
var2() #$ MISSING: use=moduleImport("builtins").getMember("print").getReturn()

0 commit comments

Comments
 (0)