@@ -7329,19 +7329,16 @@ def test_type_params_possibilities(self):
73297329 Ts_default = TypeVarTuple ('Ts_default' , default = Unpack [Tuple [str , int ]])
73307330 P = ParamSpec ('P' )
73317331 P_default = ParamSpec ('P_default' , default = [str , int ])
7332- P_default2 = ParamSpec ('P_default2' , default = P_default )
73337332
7334- ok_cases = [
7335- (T , T_default ),
7336- (T , Ts_default ),
7333+ # NOTE: "TypeVars with defaults cannot immediately follow TypeVarTuples"
7334+ # from PEP 696 is currently not enfored for the type statement and are not tested.
7335+ # PEP 695: Double usage of the same name is also not enforced and not tested.
7336+ valid_cases = [
73377337 (T , P , Ts ),
7338+ (T , Ts_default ),
7339+ (P_default , T_default )
73387340 (P , T_default , Ts_default ),
7339- (Ts , P , Ts_default ),
7340- (T , P_default ),
7341- (T , P_default , T_default ),
7342- (T , P_default , Ts_default ),
7343- (T , Ts_default , P_default ),
7344- (T , P_default , P_default2 ),
7341+ (T_default , P_default , Ts_default ),
73457342 ]
73467343 invalid_cases = [
73477344 ((T_default , T ), f"non-default type parameter { T !r} follows default" ),
@@ -7352,19 +7349,9 @@ def test_type_params_possibilities(self):
73527349 # depends on upstream
73537350 ((1 ,), "Expected a type param, got 1" ),
73547351 ((str ,), f"Expected a type param, got { str !r} " ),
7355-
7356- # "TypeVars with defaults cannot immediately follow TypeVarTuples"
7357- # is currently not enfored for the type statement, only for Generics
7358- # (T, Ts, T_default),
7359- # (T, Ts_default, T_default),
7360-
7361- # Double use; however T2 = T; (T, T2) would likely be fine for a type checker
7362- # (T, T)
7363- # (Ts, *Ts)
7364- # (P, **P)
73657352 ]
73667353
7367- for case in ok_cases :
7354+ for case in valid_cases :
73687355 with self .subTest (type_params = case ):
73697356 TypeAliasType ("OkCase" , List [T ], type_params = case )
73707357 for case , msg in invalid_cases :
0 commit comments