File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -4637,6 +4637,27 @@ def foo():
46374637            f'{ boldm } { reset } { magenta } { reset }  ]
46384638        self .assertEqual (actual , expected )
46394639
4640+     def  test_colorized_traceback_from_exception_group (self ):
4641+         try :
4642+             exceptions  =  []
4643+             try :
4644+                 1  /  0 
4645+             except  ZeroDivisionError  as  inner_exc :
4646+                 exceptions .append (inner_exc )
4647+             raise  ExceptionGroup ("test" , exceptions )
4648+         except  Exception  as  e :
4649+             exc  =  traceback .TracebackException .from_exception (
4650+                 e , capture_locals = True 
4651+             )
4652+ 
4653+         actual  =  "" .join (exc .format (colorize = True ))
4654+         red  =  _colorize .ANSIColors .RED 
4655+         boldr  =  _colorize .ANSIColors .BOLD_RED 
4656+         reset  =  _colorize .ANSIColors .RESET 
4657+ 
4658+         self .assertIn (f"{ red } { reset + boldr } { reset + red } { reset }  , actual )
4659+         self .assertIn (f"{ red } { reset + boldr } { reset + red } { reset }  , actual )
4660+ 
46404661
46414662if  __name__  ==  "__main__" :
46424663    unittest .main ()
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments