B
„ f´
ã @ s� d Z ddlmZ ddlmZ ddlZddlmZ ddlZej Z de j
kZdZed Z
G d d
„ d
ejƒZG dd„ dejƒZe
d
krŒejdd� dS )a6 Test 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( e Zd Ze ed¡dd„ ƒZdd„ ZdS )ÚRunWarnTestz#Does not work when run within Idle.c C sD | tjt¡ t d¡ | tjtj¡ t d¡ | tjt¡ d S )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 C sB t ƒ �2}t dtdd|d¡ | t ¡ | ¡ ¡ ¡ W d Q R X d S )NÚTestztest_warning.pyéc zLine of code)r r r
ÚUserWarningÚassertEqualÚidlemsgÚ
splitlinesÚgetvalue)r Úfr r r
Ú
test_run_show) s zRunWarnTest.test_run_showN)Ú__name__Ú
__module__Ú__qualname__ÚunittestÚskipIfÚrunning_in_idler r r r r r
r s r c @ s0 e Zd Ze ed¡dd„ ƒZdd„ Zdd„ ZdS ) Ú
ShellWarnTestz#Does not work when run within Idle.c C sD | tjt¡ t d¡ | tjtj¡ t d¡ | tjt¡ d S )NTF)r r r Úshellr Úidle_showwarning)r r r r
r 3 s
zShellWarnTest.test_showwarningsc C s" t dtddd¡}| t|¡ d S )Nr ztest_warning.pyr zLine of code)r Zidle_formatwarningr r r )r Úsr r r
Útest_idle_formatter; s z!ShellWarnTest.test_idle_formatterc C sB t ƒ �2}t dtdd|d¡ | t ¡ | ¡ ¡ ¡ W d Q R X d S )Nr ztest_warning.pyr zLine of code)r r r r r Úshellmsgr r )r r r r r
Útest_shell_showA s zShellWarnTest.test_shell_showN) r r r r r r r r" r$ r r r r
r 1 s r Ú__main__é )Ú verbosity)Ú__doc__Zidlelibr r r r Ztest.supportr r r r r r r# ZTestCaser r Úmainr r r r
Ú