From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:20:00 +0000 (+0100) Subject: [3.12] gh-128613: Increase `typing.Concatenate` coverage (GH-128614) (#128624) X-Git-Tag: v3.12.9~94 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d8890fb82d07b47d181776c1f2ceff9ce4845e93;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-128613: Increase `typing.Concatenate` coverage (GH-128614) (#128624) gh-128613: Increase `typing.Concatenate` coverage (GH-128614) (cherry picked from commit eb26e170695f15714b5e2ae0c0b83aa790c97869) Co-authored-by: sobolevn --- diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 1da65162a0b3..c1057dc38873 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -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')