Skip to content

Commit 8ec414d

Browse files
committed
Python: Add copy of internal Python 3 tests
Again, mostly extractor tests, and a single library test.
1 parent b22b4c5 commit 8ec414d

Some content is hidden

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

82 files changed

+1462
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| Script \u0ca8\u0ca8\u0ccd\u0ca8_\u0cb8\u0ccd\u0c95\u0ccd\u0cb0\u0cbf\u0caa\u0ccd\u0c9f\u0ccd.py |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import python
2+
from Module m
3+
select m.toString()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- coding: utf-8 -*-
2+
import sys
3+
from dbgimporter import import_and_enable_debugger
4+
import_and_enable_debugger()
5+
def ಏನಾದರೂ_ಮಾಡು():
6+
print('ಏನೋ ಮಾಡಿದೆ'.encode(sys.stdout.encoding, errors='replace'))
7+
8+
9+
ಏನಾದರೂ_ಮಾಡು()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
| 1 | AnnAssign | x | int | IntegerLiteral |
2+
| 2 | AnnAssign | y | Thing | something() |
3+
| 3 | AnnAssign | z | Any | ---- |
4+
| 4 | AnnAssign | Attribute | complex | ---- |
5+
| 5 | AnnAssign | Attribute | not_simple | None |
6+
| 8 | AnnAssign | a | int | IntegerLiteral |
7+
| 9 | AnnAssign | b | Thing | something() |
8+
| 10 | AnnAssign | c | Any | ---- |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
import python
3+
4+
from AnnAssign a, string value
5+
where
6+
value = a.getValue().toString() or not exists(a.getValue()) and value = "----"
7+
select a.getLocation().getStartLine(), a.toString(), a.getTarget().toString(), a.getAnnotation().toString(), value
8+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
| 0 | 0 | 0 | 0 | Module test |
2+
| 1 | 1 | 1 | 1 | x |
3+
| 1 | 1 | 1 | 10 | AnnAssign |
4+
| 1 | 4 | 1 | 6 | int |
5+
| 1 | 10 | 1 | 10 | IntegerLiteral |
6+
| 2 | 1 | 2 | 1 | y |
7+
| 2 | 1 | 2 | 22 | AnnAssign |
8+
| 2 | 4 | 2 | 8 | Thing |
9+
| 2 | 12 | 2 | 20 | something |
10+
| 2 | 12 | 2 | 22 | something() |
11+
| 3 | 1 | 3 | 1 | z |
12+
| 3 | 1 | 3 | 6 | AnnAssign |
13+
| 3 | 4 | 3 | 6 | Any |
14+
| 4 | 1 | 4 | 1 | a |
15+
| 4 | 1 | 4 | 3 | Attribute |
16+
| 4 | 1 | 4 | 13 | AnnAssign |
17+
| 4 | 7 | 4 | 13 | complex |
18+
| 5 | 1 | 5 | 1 | c |
19+
| 5 | 1 | 5 | 3 | Attribute |
20+
| 5 | 1 | 5 | 23 | AnnAssign |
21+
| 5 | 7 | 5 | 16 | not_simple |
22+
| 5 | 20 | 5 | 23 | None |
23+
| 7 | 1 | 7 | 8 | Function f |
24+
| 7 | 1 | 7 | 8 | FunctionDef |
25+
| 7 | 1 | 7 | 8 | FunctionExpr |
26+
| 7 | 5 | 7 | 5 | f |
27+
| 8 | 5 | 8 | 5 | a |
28+
| 8 | 5 | 8 | 14 | AnnAssign |
29+
| 8 | 8 | 8 | 10 | int |
30+
| 8 | 14 | 8 | 14 | IntegerLiteral |
31+
| 9 | 5 | 9 | 5 | b |
32+
| 9 | 5 | 9 | 26 | AnnAssign |
33+
| 9 | 8 | 9 | 12 | Thing |
34+
| 9 | 16 | 9 | 24 | something |
35+
| 9 | 16 | 9 | 26 | something() |
36+
| 10 | 5 | 10 | 5 | c |
37+
| 10 | 5 | 10 | 10 | AnnAssign |
38+
| 10 | 8 | 10 | 10 | Any |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
import python
3+
4+
from AstNode a, Location l
5+
where l = a.getLocation()
6+
select l.getStartLine(), l.getStartColumn(), l.getEndLine(), l.getEndColumn(), a.toString()
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
| 0 | Module test | 1 | IntegerLiteral |
2+
| 1 | AnnAssign | 2 | something |
3+
| 1 | IntegerLiteral | 1 | x |
4+
| 1 | int | 1 | AnnAssign |
5+
| 1 | x | 1 | int |
6+
| 2 | AnnAssign | 3 | z |
7+
| 2 | Thing | 2 | AnnAssign |
8+
| 2 | something | 2 | something() |
9+
| 2 | something() | 2 | y |
10+
| 2 | y | 2 | Thing |
11+
| 3 | AnnAssign | 4 | a |
12+
| 3 | Any | 3 | AnnAssign |
13+
| 3 | z | 3 | Any |
14+
| 4 | AnnAssign | 5 | None |
15+
| 4 | Attribute | 4 | complex |
16+
| 4 | a | 4 | Attribute |
17+
| 4 | complex | 4 | AnnAssign |
18+
| 5 | AnnAssign | 7 | FunctionExpr |
19+
| 5 | Attribute | 5 | not_simple |
20+
| 5 | None | 5 | c |
21+
| 5 | c | 5 | Attribute |
22+
| 5 | not_simple | 5 | AnnAssign |
23+
| 7 | Function f | 8 | IntegerLiteral |
24+
| 7 | FunctionExpr | 7 | f |
25+
| 7 | f | 0 | Module test |
26+
| 8 | AnnAssign | 9 | something |
27+
| 8 | IntegerLiteral | 8 | a |
28+
| 8 | a | 8 | AnnAssign |
29+
| 9 | AnnAssign | 10 | c |
30+
| 9 | b | 9 | AnnAssign |
31+
| 9 | something | 9 | something() |
32+
| 9 | something() | 9 | b |
33+
| 10 | AnnAssign | 7 | Function f |
34+
| 10 | c | 10 | AnnAssign |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
import python
3+
4+
from ControlFlowNode p, ControlFlowNode s
5+
where p.getASuccessor() = s
6+
select p.getLocation().getStartLine(), p.getNode().toString(), s.getLocation().getStartLine(), s.getNode().toString()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
x: int = 0
2+
y: Thing = something()
3+
z: Any
4+
a.x : complex
5+
c.y : not_simple = None
6+
7+
def f():
8+
a: int = 0
9+
b: Thing = something()
10+
c: Any

0 commit comments

Comments
 (0)