mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
Python: Add copy of internal Python 3 tests
Again, mostly extractor tests, and a single library test.
This commit is contained in:
94
python/ql/test/3/extractor-tests/unpacking/AST.expected
Normal file
94
python/ql/test/3/extractor-tests/unpacking/AST.expected
Normal file
@@ -0,0 +1,94 @@
|
||||
| 0 | 0 | 0 | 0 | Module test |
|
||||
| 2 | 1 | 2 | 5 | print |
|
||||
| 2 | 1 | 2 | 29 | ExprStmt |
|
||||
| 2 | 1 | 2 | 29 | print() |
|
||||
| 2 | 7 | 2 | 10 | Starred |
|
||||
| 2 | 8 | 2 | 10 | List |
|
||||
| 2 | 9 | 2 | 9 | IntegerLiteral |
|
||||
| 2 | 13 | 2 | 16 | Starred |
|
||||
| 2 | 14 | 2 | 16 | List |
|
||||
| 2 | 15 | 2 | 15 | IntegerLiteral |
|
||||
| 2 | 19 | 2 | 19 | IntegerLiteral |
|
||||
| 2 | 22 | 2 | 28 | Starred |
|
||||
| 2 | 23 | 2 | 28 | List |
|
||||
| 2 | 24 | 2 | 24 | IntegerLiteral |
|
||||
| 2 | 27 | 2 | 27 | IntegerLiteral |
|
||||
| 3 | 1 | 3 | 2 | fn |
|
||||
| 3 | 1 | 3 | 42 | ExprStmt |
|
||||
| 3 | 1 | 3 | 42 | fn() |
|
||||
| 3 | 4 | 3 | 21 | DictUnpacking |
|
||||
| 3 | 6 | 3 | 21 | Dict |
|
||||
| 3 | 7 | 3 | 9 | Str |
|
||||
| 3 | 7 | 3 | 12 | KeyValuePair |
|
||||
| 3 | 12 | 3 | 12 | IntegerLiteral |
|
||||
| 3 | 15 | 3 | 17 | Str |
|
||||
| 3 | 15 | 3 | 20 | KeyValuePair |
|
||||
| 3 | 20 | 3 | 20 | IntegerLiteral |
|
||||
| 3 | 24 | 3 | 41 | DictUnpacking |
|
||||
| 3 | 26 | 3 | 41 | Dict |
|
||||
| 3 | 27 | 3 | 29 | Str |
|
||||
| 3 | 27 | 3 | 32 | KeyValuePair |
|
||||
| 3 | 32 | 3 | 32 | IntegerLiteral |
|
||||
| 3 | 35 | 3 | 37 | Str |
|
||||
| 3 | 35 | 3 | 40 | KeyValuePair |
|
||||
| 3 | 40 | 3 | 40 | IntegerLiteral |
|
||||
| 4 | 1 | 4 | 1 | g |
|
||||
| 4 | 1 | 4 | 30 | ExprStmt |
|
||||
| 4 | 1 | 4 | 30 | g() |
|
||||
| 4 | 3 | 4 | 3 | IntegerLiteral |
|
||||
| 4 | 6 | 4 | 7 | Starred |
|
||||
| 4 | 7 | 4 | 7 | x |
|
||||
| 4 | 10 | 4 | 10 | IntegerLiteral |
|
||||
| 4 | 13 | 4 | 15 | Keyword |
|
||||
| 4 | 15 | 4 | 15 | y |
|
||||
| 4 | 18 | 4 | 19 | Starred |
|
||||
| 4 | 19 | 4 | 19 | z |
|
||||
| 4 | 22 | 4 | 24 | Keyword |
|
||||
| 4 | 24 | 4 | 24 | IntegerLiteral |
|
||||
| 4 | 27 | 4 | 29 | DictUnpacking |
|
||||
| 4 | 29 | 4 | 29 | p |
|
||||
| 5 | 1 | 5 | 1 | h |
|
||||
| 5 | 1 | 5 | 14 | ExprStmt |
|
||||
| 5 | 1 | 5 | 14 | h() |
|
||||
| 5 | 3 | 5 | 5 | DictUnpacking |
|
||||
| 5 | 5 | 5 | 5 | x |
|
||||
| 5 | 7 | 5 | 9 | Keyword |
|
||||
| 5 | 9 | 5 | 9 | IntegerLiteral |
|
||||
| 5 | 11 | 5 | 13 | DictUnpacking |
|
||||
| 5 | 13 | 5 | 13 | y |
|
||||
| 7 | 1 | 7 | 9 | Starred |
|
||||
| 7 | 1 | 7 | 12 | ExprStmt |
|
||||
| 7 | 1 | 7 | 12 | Tuple |
|
||||
| 7 | 2 | 7 | 6 | range |
|
||||
| 7 | 2 | 7 | 9 | range() |
|
||||
| 7 | 8 | 7 | 8 | IntegerLiteral |
|
||||
| 7 | 12 | 7 | 12 | IntegerLiteral |
|
||||
| 10 | 1 | 10 | 14 | ExprStmt |
|
||||
| 10 | 1 | 10 | 14 | List |
|
||||
| 10 | 2 | 10 | 10 | Starred |
|
||||
| 10 | 3 | 10 | 7 | range |
|
||||
| 10 | 3 | 10 | 10 | range() |
|
||||
| 10 | 9 | 10 | 9 | IntegerLiteral |
|
||||
| 10 | 13 | 10 | 13 | IntegerLiteral |
|
||||
| 13 | 1 | 13 | 26 | ExprStmt |
|
||||
| 13 | 1 | 13 | 26 | Set |
|
||||
| 13 | 2 | 13 | 10 | Starred |
|
||||
| 13 | 3 | 13 | 7 | range |
|
||||
| 13 | 3 | 13 | 10 | range() |
|
||||
| 13 | 9 | 13 | 9 | IntegerLiteral |
|
||||
| 13 | 13 | 13 | 13 | IntegerLiteral |
|
||||
| 13 | 16 | 13 | 25 | Starred |
|
||||
| 13 | 18 | 13 | 18 | IntegerLiteral |
|
||||
| 13 | 18 | 13 | 24 | Tuple |
|
||||
| 13 | 21 | 13 | 21 | IntegerLiteral |
|
||||
| 13 | 24 | 13 | 24 | IntegerLiteral |
|
||||
| 16 | 1 | 16 | 20 | Dict |
|
||||
| 16 | 1 | 16 | 20 | ExprStmt |
|
||||
| 16 | 2 | 16 | 4 | Str |
|
||||
| 16 | 2 | 16 | 7 | KeyValuePair |
|
||||
| 16 | 7 | 16 | 7 | IntegerLiteral |
|
||||
| 16 | 10 | 16 | 19 | DictUnpacking |
|
||||
| 16 | 12 | 16 | 19 | Dict |
|
||||
| 16 | 13 | 16 | 15 | Str |
|
||||
| 16 | 13 | 16 | 18 | KeyValuePair |
|
||||
| 16 | 18 | 16 | 18 | IntegerLiteral |
|
||||
7
python/ql/test/3/extractor-tests/unpacking/AST.ql
Normal file
7
python/ql/test/3/extractor-tests/unpacking/AST.ql
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
import python
|
||||
|
||||
from AstNode a, int bl, int bc, int el, int ec
|
||||
where a.getLocation().hasLocationInfo(_, bl, bc, el, ec)
|
||||
select bl, bc, el, ec, a.toString()
|
||||
|
||||
17
python/ql/test/3/extractor-tests/unpacking/test.py
Normal file
17
python/ql/test/3/extractor-tests/unpacking/test.py
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
print(*[1], *[2], 3, *[4, 5])
|
||||
fn(**{'a': 1, 'c': 3}, **{'b': 2, 'd': 4})
|
||||
g(1, *x, 2, a=y, *z, b=3, **p)
|
||||
h(**x,a=1,**y)
|
||||
|
||||
*range(4), 4
|
||||
#(0, 1, 2, 3, 4)
|
||||
|
||||
[*range(4), 4]
|
||||
#[0, 1, 2, 3, 4]
|
||||
|
||||
{*range(4), 4, *(5, 6, 7)}
|
||||
#{0, 1, 2, 3, 4, 5, 6, 7}
|
||||
|
||||
{'x': 1, **{'y': 2}}
|
||||
#{'x': 1, 'y': 2}
|
||||
Reference in New Issue
Block a user