Skip to content

Commit 6674288

Browse files
committed
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.
1 parent 68668b8 commit 6674288

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python/ql/test/query-tests/Functions/return_values/functions_test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def function_returning_2_tuple():
321321
def function_returning_3_tuple():
322322
return 1,2,3
323323

324-
def indirectly_returning_different_tuple_sizes(x):
324+
def indirectly_returning_different_tuple_sizes(x): # OK, since we only look at local tuple returns
325325
if x:
326326
return function_returning_2_tuple()
327327
else:
@@ -347,3 +347,9 @@ def ok_match2(x): # FP
347347
return 0
348348
case _:
349349
return 1
350+
351+
def ok_tuple_returns_captured_in_type(x: bool) -> tuple[int, ...]: # OK because there is a type annotation present
352+
if x:
353+
return 1, 2
354+
else:
355+
return 1, 2, 3

0 commit comments

Comments
 (0)