Skip to content

Commit 9340ce7

Browse files
authored
TypeAliasType: Add apostrophe to error message for compatibility with CPython (#495)
1 parent a506398 commit 9340ce7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/test_typing_extensions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7463,9 +7463,9 @@ def test_type_params_possibilities(self):
74637463
(T_default, P_default, Ts_default),
74647464
]
74657465
invalid_cases = [
7466-
((T_default, T), f"non-default type parameter {T!r} follows default"),
7467-
((P_default, P), f"non-default type parameter {P!r} follows default"),
7468-
((Ts_default, T), f"non-default type parameter {T!r} follows default"),
7466+
((T_default, T), f"non-default type parameter '{T!r}' follows default"),
7467+
((P_default, P), f"non-default type parameter '{P!r}' follows default"),
7468+
((Ts_default, T), f"non-default type parameter '{T!r}' follows default"),
74697469
# Only type params are accepted
74707470
((1,), "Expected a type param, got 1"),
74717471
((str,), f"Expected a type param, got {str!r}"),

src/typing_extensions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3622,8 +3622,8 @@ def __init__(self, name: str, value, *, type_params=()):
36223622
getattr(type_param, '__default__', NoDefault) is not NoDefault
36233623
)
36243624
if default_value_encountered and not has_default:
3625-
raise TypeError(f'non-default type parameter {type_param!r}'
3626-
' follows default type parameter')
3625+
raise TypeError(f"non-default type parameter '{type_param!r}'"
3626+
" follows default type parameter")
36273627
if has_default:
36283628
default_value_encountered = True
36293629
if isinstance(type_param, TypeVarTuple):

0 commit comments

Comments
 (0)