[3.12] gh-128613: Increase `typing.Concatenate` coverage (GH-128614) (#128624)
![](https://secure.gravatar.com/avatar/cc7737cd64a84f1b5c61a160798e97ee.jpg?s=120&d=mm&r=g)
https://github.com/python/cpython/commit/d8890fb82d07b47d181776c1f2ceff9ce48... commit: d8890fb82d07b47d181776c1f2ceff9ce4845e93 branch: 3.12 author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> committer: sobolevn <mail@sobolevn.me> date: 2025-01-08T12:20:00Z summary: [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 <mail@sobolevn.me> files: M Lib/test/test_typing.py diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 1da65162a0b300..c1057dc3887378 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -9315,6 +9315,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')
participants (1)
-
sobolevn