Skip to content

Commit 0cc8d49

Browse files
committed
Python: Add tests for full Python 3 parameters syntax
Currently keyword-only parameters are not handled properly :(
1 parent 96b36a7 commit 0cc8d49

20 files changed

+113
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
| test.py:4:1:11:2 | Function func | test.py:5:5:5:12 | pos_only |
2+
| test.py:4:1:11:2 | Function func | test.py:7:5:7:10 | normal |
3+
| test.py:4:1:11:2 | Function func | test.py:8:6:8:9 | args |
4+
| test.py:4:1:11:2 | Function func | test.py:10:7:10:12 | kwargs |
5+
| test.py:4:1:11:2 | Function func | test.py:12:5:12:41 | ExprStmt |
6+
| test.py:4:1:11:2 | Function func | test.py:13:5:13:15 | ExprStmt |
7+
| test.py:4:1:11:2 | Function func | test.py:14:5:14:17 | ExprStmt |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import python
2+
3+
from Function f
4+
select f, f.getAChildNode()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.py:4:1:11:2 | Function func | 0 | test.py:5:5:5:12 | Parameter |
2+
| test.py:4:1:11:2 | Function func | 1 | test.py:7:5:7:10 | Parameter |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import python
2+
3+
from Function f, int i
4+
select f, i, f.getArg(i)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.py:4:1:11:2 | Function func | normal | test.py:7:5:7:10 | Parameter |
2+
| test.py:4:1:11:2 | Function func | pos_only | test.py:5:5:5:12 | Parameter |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import python
2+
3+
from Function f, string name
4+
select f, name, f.getArgByName(name)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
| test.py:4:1:11:2 | FunctionExpr | test.py:5:15:5:17 | int |
2+
| test.py:4:1:11:2 | FunctionExpr | test.py:5:21:5:22 | UnaryExpr |
3+
| test.py:4:1:11:2 | FunctionExpr | test.py:7:13:7:15 | int |
4+
| test.py:4:1:11:2 | FunctionExpr | test.py:7:19:7:20 | UnaryExpr |
5+
| test.py:4:1:11:2 | FunctionExpr | test.py:8:12:8:23 | Str |
6+
| test.py:4:1:11:2 | FunctionExpr | test.py:9:25:9:26 | UnaryExpr |
7+
| test.py:4:1:11:2 | FunctionExpr | test.py:10:15:10:30 | Str |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import python
2+
3+
from FunctionExpr fe
4+
select fe, fe.getASubExpression()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.py:4:1:11:2 | FunctionExpr | Arguments | test.py:5:21:5:22 | UnaryExpr |
2+
| test.py:4:1:11:2 | FunctionExpr | Arguments | test.py:7:19:7:20 | UnaryExpr |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import python
2+
3+
from FunctionExpr fe
4+
select fe, fe.getArgs(), fe.getArgs().getADefault()

0 commit comments

Comments
 (0)