
    ;e
                         d Z ddlmZ ddlmZ ddlZddlmZ ddlZej	        Z	de	j
        v ZdZedz   Z G d	 d
ej                  Z G d dej                  Ze
dk    r ej        d           dS dS )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_stderridlezf
Warning (from warnings module):
  File "test_warning.py", line 99
    Line of code
UserWarning: Test
z>>> c                   H    e Zd Z ej        ed          d             Zd ZdS )RunWarnTest#Does not work when run within Idle.c                 >   |                      t          j        t                     t          j        d           |                      t          j        t          j                   t          j        d           |                      t          j        t                     d S NTF)assertIswarningsshowwarningr   capture_warningsidle_showwarning_subprocselfs    5/usr/lib/python3.11/idlelib/idle_test/test_warning.pytest_showwarningszRunWarnTest.test_showwarnings!   sr    h*K888T"""h*C,HIIIU###h*K88888    c           	      2   t                      5 }t          j        dt          dd|d           |                     t
                                          |                                                                           d d d            d S # 1 swxY w Y   d S NTestztest_warning.pyc   zLine of code)r   r   r   UserWarningassertEqualidlemsg
splitlinesgetvaluer   fs     r   test_run_showzRunWarnTest.test_run_show)   s     	N!(K):B>S S S W//111::<<3J3J3L3LMMM		N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N   A0BBBN)__name__
__module____qualname__unittestskipIfrunning_in_idler   r!    r   r   r   r      sR        X__&KLL9 9 ML9N N N N Nr   r   c                   N    e Zd Z ej        ed          d             Zd Zd ZdS )ShellWarnTestr	   c                 >   |                      t          j        t                     t          j        d           |                      t          j        t          j                   t          j        d           |                      t          j        t                     d S r   )r   r   r   shellr   idle_showwarningr   s    r   r   zShellWarnTest.test_showwarnings3   sr    h*K888t$$$h*E,BCCCu%%%h*K88888r   c                 v    t          j        dt          ddd          }|                     t          |           d S r   )r-   idle_formatwarningr   r   r   )r   ss     r   test_idle_formatterz!ShellWarnTest.test_idle_formatter;   s>    $%6NL L!$$$$$r   c           	      2   t                      5 }t          j        dt          dd|d           |                     t
                                          |                                                                           d d d            d S # 1 swxY w Y   d S r   )r   r-   r.   r   r   shellmsgr   r   r   s     r   test_shell_showzShellWarnTest.test_shell_showA   s     	O!"K):B>S S SX0022AJJLL4K4K4M4MNNN	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	Or"   N)	r#   r$   r%   r&   r'   r(   r   r2   r5   r)   r   r   r+   r+   1   sa        X__&KLL9 9 ML9% % %O O O O Or   r+   __main__   )	verbosity)__doc__idlelibr   r   r-   r&   test.supportr   r   r   r#   r(   r   r4   TestCaser   r+   mainr)   r   r   <module>r>      s          $ $ $ $ $ $  ( ( ( ( ( (  " K00 VN N N N N(# N N N$O O O O OH% O O O. zHMA r   