File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -2919,6 +2919,32 @@ def exc():
29192919 report = self .get_report (exc )
29202920 self .assertEqual (report , expected )
29212921
2922+ def test_exception_group_wrapped_naked (self ):
2923+ # See gh-128799
2924+
2925+ def exc ():
2926+ try :
2927+ raise Exception (42 )
2928+ except* Exception as e :
2929+ raise
2930+
2931+ expected = (f' + Exception Group Traceback (most recent call last):\n '
2932+ f' | File "{ __file__ } ", line { self .callable_line } , in get_exception\n '
2933+ f' | exception_or_callable()\n '
2934+ f' | ~~~~~~~~~~~~~~~~~~~~~^^\n '
2935+ f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 3 } , in exc\n '
2936+ f' | except* Exception as e:\n '
2937+ f' | ExceptionGroup: (1 sub-exception)\n '
2938+ f' +-+---------------- 1 ----------------\n '
2939+ f' | Traceback (most recent call last):\n '
2940+ f' | File "{ __file__ } ", line { exc .__code__ .co_firstlineno + 2 } , in exc\n '
2941+ f' | raise Exception(42)\n '
2942+ f' | Exception: 42\n '
2943+ f' +------------------------------------\n ' )
2944+
2945+ report = self .get_report (exc )
2946+ self .assertEqual (report , expected )
2947+
29222948 def test_KeyboardInterrupt_at_first_line_of_frame (self ):
29232949 # see GH-93249
29242950 def f ():
You can’t perform that action at this time.
0 commit comments