]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128613: Increase `typing.Concatenate` coverage (#128614)
authorsobolevn <mail@sobolevn.me>
Wed, 8 Jan 2025 12:02:47 +0000 (15:02 +0300)
committerGitHub <noreply@github.com>
Wed, 8 Jan 2025 12:02:47 +0000 (15:02 +0300)
Lib/test/test_typing.py

index 0bb9ada221e985f33c4cebaadadf0ba572d77586..a75dac4a6102bf98338dc0efce469fb577a5c0f7 100644 (file)
@@ -10129,6 +10129,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')