HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_winconsoleio.cpython-310.pyc
o

�iG�@s�dZddlZddlZddlZddlZddlZddlmZejdkr&e�	d��ddl
mZejZ
Gdd�dej�Zed	krBe��dSdS)
zTests for WindowsConsoleIO
�N)�	os_helper�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�3/usr/local/lib/python3.10/test/test_winconsoleio.py�test_abcszWindowsConsoleIOTests.test_abccCsn|�tdtd�t���}|��}|�tdt|�Wd�n1s#wYztd�}Wn	ty7Ynw|�|���|�|�	��|�
d|���|��|��ztdd�}Wn	tyfYnw|�|���|�|�	��|�
d|���|��|��ztdd�}Wn
ty�YdSw|�|���|�|�	��|�
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_fdsN�
�����z"WindowsConsoleIOTests.test_open_fdcCs|�tttj�td�}|�|���|�|���|�	|�
��|��|��td�}|�|���|�|���|�	|�
��|��|��tdd�}|�|���|�|���|�	|�
��|��|��t��dd�dkr�t
ddd	d
�}|�|t�|��dSdS)N�CON�CONIN$�CONOUT$r���
ri�UzC:/con�rbr��	buffering)ZassertRaisesrr�sys�
executablerrrrZassertIsNotNonerr�getwindowsversion�open�assertIsInstance�rr rrr�test_open_nameGs0
�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��0}dt	�
�dd�kr*dkr3nn|�|t�n|�
|t�Wd�dSWd�dS1sLwYdS)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_pathcCsBtdd��}|�|�d�d�Wd�dS1swYdS)Nr$r�r)rr�writer0rrr�test_write_empty_data}s"�z+WindowsConsoleIOTests.test_write_empty_datacCsZtdd�}tj}z|t_t|jj|d�dd��t�}W|t_n|t_w|�||�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	C�d�d�}d�d�}tdd�D]=}tdddd	��,}t||�d
}|�d�s3|�|�}||7}|�d�r%|�||d�|��Wd�n1sGwYqdS)
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	CrM)
Nu
􁿿􁀁
r@rNrrOr#r(rr)r<rPrQrRrWrrr�test_partial_surrogate_reads�s





����z2WindowsConsoleIOTests.test_partial_surrogate_readscCs�tdddd��6}d�d�}d�d�}t||�|�d	�|��}}|�|dd	�|�|�|d	d�|�Wd�dS1s@wYdS)
Nr#r(rr)uÄ
r@�ÄrNr)r.rErrU�readallr)rrBrXrY�arZrrr�test_ctrl_z�s


"�z!WindowsConsoleIOTests.test_ctrl_z)�__name__�
__module__�__qualname__rr!r1�unittestZskipIfr+r-r5r;r>rIrKrLr[r\r`rrrrrs$/�
	

	


r�__main__)�__doc__r	r8r+rrdZtest.supportr�platformZSkipTestZ_testconsolerZ_WindowsConsoleIOrZTestCaserra�mainrrrr�<module>s 

8�