@@ -636,18 +636,17 @@ def test_raise_handle_all_raise_one_named(self):
636
636
raise orig
637
637
except* (TypeError , ValueError ) as e :
638
638
raise SyntaxError (3 )
639
- except BaseException as e :
639
+ except SyntaxError as e :
640
640
exc = e
641
641
642
- self .assertExceptionIsLike (
643
- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
642
+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
644
643
645
644
self .assertExceptionIsLike (
646
- exc .exceptions [ 0 ]. __context__ ,
645
+ exc .__context__ ,
647
646
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
648
647
649
648
self .assertMetadataNotEqual (orig , exc )
650
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __context__ )
649
+ self .assertMetadataEqual (orig , exc .__context__ )
651
650
652
651
def test_raise_handle_all_raise_one_unnamed (self ):
653
652
orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
@@ -656,18 +655,17 @@ def test_raise_handle_all_raise_one_unnamed(self):
656
655
raise orig
657
656
except* (TypeError , ValueError ) as e :
658
657
raise SyntaxError (3 )
659
- except ExceptionGroup as e :
658
+ except SyntaxError as e :
660
659
exc = e
661
660
662
- self .assertExceptionIsLike (
663
- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
661
+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
664
662
665
663
self .assertExceptionIsLike (
666
- exc .exceptions [ 0 ]. __context__ ,
664
+ exc .__context__ ,
667
665
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
668
666
669
667
self .assertMetadataNotEqual (orig , exc )
670
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __context__ )
668
+ self .assertMetadataEqual (orig , exc .__context__ )
671
669
672
670
def test_raise_handle_all_raise_two_named (self ):
673
671
orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
@@ -791,23 +789,22 @@ def test_raise_handle_all_raise_one_named(self):
791
789
raise orig
792
790
except* (TypeError , ValueError ) as e :
793
791
raise SyntaxError (3 ) from e
794
- except BaseException as e :
792
+ except SyntaxError as e :
795
793
exc = e
796
794
797
- self .assertExceptionIsLike (
798
- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
795
+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
799
796
800
797
self .assertExceptionIsLike (
801
- exc .exceptions [ 0 ]. __context__ ,
798
+ exc .__context__ ,
802
799
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
803
800
804
801
self .assertExceptionIsLike (
805
- exc .exceptions [ 0 ]. __cause__ ,
802
+ exc .__cause__ ,
806
803
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
807
804
808
805
self .assertMetadataNotEqual (orig , exc )
809
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __context__ )
810
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __cause__ )
806
+ self .assertMetadataEqual (orig , exc .__context__ )
807
+ self .assertMetadataEqual (orig , exc .__cause__ )
811
808
812
809
def test_raise_handle_all_raise_one_unnamed (self ):
813
810
orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
@@ -817,23 +814,22 @@ def test_raise_handle_all_raise_one_unnamed(self):
817
814
except* (TypeError , ValueError ) as e :
818
815
e = sys .exception ()
819
816
raise SyntaxError (3 ) from e
820
- except ExceptionGroup as e :
817
+ except SyntaxError as e :
821
818
exc = e
822
819
823
- self .assertExceptionIsLike (
824
- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
820
+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
825
821
826
822
self .assertExceptionIsLike (
827
- exc .exceptions [ 0 ]. __context__ ,
823
+ exc .__context__ ,
828
824
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
829
825
830
826
self .assertExceptionIsLike (
831
- exc .exceptions [ 0 ]. __cause__ ,
827
+ exc .__cause__ ,
832
828
ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
833
829
834
830
self .assertMetadataNotEqual (orig , exc )
835
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __context__ )
836
- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __cause__ )
831
+ self .assertMetadataEqual (orig , exc .__context__ )
832
+ self .assertMetadataEqual (orig , exc .__cause__ )
837
833
838
834
def test_raise_handle_all_raise_two_named (self ):
839
835
orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
0 commit comments