Python: Add QL test for the new syntax

This commit is contained in:
Taus
2026-04-10 14:39:13 +00:00
parent 1ddfed6b6b
commit 6b7d47ee7d
3 changed files with 24 additions and 0 deletions

View File

@@ -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 |

View 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

View 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)