o
    ˷e                     @   sp   d Z ddlZddlmZ ddlmZmZ ddlZddlm	Z	m
Z
 dd ZG dd	 d	ejZG d
d dejZdS )zTests for io.py    N)StringIO)PopenPIPE)Teecapture_outputc                  C   s:   t  } d}t| dd}t|| d |  |d ksJ dS )z"Very simple check with stdout onlyHellostdoutchannelfile
N)r   r   printgetvalue)chantexttee r   R/var/www/ideatree/venv/lib/python3.10/site-packages/IPython/utils/tests/test_io.pytest_tee_simple   s
   r   c                   @   s   e Zd Zdd Zdd ZdS )TeeTestCasec                 C   s   t  }t  }d}tt|}tt|| t||d}t|d|d | }| | | |  tt|| tt||ks?J d S )Nr   r	    )endr   )	r   getattrsyssetattrr   r   r   assertEqualclose)selfr
   trapr   r   std_orir   trap_valr   r   r   tchan   s   
zTeeTestCase.tchanc                 C   s   dD ]}|  | qd S )N)r   stderr)r"   )r   r   r   r   r   test/   s   zTeeTestCase.testN)__name__
__module____qualname__r"   r$   r   r   r   r   r      s    r   c                   @   s   e Zd Zdd ZdS )TestIOStreamc                 C   s\   t  }td tdtjd W d   n1 sw   Y  | |jd | |jd dS )zcapture_output() context worksz
hi, stdoutz
hi, stderrr   Nzhi, stdout
zhi, stderr
)r   r   r   r#   r   r   )r   ior   r   r   test_capture_output5   s   z TestIOStream.test_capture_outputN)r%   r&   r'   r*   r   r   r   r   r(   3   s    r(   )__doc__r   r)   r   
subprocessr   r   unittestIPython.utils.ior   r   r   TestCaser   r(   r   r   r   r   <module>   s   	