mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Python: Add redimentary tests for new Value API.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
| file://:0:0:0:0 | builtin-class bool | bool |
|
||||
| file://:0:0:0:0 | builtin-class classmethod | classmethod |
|
||||
| file://:0:0:0:0 | builtin-class float | float |
|
||||
| file://:0:0:0:0 | builtin-class int | int |
|
||||
| file://:0:0:0:0 | builtin-class object | object |
|
||||
15
python/ql/test/library-tests/PointsTo/api/ClassValue.ql
Normal file
15
python/ql/test/library-tests/PointsTo/api/ClassValue.ql
Normal file
@@ -0,0 +1,15 @@
|
||||
import python
|
||||
|
||||
from ClassValue cls, string description
|
||||
where
|
||||
cls = ClassValue::bool() and description = "bool"
|
||||
or
|
||||
cls = ClassValue::int_() and description = "int"
|
||||
or
|
||||
cls = ClassValue::float_() and description = "float"
|
||||
or
|
||||
cls = ClassValue::classmethod() and description = "classmethod"
|
||||
or
|
||||
cls = ClassValue::bool().getMro().getItem(2) and description = "object"
|
||||
|
||||
select cls, description
|
||||
4
python/ql/test/library-tests/PointsTo/api/Value.expected
Normal file
4
python/ql/test/library-tests/PointsTo/api/Value.expected
Normal file
@@ -0,0 +1,4 @@
|
||||
| file://:0:0:0:0 | builtin-class ValueError | ValueError |
|
||||
| file://:0:0:0:0 | builtin-class bool | bool |
|
||||
| file://:0:0:0:0 | builtin-class slice | slice |
|
||||
| file://:0:0:0:0 | list object | sys.argv |
|
||||
12
python/ql/test/library-tests/PointsTo/api/Value.ql
Normal file
12
python/ql/test/library-tests/PointsTo/api/Value.ql
Normal file
@@ -0,0 +1,12 @@
|
||||
import python
|
||||
|
||||
from Value val, string name
|
||||
where
|
||||
val = Value::named(name)
|
||||
and
|
||||
(
|
||||
name = "bool" or name = "sys" or name = "sys.argv" or
|
||||
name = "ValueError" or name = "slice"
|
||||
)
|
||||
|
||||
select val, name
|
||||
Reference in New Issue
Block a user