Skip to content

Commit dc33f0d

Browse files
committed
Python: Additional tests for model-editor
We currently have some problems with these files, that we should fix later down the line. See PR comment for more details.
1 parent 6bc830d commit dc33f0d

File tree

8 files changed

+42
-0
lines changed

8 files changed

+42
-0
lines changed

python/ql/test/modelling/FrameworkModeEndpoints.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,11 @@
1212
| MyPackage/Foo.py:34:1:34:42 | Function func_with_fancy_args | MyPackage | Foo | func_with_fancy_args | () | false | Foo.py | | Function |
1313
| MyPackage/ModuleWithAll.py:2:1:2:10 | Class Foo | MyPackage | ModuleWithAll.Foo | | | false | ModuleWithAll.py | | Class |
1414
| MyPackage/ModuleWithAll.py:3:1:3:10 | Class Bar | MyPackage | ModuleWithAll.Bar | | | false | ModuleWithAll.py | | Class |
15+
| NotPackage/not_in_pacakge_lib.py:1:1:1:34 | Function not_in_pacakge_lib_func | NotPackage | | not_in_pacakge_lib_func | (x,y) | false | not_in_pacakge_lib.py | | Function |
16+
| NotPackage/not_in_pacakge_lib.py:1:1:1:34 | Function not_in_pacakge_lib_func | NotPackage | not_in_pacakge_lib | not_in_pacakge_lib_func | (x,y) | false | not_in_pacakge_lib.py | | Function |
17+
| NotPackage/not_in_pacakge_lib.py:1:1:1:34 | Function not_in_pacakge_lib_func | not_in_pacakge_lib | | not_in_pacakge_lib_func | (x,y) | false | not_in_pacakge_lib.py | | Function |
18+
| NotPackage/not_in_pacakge_lib.py:1:1:1:34 | Function not_in_pacakge_lib_func | not_in_pacakge_lib | not_in_pacakge_lib | not_in_pacakge_lib_func | (x,y) | false | not_in_pacakge_lib.py | | Function |
19+
| NotPackage/not_in_package_script.py:5:1:5:37 | Function not_in_package_script_func | NotPackage | not_in_package_script | not_in_package_script_func | (x,y) | false | not_in_package_script.py | | Function |
20+
| NotPackage/possibly_lib.py:4:1:4:28 | Function possibly_lib_func | NotPackage | possibly_lib | possibly_lib_func | (x,y) | false | possibly_lib.py | | Function |
1521
| TopLevel.py:3:1:3:38 | Function top_level_function | TopLevel | | top_level_function | (x,y,z:) | false | TopLevel.py | | Function |
22+
| not-valid-package/not_in_pacakge_lib_copy.py:1:1:1:34 | Function not_in_pacakge_lib_func | not_in_pacakge_lib_copy | | not_in_pacakge_lib_func | (x,y) | false | not_in_pacakge_lib_copy.py | | Function |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def not_in_pacakge_lib_func(x, y):
2+
return x + y
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python
2+
3+
import not_in_pacakge_lib
4+
5+
def not_in_package_script_func(x, y):
6+
return x + y
7+
8+
if __name__ == "__main__":
9+
print(not_in_pacakge_lib.not_in_pacakge_lib_func(1, 2))
10+
print(not_in_package_script_func(3, 4))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# model editor should allow modeling the functions defined in this file, even when the
2+
# file is not imported explicitly.
3+
4+
def possibly_lib_func(x, y):
5+
return x + y
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def not_in_pacakge_lib_func(x, y):
2+
return x + y
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python
2+
3+
import not_in_pacakge_lib_copy
4+
5+
def not_in_package_script_func(x, y):
6+
return x + y
7+
8+
if __name__ == "__main__":
9+
print(not_in_pacakge_lib_copy.not_in_pacakge_lib_func(1, 2))
10+
print(not_in_package_script_func(3, 4))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# model editor should allow modeling the functions defined in this file, even when the
2+
# file is not imported explicitly.
3+
4+
def possibly_lib_func(x, y):
5+
return x + y

python/ql/test/modelling/options

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
semmle-extractor-options: -R .

0 commit comments

Comments
 (0)