Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2524f23

Browse files
committed
Python: Add more test cases
There is now a bit of redundancy in the tests, but I thought it useful to actually include some of the cases called out explicitly in the documentation, so as to make it easy to see that the code actually does what we expect (in these cases, anyway).
1 parent aa7e9f0 commit 2524f23

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • python/ql/test/experimental/dataflow/ApiGraphs

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@
2828

2929
x6 = m6().foo().bar() #$ use=moduleImport("a6").getMember("m6").getReturn().getMember("foo").getReturn().getMember("bar").getReturn()
3030

31+
import foo.baz.baz as fbb #$ use=moduleImport("foo").getMember("baz").getMember("baz")
32+
from foo.bar.baz import quux as fbbq #$ use=moduleImport("foo").getMember("bar").getMember("baz").getMember("quux")
33+
from ham.bar.eggs import spam as hbes #$ use=moduleImport("ham").getMember("bar").getMember("eggs").getMember("spam")
34+
fbb.quux #$ use=moduleImport("foo").getMember("baz").getMember("baz").getMember("quux")
35+
fbbq #$ use=moduleImport("foo").getMember("bar").getMember("baz").getMember("quux")
36+
hbes #$ use=moduleImport("ham").getMember("bar").getMember("eggs").getMember("spam")
37+
38+
import foo.bar.baz #$ use=moduleImport("foo")
3139

3240
# Relative imports. These are ignored
3341

@@ -65,3 +73,9 @@ def f():
6573
foo = NONSOURCE
6674
change_foo()
6775
sink(foo) #$ MISSING: use=moduleImport("danger").getMember("SOURCE")
76+
77+
# Star imports
78+
79+
from unknown import * #$ use=moduleImport("unknown")
80+
81+
hello() #$ MISSING: use=moduleImport("unknown").getMember("hello").getReturn()

0 commit comments

Comments
 (0)