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 @@
Exceptions/CatchingBaseException.ql
query: Exceptions/CatchingBaseException.ql

View File

@@ -1 +1 @@
Exceptions/EmptyExcept.ql
query: Exceptions/EmptyExcept.ql

View File

@@ -1 +1,2 @@
Exceptions/IllegalExceptionHandlerType.ql
query: Exceptions/IllegalExceptionHandlerType.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Exceptions/IllegalRaise.ql
query: Exceptions/IllegalRaise.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -1 +1,2 @@
Exceptions/NotImplementedIsNotAnException.ql
query: Exceptions/NotImplementedIsNotAnException.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql

View File

@@ -37,21 +37,21 @@ class NotException2(object):
pass
def illegal_raise_type():
raise NotException1
raise NotException1 # $ Alert[py/illegal-raise]
def illegal_raise_value1():
raise "Exception"
raise "Exception" # $ Alert[py/illegal-raise]
def illegal_raise_value2():
raise NotException2()
raise NotException2() # $ Alert[py/illegal-raise]
def illegal_handler():
try:
illegal_raise()
except NotException1:
except NotException1: # $ Alert[py/useless-except]
#Must do something
print("NotException1")
except NotException2:
except NotException2: # $ Alert[py/useless-except]
#Must do something
print("NotException2")
@@ -135,7 +135,7 @@ def a_number():
def illegal_handler2():
try:
illegal_raise()
except a_number():
except a_number(): # $ Alert[py/useless-except]
print ("Caught exception")
def stop_iter_ok(seq):
@@ -193,7 +193,7 @@ def ee8(x):
#These are so common, we give warnings not errors.
def foo():
raise NotImplemented
raise NotImplemented # $ Alert[py/raise-not-implemented]
def bar():
raise NotImplemented()
raise NotImplemented() # $ Alert[py/raise-not-implemented]

View File

@@ -11,10 +11,9 @@ def test():
try:
a = A()
raise a
except 42:
except 42: # $ Alert[py/useless-except]
#Some comment
pass
except A:
#Another comment
pass