Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_winconsoleio.cpython-312.pyc

�

'Μg����dZddlZddlZddlZddlZddlZddlmZmZejdk7rejd��ddlmZejZGd�dej�Zed	k(rej$�yy)
zTests for WindowsConsoleIO
�N)�	os_helper�requires_resource�win32ztest only relevant on win32)�write_inputc�D�eZdZd�Zd�Zd�Zejej�dddkd�d��Z
d	�Zd
�Zd�Z
ed�d
��Zejdd�d��Zed�d��Zejdd�d��Zed�d��Zy)�WindowsConsoleIOTestsc��|jtttj��|jtttj��|jtttj��y)N)�
assertTrue�
issubclass�ConIO�io�	RawIOBase�assertFalse�BufferedIOBase�
TextIOBase��selfs �3/usr/local/lib/python3.12/test/test_winconsoleio.py�test_abczWindowsConsoleIOTests.test_abcsM�����
�5�"�,�,�7�8�����E�2�+<�+<�=�>�����E�2�=�=�9�:�c��|jtdtd�tj�5}|j�}|jtdt|�ddd�	td�}|j
|j��|j|j��|jd|j��|j�|j�	tdd�}|j|j��|j
|j��|jd|j��|j�|j�	tdd�}|j|j��|j
|j��|jd|j��|j�|j�y#1swY���xYw#t$rY��0wxYw#t$rY��wxYw#t$rYywxYw)Nznegative file descriptor���z&Cannot open (console|non-console file)r��w�)�assertRaisesRegex�
ValueErrorr�tempfile�
TemporaryFile�filenor
�readabler�writable�assertEqual�close)r�tmpfile�fd�fs    r�test_open_fdz"WindowsConsoleIOTests.test_open_fds������z�&��r�	3��
#�
#�
%�����!�B�
�"�"�:�8�%��
E�	&�
	��a��A�

�O�O�A�J�J�L�)����Q�Z�Z�\�*����Q����
�+�
�G�G�I�
�G�G�I�
	��a��
�A�

���Q�Z�Z�\�*��O�O�A�J�J�L�)����Q����
�+�
�G�G�I�
�G�G�I�
	��a��
�A�

���Q�Z�Z�\�*��O�O�A�J�J�L�)����Q����
�+�
�G�G�I�
�G�G�I�S&�
%���	��	���	��	���	��	�sA�-H�'H�1H$�<H3�H�	H!� H!�$	H0�/H0�3	H?�>H?c�&�|jtttj�td�}|j|j
��|j|j��|j|j��|j�|j�td�}|j|j
��|j|j��|j|j��|j�|j�tdd�}|j|j
��|j|j��|j|j��|j�|j�tj�dddkr5tddd	�
�}|j|t�|j�yy)N�CON�CONIN$�CONOUT$r���
ri�UzC:/con�rbr��	buffering)�assertRaisesrr�sys�
executabler
r!rr"�assertIsNotNoner r$�getwindowsversion�open�assertIsInstance�rr's  r�test_open_namez$WindowsConsoleIOTests.test_open_nameGs`�����*�e�S�^�^�<��%�L������
�
��%��������&����Q�X�X�Z�(�	���	�	���	��(�O������
�
��%��������&����Q�X�X�Z�(�	���	�	���	��)�S�!���������&�����
�
��%����Q�X�X�Z�(�	���	�	���	�� � �"�2�A�&��7��X�t�q�1�A��!�!�!�U�+�
�G�G�I�8rNr��rz+test does not work on Windows 7 and earlierc���tddd��}|j|t�|j�tddd��}|j|t�|j�y)Nz
\\.\conin$r0rr1z//?/conout$�wb)r8r9rr$r:s  r�test_conin_conout_namesz-WindowsConsoleIOTests.test_conin_conout_namesesR��
����2�����a��'�	���	�����2�����a��'�	���	rc��tj�}|jtj|�t
jj|d�}t|dd��5}dtj�ddcxkrdkrnn|j|t�n|j|t�ddd�y#1swYyxYw)Nr,r?rr1r<r-r.)r�mkdtemp�
addCleanupr�rmtree�os�path�joinr8r4r7r9r�assertNotIsInstance)r�	temp_path�conout_pathr's    r�test_conout_pathz&WindowsConsoleIOTests.test_conout_pathps����$�$�&�	����	�(�(�)�4��g�g�l�l�9�i�8��
�+�t�q�
1�Q���-�-�/���3�D�n�D��%�%�a��/��(�(��E�2�2�
1�
1�s
�#AB=�=Cc��tdd�5}|j|jd�d�ddd�y#1swYyxYw)Nr,rrr)rr#�writer:s  r�test_write_empty_dataz+WindowsConsoleIOTests.test_write_empty_data}s2��
�9�c�
"�a����Q�W�W�S�\�1�-�#�
"�
"�s	�"8�Ac�(�tdd�}tj}	|t_t|jj
|dzj
dd��t�}|t_|j||�y#|t_wxYw)Nr+�rz
�	utf-16-le�
surrogatepass)	r8r4�stdinr�buffer�raw�encode�inputr#)r�textrS�	old_stdin�actuals     r�assertStdinRoundTripz*WindowsConsoleIOTests.assertStdinRoundTrip�sw���X�s�#���I�I�	�	"��C�I����� � ����&�&�{�O�D�
��W�F�!�C�I������&��"�C�I�s�AB�
B�consolec�j�|jd�|jd�|jd�y)N�abc123uϼўТλФЙuA͏B ﬖ̳AA̝�r[rs r�
test_inputz WindowsConsoleIOTests.test_input�s/��	
�!�!�(�+��!�!�.�1��!�!�"2�3rTz%Handling Non-BMP characters is brokenc�&�|jd�y)Nu􀀀􏿿􏿽r_rs r�test_input_nonbmpz'WindowsConsoleIOTests.test_input_nonbmp�s��	
�!�!�"B�Crc	��djd�}djd�}tdd�D]�}tddd�	�5}t||�d
}|j	d�s(|j|�}||z
}|j	d�s�(|j
||dj|��ddd���y#1swY��xYw)
NuϼўТλФЙ
rQ�utf-8r�r+r0rr1r�
�stdin.read({})�rV�ranger8r�endswith�readr#�format�r�source�expected�
read_countrSrZ�bs       r�test_partial_readsz(WindowsConsoleIOTests.test_partial_reads�s���$�*�*�;�7��%�,�,�W�5����2�,�J��h���2�e��E�6�*��� �/�/�%�0��
�
�:�.�A��a�K�F�!�/�/�%�0�� � ���3C�3J�3J�:�3V�W�3�2�'�2�2���AB5�"B5�5B>	c	��djd�}djd�}tdd�D]�}tddd�	�5}t||�d
}|j	d�s(|j|�}||z
}|j	d�s�(|j
||dj|��ddd���y#1swY��xYw)
Nu
􁿿􁀁
rQrdrrer+r0rr1rrfrgrhrms       r�test_partial_surrogate_readsz2WindowsConsoleIOTests.test_partial_surrogate_reads�s���
,�2�2�;�?��-�4�4�W�=����2�,�J��h���2�e��E�6�*��� �/�/�%�0��
�
�:�.�A��a�K�F�!�/�/�%�0�� � ���3C�3J�3J�:�3V�W�3�2�'�2�2�rsc�<�tddd��5}djd�}djd�}t||�|jd	�|j	�}}|j|dd	|�|j|d	d|�ddd�y#1swYyxYw)
Nr+r0rr1uÄ
rQ�Ärdr)r8rVrrk�readallr#)rrSrnro�arqs      r�test_ctrl_zz!WindowsConsoleIOTests.test_ctrl_z�s���
�(�D�A�
.�%�#�*�*�;�7�F��}�}�W�-�H���v�&��:�:�a�=�%�-�-�/�q�A����X�a��]�A�.����X�a�b�\�1�-�
/�
.�
.�s�A:B�B)�__name__�
__module__�__qualname__rr(r;�unittest�skipIfr4r7r@rKrNr[rr`rbrrrurz�rrrrs���;�
-�^�<�X�_�_�*�S�*�*�,�R�a�0�F�:�5�7��7��3�.�'��y�!�4�"�4��X�_�_�T�B�C�D�D�D��y�!�X�"�X�"�X�_�_�T�B�C�X�D�X�"�y�!�.�"�.rr�__main__)�__doc__r
rEr4rr~�test.supportrr�platform�SkipTest�_testconsoler�_WindowsConsoleIOr�TestCaserr{�mainr�rr�<module>r�s{���
�	�
���5��<�<�7��
�(�
�
�9�
:�:�$�
����x.�H�-�-�x.�t�z���H�M�M�O�r

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