Python: add test for crosstalk

This commit is contained in:
Rasmus Lerchedahl Petersen
2023-12-20 12:06:52 +01:00
parent 6831775a8d
commit 3b7e29bed6
3 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
| test_crosstalk.py:8:16:8:18 | ControlFlowNode for f() | bar |
| test_crosstalk.py:8:16:8:18 | ControlFlowNode for f() | baz |
| test_crosstalk.py:13:16:13:18 | ControlFlowNode for g() | bar |
| test_crosstalk.py:13:16:13:18 | ControlFlowNode for g() | baz |

View File

@@ -0,0 +1,13 @@
def outer():
from foo import bar, baz
def inner_bar():
f = bar
g = baz
return f()
def inner_baz():
f = bar
g = baz
return g()

View File

@@ -0,0 +1,8 @@
import python
import semmle.python.ApiGraphs
from API::CallNode callNode, string member
where
callNode = API::moduleImport("foo").getMember(member).getACall() and
callNode.getLocation().getFile().getBaseName() = "test_crosstalk.py"
select callNode, member