@@ -618,18 +618,17 @@ def test_raise_handle_all_raise_one_named(self):
618
618
raise orig
619
619
except* (TypeError , ValueError ) as e :
620
620
raise SyntaxError (3 )
621
- except BaseException as e :
621
+ except SyntaxError as e :
622
622
exc = e
623
623
624
- self .assertExceptionIsLike (
625
- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
624
+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
626
625
627
626
self .assertExceptionIsLike (
628
- exc .exceptions [ 0 ]. __context__ ,
627
+ exc .__context__ ,
629
628
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
630
629
631
630
self .assertMetadataNotEqual (orig , exc )
632
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __context__ )
631
+ self .assertMetadataEqual (orig , exc .__context__ )
633
632
634
633
def test_raise_handle_all_raise_one_unnamed (self ):
635
634
orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
@@ -638,18 +637,17 @@ def test_raise_handle_all_raise_one_unnamed(self):
638
637
raise orig
639
638
except* (TypeError , ValueError ) as e :
640
639
raise SyntaxError (3 )
641
- except ExceptionGroup as e :
640
+ except SyntaxError as e :
642
641
exc = e
643
642
644
- self .assertExceptionIsLike (
645
- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
643
+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
646
644
647
645
self .assertExceptionIsLike (
648
- exc .exceptions [ 0 ]. __context__ ,
646
+ exc .__context__ ,
649
647
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
650
648
651
649
self .assertMetadataNotEqual (orig , exc )
652
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __context__ )
650
+ self .assertMetadataEqual (orig , exc .__context__ )
653
651
654
652
def test_raise_handle_all_raise_two_named (self ):
655
653
orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
@@ -773,23 +771,22 @@ def test_raise_handle_all_raise_one_named(self):
773
771
raise orig
774
772
except* (TypeError , ValueError ) as e :
775
773
raise SyntaxError (3 ) from e
776
- except BaseException as e :
774
+ except SyntaxError as e :
777
775
exc = e
778
776
779
- self .assertExceptionIsLike (
780
- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
777
+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
781
778
782
779
self .assertExceptionIsLike (
783
- exc .exceptions [ 0 ]. __context__ ,
780
+ exc .__context__ ,
784
781
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
785
782
786
783
self .assertExceptionIsLike (
787
- exc .exceptions [ 0 ]. __cause__ ,
784
+ exc .__cause__ ,
788
785
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
789
786
790
787
self .assertMetadataNotEqual (orig , exc )
791
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __context__ )
792
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __cause__ )
788
+ self .assertMetadataEqual (orig , exc .__context__ )
789
+ self .assertMetadataEqual (orig , exc .__cause__ )
793
790
794
791
def test_raise_handle_all_raise_one_unnamed (self ):
795
792
orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
@@ -799,23 +796,22 @@ def test_raise_handle_all_raise_one_unnamed(self):
799
796
except* (TypeError , ValueError ) as e :
800
797
e = sys .exception ()
801
798
raise SyntaxError (3 ) from e
802
- except ExceptionGroup as e :
799
+ except SyntaxError as e :
803
800
exc = e
804
801
805
- self .assertExceptionIsLike (
806
- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
802
+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
807
803
808
804
self .assertExceptionIsLike (
809
- exc .exceptions [ 0 ]. __context__ ,
805
+ exc .__context__ ,
810
806
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
811
807
812
808
self .assertExceptionIsLike (
813
- exc .exceptions [ 0 ]. __cause__ ,
809
+ exc .__cause__ ,
814
810
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
815
811
816
812
self .assertMetadataNotEqual (orig , exc )
817
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __context__ )
818
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __cause__ )
813
+ self .assertMetadataEqual (orig , exc .__context__ )
814
+ self .assertMetadataEqual (orig , exc .__cause__ )
819
815
820
816
def test_raise_handle_all_raise_two_named (self ):
821
817
orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
0 commit comments