Skip to content

Commit

Permalink
[3.12] gh-128613: Increase typing.Concatenate coverage (GH-128614) (#…
Browse files Browse the repository at this point in the history
…128624)

gh-128613: Increase `typing.Concatenate` coverage (GH-128614)
(cherry picked from commit eb26e17)

Co-authored-by: sobolevn <mail@sobolevn.me>
  • Loading branch information
miss-islington and sobolevn authored Jan 8, 2025
1 parent e903b8a commit d8890fb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit d8890fb

Please sign in to comment.