gh-128613: Increase `typing.Concatenate` coverage (#128614)
https://github.com/python/cpython/commit/eb26e170695f15714b5e2ae0c0b83aa790c... commit: eb26e170695f15714b5e2ae0c0b83aa790c97869 branch: main author: sobolevn <mail@sobolevn.me> committer: sobolevn <mail@sobolevn.me> date: 2025-01-08T15:02:47+03:00 summary: gh-128613: Increase `typing.Concatenate` coverage (#128614) files: M Lib/test/test_typing.py diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 0bb9ada221e985..a75dac4a6102bf 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')
participants (1)
-
sobolevn