get basic module exports to work in API-graphs

This commit is contained in:
Erik Krogh Kristensen
2022-02-01 11:44:18 +01:00
parent df9efbe778
commit 038b032a43
4 changed files with 65 additions and 20 deletions

View File

@@ -15,7 +15,11 @@ class ApiDefTest extends InlineExpectationsTest {
// from the inline tests.
not n instanceof DataFlow::ModuleVariableNode and
exists(l.getFile().getRelativePath()) and
n.getLocation().getFile().getBaseName().matches("def%.py")
exists(File f | f = n.getLocation().getFile() |
f.getBaseName().matches("def%.py")
or
f.getAbsolutePath().matches("%/mypkg/%")
)
}
override predicate hasActualResult(Location location, string element, string tag, string value) {

View File

@@ -1 +1,2 @@
foo = 42
# TODO: Shortcurcuit the __init__ package.
foo = 42 #$ def=moduleImport("mypkg").getMember("__init__").getMember("foo")

View File

@@ -1 +1 @@
pass
value = 3 #$ def=moduleImport("mypkg").getMember("foo").getMember("value")