Skip to content

Commit b22b4c5

Browse files
committed
Python: Add copy of internal Python 2 tests
These are mostly extractor tests, which now live in `2/extractor-tests`, and a single library tests that was added to the existing directory.
1 parent e45f6e9 commit b22b4c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+213
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| 2 |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import python
2+
3+
4+
select count(Ellipsis e)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
a = {}
2+
a[...] = 1
3+
b = a[
4+
...]
5+
6+
print(b)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
| test.py | 0 | Entry node for Module test | 1 | ControlFlowNode for FunctionExpr | normal |
2+
| test.py | 1 | ControlFlowNode for FunctionExpr | 1 | ControlFlowNode for f | normal |
3+
| test.py | 1 | ControlFlowNode for f | 0 | Exit node for Module test | normal |
4+
| test.py | 1 | ControlFlowNode for x | 2 | ControlFlowNode for exec | normal |
5+
| test.py | 1 | Entry node for Function f | 1 | ControlFlowNode for x | normal |
6+
| test.py | 2 | ControlFlowNode for Str | 2 | ControlFlowNode for exec() | normal |
7+
| test.py | 2 | ControlFlowNode for exec | 2 | ControlFlowNode for Str | normal |
8+
| test.py | 2 | ControlFlowNode for exec() | 3 | ControlFlowNode for x | normal |
9+
| test.py | 3 | ControlFlowNode for Return | 1 | Exit node for Function f | normal |
10+
| test.py | 3 | ControlFlowNode for x | 3 | ControlFlowNode for Return | normal |
11+
| unicode.py | 0 | Entry node for Module unicode | 1 | ControlFlowNode for ImportExpr | normal |
12+
| unicode.py | 1 | ControlFlowNode for ImportExpr | 1 | ControlFlowNode for ImportMember | normal |
13+
| unicode.py | 1 | ControlFlowNode for ImportMember | 1 | ControlFlowNode for unicode_literals | normal |
14+
| unicode.py | 1 | ControlFlowNode for unicode_literals | 3 | ControlFlowNode for FunctionExpr | normal |
15+
| unicode.py | 3 | ControlFlowNode for FunctionExpr | 3 | ControlFlowNode for f | normal |
16+
| unicode.py | 3 | ControlFlowNode for f | 0 | Exit node for Module unicode | normal |
17+
| unicode.py | 3 | ControlFlowNode for x | 4 | ControlFlowNode for exec | normal |
18+
| unicode.py | 3 | Entry node for Function f | 3 | ControlFlowNode for x | normal |
19+
| unicode.py | 4 | ControlFlowNode for Str | 4 | ControlFlowNode for exec() | normal |
20+
| unicode.py | 4 | ControlFlowNode for exec | 4 | ControlFlowNode for Str | normal |
21+
| unicode.py | 4 | ControlFlowNode for exec() | 5 | ControlFlowNode for x | normal |
22+
| unicode.py | 5 | ControlFlowNode for Return | 3 | Exit node for Function f | normal |
23+
| unicode.py | 5 | ControlFlowNode for x | 5 | ControlFlowNode for Return | normal |
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
import python
3+
4+
from ControlFlowNode p, ControlFlowNode s, string kind, string filename
5+
6+
where p.getASuccessor() = s and
7+
(
8+
p.getAnExceptionalSuccessor() = s and kind = "exception"
9+
or
10+
not p.getAnExceptionalSuccessor() = s and kind = "normal"
11+
) and filename = p.getLocation().getFile().getShortName() and
12+
not filename = "__future__.py"
13+
14+
select filename, p.getLocation().getStartLine(), p.toString(), s.getLocation().getStartLine(), s.toString(), kind
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def f(x):
2+
exec("raise thing")
3+
return x
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from __future__ import unicode_literals
2+
3+
def f(x):
4+
exec("raise thing")
5+
return x

python/ql/test/2/extractor-tests/hidden/.hidden/inner/test.py

Whitespace-only changes.

python/ql/test/2/extractor-tests/hidden/.hidden/module.py

Whitespace-only changes.

python/ql/test/2/extractor-tests/hidden/folder/module.py

Whitespace-only changes.

0 commit comments

Comments
 (0)