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