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_file.cpython-312.opt-2.pyc

�

'Μg!/���ddlZddlZddlZddlmZddlmZddlZddlZddl	m
Z
ddlmZddl	m
Z
ddl	mZddlmZGd	�d
�ZGd�deej$�ZGd
�deej$�ZGd�d�ZGd�deej$�ZGd�deej$�Zedk(rej2�yy)�N)�array)�proxy)�
gc_collect)�TESTFN)�	os_helper)�warnings_helper)�UserListc�Z�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zy)�
AutoFileTestsc�:�|jtd�|_y)N�wb)�openr�f��selfs �+/usr/local/lib/python3.12/test/test_file.py�setUpzAutoFileTests.setUps�����6�4�(���c��|jr|jj�tjt�y�N)r�closer�unlinkrrs r�tearDownzAutoFileTests.tearDowns$���6�6��F�F�L�L�N����� rc�N�t|j�}|jd�|j|jj	�|j	��|jj�d|_t
�|jtt|d�y)Ns
teststring�tell)
rr�write�assertEqualrrr�assertRaises�ReferenceError�getattr)r�ps  r�testWeakRefszAutoFileTests.testWeakRefssh���$�&�&�M��	���
���������������1���������������.�'�1�f�=rc�d�|j}|j|j|jyr)r�name�mode�closed�rrs  r�testAttributeszAutoFileTests.testAttributes%s ���F�F��	���	���	��rc�8�|jjd�|jj�tdd�}|j	t
d�|_|jj
|�}|jd|j�d|�y)N�12�b�
xxxxxxxxxx�rb)	rrrrrr�readintor�tobytes)r�a�ns   r�testReadintozAutoFileTests.testReadinto,sk�������U���������#�w������6�4�(����F�F�O�O�A��������	�	��B�Q��0rc��tdd�}|jj�|jtd��|_t|jd�r,|j
t|jj|�yy)Nr+r,zutf-8)�encodingr.)	rrrrr�hasattrr�	TypeErrorr.)rr0s  r�testReadinto_textzAutoFileTests.testReadinto_text5s\���#�w������������6�G��4����4�6�6�:�&����i������!�<�'rc��tddg�}|jj|�|jj�|j	t
d�|_|jj
�}|j|d�y)N�1�2r-r*)r	r�
writelinesrrr�readr)r�l�bufs   r�testWritelinesUserListz$AutoFileTests.testWritelinesUserList=s`���d�D�\�"�������!�����������6�4�(����f�f�k�k�m������e�$rc�^�|jt|jjgd��y�N)����rr6rr;rs r�testWritelinesIntegersz$AutoFileTests.testWritelinesIntegersFs�����)�T�V�V�%6�%6�	�Brc�t�tgd��}|jt|jj|�yrA)r	rr6rr;)rr=s  r�testWritelinesIntegersUserListz,AutoFileTests.testWritelinesIntegersUserListJs(���W������)�T�V�V�%6�%6��:rc��Gd�d�}|jt|jj|�|�g�y)Nc��eZdZy)�8AutoFileTests.testWritelinesNonString.<locals>.NonStringN)�__name__�
__module__�__qualname__�rr�	NonStringrKQs��rrPrE)rrPs  r�testWritelinesNonStringz%AutoFileTests.testWritelinesNonStringOs6��	�	�	
���)�T�V�V�%6�%6�$�;�	��4�	6rc��|j}|j|jt�|j	|j��|j	|j�t|d�r'|jttf|jd�|j�|j|j�y)Nr.�)rrr$r�assertFalse�isattyr&r5r�OSErrorr6r.r�
assertTruer's  r�
testErrorszAutoFileTests.testErrorsWs����F�F���������(��������$�������"��1�j�!����w�	�2�A�J�J��C�	���	�������!rc
�(�ddddddddd	d
ddgffdg
}|jd
�|jjddd�|j|jj�|D]3\}}t|j|�}|jt|g|����5|j|jjddd�d�	ddzy#|j|jjtj��d�YyxYw)N)�filenorO)�flushrO)rUrO)�__next__rO�r<rO)r)r��readlinerO��	readlinesrO)�seek)r)rrOr;)�__iter__rO)�truncaterOrBr)�appendr�__exit__rWr&r r�
ValueErrorr�sys�exc_info)r�methods�
methodname�args�methods     r�testMethodszAutoFileTests.testMethodsbs��!� �!�#��$�#�$�!��$� �2�%�(�#�
��	���'�(�	
������d�D�)�������
�
�&� '��J���T�V�V�Z�0�F��D���j�&�8�4�8�!(�	
���������t�T�:�D�A�	E�
�a�C��	E����_�T�V�V�_�_�c�l�l�n�=�t�D�s�C�=Dc�X�|jt|jj�yr)rrVrr<rs r�testReadWhenWritingz!AutoFileTests.testReadWhenWriting�s�����'�4�6�6�;�;�/rN)rLrMrNrrr"r(r2r7r?rFrHrQrXrnrprOrrrrsF��)�!�
>��1�=�%�C�;�
6�	"� E�D0rrc�$�eZdZejZy)�CAutoFileTestsN�rLrMrN�iorrOrrrrrr����
�7�7�Drrrc�0�eZdZeej
�Zy)�PyAutoFileTestsN�rLrMrN�staticmethod�pyiorrOrrrwrw������	�	�"�Drrwc�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�OtherFileTestsc�6�tjt�yr)rrrrs rrzOtherFileTests.tearDown�s������ rc���|jtd�j�dD]=}	|jt|�}|j�|jd|z��?y#t$rY�LwxYw)Nr
)rS�aUzwU+zU+z+UzrU+z%r is an invalid file mode)rrr�failrg)rr%rs   r�testModeStringszOtherFileTests.testModeStrings�si���	�	�&�$��%�%�'�8�D�
?��I�I�f�d�+�����	��	�	�6��=�>�9���
��
�s�A(�(	A4�3A4c���tjdk(r|jd�tjj	�s|jd�|jttf�5tjjd�ddd�|jttf�5tjj�ddd�y#1swY�LxYw#1swYyxYw)N�osf1V5zE sys.stdin.seek(-1) may crash the interpreter on OSF1. Test manually.z stdin must be a TTY in this test���)
rh�platform�skipTest�stdinrUr�IOErrorrgrbrdrs r�	testStdinzOtherFileTests.testStdin�s����<�<�8�#��M�M�"�
#��y�y���!��M�M�<�=�
�
�
���4�
5��I�I�N�N�2��6�
�
�
���4�
5��I�I��� �6�
5�6�
5��
5�
5�s�/ C�2C&�C#�&C/c�8�d}	|jt|�}|j�|jd|z�y#t$rQ}|j
ddk7r5t
|�}t|vs||vr|jd|z�Yd}~yYd}~yYd}~yd}~wwxYw)N�qwertyzno error for invalid mode: %srz&bad error message for invalid mode: %s)rrrr�rgrl�str)r�bad_moder�msg�ss     r�testBadModeArgumentz"OtherFileTests.testBadModeArgument�s�����	B��	�	�&�(�+�A�
�G�G�I��I�I�5��@�A���	L��x�x��{�a����H���Q�;�(�!�"3��I�I�F��J�K�K�#4� ��	L�s�?�	B�=B�Bc��	|jtd|�}|jt|�j	d��|j�|j�|jtd|�}t
|j�jd��}|j�|j�|j|�y#t$r)}|jd|t|�fz�Yd}~�@d}~wwxYw)Nr
�asciir-z error setting buffer size %d: %s)rrrr��encoder�intr<�decoderVr�r)rr�r�dr�s     r�_checkBufferSizezOtherFileTests._checkBufferSize�s���
	J��	�	�&�$��*�A�
�G�G�C��F�M�M�'�*�+�
�G�G�I�
�G�G�I��	�	�&�$��*�A��A�F�F�H�O�O�G�,�-�A�
�G�G�I�
�G�G�I�	
����A����	J��I�I�8�A�s�3�x�=�H�I�I��	J�s�B?C�	D�D�Dc��dD]8}tj|dt��5|j|�ddd��:|j	td�5|jd�ddd�y#1swY�uxYw#1swYyxYw)N)r�rizline buffering)�message�categoryrB)r�check_no_warnings�RuntimeWarningr��assertWarnsRegex)rr�s  r�testSetBufferSizez OtherFileTests.testSetBufferSize�s����A� �2�2�4�3C�4B�D��%�%�a�(�D�D���
"�
"�>�3C�
D��!�!�!�$�E�
D�D�D��E�
D�s�A/�A;�/A8	�;Bc���|jtd�}	|jd�|j�|jtd�}|j	d�}|dk7r|jd|z�|j
�dk7r"|jd|j
�z�|j�|j
�dk7r"|jd|j
�z�|j�tjjt�}|dk7r|jd	|z�|j�y#|j�wxYw)
Nr
s12345678901zrb+�s12345z(Read on file opened for update failed %rzFile pos after read wrong %dz!File pos after ftruncate wrong %dz"File size after ftruncate wrong %d)rrrrr<r�rrd�os�path�getsize)rr�data�sizes    r�testTruncateOnWindowsz$OtherFileTests.testTruncateOnWindows�s���
�I�I�f�d�#��	�
�G�G�N�#�
�G�G�I��	�	�&��'�A��6�6�!�9�D��x���	�	�D�t�K�L��v�v�x�1�}��	�	�8�1�6�6�8�C�D�
�J�J�L��v�v�x�1�}��	�	�=�����H�I�
�G�G�I��7�7�?�?�6�*�D��q�y��	�	�>��E�F�
�G�G�I��A�G�G�I�s�D'E�E"c��d}d}|t|�z}gd�}ddddtdd	�ffg}|jtd
�}|j	||z�|j|�|j
�|D]W\}}|jtd�}	|jt|	�|�t|	|�}
|
|�|	j
��Y|jtd�}	t|�D]
}t|	��|jd�}	|	j�}

|k7r|jd|
�d|���|jd�}tddt|�z�}	|	j|�|j!�}
|
|k7r|jd|
�d|���|jd�}	|	j#t|��}
|
|k7r|jd|
�d|���	|	j%�}|k7r|jd|
�d|���|	j
�|jtd�}		|	D]}
�	|	j�|	j|�|	j#�|	j%�|	j
�y#t$r|jd
�Y���wxYw#t$r|jd�Y��`wxYw#t$r|jd�Y��)wxYw#t$r|jd�Y��wxYw#t$r|jd�Y��wxYw#|	j
�wxYw)Ni@sham
)sspam, spam and eggs
seggs, spam, ham and spam
ssaussages, spam, spam and eggs
sspam, ham, spam and eggs
s(spam, spam, spam, spam, spam, ham, spam
swonderful spaaaaaam.
r^r]r`r.r+sd                                                                                                    r
r-rzLreadline() after next() with supposedly empty iteration-buffer failed anywayz6readline() after next() with empty buffer failed. Got z, expected �zLreadinto() after next() with supposedly empty iteration-buffer failed anywayz6readinto() after next() with empty buffer failed. Got zHread() after next() with supposedly empty iteration-buffer failed anywayz2read() after next() with empty buffer failed. Got zMreadlines() after next() with supposedly empty iteration-buffer failed anywayz7readlines() after next() with empty buffer failed. Got z'read* failed after next() consumed file)�lenrrrrr;rr�nextr �range�popr_rgr�r.r/r<ra)r�
dataoffset�filler�nchunks�	testlinesrj�bagrkrlr�meth�i�testline�liner>�liness                r�
testIterationzOtherFileTests.testIteration�s&���
�����F��+��
�	�$�\�3D���s�H�!5� 7�8�:���i�i���%���	�	�&�7�"�#����y�!��	�	�� '��J���	�	�&�$�'�A����T�!�W�f�-��1�j�)�D��$�K�
�G�G�I�!(�
�I�I�f�d�#���w��A���G� ��=�=��#��	:��:�:�<�D��8���I�I�9=�x�I�
J��=�=��#���C��3�x�=�0�1��	:�
�J�J�s�O��{�{�}���8���I�I�9=�x�I�
J��=�=��#��	:��6�6�#�h�-�(�D��8���I�I�9=�x�I�
J�	:��K�K�M�E��I���I�I�9=�x�I�
J�	���	�
�I�I�f�d�#��	�����
E��
�
���
�
�3���������
�
�G�G�I��e�	:��I�I�9�
:�	:���	:��I�I�9�
:�	:���	:��I�I�9�
:�	:���	:��I�I�9�
:�	:��$�
E��	�	�C�D�
E��
�G�G�I�ss�J�*J>�9K�0L�M�AL!�J;�:J;�>K�K�K=�<K=�L�L�!L>�;M�=L>�>M�MN)rLrMrNrr�r�r�r�r�r�r�rOrrr}r}�s,��!�
?�!� B� �%��8_rr}c�$�eZdZejZy)�COtherFileTestsNrsrOrrr�r�Xrurr�c�0�eZdZeej
�Zy)�PyOtherFileTestsNrxrOrrr�r�[r{rr��__main__)rhr��unittestr�weakrefrrt�_pyiorz�test.supportr�test.support.os_helperrrr�collectionsr	r�TestCaserrrwr}r�r�rL�mainrOrr�<module>r�s���
�	����	��#�)�"�(� �u0�u0�n�]�H�$5�$5��#�m�X�%6�%6�#�H�H�T�n�h�&7�&7��#�~�x�'8�'8�#��z���H�M�M�O�r

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