]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-128613: Increase `typing.Concatenate` coverage (GH-128614) (#128623)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 8 Jan 2025 12:26:01 +0000 (13:26 +0100)
committerGitHub <noreply@github.com>
Wed, 8 Jan 2025 12:26:01 +0000 (12:26 +0000)
Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/test_typing.py

index f32bb31280a8efa8d2126a7863712a566ced2b86..cf0406faf1167098291887fcb002d6dc2c854e5f 100644 (file)
@@ -9998,6 +9998,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')