a 9êdg´ ã@sdZddlmZddlmZddlZddlmZddlZej Z de j vZ 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)Ú RunWarnTestú#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ú:/usr/local/lib/python3.9/idlelib/idle_test/test_warning.pyÚtest_showwarnings!s   zRunWarnTest.test_showwarningsc CsVtƒ<}t dtdd|d¡| t ¡| ¡ ¡¡Wdƒn1sH0YdS©NZTestztest_warning.pyécz Line of code)rrr Ú UserWarningÚ assertEqualÚidlemsgÚ splitlinesÚgetvalue©rÚfrrrÚ test_run_show)s  ÿzRunWarnTest.test_run_showN)Ú__name__Ú __module__Ú __qualname__ÚunittestÚskipIfÚrunning_in_idlerrrrrrrs  rc@s0eZdZe ed¡dd„ƒZdd„Zdd„ZdS) Ú ShellWarnTestrcCsD| tjt¡t d¡| tjtj¡t d¡| tjt¡dSr)rr r Úshellr Úidle_showwarningr rrrr3s   zShellWarnTest.test_showwarningscCs"t dtddd¡}| t|¡dSr)r#Zidle_formatwarningrrr)rÚsrrrÚtest_idle_formatter;s ÿz!ShellWarnTest.test_idle_formatterc CsVtƒ<}t dtdd|d¡| t ¡| ¡ ¡¡Wdƒn1sH0YdSr)rr#r$rrÚshellmsgrrrrrrÚtest_shell_showAs  ÿzShellWarnTest.test_shell_showN) rrrrr r!rr&r(rrrrr"1s  r"Ú__main__é)Ú verbosity)Ú__doc__Zidlelibrrr#rZ test.supportrr r rr!rr'ZTestCaserr"ÚmainrrrrÚs