@@ -7236,14 +7236,14 @@ def test_alias_types_and_substitutions(self):
72367236 TypeAliasType ("NestedAlias" , List [T ], type_params = (T ,))[T2 ] : (T2 ,),
72377237 }
72387238 # currently a limitation, these args are no longer unpacked in 3.11
7239- # also valid on 310 if GenericAlias is used
7239+ # OK if GenericAlias in __getitem__ is used
72407240 test_argument_cases_310_plus = {
7241+ Unpack [Ts ] : (Ts ,),
72417242 Unpack [Tuple [int , T2 ]] : (T2 ,),
72427243 Concatenate [int , P ] : (P ,),
7243- Unpack [Ts ] : (Ts ,),
72447244 }
72457245 test_argument_cases_311_plus = {
7246- Ts : (Ts ,),
7246+ Ts : (Ts ,), # invalid case
72477247 }
72487248 test_argument_cases .update (test_argument_cases_310_plus )
72497249 test_argument_cases .update (test_argument_cases_311_plus )
@@ -7413,8 +7413,7 @@ def test_callable_with_concatenate(self):
74137413 self .skipTest ("Nested list is invalid type form" )
74147414 self .assertEqual (concat_usage , callable_concat [[str ]])
74157415
7416- @skipUnless (TYPING_3_11_0 , "__args__ behaves differently" )
7417- def test_substitution_311_plus (self ):
7416+ def test_substitution (self ):
74187417 # To pass these tests alias.__args__ in TypeAliasType.__getitem__ needs adjustment
74197418 # Unpack and Concatenate are unpacked in versions before
74207419 T = TypeVar ('T' )
@@ -7428,6 +7427,7 @@ def test_substitution_311_plus(self):
74287427 CallableP = TypeAliasType ("CallableP" , Callable [P , T ], type_params = (P , T ))
74297428 callable_concat = CallableP [Concatenate [int , P ], Any ]
74307429 self .assertEqual (get_args (callable_concat ), (Concatenate [int , P ], Any ))
7430+ self .assertEqual (callable_concat .__parameters__ , (P ,))
74317431
74327432 @skipUnless (TYPING_3_12_0 , "__args__ behaves differently" )
74337433 def test_substitution_312_plus (self ):
@@ -7508,7 +7508,7 @@ def test_list_argument(self):
75087508 invalid_tupleT [str ]
75097509
75107510 # The condition should align with the version of GeneriAlias usage in __getitem__
7511- @skipIf (TYPING_3_9_0 , "Most cases are allowed in 3.11+ or with GenericAlias" )
7511+ @skipIf (TYPING_3_10_0 , "Most cases are allowed in 3.11+ or with GenericAlias" )
75127512 def test_invalid_cases_before_3_11 (self ):
75137513 T = TypeVar ('T' )
75147514 ListOrSetT = TypeAliasType ("ListOrSetT" , Union [List [T ], Set [T ]], type_params = (T ,))
0 commit comments