3
Õì2a´
ã @ sŒ d dl mZ d dl mZ d dlZd dlmZ d dlZejZdej kZ
dZed ZG dd „ d ej
ƒZG d
d„ dej
ƒZe dkrˆejd
d� dS )é )Úrun)ÚpyshellN)Úcaptured_stderrZidlezf
Warning (from warnings module):
File "test_warning.py", line 99
Line of code
UserWarning: Test
z>>> c @ s( e Zd Zejedƒdd„ ƒZdd„ ZdS )ÚRunWarnTestz#Does not work when run within Idle.c C sD | j tjtƒ tjdƒ | j tjtjƒ tjdƒ | j tjtƒ d S )NTF)ÚassertIsÚwarningsÚshowwarningr Úcapture_warningsÚidle_showwarning_subproc)Úself© r ú1/opt/alt/python36/lib64/python3.6/test_warning.pyÚtest_showwarnings! s
zRunWarnTest.test_showwarningsc C sB t ƒ �2}tjdtdd|dƒ | jtjƒ |jƒ jƒ ƒ 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 Zejedƒdd„ ƒZdd„ Zdd„ ZdS ) Ú
ShellWarnTestz#Does not work when run within Idle.c C sD | j tjtƒ tjdƒ | j tjtjƒ tjdƒ | j tjtƒ d S )NTF)r r r Úshellr Úidle_showwarning)r r r r
r 3 s
zShellWarnTest.test_showwarningsc C s" t jdtdddƒ}| jt|ƒ 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}tjdtdd|dƒ | jtjƒ |jƒ jƒ ƒ 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)Zidlelibr r r r Ztest.supportr r r r r r r# ZTestCaser r Úmainr r r r
Ú