Skip to content

Commit 6b7d47e

Browse files
committed
Python: Add QL test for the new syntax
1 parent 1ddfed6 commit 6b7d47e

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
| 2 | Import | lazy |
2+
| 3 | Import | lazy |
3+
| 4 | Import | lazy |
4+
| 5 | Import | lazy |
5+
| 6 | Import | lazy |
6+
| 9 | Import | normal |
7+
| 10 | Import | normal |
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Lazy imports (PEP 810)
2+
lazy import a
3+
lazy from b import c
4+
lazy from d import e as f
5+
lazy import g.h as i
6+
lazy from ..j import k
7+
8+
# Non-lazy imports
9+
import x
10+
from y import z
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import python
2+
3+
string lazy(Import imp) { if imp.isLazy() then result = "lazy" else result = "normal" }
4+
5+
from Import imp
6+
where imp.getLocation().getFile().getShortName() = "test.py"
7+
select imp.getLocation().getStartLine(), imp.toString(), lazy(imp)

0 commit comments

Comments
 (0)