summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2023-03-07 16:16:43 -0500
committerGitHub <noreply@github.com>2023-03-07 21:16:43 +0000
commitca2549708acd3ede6621c56477b1c0333eb62254 (patch)
tree1613f66fe3282a961e372b6c03ea720349855086
parentb4fe93a9f8059efb0b462d879da3c3d8ef9e7010 (diff)
downloadpylint-git-ca2549708acd3ede6621c56477b1c0333eb62254.tar.gz
Add regression test for #5288 (#8385)
-rw-r--r--doc/whatsnew/fragments/5288.false_positive4
-rw-r--r--tests/functional/u/unpacking/unpacking_non_sequence_py310.py11
-rw-r--r--tests/functional/u/unpacking/unpacking_non_sequence_py310.rc2
3 files changed, 17 insertions, 0 deletions
diff --git a/doc/whatsnew/fragments/5288.false_positive b/doc/whatsnew/fragments/5288.false_positive
new file mode 100644
index 000000000..bdc696622
--- /dev/null
+++ b/doc/whatsnew/fragments/5288.false_positive
@@ -0,0 +1,4 @@
+Fix various false positives for functions that return directly from
+structural pattern matching cases.
+
+Closes #5288
diff --git a/tests/functional/u/unpacking/unpacking_non_sequence_py310.py b/tests/functional/u/unpacking/unpacking_non_sequence_py310.py
new file mode 100644
index 000000000..73492706a
--- /dev/null
+++ b/tests/functional/u/unpacking/unpacking_non_sequence_py310.py
@@ -0,0 +1,11 @@
+"""Test returns from structural pattern matching cases."""
+
+def unpack(num) -> tuple[int, int]:
+ """Return a tuple of integers."""
+ match num:
+ case 1:
+ return 1, 1
+ case _:
+ return 0, 0
+
+x, y = unpack(1)
diff --git a/tests/functional/u/unpacking/unpacking_non_sequence_py310.rc b/tests/functional/u/unpacking/unpacking_non_sequence_py310.rc
new file mode 100644
index 000000000..68a8c8ef1
--- /dev/null
+++ b/tests/functional/u/unpacking/unpacking_non_sequence_py310.rc
@@ -0,0 +1,2 @@
+[testoptions]
+min_pyver=3.10