]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-128613: Increase `typing.Concatenate` coverage (GH-128614) (#128624)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 8 Jan 2025 12:20:00 +0000 (13:20 +0100)
committerGitHub <noreply@github.com>
Wed, 8 Jan 2025 12:20:00 +0000 (12:20 +0000)
gh-128613: Increase `typing.Concatenate` coverage (GH-128614)
(cherry picked from commit eb26e170695f15714b5e2ae0c0b83aa790c97869)

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/test_typing.py

index 1da65162a0b300dbb614cdcfed7d385e1b4b6d18..c1057dc38873789a6156ba42a30d99d88df1a055 100644 (file)
@@ -9315,6 +9315,18 @@ class ConcatenateTests(BaseTestCase):
         self.assertEqual(C4.__args__, (Concatenate[int, T, P], T))
         self.assertEqual(C4.__parameters__, (T, P))
 
+    def test_invalid_uses(self):
+        with self.assertRaisesRegex(TypeError, 'Concatenate of no types'):
+            Concatenate[()]
+        with self.assertRaisesRegex(
+            TypeError,
+            (
+                'The last parameter to Concatenate should be a '
+                'ParamSpec variable or ellipsis'
+            ),
+        ):
+            Concatenate[int]
+
     def test_var_substitution(self):
         T = TypeVar('T')
         P = ParamSpec('P')