Skip to content

Commit 3f4349f

Browse files
committed
Add more useless-return tests
Test suite has been improved with more tests to verify no bugs have been introduced by the recent changes to the checker.
1 parent bc9e0f9 commit 3f4349f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/functional/u/useless/useless_return.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,30 @@ def function5(parameter): # [useless-return]
4141
parameter.do()
4242
except RuntimeError:
4343
return
44+
45+
46+
def code_after_return(param):
47+
try:
48+
param.kaboom()
49+
except RuntimeError:
50+
param.other()
51+
return
52+
53+
param.something_else()
54+
param.state = "good"
55+
56+
57+
def code_after_else(obj):
58+
if obj.k:
59+
pass
60+
else:
61+
return
62+
63+
obj.do()
64+
65+
66+
def return_in_loop(obj):
67+
for _ in range(10):
68+
obj.do()
69+
if obj.k:
70+
return

0 commit comments

Comments
 (0)