mirror of
https://github.com/github/codeql.git
synced 2026-06-17 02:41:08 +02:00
Convert Python qlref tests to inline expectations
This commit is contained in:
@@ -1 +1 @@
|
||||
Exceptions/CatchingBaseException.ql
|
||||
query: Exceptions/CatchingBaseException.ql
|
||||
|
||||
@@ -1 +1 @@
|
||||
Exceptions/EmptyExcept.ql
|
||||
query: Exceptions/EmptyExcept.ql
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
Exceptions/IllegalExceptionHandlerType.ql
|
||||
query: Exceptions/IllegalExceptionHandlerType.ql
|
||||
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
Exceptions/IllegalRaise.ql
|
||||
query: Exceptions/IllegalRaise.ql
|
||||
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
Exceptions/NotImplementedIsNotAnException.ql
|
||||
query: Exceptions/NotImplementedIsNotAnException.ql
|
||||
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user