
    f                         d Z ddlZddlmZ ddlZddlmZmZ d Z G d dej                        Z
 G d d	ej                        Zy)
zTests for io.py    N)StringIO)Teecapture_outputc                      t               } d}t        | d      }t        ||        | j                         |dz   k(  sJ y)z"Very simple check with stdout onlyHellostdoutchannelfile
N)r   r   printgetvalue)chantexttees      V/var/www/cvtools/html/venv/lib/python3.12/site-packages/IPython/utils/tests/test_io.pytest_tee_simpler      s<    :DD
dH
%C	$T==?dTk)))    c                       e Zd Zd Zd Zy)TeeTestCasec                 t   t               }t               }d}t        t        |      }t        t        ||       t	        ||      }t        |d|       |j                         }| j                  |j                         |       |j                          t        t        ||       t        t        |      |k(  sJ y )Nr   r	    )endr   )	r   getattrsyssetattrr   r   r   assertEqualclose)selfr
   trapr   r   std_orir   trap_vals           r   tchanzTeeTestCase.tchan   s    zz#w'Wd#$(d&==?$/		Wg&sG$///r   c                 4    dD ]  }| j                  |        y )N)r   stderr)r$   )r    r   s     r   testzTeeTestCase.test.   s    ( 	DJJt	r   N)__name__
__module____qualname__r$   r'    r   r   r   r      s    0&r   r   c                       e Zd Zd Zy)TestIOStreamc                     t               5 }t        d       t        dt        j                         ddd       | j	                  j
                  d       | j	                  |j                  d       y# 1 sw Y   BxY w)zcapture_output() context worksz
hi, stdoutz
hi, stderrr   Nzhi, stdout
zhi, stderr
)r   r   r   r&   r   r   )r    ios     r   test_capture_outputz TestIOStream.test_capture_output4   sa      	1,,SZZ0	1 	N3N3	1 	1s   'A33A<N)r(   r)   r*   r0   r+   r   r   r-   r-   2   s    4r   r-   )__doc__r   r/   r   unittestIPython.utils.ior   r   r   TestCaser   r-   r+   r   r   <module>r5      s?        0*(## 2
48$$ 
4r   