From e2a2754bce17fa938600b5040ccbe81496f95ffc Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 8 Jan 2025 12:01:19 +0300 Subject: [PATCH] gh-128613: Increase `typing.Concatenate` coverage --- Lib/test/test_typing.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index ef3cfc9517085e..a22689251c9e46 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -10129,6 +10129,18 @@ def test_valid_uses(self): 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')