a  ze @sdZddlmZddlmZddlZddlmZddlZej Z de j vZ dZ e dZ Gd d d ejZGd d d ejZe d krejdddS)a6Test warnings replacement in pyshell.py and run.py. This file could be expanded to include traceback overrides (in same two modules). If so, change name. Revise if output destination changes (http://bugs.python.org/issue18318). Make sure warnings module is left unaltered (http://bugs.python.org/issue18081). )run)pyshellN)captured_stderrZidlezf Warning (from warnings module): File "test_warning.py", line 99 Line of code UserWarning: Test z>>> c@s(eZdZeedddZddZdS) RunWarnTest#Does not work when run within Idle.cCsD|tjttd|tjtjtd|tjtdSNTF)assertIswarnings showwarningrcapture_warningsidle_showwarning_subprocselfrR/opt/bitninja-python-dojo/embedded/lib/python3.9/idlelib/idle_test/test_warning.pytest_showwarnings!s   zRunWarnTest.test_showwarningsc CsVt<}tdtdd|d|t|Wdn1sH0YdSNZTestztest_warning.pycz Line of code)rrr UserWarning assertEqualidlemsg splitlinesgetvaluerfrrr test_run_show)s  zRunWarnTest.test_run_showN)__name__ __module__ __qualname__unittestskipIfrunning_in_idlerrrrrrrs  rc@s0eZdZeedddZddZddZdS) ShellWarnTestrcCsD|tjttd|tjtjtd|tjtdSr)rr r shellr idle_showwarningr rrrr3s   zShellWarnTest.test_showwarningscCs"tdtddd}|t|dSr)r#Zidle_formatwarningrrr)rsrrrtest_idle_formatter;s z!ShellWarnTest.test_idle_formatterc CsVt<}tdtdd|d|t|Wdn1sH0YdSr)rr#r$rrshellmsgrrrrrrtest_shell_showAs  zShellWarnTest.test_shell_showN) rrrrr r!rr&r(rrrrr"1s  r"__main__) verbosity)__doc__Zidlelibrrr#rZ test.supportrr r rr!rr'ZTestCaserr"mainrrrrs