mirror of
https://github.com/github/codeql.git
synced 2026-04-15 03:54:02 +02:00
Python: Add QL test for the new syntax
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
| 2 | Import | lazy |
|
||||
| 3 | Import | lazy |
|
||||
| 4 | Import | lazy |
|
||||
| 5 | Import | lazy |
|
||||
| 6 | Import | lazy |
|
||||
| 9 | Import | normal |
|
||||
| 10 | Import | normal |
|
||||
10
python/ql/test/3/extractor-tests/lazy-imports/test.py
Normal file
10
python/ql/test/3/extractor-tests/lazy-imports/test.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# Lazy imports (PEP 810)
|
||||
lazy import a
|
||||
lazy from b import c
|
||||
lazy from d import e as f
|
||||
lazy import g.h as i
|
||||
lazy from ..j import k
|
||||
|
||||
# Non-lazy imports
|
||||
import x
|
||||
from y import z
|
||||
7
python/ql/test/3/extractor-tests/lazy-imports/test.ql
Normal file
7
python/ql/test/3/extractor-tests/lazy-imports/test.ql
Normal file
@@ -0,0 +1,7 @@
|
||||
import python
|
||||
|
||||
string lazy(Import imp) { if imp.isLazy() then result = "lazy" else result = "normal" }
|
||||
|
||||
from Import imp
|
||||
where imp.getLocation().getFile().getShortName() = "test.py"
|
||||
select imp.getLocation().getStartLine(), imp.toString(), lazy(imp)
|
||||
Reference in New Issue
Block a user