mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
Python: Add 2/3 specific query tests.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
| UndefinedExport.py:3:18:3:20 | Str | The name 'y' is exported by __all__ but is not defined. |
|
||||
| UndefinedExport.py:3:23:3:25 | Str | The name 'z' is exported by __all__ but is not defined. |
|
||||
| UndefinedExport.py:3:28:3:35 | Str | The name 'module' is exported by __all__ but is not defined. |
|
||||
| package/__init__.py:1:23:1:34 | Str | The name 'not_exists' is exported by __all__ but is not defined. |
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
__all__ = [ "x", "y", "z", "module", "w" ]
|
||||
|
||||
x = 1
|
||||
if 0:
|
||||
y = 2
|
||||
|
||||
import package.module
|
||||
|
||||
def init():
|
||||
global w
|
||||
w = 1
|
||||
|
||||
init()
|
||||
@@ -0,0 +1 @@
|
||||
Variables/UndefinedExport.ql
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
def kwonly(p0, *, kw=None):
|
||||
return kw
|
||||
@@ -0,0 +1 @@
|
||||
Variables/UninitializedLocal.ql
|
||||
@@ -0,0 +1,8 @@
|
||||
from enum import IntEnum
|
||||
|
||||
IntEnum._convert(
|
||||
'Maybe',
|
||||
__name__,
|
||||
lambda C: C.isupper() and C.startswith('AF_'))
|
||||
|
||||
__all__ = [ "Maybe", "Maybe_not" ]
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
__all__ = [ "a", "b" ]
|
||||
|
||||
from cant_resolve import *
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
__all__ = [ "a", "b" ]
|
||||
|
||||
globals().update({'a':1, 'b':2})
|
||||
1
python/ql/test/3/query-tests/Variables/undefined/options
Normal file
1
python/ql/test/3/query-tests/Variables/undefined/options
Normal file
@@ -0,0 +1 @@
|
||||
semmle-extractor-options: --max-import-depth=2
|
||||
@@ -0,0 +1 @@
|
||||
__all__ = [ "module", "not_exists" ]
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user