File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -2131,6 +2131,34 @@ def test_pwarning_no_style(base_app, capsys):
21312131 assert err == msg + end
21322132
21332133
2134+ def test_pexcept_style (base_app , capsys ):
2135+ msg = Exception ('testing...' )
2136+ ansi .allow_style = ansi .STYLE_ALWAYS
2137+
2138+ base_app .pexcept (msg )
2139+ out , err = capsys .readouterr ()
2140+ assert err .startswith (ansi .style_error ("EXCEPTION of type 'Exception' occurred with message: testing..." ))
2141+
2142+
2143+ def test_pexcept_no_style (base_app , capsys ):
2144+ msg = Exception ('testing...' )
2145+ ansi .allow_style = ansi .STYLE_ALWAYS
2146+
2147+ base_app .pexcept (msg , apply_style = False )
2148+ out , err = capsys .readouterr ()
2149+ assert err .startswith ("EXCEPTION of type 'Exception' occurred with message: testing..." )
2150+
2151+
2152+ def test_pexcept_not_exception (base_app , capsys ):
2153+ # Pass in a msg that is not an Exception object
2154+ msg = False
2155+ ansi .allow_style = ansi .STYLE_ALWAYS
2156+
2157+ base_app .pexcept (msg )
2158+ out , err = capsys .readouterr ()
2159+ assert err .startswith (ansi .style_error (msg ))
2160+
2161+
21342162def test_ppaged (outsim_app ):
21352163 msg = 'testing...'
21362164 end = '\n '
You can’t perform that action at this time.
0 commit comments