B ãxác´ ã@sdZddlmZddlmZddlZddlmZddlZej Z de j kZ dZ e dZ Gd d „d ejƒZGd d „d ejƒZe d krŒejdddS)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(eZdZe ed¡dd„ƒZdd„ZdS)Ú RunWarnTestz#Does not work when run within Idle.cCsD| tjt¡t d¡| tjtj¡t d¡| tjt¡dS)NTF)ÚassertIsÚwarningsÚ showwarningrÚcapture_warningsÚidle_showwarning_subproc)Úself©r úC/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_warning.pyÚtest_showwarnings!s   zRunWarnTest.test_showwarningsc CsBtƒ2}t dtdd|d¡| t ¡| ¡ ¡¡WdQRXdS)NÚTestztest_warning.pyécz Line of code)rrr Ú UserWarningÚ assertEqualÚidlemsgÚ splitlinesÚgetvalue)r Úfr r r Ú test_run_show)szRunWarnTest.test_run_showN)Ú__name__Ú __module__Ú __qualname__ÚunittestÚskipIfÚrunning_in_idlerrr r r r rsrc@s0eZdZe ed¡dd„ƒZdd„Zdd„ZdS) Ú ShellWarnTestz#Does not work when run within Idle.cCsD| tjt¡t d¡| tjtj¡t d¡| tjt¡dS)NTF)rrrÚshellr Úidle_showwarning)r r r r r3s   zShellWarnTest.test_showwarningscCs"t dtddd¡}| t|¡dS)Nrztest_warning.pyrz Line of code)rZidle_formatwarningrrr)r Úsr r r Útest_idle_formatter;sz!ShellWarnTest.test_idle_formatterc CsBtƒ2}t dtdd|d¡| t ¡| ¡ ¡¡WdQRXdS)Nrztest_warning.pyrz Line of code)rrr rrÚshellmsgrr)r rr r r Útest_shell_showAszShellWarnTest.test_shell_showN) rrrrrrrr"r$r r r r r1srÚ__main__é)Ú verbosity)Ú__doc__ZidlelibrrrrZ test.supportrrrrrrr#ZTestCaserrÚmainr r r r Ús