File: D:/Python311/Lib/idlelib/idle_test/__pycache__/test_warning.cpython-311.opt-1.pyc
�
��Vc�
� �� � d Z ddlmZ ddlmZ ddlZddlmZ ddlZej Z de j
v ZdZedz Z
G d � d
ej � � Z G d� dej � � Ze
d
k r ej d�� � dS 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_stderr�idlezf
Warning (from warnings module):
File "test_warning.py", line 99
Line of code
UserWarning: Test
z>>> c �H � e Zd Z ej ed� � d� � � Zd� ZdS )�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 �2D:\Python311\Lib\idlelib\idle_test\test_warning.py�test_showwarningszRunWarnTest.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 dt dd|d� � | � t
� � � |� � � � � � � � d d d � � d S # 1 swxY w Y d S �N�Testztest_warning.py�c zLine of code)r r r �UserWarning�assertEqual�idlemsg�
splitlines�getvalue�r �fs r �
test_run_showzRunWarnTest.test_run_show) s� � �
�
�
� N�!��(��K�):�B��>�
S�
S�
S�
���W�/�/�1�1�1�:�:�<�<�3J�3J�3L�3L�M�M�M� N� N� N� N� N� N� N� N� N� N� N� N���� N� N� N� N� N� N� �A0B�B�BN)�__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� Nr r c �N � e Zd Z ej ed� � d� � � Zd� Zd� ZdS )�
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 zShellWarnTest.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 dt ddd� � }| � t |� � d S r )r- �idle_formatwarningr r r )r �ss r �test_idle_formatterz!ShellWarnTest.test_idle_formatter; s>