3 2a @sddlmZddlmZddlZddlmZddlZejZdej kZ dZ e dZ Gdd d ej ZGd d d ej Ze d krejd ddS))run)pyshellN)captured_stderrZidlezf Warning (from warnings module): File "test_warning.py", line 99 Line of code UserWarning: Test z>>> c@s(eZdZejedddZddZdS) RunWarnTestz#Does not work when run within Idle.cCsD|jtjttjd|jtjtjtjd|jtjtdS)NTF)assertIswarnings showwarningrcapture_warningsidle_showwarning_subproc)selfr 1/opt/alt/python36/lib64/python3.6/test_warning.pytest_showwarnings!s   zRunWarnTest.test_showwarningscCsBt2}tjdtdd|d|jtj|jjWdQRXdS)NTestztest_warning.pycz Line of code)rrr UserWarning assertEqualidlemsg splitlinesgetvalue)r fr r r test_run_show)szRunWarnTest.test_run_showN)__name__ __module__ __qualname__unittestskipIfrunning_in_idlerrr r r r rsrc@s0eZdZejedddZddZddZdS) ShellWarnTestz#Does not work when run within Idle.cCsD|jtjttjd|jtjtjtjd|jtjtdS)NTF)rrrshellr idle_showwarning)r r r r r3s   zShellWarnTest.test_showwarningscCs"tjdtddd}|jt|dS)Nrztest_warning.pyrz Line of code)rZidle_formatwarningrrr)r sr r r test_idle_formatter;sz!ShellWarnTest.test_idle_formattercCsBt2}tjdtdd|d|jtj|jjWdQRXdS)Nrztest_warning.pyrz Line of code)rrr rrshellmsgrr)r rr r r test_shell_showAszShellWarnTest.test_shell_showN) rrrrrrrr"r$r r r r r1sr__main__) verbosity)ZidlelibrrrrZ test.supportrrrrrrr#ZTestCaserrmainr r r r s