Skip to content

Commit fc90f34

Browse files
crazybolilloPierre-Sassoulas
authored andcommitted
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 f7a196c commit fc90f34

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/functional/u/useless/useless_return.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,32 @@ 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
71+
72+
return

0 commit comments

Comments
 (0)