Python: Add test case for unwanted module type tracking

This commit is contained in:
Taus Brock-Nannestad
2020-10-13 22:47:03 +02:00
parent b895641a83
commit 76e5b59dab
2 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
import module.attr as attr_ref
x = attr_ref
def fun():
y = attr_ref
# The following should _not_ be a reference to the above module, since we don't actually import it.
z = module

View File

@@ -1,5 +1,12 @@
module_tracker
| import_as_attr.py:1:6:1:11 | ControlFlowNode for ImportExpr |
| import_as_attr_dotted.py:0:0:0:0 | ModuleVariableNode for Global Variable attr_ref in Module import_as_attr_dotted |
| import_as_attr_dotted.py:1:8:1:18 | ControlFlowNode for ImportExpr |
| import_as_attr_dotted.py:1:23:1:30 | GSSA Variable attr_ref |
| import_as_attr_dotted.py:3:1:3:1 | GSSA Variable x |
| import_as_attr_dotted.py:3:5:3:12 | ControlFlowNode for attr_ref |
| import_as_attr_dotted.py:6:5:6:5 | SSA variable y |
| import_as_attr_dotted.py:6:9:6:16 | ControlFlowNode for attr_ref |
module_attr_tracker
| import_as_attr.py:0:0:0:0 | ModuleVariableNode for Global Variable attr_ref in Module import_as_attr |
| import_as_attr.py:1:20:1:35 | ControlFlowNode for ImportMember |