diff --git a/python/ql/test/3/extractor-tests/lazy-imports/test.expected b/python/ql/test/3/extractor-tests/lazy-imports/test.expected index 9eb4f975dc4..6c9aea1255e 100644 --- a/python/ql/test/3/extractor-tests/lazy-imports/test.expected +++ b/python/ql/test/3/extractor-tests/lazy-imports/test.expected @@ -3,5 +3,7 @@ | 4 | Import | lazy | | 5 | Import | lazy | | 6 | Import | lazy | -| 9 | Import | normal | +| 7 | from l import * | lazy | | 10 | Import | normal | +| 11 | Import | normal | +| 12 | from w import * | normal | diff --git a/python/ql/test/3/extractor-tests/lazy-imports/test.py b/python/ql/test/3/extractor-tests/lazy-imports/test.py index 775cac00bbf..ecb69008911 100644 --- a/python/ql/test/3/extractor-tests/lazy-imports/test.py +++ b/python/ql/test/3/extractor-tests/lazy-imports/test.py @@ -4,7 +4,9 @@ lazy from b import c lazy from d import e as f lazy import g.h as i lazy from ..j import k +lazy from l import * # Non-lazy imports import x from y import z +from w import * diff --git a/python/ql/test/3/extractor-tests/lazy-imports/test.ql b/python/ql/test/3/extractor-tests/lazy-imports/test.ql index 312019c7cd1..9728226ed7e 100644 --- a/python/ql/test/3/extractor-tests/lazy-imports/test.ql +++ b/python/ql/test/3/extractor-tests/lazy-imports/test.ql @@ -1,7 +1,11 @@ import python -string lazy(Import imp) { if imp.isLazy() then result = "lazy" else result = "normal" } +string lazy(Stmt s) { + if s.(Import).isLazy() or s.(ImportStar).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) +from Stmt s +where + s.getLocation().getFile().getShortName() = "test.py" and + (s instanceof Import or s instanceof ImportStar) +select s.getLocation().getStartLine(), s.toString(), lazy(s)