@@ -618,18 +618,17 @@ def test_raise_handle_all_raise_one_named(self):
618618 raise orig
619619 except* (TypeError , ValueError ) as e :
620620 raise SyntaxError (3 )
621- except BaseException as e :
621+ except SyntaxError as e :
622622 exc = e
623623
624- self .assertExceptionIsLike (
625- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
624+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
626625
627626 self .assertExceptionIsLike (
628- exc .exceptions [ 0 ]. __context__ ,
627+ exc .__context__ ,
629628 ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
630629
631630 self .assertMetadataNotEqual (orig , exc )
632- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __context__ )
631+ self .assertMetadataEqual (orig , exc .__context__ )
633632
634633 def test_raise_handle_all_raise_one_unnamed (self ):
635634 orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
@@ -638,18 +637,17 @@ def test_raise_handle_all_raise_one_unnamed(self):
638637 raise orig
639638 except* (TypeError , ValueError ) as e :
640639 raise SyntaxError (3 )
641- except ExceptionGroup as e :
640+ except SyntaxError as e :
642641 exc = e
643642
644- self .assertExceptionIsLike (
645- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
643+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
646644
647645 self .assertExceptionIsLike (
648- exc .exceptions [ 0 ]. __context__ ,
646+ exc .__context__ ,
649647 ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
650648
651649 self .assertMetadataNotEqual (orig , exc )
652- self .assertMetadataEqual (orig , exc .exceptions [ 0 ]. __context__ )
650+ self .assertMetadataEqual (orig , exc .__context__ )
653651
654652 def test_raise_handle_all_raise_two_named (self ):
655653 orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
@@ -773,23 +771,22 @@ def test_raise_handle_all_raise_one_named(self):
773771 raise orig
774772 except* (TypeError , ValueError ) as e :
775773 raise SyntaxError (3 ) from e
776- except BaseException as e :
774+ except SyntaxError as e :
777775 exc = e
778776
779- self .assertExceptionIsLike (
780- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
777+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
781778
782779 self .assertExceptionIsLike (
783- exc .exceptions [ 0 ]. __context__ ,
780+ exc .__context__ ,
784781 ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
785782
786783 self .assertExceptionIsLike (
787- exc .exceptions [ 0 ]. __cause__ ,
784+ exc .__cause__ ,
788785 ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
789786
790787 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__ )
793790
794791 def test_raise_handle_all_raise_one_unnamed (self ):
795792 orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
@@ -799,23 +796,22 @@ def test_raise_handle_all_raise_one_unnamed(self):
799796 except* (TypeError , ValueError ) as e :
800797 e = sys .exception ()
801798 raise SyntaxError (3 ) from e
802- except ExceptionGroup as e :
799+ except SyntaxError as e :
803800 exc = e
804801
805- self .assertExceptionIsLike (
806- exc , ExceptionGroup ("" , [SyntaxError (3 )]))
802+ self .assertExceptionIsLike (exc , SyntaxError (3 ))
807803
808804 self .assertExceptionIsLike (
809- exc .exceptions [ 0 ]. __context__ ,
805+ exc .__context__ ,
810806 ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
811807
812808 self .assertExceptionIsLike (
813- exc .exceptions [ 0 ]. __cause__ ,
809+ exc .__cause__ ,
814810 ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )]))
815811
816812 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__ )
819815
820816 def test_raise_handle_all_raise_two_named (self ):
821817 orig = ExceptionGroup ("eg" , [TypeError (1 ), ValueError (2 )])
0 commit comments