Convert Python qlref tests to inline expectations

This commit is contained in:
Owen Mansel-Chan
2026-06-15 11:06:48 +01:00
parent d6ade8fe95
commit 0c2df7c7e9
475 changed files with 1612 additions and 1382 deletions

View File

@@ -1 +1,2 @@
Classes/DefineEqualsWhenAddingAttributes.ql
query: Classes/DefineEqualsWhenAddingAttributes.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -9,7 +9,7 @@ class RedefineEquals:
def __eq__(self, other):
return other is "Tuesday"
class C(RedefineEquals):
class C(RedefineEquals): # $ Alert
def __init__(self, args):
self.a, self.b = args

View File

@@ -1 +1,2 @@
Classes/InconsistentMRO.ql
query: Classes/InconsistentMRO.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -6,12 +6,12 @@ class X(object):
class Y(X):
pass
class Z(X, Y):
class Z(X, Y): # $ Alert
pass
class O:
pass
#This is OK in Python 2
class N(object, O):
class N(object, O): # $ Alert
pass

View File

@@ -1 +1,2 @@
Classes/MaybeUndefinedClassAttribute.ql
query: Classes/MaybeUndefinedClassAttribute.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Classes/UndefinedClassAttribute.ql
query: Classes/UndefinedClassAttribute.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/WrongNameForArgumentInCall.ql
query: Expressions/WrongNameForArgumentInCall.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/WrongNumberArgumentsInCall.ql
query: Expressions/WrongNumberArgumentsInCall.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -9,8 +9,8 @@ f(1, 2, 3, kw1=1)
f(1, 2, kw1=1, kw2=2)
#Not OK
f(1, 2, 3, kw1=1, kw3=3)
f(1, 2, 3, kw3=3)
f(1, 2, 3, kw1=1, kw3=3) # $ Alert[py/call/wrong-named-argument]
f(1, 2, 3, kw3=3) # $ Alert[py/call/wrong-named-argument]
#ODASA-5897
@@ -21,4 +21,4 @@ def ok():
return analyze_member_access(msg, original=original, chk=chk)
def bad():
return analyze_member_access(msg, original, chk=chk)
return analyze_member_access(msg, original, chk=chk) # $ Alert[py/call/wrong-arguments]

View File

@@ -1 +1,2 @@
Expressions/WrongNumberArgumentsForFormat.ql
query: Expressions/WrongNumberArgumentsForFormat.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/TruncatedDivision.ql
query: Expressions/TruncatedDivision.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Expressions/UseofApply.ql
query: Expressions/UseofApply.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Imports/EncodingError.ql
query: Imports/EncodingError.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Imports/EncodingError.ql
query: Imports/EncodingError.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Imports/SyntaxError.ql
query: Imports/SyntaxError.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -8,5 +8,5 @@
# encoding:shift-jis
def f():
print "Python <20>̊J<CC8A><4A><EFBFBD>́A1990 <20>N<EFBFBD><4E><EFBFBD><EFBFBD><EB82A9><EFBFBD>J<EFBFBD>n<EFBFBD><6E><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD>"
print "Python <20>̊J<CC8A><4A><EFBFBD>́A1990 <20>N<EFBFBD><4E><EFBFBD><EFBFBD><EB82A9><EFBFBD>J<EFBFBD>n<EFBFBD><6E><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD>" # $ Alert[py/encoding-error]
"""

View File

@@ -1,4 +1,4 @@
`Twas brillig, and the slithy toves
`Twas brillig, and the slithy toves # $ Alert[py/syntax-error]
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.

View File

@@ -1 +1,2 @@
Statements/ExecUsed.ql
query: Statements/ExecUsed.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Statements/TopLevelPrint.ql
query: Statements/TopLevelPrint.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1,2 +1,2 @@
#Top level prints in modules are bad
print ("Side effect on import")
print ("Side effect on import") # $ Alert[py/print-during-import]

View File

@@ -2,7 +2,7 @@
def exec_used(val):
exec(val)
exec(val) # $ Alert[py/use-of-exec]
#Top level print
import module

View File

@@ -1 +1,2 @@
Statements/IterableStringOrSequence.ql
query: Statements/IterableStringOrSequence.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Statements/NonIteratorInForLoop.ql
query: Statements/NonIteratorInForLoop.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -23,5 +23,5 @@ async def good():
yield x
async def bad():
async for x in MissingAiter():
async for x in MissingAiter(): # $ Alert[py/non-iterable-in-for-loop]
yield x

View File

@@ -18,7 +18,7 @@ def f(x):
s = u"Hello World"
else:
s = [ u'Hello', u'World']
for thing in s:
for thing in s: # $ Alert[py/iteration-string-and-sequence]
print (thing)
@@ -31,7 +31,7 @@ class Color(Enum):
def colors():
for color in Color:
print(color)
for color in 1:
for color in 1: # $ Alert[py/non-iterable-in-for-loop]
print(color)
colors()

View File

@@ -1 +1,2 @@
Statements/UnreachableCode.ql
query: Statements/UnreachableCode.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Statements/UnreachableCode.ql
query: Statements/UnreachableCode.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1 @@
Summary/LinesOfCode.ql
query: Summary/LinesOfCode.ql

View File

@@ -1 +1 @@
Summary/LinesOfUserCode.ql
query: Summary/LinesOfUserCode.ql

View File

@@ -1,6 +1,6 @@
__all__ = [ "x", "y", "z", "module", "w" ]
__all__ = [ "x", "y", "z", "module", "w" ] # $ Alert[py/undefined-export]
x = 1
if 0:

View File

@@ -1 +1,2 @@
Variables/UndefinedExport.ql
query: Variables/UndefinedExport.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Variables/UninitializedLocal.ql
query: Variables/UninitializedLocal.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -5,4 +5,4 @@ IntEnum._convert(
__name__,
lambda C: C.isupper() and C.startswith('AF_'))
__all__ = [ "Maybe", "Maybe_not" ]
__all__ = [ "Maybe", "Maybe_not" ] # $ Alert[py/undefined-export]

View File

@@ -1 +1 @@
__all__ = [ "module", "not_exists" ]
__all__ = [ "module", "not_exists" ] # $ Alert[py/undefined-export]