Python: Port CallGraph-implicit-init tests

to the new call-graph test setup. Nice that we can write `MISSING:` now!
This commit is contained in:
Rasmus Wriedt Larsen
2022-06-24 16:17:26 +02:00
parent b60504f404
commit ab42521906
11 changed files with 11 additions and 29 deletions

View File

@@ -0,0 +1,5 @@
failures
debug_callableNotUnique
pointsTo_found_typeTracker_notFound
| example.py:22:1:22:16 | ControlFlowNode for explicit_afunc() | explicit_afunc |
typeTracker_found_pointsTo_notFound

View File

@@ -0,0 +1 @@
../CallGraph/InlineCallGraphTest.ql

View File

@@ -1,6 +0,0 @@
debug_missingAnnotationForCallable
debug_nonUniqueAnnotationForCallable
debug_missingAnnotationForCall
expectedCallEdgeNotFound
| example.py:19:1:19:7 | afunc() | foo/bar/a.py:2:1:2:12 | Function afunc |
unexpectedCallEdgeFound

View File

@@ -1 +0,0 @@
../CallGraph/PointsTo.ql

View File

@@ -1,6 +0,0 @@
debug_missingAnnotationForCallable
debug_nonUniqueAnnotationForCallable
debug_missingAnnotationForCall
pointsTo_found_typeTracker_notFound
| example.py:22:1:22:16 | explicit_afunc() | foo_explicit/bar/a.py:2:1:2:21 | Function explicit_afunc |
pointsTo_notFound_typeTracker_found

View File

@@ -1 +0,0 @@
../CallGraph/Relative.ql

View File

@@ -1,7 +0,0 @@
debug_missingAnnotationForCallable
debug_nonUniqueAnnotationForCallable
debug_missingAnnotationForCall
expectedCallEdgeNotFound
| example.py:19:1:19:7 | afunc() | foo/bar/a.py:2:1:2:12 | Function afunc |
| example.py:22:1:22:16 | explicit_afunc() | foo_explicit/bar/a.py:2:1:2:21 | Function explicit_afunc |
unexpectedCallEdgeFound

View File

@@ -1 +0,0 @@
../CallGraph/TypeTracker.ql

View File

@@ -5,18 +5,18 @@ This is not included in the standard `CallGraph/code` folder, since we're testin
understanding import work properly, so it's better to have a clean test setup that is
obviously correct (the other one isn't in regards to imports).
Technically this is part of PEP 420 -- Implicit Namespace Packages, but does use the
Technically this is part of PEP 420 -- Implicit Namespace Packages, but does not use the
*real* namespace package feature of allowing source code for a single package to reside
in multiple places.
Maybe this should have been an import resolution test, and not a call-graph test ¯\_(ツ)_/¯
Since PEP 420 was accepted in Python 3, this test is Python 3 only.
"""
from foo.bar.a import afunc
from foo_explicit.bar.a import explicit_afunc
# calls:afunc
afunc()
afunc() # $ MISSING: pt,tt=afunc
# calls:explicit_afunc
explicit_afunc()
explicit_afunc() # $ pt=explicit_afunc MISSING: tt=explicit_afunc

View File

@@ -1,4 +1,3 @@
# name:afunc
def afunc():
print("afunc called")
return 1

View File

@@ -1,4 +1,3 @@
# name:explicit_afunc
def explicit_afunc():
print("explicit_afunc called")
return 1