Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Python: Add QL test for the new syntax
  • Loading branch information
tausbn committed Apr 10, 2026
commit 6b7d47ee7d2cc386649864a78535f56c02bc096e
7 changes: 7 additions & 0 deletions python/ql/test/3/extractor-tests/lazy-imports/test.expected
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions python/ql/test/3/extractor-tests/lazy-imports/test.py
Original file line number Diff line number Diff line change
@@ -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
Comment thread
tausbn marked this conversation as resolved.
7 changes: 7 additions & 0 deletions python/ql/test/3/extractor-tests/lazy-imports/test.ql
Original file line number Diff line number Diff line change
@@ -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)