@@ -8642,20 +8642,24 @@ class Y(Generic[Tx]):
86428642
86438643 def test_invalid_special_forms (self ):
86448644 # tests _lax_type_check to raise errors the same way as the typing module.
8645- with self .assertRaisesRegex (TypeError , "Plain" ):
8645+ with self .assertRaisesRegex (
8646+ TypeError , "Plain .*Protocol('>)? is not valid as type argument"
8647+ ):
86468648 evaluate_forward_ref (typing .ForwardRef ("Protocol" ), globals = vars (typing ))
8647- with self .assertRaisesRegex (TypeError , "Plain" ):
8649+ with self .assertRaisesRegex (
8650+ TypeError , "Plain .*Generic('>)? is not valid as type argument"
8651+ ):
86488652 evaluate_forward_ref (typing .ForwardRef ("Generic" ), globals = vars (typing ))
8649- with self .assertRaisesRegex (TypeError , "Plain" ):
8653+ with self .assertRaisesRegex (TypeError , "Plain typing(_extensions)?.Final is not valid as type argument " ):
86508654 evaluate_forward_ref (typing .ForwardRef ("Final" ), globals = vars (typing ))
8651- with self .assertRaisesRegex (TypeError , "Plain" ):
8655+ with self .assertRaisesRegex (TypeError , "Plain typing(_extensions)?.ClassVar is not valid as type argument " ):
86528656 evaluate_forward_ref (typing .ForwardRef ("ClassVar" ), globals = vars (typing ))
86538657 if _FORWARD_REF_HAS_CLASS :
86548658 self .assertIs (evaluate_forward_ref (typing .ForwardRef ("Final" , is_class = True ), globals = vars (typing )), Final )
86558659 self .assertIs (evaluate_forward_ref (typing .ForwardRef ("ClassVar" , is_class = True ), globals = vars (typing )), ClassVar )
8656- with self .assertRaisesRegex (TypeError , "Plain" ):
8660+ with self .assertRaisesRegex (TypeError , "Plain .*Final('>)? is not valid as type argument " ):
86578661 evaluate_forward_ref (typing .ForwardRef ("Final" , is_argument = False ), globals = vars (typing ))
8658- with self .assertRaisesRegex (TypeError , "Plain" ):
8662+ with self .assertRaisesRegex (TypeError , "Plain .*ClassVar('>)? is not valid as type argument " ):
86598663 evaluate_forward_ref (typing .ForwardRef ("ClassVar" , is_argument = False ), globals = vars (typing ))
86608664 else :
86618665 self .assertIs (evaluate_forward_ref (typing .ForwardRef ("Final" , is_argument = False ), globals = vars (typing )), Final )
0 commit comments