@@ -638,70 +638,31 @@ class Foo(A, B):
638638
639639 #[ test]
640640 #[ cfg( feature = "all-nodes-with-ranges" ) ]
641- fn test_parse_class_with_generic_type ( ) {
641+ fn test_parse_class_generic_types ( ) {
642642 let source = "\
643- class Foo[T](A, B):
644- pass
645- " ;
646- insta:: assert_debug_snapshot!( ast:: Suite :: parse( source, "<test>" ) . unwrap( ) ) ;
647- }
643+ # TypeVar
644+ class Foo[T](): ...
648645
649- #[ test]
650- #[ cfg( feature = "all-nodes-with-ranges" ) ]
651- fn test_parse_class_with_generic_type_with_bound ( ) {
652- let source = "\
653- class Foo[T: str](A, B):
654- pass
655- " ;
656- insta:: assert_debug_snapshot!( ast:: Suite :: parse( source, "<test>" ) . unwrap( ) ) ;
657- }
646+ # TypeVar with bound
647+ class Foo[T: str](): ...
658648
659- #[ test]
660- #[ cfg( feature = "all-nodes-with-ranges" ) ]
661- fn test_parse_class_with_generic_type_with_tuple_bound ( ) {
662- let source = "\
663- class Foo[T: (str, bytes)](A, B):
664- pass
665- " ;
666- insta:: assert_debug_snapshot!( ast:: Suite :: parse( source, "<test>" ) . unwrap( ) ) ;
667- }
649+ # TypeVar with tuple bound
650+ class Foo[T: (str, bytes)](): ...
668651
669- #[ test]
670- #[ cfg( feature = "all-nodes-with-ranges" ) ]
671- fn test_parse_class_with_multiple_generic_types ( ) {
672- let source = "\
673- class Foo[T, U](A, B):
674- pass
675- " ;
676- insta:: assert_debug_snapshot!( ast:: Suite :: parse( source, "<test>" ) . unwrap( ) ) ;
677- }
652+ # Multiple TypeVar
653+ class Foo[T, U](): ...
678654
679- #[ test]
680- #[ cfg( feature = "all-nodes-with-ranges" ) ]
681- fn test_parse_class_with_generic_type_var_tuple ( ) {
682- let source = "\
683- class Foo[*U](A, B):
684- pass
685- " ;
686- insta:: assert_debug_snapshot!( ast:: Suite :: parse( source, "<test>" ) . unwrap( ) ) ;
687- }
655+ # Trailing comma
656+ class Foo[T, U,](): ...
688657
658+ # TypeVarTuple
659+ class Foo[*Ts](): ...
689660
690- #[ test]
691- #[ cfg( feature = "all-nodes-with-ranges" ) ]
692- fn test_parse_class_with_generic_param_spec ( ) {
693- let source = "\
694- class Foo[**P](A, B):
695- pass
696- " ;
697- insta:: assert_debug_snapshot!( ast:: Suite :: parse( source, "<test>" ) . unwrap( ) ) ;
698- }
661+ # ParamSpec
662+ class Foo[**P](): ...
699663
700- #[ test]
701- #[ cfg( feature = "all-nodes-with-ranges" ) ]
702- fn test_parse_class_with_all_possible_generic_types ( ) {
703- let source = "\
704- class Foo[X, Y: str, *U, **P](A, B):
664+ # Mixed types
665+ class Foo[X, Y: str, *U, **P]():
705666 pass
706667" ;
707668 insta:: assert_debug_snapshot!( ast:: Suite :: parse( source, "<test>" ) . unwrap( ) ) ;
0 commit comments