8000 gh-128613: Increase `typing.Concatenate` coverage (#128614) · python/cpython@eb26e17 · GitHub
[go: up one dir, main page]

Skip to content

Commit eb26e17

Browse files
authored
gh-128613: Increase typing.Concatenate coverage (#128614)
1 parent 971a52b commit eb26e17

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/test/test_typing.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10129,6 +10129,18 @@ def test_valid_uses(self):
1012910129
self.assertEqual(C4.__args__, (Concatenate[int, T, P], T))
1013010130
self.assertEqual(C4.__parameters__, (T, P))
1013110131

10132+
def test_invalid_uses(self):
10133+
with self.assertRaisesRegex(TypeError, 'Concatenate of no types'):
10134+
Concatenate[()]
10135+
with self.assertRaisesRegex(
10136+
TypeError,
10137+
(
10138+
'The last parameter to Concatenate should be a '
10139+
'ParamSpec variable or ellipsis'
10140+
),
10141+
):
10142+
Concatenate[int]
10143+
1013210144
def test_var_substitution(self):
1013310145
T = TypeVar('T')
1013410146
P = ParamSpec('P')

0 commit comments

Comments
 (0)
0