new tests
This commit is contained in:
parent
47c455a73c
commit
2c72168e18
36 changed files with 184 additions and 0 deletions
2
test/parser/16.in
Normal file
2
test/parser/16.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
-5
|
||||||
|
|
||||||
5
test/parser/16.out
Normal file
5
test/parser/16.out
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
UnaryOp(-)
|
||||||
|
Number(5)
|
||||||
|
|
||||||
2
test/parser/17.in
Normal file
2
test/parser/17.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
1 < 2
|
||||||
|
|
||||||
6
test/parser/17.out
Normal file
6
test/parser/17.out
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Compare(<)
|
||||||
|
Number(1)
|
||||||
|
Number(2)
|
||||||
|
|
||||||
2
test/parser/18.in
Normal file
2
test/parser/18.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
x and y
|
||||||
|
|
||||||
6
test/parser/18.out
Normal file
6
test/parser/18.out
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
BoolOp(and)
|
||||||
|
Identifier(x)
|
||||||
|
Identifier(y)
|
||||||
|
|
||||||
2
test/parser/19.in
Normal file
2
test/parser/19.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
x or y and z
|
||||||
|
|
||||||
8
test/parser/19.out
Normal file
8
test/parser/19.out
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
BoolOp(or)
|
||||||
|
Identifier(x)
|
||||||
|
BoolOp(and)
|
||||||
|
Identifier(y)
|
||||||
|
Identifier(z)
|
||||||
|
|
||||||
2
test/parser/20.in
Normal file
2
test/parser/20.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
foo.bar(1, 2).baz
|
||||||
|
|
||||||
9
test/parser/20.out
Normal file
9
test/parser/20.out
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Attribute(.baz)
|
||||||
|
Call
|
||||||
|
Attribute(.bar)
|
||||||
|
Identifier(foo)
|
||||||
|
Number(1)
|
||||||
|
Number(2)
|
||||||
|
|
||||||
2
test/parser/21.in
Normal file
2
test/parser/21.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
arr[5]
|
||||||
|
|
||||||
6
test/parser/21.out
Normal file
6
test/parser/21.out
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Subscript
|
||||||
|
Identifier(arr)
|
||||||
|
Number(5)
|
||||||
|
|
||||||
2
test/parser/22.in
Normal file
2
test/parser/22.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
arr[1:3]
|
||||||
|
|
||||||
7
test/parser/22.out
Normal file
7
test/parser/22.out
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Slice
|
||||||
|
Identifier(arr)
|
||||||
|
Number(1)
|
||||||
|
Number(3)
|
||||||
|
|
||||||
2
test/parser/23.in
Normal file
2
test/parser/23.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
(1, 2, 3)
|
||||||
|
|
||||||
7
test/parser/23.out
Normal file
7
test/parser/23.out
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Tuple
|
||||||
|
Number(1)
|
||||||
|
Number(2)
|
||||||
|
Number(3)
|
||||||
|
|
||||||
2
test/parser/24.in
Normal file
2
test/parser/24.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
{"x": 1, "y": 2}
|
||||||
|
|
||||||
10
test/parser/24.out
Normal file
10
test/parser/24.out
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Dict
|
||||||
|
KeyValue
|
||||||
|
String("x")
|
||||||
|
Number(1)
|
||||||
|
KeyValue
|
||||||
|
String("y")
|
||||||
|
Number(2)
|
||||||
|
|
||||||
3
test/parser/25.in
Normal file
3
test/parser/25.in
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
while x:
|
||||||
|
x = x - 1
|
||||||
|
|
||||||
9
test/parser/25.out
Normal file
9
test/parser/25.out
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
Module
|
||||||
|
While
|
||||||
|
Identifier(x)
|
||||||
|
Assign
|
||||||
|
Identifier(x)
|
||||||
|
BinOp(-)
|
||||||
|
Identifier(x)
|
||||||
|
Number(1)
|
||||||
|
|
||||||
5
test/parser/26.in
Normal file
5
test/parser/26.in
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
def f(x):
|
||||||
|
if x:
|
||||||
|
return x
|
||||||
|
return
|
||||||
|
|
||||||
9
test/parser/26.out
Normal file
9
test/parser/26.out
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
Module
|
||||||
|
FunctionDef(f)
|
||||||
|
Param(x)
|
||||||
|
If
|
||||||
|
Identifier(x)
|
||||||
|
Return
|
||||||
|
Identifier(x)
|
||||||
|
Return
|
||||||
|
|
||||||
3
test/parser/27.in
Normal file
3
test/parser/27.in
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
class A:
|
||||||
|
pass
|
||||||
|
|
||||||
4
test/parser/27.out
Normal file
4
test/parser/27.out
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
Module
|
||||||
|
ClassDef(A)
|
||||||
|
Pass
|
||||||
|
|
||||||
4
test/parser/28.in
Normal file
4
test/parser/28.in
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
for x in y:
|
||||||
|
if x:
|
||||||
|
break
|
||||||
|
|
||||||
7
test/parser/28.out
Normal file
7
test/parser/28.out
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Module
|
||||||
|
For(x)
|
||||||
|
Identifier(y)
|
||||||
|
If
|
||||||
|
Identifier(x)
|
||||||
|
Break
|
||||||
|
|
||||||
4
test/parser/29.in
Normal file
4
test/parser/29.in
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
for x in y:
|
||||||
|
if x:
|
||||||
|
continue
|
||||||
|
|
||||||
7
test/parser/29.out
Normal file
7
test/parser/29.out
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Module
|
||||||
|
For(x)
|
||||||
|
Identifier(y)
|
||||||
|
If
|
||||||
|
Identifier(x)
|
||||||
|
Continue
|
||||||
|
|
||||||
2
test/parser/30.in
Normal file
2
test/parser/30.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
(lambda a, b: a + b)(3, 4)
|
||||||
|
|
||||||
12
test/parser/30.out
Normal file
12
test/parser/30.out
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Call
|
||||||
|
Lambda
|
||||||
|
Param(a)
|
||||||
|
Param(b)
|
||||||
|
BinOp(+)
|
||||||
|
Identifier(a)
|
||||||
|
Identifier(b)
|
||||||
|
Number(3)
|
||||||
|
Number(4)
|
||||||
|
|
||||||
2
test/parser/31.in
Normal file
2
test/parser/31.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
{x for x in items}
|
||||||
|
|
||||||
7
test/parser/31.out
Normal file
7
test/parser/31.out
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
SetComp
|
||||||
|
Identifier(x)
|
||||||
|
For(x)
|
||||||
|
Identifier(items)
|
||||||
|
|
||||||
2
test/parser/32.in
Normal file
2
test/parser/32.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
(x for x in items)
|
||||||
|
|
||||||
7
test/parser/32.out
Normal file
7
test/parser/32.out
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Generator
|
||||||
|
Identifier(x)
|
||||||
|
For(x)
|
||||||
|
Identifier(items)
|
||||||
|
|
||||||
2
test/parser/33.in
Normal file
2
test/parser/33.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[ x*x for x in items if x > 0 ]
|
||||||
|
|
||||||
13
test/parser/33.out
Normal file
13
test/parser/33.out
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
ListComp
|
||||||
|
BinOp(*)
|
||||||
|
Identifier(x)
|
||||||
|
Identifier(x)
|
||||||
|
For(x)
|
||||||
|
Identifier(items)
|
||||||
|
If
|
||||||
|
Compare(>)
|
||||||
|
Identifier(x)
|
||||||
|
Number(0)
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue