Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_winconsoleio.cpython-39.opt-2.pyc

a

��g;�@s�ddlZddlZddlZddlZddlZddlmZejdkrHe�d��ddl	m
Z
ejZGdd�dej
�Zedkr|e��dS)	�N)�support�win32ztest only relevant on win32)�write_inputc@s�eZdZdd�Zdd�Zdd�Ze�e�	�dd�d	kd
�dd��Z
d
d�Zdd�Zdd�Z
dd�Ze�dd�dd��Zdd�Ze�dd�dd��Zdd�ZdS)�WindowsConsoleIOTestscCs:|�tttj��|�tttj��|�tttj��dS)N)�
assertTrue�
issubclass�ConIO�io�	RawIOBase�assertFalse�BufferedIOBase�
TextIOBase��self�r�2/usr/local/lib/python3.9/test/test_winconsoleio.py�test_abcszWindowsConsoleIOTests.test_abccCsn|�tdtd�t���(}|��}|�tdt|�Wd�n1sF0Yztd�}WntynYn>0|�|���|�|�	��|�
d|���|��|��ztdd�}Wnty�Yn>0|�|���|�|�	��|�
d|���|��|��ztdd�}Wnt�y,Yn>0|�|���|�|�	��|�
d|���|��|��dS)Nznegative file descriptor���z&Cannot open (console|non-console file)r��w�)ZassertRaisesRegex�
ValueErrorr�tempfile�
TemporaryFile�filenor�readabler�writable�assertEqual�close)rZtmpfile�fd�frrr�test_open_fdsF�
�"z"WindowsConsoleIOTests.test_open_fdcCs|�tttj�td�}|�|���|�|���|�	|�
��|��|��td�}|�|���|�|���|�	|�
��|��|��tdd�}|�|���|�|���|�	|�
��|��|��t��dd�dk�rt
ddd	d
�}|�|t�|��dS)N�CON�CONIN$�CONOUT$r���
ri�UzC:/con�rbr��	buffering)ZassertRaisesrr�sys�
executablerrrrZassertIsNotNonerr�getwindowsversion�open�assertIsInstance�rr rrr�test_open_nameGs.
z$WindowsConsoleIOTests.test_open_nameNr��rz+test does not work on Windows 7 and earliercCsHtdddd�}|�|t�|��tdddd�}|�|t�|��dS)Nz
\\.\conin$r(rr)z//?/conout$�wb)r.r/rrr0rrr�test_conin_conout_namesesz-WindowsConsoleIOTests.test_conin_conout_namescCs�t��}|�tj|�tj�|d�}t|ddd��N}dt	�
�dd�krTdkrfnn|�|t�n|�
|t�Wd�n1s�0YdS)Nr$r4rr)r2r%r&)r�mkdtempZ
addCleanupr�rmtree�os�path�joinr.r+r-r/rZassertNotIsInstance)rZ	temp_pathZconout_pathr rrr�test_conout_pathps$z&WindowsConsoleIOTests.test_conout_pathcCs@tdd��"}|�|�d�d�Wd�n1s20YdS)Nr$r�r)rr�writer0rrr�test_write_empty_data}sz+WindowsConsoleIOTests.test_write_empty_datacCsZtdd�}tj}z0|t_t|jj|d�dd��t�}W|t_n|t_0|�||�dS)Nr#�rz
�	utf-16-le�
surrogatepass)	r.r+�stdinr�buffer�raw�encode�inputr)r�textrBZ	old_stdin�actualrrr�assertStdinRoundTrip�s
�z*WindowsConsoleIOTests.assertStdinRoundTripcCs"|�d�|�d�|�d�dS)NZabc123uϼўТλФЙuA͏B ﬖ̳AA̝�rIrrrr�
test_input�s

z WindowsConsoleIOTests.test_inputTz%Handling Non-BMP characters is brokencCs|�d�dS)Nu􀀀􏿿􏿽rJrrrr�test_input_nonbmp�sz'WindowsConsoleIOTests.test_input_nonbmpc	Cs�d�d�}d�d�}tdd�D]r}tdddd	��P}t||�d
}|�d�s^|�|�}||7}q@|�||d�|��Wd�q1s�0YqdS)
NuϼўТλФЙ
r@�utf-8r�r#r(rr)r<�
�stdin.read({})�rE�ranger.r�endswith�readr�format�r�source�expectedZ
read_countrBrH�brrr�test_partial_reads�s





z(WindowsConsoleIOTests.test_partial_readsc	Cs�d�d�}d�d�}tdd�D]r}tdddd	��P}t||�d
}|�d�s^|�|�}||7}q@|�||d�|��Wd�q1s�0YqdS)
Nu
􁿿􁀁
r@rMrrNr#r(rr)r<rOrPrQrVrrr�test_partial_surrogate_reads�s





z2WindowsConsoleIOTests.test_partial_surrogate_readscCs�tdddd��j}d�d�}d�d�}t||�|�d	�|��}}|�|dd	�|�|�|d	d�|�Wd�n1s~0YdS)
Nr#r(rr)uÄ
r@�ÄrMr)r.rErrT�readallr)rrBrWrX�arYrrr�test_ctrl_z�s


z!WindowsConsoleIOTests.test_ctrl_z)�__name__�
__module__�__qualname__rr!r1�unittestZskipIfr+r-r5r;r>rIrKrLrZr[r_rrrrrs"/�
	
	



r�__main__)r	r8r+rrc�testr�platformZSkipTestZ_testconsolerZ_WindowsConsoleIOrZTestCaserr`�mainrrrr�<module>s

8

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists