Python: Update test cases

Adds a comment explaining why we no longer flag the indirect tuple
example.
Also adds a test case which _would_ be flagged if not for the type
annotation.
This commit is contained in:
Taus
2025-03-28 15:12:39 +00:00
parent 68668b8e22
commit 6674288fd2

View File

@@ -321,7 +321,7 @@ def function_returning_2_tuple():
def function_returning_3_tuple():
return 1,2,3
def indirectly_returning_different_tuple_sizes(x):
def indirectly_returning_different_tuple_sizes(x): # OK, since we only look at local tuple returns
if x:
return function_returning_2_tuple()
else:
@@ -347,3 +347,9 @@ def ok_match2(x): # FP
return 0
case _:
return 1
def ok_tuple_returns_captured_in_type(x: bool) -> tuple[int, ...]: # OK because there is a type annotation present
if x:
return 1, 2
else:
return 1, 2, 3