HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/test/__pycache__/test_fileio.cpython-311.opt-2.pyc
�

��Vc�R���ddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
mZmZddlmZmZmZddlmZddlmZddlZddlZGd	�d
��ZGd�deej��ZGd
�deej��ZGd�d��ZGd�deej��ZGd�deej��Z d�Z!e"dkrej#��dSdS)�N)�array)�proxy��wraps)�cpython_only�	swap_attr�
gc_collect�
is_emscripten�is_wasi)�TESTFN�TESTFN_UNICODE�make_bad_fd)�check_warnings)�UserListc�*�eZdZd�Zd�Zd�Zd�Zd�Zej	e
d��d���Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zej	ejdkd��d���Zd�Zd�Zed���Zed���Z ed���Z!ed���Z"ed���Z#ed ���Z$ed!���Z%ed"���Z&ed#���Z'ed$���Z(d%�Z)ed&���Z*ed'���Z+ed(���Z,d)S)*�
AutoFileTestsc�F�|�td��|_dS�N�w)�FileIOr�f��selfs �$D:\Python311\Lib\test\test_fileio.py�setUpzAutoFileTests.setUps�����V�S�)�)�����c�x�|jr|j���tjt��dS�N)r�close�os�removerrs r�tearDownzAutoFileTests.tearDowns1���6�	��F�L�L�N�N�N�
�	�&�����rc��t|j��}|�tt	d������|�|j���|�����|j���d|_t��|�	tt|d��dS)N�
�tell)rr�write�bytes�range�assertEqualr%rr	�assertRaises�ReferenceError�getattr)r�ps  r�testWeakRefszAutoFileTests.testWeakRefs"s����$�&�M�M��	����e�B�i�i� � �!�!�!���������������1�1�1������������������.�'�1�f�=�=�=�=�=rc��|j�ttd������|�|j���d��|j�d��|�|j���d��|j�d��|�|j���d��|j�dd��|�|j���d��|j�dd��|�|j���d��|j�dd��|�|j���d��dS)	N�rr$�������)rr&r'r(r)r%�seekrs r�testSeekTellzAutoFileTests.testSeekTell,sN������U�5��9�9�%�%�&�&�&�����������+�+�+�����A��������������*�*�*�����B��������������+�+�+�����A�q��������������+�+�+�����B���������������+�+�+�����B���������������+�+�+�+�+rc���|j}|�|jd��|�|jd��dD],}|�t
tft||d���-dS)N�wbF)�mode�closed�oops)rr)r:r;r*�AttributeError�	TypeError�setattr)rr�attrs   r�testAttributeszAutoFileTests.testAttributes:s����F��������&�&�&������5�)�)�)�%�	8�	8�D����~�y�9�%�q�$��
8�
8�
8�
8�	8�	8rz WASI does not expose st_blksize.c��tj}ttd��r<tj|j�����}t|d|��}|�|jj	|��dS)N�fstat�
st_blksize)
�io�DEFAULT_BUFFER_SIZE�hasattrr rCr�filenor,r)�_blksize)r�blksize�fsts   r�testBlksizezAutoFileTests.testBlksizeFsh���(���2�w���	:��(�4�6�=�=�?�?�+�+�C��c�<��9�9�G�������'�2�2�2�2�2rc��|j�tgd�����|j���t	d��}|�td��5}|�|��}ddd��n#1swxYwY|�|d��|�|d��dS)N�r2r5r��abcdefgh�r��efgh�)	rr&r'r�	bytearrayrr�readintor))r�bar�ns    r�testReadintoByteArrayz#AutoFileTests.testReadintoByteArrayQs�������U�>�>�>�*�*�+�+�+��������
�{�
#�
#��
�[�[���
%�
%�	���
�
�2���A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����4�5�5�5�����A�����s�-B�B�Bc��|j�tgd�����|j���t	td����}|�td��5}|�|��}ddd��n#1swxYwY|�	|d��|�	|d��t	td�����
dddg���}|�td��5}|�|��}ddd��n#1swxYwY|�	t|��d��|�	|d��dS)	NrNrPrQrRrS�Hr5)�shape)rr&r'r�
memoryviewrTrrrUr)�cast)r�mrrWs    r�_testReadintoMemoryviewz%AutoFileTests._testReadintoMemoryview[s�������U�>�>�>�*�*�+�+�+���������y��-�-�.�.��
�[�[���
%�
%�	���
�
�1�
�
�A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����3�4�4�4�����A�����y��-�-�.�.�3�3�C��1�v�3�F�F��
�[�[���
%�
%�	���
�
�1�
�
�A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����q���#:�;�;�;�����A�����s$�:B�B �#B �!E�E�
Ec��|j�tgd�����|j���t	dd��}|�td��5}|�|��}ddd��n#1swxYwY|�|t	dgd�����|�|d��t	dd��}|�td��5}|�|��}ddd��n#1swxYwY|�|t	dgd�����|�|d��t	d	d��}|�td��5}|�|��}ddd��n#1swxYwY|�|t	d	d
����|�|d��dS)NrN�BrPrQ)r2r5rrO�e�f�g�hrS�b)r2r5r���rbrcrdre�IrR)	rr&r'rrrrrUr))r�arrWs    r�_testReadintoArrayz AutoFileTests._testReadintoArraykst������U�>�>�>�*�*�+�+�+���������#�{�#�#��
�[�[���
%�
%�	���
�
�1�
�
�A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����E�#�'I�'I�'I�J�J�K�K�K�����A�����#�{�#�#��
�[�[���
%�
%�	���
�
�1�
�
�A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����E�#�'H�'H�'H�I�I�J�J�J�����A�����#�{�#�#��
�[�[���
%�
%�	���
�
�1�
�
�A�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����E�#�'>�?�?�@�@�@�����A�����s6�.B�B�B�D$�$D(�+D(�F8�8F<�?F<c��ddg}|j�|��|j���|�td��|_|j���}|�|d��dS�Ns123s456�rbs123456)r�
writelinesrrr�readr)�r�l�bufs   r�testWritelinesListz AutoFileTests.testWritelinesList�sq��
�V�������!��������������V�T�*�*����f�k�k�m�m������i�(�(�(�(�(rc�,�tddg��}|j�|��|j���|�t
d��|_|j���}|�|d��dSrl)rrrnrrrror)rps   r�testWritelinesUserListz$AutoFileTests.testWritelinesUserList�sy���f�f�%�&�&������!��������������V�T�*�*����f�k�k�m�m������i�(�(�(�(�(rc���|�t|jjgd���|�t|jjd��|�t|jjd��dS)N)r2r5��abc)r*r>rrnrs r�testWritelinesErrorz!AutoFileTests.testWritelinesError�sc�����)�T�V�%6�	�	�	�B�B�B����)�T�V�%6��=�=�=����)�T�V�%6��>�>�>�>�>rc��|j�d��|j���|�td��|_|�|j�d��d��|j�d��|�|j�d��d��|�|j�	d��ddg��dS)Ns
hi
bye
abcrQrshi
sbye
�abc)
rr&rrrr)ror6�readline�	readlinesrs r�test_none_argszAutoFileTests.test_none_args�s�������_�%�%�%�����������V�S�)�)����������T�*�*�O�<�<�<�����A������������.�.��8�8�8������)�)�$�/�/�(�F�1C�D�D�D�D�Drc�R�|�t|jjd��dS)NzHello!)r*r>rr&rs r�test_rejectzAutoFileTests.test_reject�s$�����)�T�V�\�8�<�<�<�<�<rc
���|�t|j��d|j�d|jj�d|jj�d���|j`|�t|j��d|j�d|j����d|jj�d���|j���|�t|j��d|j�d���dS)N�<�
.FileIO name=� mode=z closefd=True>z.FileIO fd=z.FileIO [closed]>)r)�reprr�
modulename�namer:rHrrs r�testReprzAutoFileTests.testRepr�s�������d�f�����/�/�/�4�6�;�;�;������E�	F�	F�	F�
�F�K�����d�f�����/�/�/�4�6�=�=�?�?�?�?�D�F�K�K�K�I�	J�	J�	J�	
�����������d�f����37�?�?�?�D�	F�	F�	F�	F�	Frc��tjttj��}	|�|dd���5}|�t
|��d|j�d|j�d|j	�d���ddd��n#1swxYwYtj
|��dS#tj
|��wxYw)NrQF)�closefdr�r�r�z closefd=False>)r �openr�O_RDONLYrr)r�r�r�r:r)r�fdrs   r�testReprNoCloseFDzAutoFileTests.testReprNoCloseFD�s���
�W�V�R�[�
)�
)��	����R��e��4�4�
D��� � ��a����"&�/�/�/�1�6�6�6�1�6�6�6�"C�D�D�D�
D�
D�
D�
D�
D�
D�
D�
D�
D�
D�
D����
D�
D�
D�
D�

�H�R�L�L�L�L�L��B�H�R�L�L�L�L���s.�B(�=B�;B(�B�B(�B�B(�(B>c��t|jd|j��5|�t��5t	|j��ddd��n#1swxYwYddd��dS#1swxYwYdS)Nr�)rrr*�RuntimeErrorr�rs r�testRecursiveReprzAutoFileTests.testRecursiveRepr�s���
�t�v�v�t�v�
.�
.�	�	��"�"�<�0�0�
�
��T�V����
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s4�A0�A�A0�A	�A0�A	� A0�0A4�7A4c�<�|j}|�|�����|�|j��|�t
|jd��|���|�|j��|�	td��}|�t|jd��|�|j��|���|�|j��dS)Nr$rQ�)
r�assertFalse�isattyr;r*�
ValueErrorror�
assertTruerrr>rU�rrs  r�
testErrorszAutoFileTests.testErrors�s����F����������$�$�$������"�"�"����*�a�f�b�1�1�1�	���	�	�	������!�!�!��K�K���$�$�����)�Q�Z��4�4�4������"�"�"�	���	�	�	������!�!�!�!�!rc�Z�gd�}|j���|�|jj��|D]2}t	|j|��}|�t|���3|�t|jj��|�t|jjtd����|�t|jj
��|�t|jj
d��|�t|jj��|�t|jjd��|�t|jj��|�t|jjd��dS)N)rHr��seekable�readable�writablero�readallr|r}r%�truncate�flushr2rr)
rrr�r;r,r*r�r>rUrTr6r&rn)r�methods�
methodname�methods    r�testMethodszAutoFileTests.testMethods�sY��0�0�0��	
������������
�&�&�&�!�	2�	2�J��T�V�Z�0�0�F����j�&�1�1�1�1����)�T�V�_�5�5�5����*�d�f�o�y��|�|�D�D�D����)�T�V�[�1�1�1����*�d�f�k�1�5�5�5����)�T�V�\�2�2�2����*�d�f�l�C�8�8�8����)�T�V�%6�7�7�7����*�d�f�&7��=�=�=�=�=rc��	|�dd��|�d��dS#t$rA}|�|jd��|�|jd��Yd}~dSd}~wwxYw)N�.rQ�Should have raised OSErrorr)r�fail�OSError�assertNotEqual�errnor)�filename)r�es  r�testOpendirzAutoFileTests.testOpendir�s���	4��K�K��S�!�!�!�

�I�I�2�3�3�3�3�3��	�	.�	.�	.�������+�+�+����Q�Z��-�-�-�-�-�-�-�-�-�����	.���s�/�
A:�6A5�5A:�ntz&test only works on a POSIX-like systemc�P�tjdtj��}|�t��5}|�|d��ddd��n#1swxYwYtj|��|�|jj	tj
��dS)Nr�rQ)r r�r�r*r�rrr)�	exceptionr��EISDIR)rr��cms   r�
testOpenDirFDzAutoFileTests.testOpenDirFD�s���
�W�S�"�+�
&�
&��
�
�
�w�
'�
'�	!�2��K�K��C� � � �	!�	!�	!�	!�	!�	!�	!�	!�	!�	!�	!����	!�	!�	!�	!�
�����������+�U�\�:�:�:�:�:s�A�A!�$A!c�<��t����fd���}|S)Nc�0��|j}tj|�����	�||��	|j���dS#t$rYdSwxYw#	|j���w#t$rYwwxYwxYwr)rr rrHr�)rr�funcs  �r�wrapperz'AutoFileTests.ClosedFD.<locals>.wrapper�s������A��H�Q�X�X�Z�Z� � � �
���T�1�
�
�
���F�L�L�N�N�N�N�N�������D�D��������F�L�L�N�N�N�N�������D�������s@�A)�A�
A&�%A&�)B�+B�B�
B�B�B�Br�r�r�s` r�ClosedFDzAutoFileTests.ClosedFD�s3���	�t���
	�
	�
	�
	�
��
	��rc�<��t����fd���}|S)Nc����|j}tj|�����	�||��|�d��n<#t
$r/}|�|jtj��Yd}~nd}~wwxYw	|j���dS#t
$rYdSwxYw#	|j���w#t
$rYwwxYwxYw)Nr�)	rr rrHr�r�r)r��EBADF)rrr�r�s   �rr�z-AutoFileTests.ClosedFDRaises.<locals>.wrappers�����A��H�Q�X�X�Z�Z� � � �

���T�1�
�
�
��	�	�6�7�7�7�7���
7�
7�
7�� � ���%�+�6�6�6�6�6�6�6�6�����
7����
��F�L�L�N�N�N�N�N�������D�D��������F�L�L�N�N�N�N�������D�������sd�A�B;�
B�%B�B;�B�B;�B*�*
B8�7B8�;C'�=C�C'�
C$�!C'�#C$�$C'rr�s` r�ClosedFDRaiseszAutoFileTests.ClosedFDRaisess3���	�t���	�	�	�	�
��	��rc�.�|���dSr)rr�s  r�testErrnoOnClosezAutoFileTests.testErrnoOnCloses��	���	�	�	�	�	rc�0�|�d��dS)N�a)r&r�s  r�testErrnoOnClosedWritez$AutoFileTests.testErrnoOnClosedWrites��	����
�
�
�
�
rc�0�|�d��dS�Nr)r6r�s  r�testErrnoOnClosedSeekz#AutoFileTests.testErrnoOnClosedSeek"s��	���q�	�	�	�	�	rc�.�|���dSr)r%r�s  r�testErrnoOnClosedTellz#AutoFileTests.testErrnoOnClosedTell&s��	�������rc�0�|�d��dSr�)r�r�s  r�testErrnoOnClosedTruncatez'AutoFileTests.testErrnoOnClosedTruncate*s��	�
�
�1�
�
�
�
�
rc�.�|���dSr)r�r�s  r�testErrnoOnClosedSeekablez'AutoFileTests.testErrnoOnClosedSeekable.���	�
�
�����rc�.�|���dSr)r�r�s  r�testErrnoOnClosedReadablez'AutoFileTests.testErrnoOnClosedReadable2r�rc�.�|���dSr)r�r�s  r�testErrnoOnClosedWritablez'AutoFileTests.testErrnoOnClosedWritable6r�rc�.�|���dSr)rHr�s  r�testErrnoOnClosedFilenoz%AutoFileTests.testErrnoOnClosedFileno:s��	���
�
�
�
�
rc�V�|�|���d��dS)NF)r)r�r�s  r�testErrnoOnClosedIsattyz%AutoFileTests.testErrnoOnClosedIsatty>s&����������U�+�+�+�+�+rc��	|j���n#t$rYnwxYw|�td��|_tj|j�����|jS)NrQ)rrr�rrr rHrs r�
ReopenForReadzAutoFileTests.ReopenForReadBsn��	��F�L�L�N�N�N�N���	�	�	��D�	�������V�S�)�)���
��������!�!�!��v�
s��
)�)c�X�|���}|�d��dS)Nr2)r�ror�s  r�testErrnoOnClosedReadz#AutoFileTests.testErrnoOnClosedReadKs&����� � ��	���q�	�	�	�	�	rc�V�|���}|���dSr)r�r�r�s  r�testErrnoOnClosedReadallz&AutoFileTests.testErrnoOnClosedReadallPs$����� � ��	�	�	�����rc�x�|���}tdd��}|�|��dS)Nrfs
xxxxxxxxxx)r�rrU)rrris   r�testErrnoOnClosedReadintoz'AutoFileTests.testErrnoOnClosedReadintoUs5����� � ���#�w����	�
�
�1�
�
�
�
�
rN)-�__name__�
__module__�__qualname__rr"r.r7rA�unittest�skipIfrrLrXr_rjrsruryr~r�r�r�r�r�r�r�r r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��rrrrs!������*�*�*����
>�>�>�,�,�,�
8�
8�
8��X�_�W�@�A�A�3�3�B�A�3������� ���,)�)�)�)�)�)�?�?�?�
E�E�E�=�=�=�
F�
F�
F�������"�"�"�>�>�>�,
4�
4�
4��X�_�R�W��_�&N�O�O�;�;�P�O�;�
�
�
����&����^������^������^������^������^������X������X������X������X���,�,��X�,��������^������^������^���rrc� �eZdZejZdZdS)�CAutoFileTests�_ioN)r�r�r�r�rr�r�rrr�r�[s������
�Z�F��J�J�Jrr�c� �eZdZejZdZdS)�PyAutoFileTests�_pyioN)r�r�r�r�rr�r�rrr�r�_s������
�\�F��J�J�Jrr�c��eZdZd�Zd�Zd�Zd�Zd�Zej	e
j��dkd��d���Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�ZdS)�OtherFileTestsc��	|�td��}|�|���d��|�|���d��|�|���d��|���|�td��}|�|���d��|�|���d��|�|���d��|���|�td��}|�|���d��|�|���d��|�|���d��|�|���d��|���tj	dk�r!t�s	|�dd��}|�|���d��|�|���d��tj	d	krUd
tj	vrGtj	�d��s(|�|���d��|�|���d��|���n#t$rYnwxYwtjt��dS#tjt��wxYw)NrFTrQza+�win32z/dev/ttyri�darwin�bsd)�sunos�aix)rrr)r�r�r�rr��sys�platformr
�
startswithr�r �unlinkr�s  r�	testAbleszOtherFileTests.testAblesfs���'	����F�C�(�(�A����Q�Z�Z�\�\�5�1�1�1����Q�Z�Z�\�\�4�0�0�0����Q�Z�Z�\�\�4�0�0�0�
�G�G�I�I�I����F�C�(�(�A����Q�Z�Z�\�\�4�0�0�0����Q�Z�Z�\�\�5�1�1�1����Q�Z�Z�\�\�4�0�0�0�
�G�G�I�I�I����F�D�)�)�A����Q�Z�Z�\�\�4�0�0�0����Q�Z�Z�\�\�4�0�0�0����Q�Z�Z�\�\�4�0�0�0����Q�X�X�Z�Z��/�/�/�
�G�G�I�I�I��|�w�&�
�}�
�����J��4�4�A��$�$�Q�Z�Z�\�\�5�9�9�9��$�$�Q�Z�Z�\�\�4�8�8�8��|�x�/�>��C�L�0�>��<�2�2�3C�D�D�>��(�(������u�=�=�=��$�$�Q�X�X�Z�Z��6�6�6��G�G�I�I�I�I�������D�	���� 
�I�f�������B�I�f�������s1�H6M,�9M�C2M,�
M�M,�
M�M,�,Nc��dD]Z}	|�t|��}|���|�d|z���K#t$rY�WwxYwdS)N)r��aUzwU+�rw�rtz%r is an invalid file mode)rrrr�r�)rr:rs   r�testInvalidModeStringsz%OtherFileTests.testInvalidModeStrings�s��1�	?�	?�D�
?��K�K���-�-�����	�	�	��	�	�6��=�>�>�>�>��	�
�
�
���
����	?�	?s�A�
A�Ac���	dD]\}|�t|d��5}|�|j|d��ddd��n#1swxYwY�]	tj�t��rt	jt��dSdS#tj�t��rt	jt��wwxYw)N))rr9)r9r9)zwb+�rb+)zw+br�)ri�ab)r�r�)�ab+r�)za+br�)rQrm)rmrm)r�r�)zr+br�rr2)rrr)r:r �path�existsr�)r�modesrs   r�testModeStringszOtherFileTests.testModeStrings�s��
	"�H�
7�
7��
�[�[���q��2�2�7�a��$�$�Q�V�U�1�X�6�6�6�7�7�7�7�7�7�7�7�7�7�7����7�7�7�7��
7��w�~�~�f�%�%�
"��	�&�!�!�!�!�!�
"�
"��r�w�~�~�f�%�%�
"��	�&�!�!�!�!�
"���s/�%B#�"A�	B#�A	�B#�A	�B#�#AC#c��|�tt��d��}|���t	jt��dSr)r�strrrr r�r�s  r�testUnicodeOpenzOtherFileTests.testUnicodeOpen�s>���K�K��F���S�)�)��	���	�	�	�
�	�&�����rc�$�	tjd��}n-#t$r |�dtz��YnwxYw|�|d��}	|�d��|���ttd��5}|�|�	��d��ddd��n#1swxYwYtjt��dS#tjt��wxYw)N�asciizcould not encode %r to asciirr{rm)r�encode�UnicodeEncodeError�skipTestrr&rr�r)ror r��r�fnrs   r�
testBytesOpenzOtherFileTests.testBytesOpen�s8��	C���w�'�'�B�B��!�	C�	C�	C��M�M�8�6�A�B�B�B�B�B�	C�����K�K��C� � ��	�
�G�G�F�O�O�O�
�G�G�I�I�I��f�d�#�#�
3�q�� � ������6�2�2�2�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3����
3�
3�
3�
3�
�I�f�������B�I�f��������?��'A�A�>C4�)C�C4�C�C4�C�C4�4D�utf-8z%test only works for utf-8 filesystemsc�$�	tjd��}n-#t$r |�dtz��YnwxYw|�|d��}	|�d��|���ttd��5}|�|�	��d��ddd��n#1swxYwYtjt��dS#tjt��wxYw)Nrzcould not encode %r to utf-8rr{rm)r
r	r
rrr&rr�r)ror r�rs   r�testUtf8BytesOpenz OtherFileTests.testUtf8BytesOpen�s9��	K��&�w�/�/�B�B��!�	K�	K�	K��M�M�8�>�I�J�J�J�J�J�	K�����K�K��C� � ��	&�
�G�G�F�O�O�O�
�G�G�I�I�I��n�d�+�+�
3�q�� � ������6�2�2�2�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3����
3�
3�
3�
3�
�I�n�%�%�%�%�%��B�I�n�%�%�%�%���rc��d}|�t|j|d��|�t|jt|d��d��dS)Nzfoobarrr)r*r�rr')r�fn_with_NULs  r�testConstructorHandlesNULCharsz-OtherFileTests.testConstructorHandlesNULChars�sP�� �����*�d�k�;��D�D�D����*�d�k�5��g�3N�3N�PS�T�T�T�T�Trc�(�|�t|jd��|�t|jt	����t
jdkr3ddl}|�t|jt	����dSdS)Ni����r�r)	r*r�rr�rr�r��msvcrt�
get_osfhandle)rrs  r�
testInvalidFdzOtherFileTests.testInvalidFd�s������*�d�k�3�7�7�7����'�4�;��
�
�>�>�>��<�7�"�	L��M�M�M����g�v�';�[�]�]�K�K�K�K�K�	L�	Lrc�l�d}	|�t|��}|���|�d|z��dS#t$r\}|jddkr:t
|��}t|vs||vr$|�d|z��Yd}~dSYd}~dSYd}~dSd}~wwxYw)N�qwertyzno error for invalid mode: %srz&bad error message for invalid mode: %s)rrrr�r��argsr)r�bad_moder�msg�ss     r�testBadModeArgumentz"OtherFileTests.testBadModeArgument�s����	B����F�H�-�-�A�
�G�G�I�I�I��I�I�5��@�A�A�A�A�A���	L�	L�	L��x��{�a��
L���H�H���Q�;�L�(�!�"3�L��I�I�F��J�K�K�K�K�K�K�K�K�K�
L�
L�
L�
L�
L�
L�L�L�L�L�L�L�����	L���s�A
�
B3�AB.�.B3c	���|�td��}|�tt	td��������|�|���d��|�d��|�|���d��|�|�	dtj��d��|�d��|�|���d��|�|�	dtj��d��|���dS)Nrr$r1rr3)
rrr&r'rTr(r)r%r�r6rE�SEEK_ENDrr�s  r�testTruncatezOtherFileTests.testTruncate�s���K�K���$�$��	����i��b�	�	�*�*�+�+�,�,�,���������2�&�&�&�	�
�
�1�
�
�
���������2�&�&�&��������2�;�/�/��3�3�3�	�
�
�2������������1�%�%�%��������2�;�/�/��4�4�4�	���	�	�	�	�	rc����fd�}	|��tjt��dS#tjt��wxYw)Nc�t����td��}|�tt	d������|�����td��}|�d��}|tt	d����kr��d|z��|���dkr*��d|���z��|�	��|���dkr*��d|���z��|���tj�t��}|dkr��d|z��dSdS)	Nr�zr+r1z(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)
rrr&r'r(rror�r%r�r r�getsize)r�data�sizers   �r�	bug801631z7OtherFileTests.testTruncateOnWindows.<locals>.bug801631�sg������F�C�(�(�A�
�G�G�E�%��)�)�$�$�%�%�%�
�G�G�I�I�I����F�4�(�(�A��6�6�!�9�9�D��u�U�1�X�X���&�
M��	�	�D�t�K�L�L�L��v�v�x�x�1�}�
E��	�	�8�1�6�6�8�8�C�D�D�D�
�J�J�L�L�L��v�v�x�x�1�}�
J��	�	�=������H�I�I�I�
�G�G�I�I�I��7�?�?�6�*�*�D��q�y�
G��	�	�>��E�F�F�F�F�F�
G�
Gr)r r�r)rr*s` r�testTruncateOnWindowsz$OtherFileTests.testTruncateOnWindows�s]���	G�	G�	G�	G�	G�.	��I�K�K�K��I�f�������B�I�f�������s	�
-�Ac�6�	ttd��}|�d��|���ttd��}|�d��|���ttd��}|���}|���|�|d��	t
jt��dS#YdSxYw#	t
jt��w#YwxYwxYw)Nr9sspamr�seggsrmsspameggs)r�rr&rror)r r�)rr�ds   r�
testAppendzOtherFileTests.testAppends���	��V�T�"�"�A�
�G�G�G����
�G�G�I�I�I��V�T�"�"�A�
�G�G�G����
�G�G�I�I�I��V�T�"�"�A������A�
�G�G�I�I�I����Q��,�,�,�
��	�&�!�!�!�!�!��
��������
��	�&�!�!�!�!��
��������s0�CC5�C-�-C2�5D�7D�D�D�Dc�L�|�t|jddd��dS)N�1r)r*r>rrs r�testInvalidInitzOtherFileTests.testInvalidInit's&�����)�T�[�#�q�!�<�<�<�<�<rc��td���5}|�|jg��|�t|jg��|�|jg��|�t|jdd��|�|jg��ddd��dS#1swxYwYdS)NT��quietz/some/invalid/namer�)rr)�warningsr*r>rr�)rrs  r�testWarningszOtherFileTests.testWarnings*s���
�$�
'�
'�
'�	-�1����Q�Z��,�,�,����i���b�9�9�9����Q�Z��,�,�,����j�$�+�7K�T�R�R�R����Q�Z��,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-�	-�	-s�BB3�3B7�:B7c����Gd�dt���G��fd�d|j���tjttj��}|���|��tj|��dS)Nc��eZdZdS)�=OtherFileTests.testUnclosedFDOnException.<locals>.MyExceptionN)r�r�r�r�rr�MyExceptionr93s�������rr:c�$���eZdZ���fd�Z�xZS)�:OtherFileTests.testUnclosedFDOnException.<locals>.MyFileIOc�n��|dkr�d���t�|���||��S)Nr�zblocked setting name)�super�__setattr__)rr��valuer:�MyFileIO�	__class__s   ���rr?zFOtherFileTests.testUnclosedFDOnException.<locals>.MyFileIO.__setattr__5s@����6�>�>�%�+�&<�=�=�=��X�t�,�,�8�8��u�E�E�Er)r�r�r�r?�
__classcell__)rBr:rAs@��rrAr<4sN��������
F�
F�
F�
F�
F�
F�
F�
F�
F�
F�
FrrA)�	Exceptionrr r��__file__r�r*r)rr�r:rAs  @@r�testUnclosedFDOnExceptionz(OtherFileTests.testUnclosedFDOnException2s�����*�*�*�*�*�)�*�*�*�	F�	F�	F�	F�	F�	F�	F�	F�t�{�	F�	F�	F�
�W�X�r�{�
+�
+�����+�x��4�4�4�
�������rN)r�r�r�r�r�rrrr�r�r��getfilesystemencodingrrrr r#r+r.r1r6rFr�rrr�r�ds2������(�(�(�T	?�	?�	?�
"�
"�
"����
�
�
��X�_�.�S�.�0�0�G�;�<�>�>�
&�
&�>�>�
&�U�U�U�
L�L�L�B�B�B� 
�
�
����:���$=�=�=�-�-�-�	�	�	�	�	rr�c�<�eZdZejZdZed���Zd�ZdS)�COtherFileTestsr�c��ddl}|�t|j|jdz��|�t|j|jdz
��dS)Nrr2)�	_testcapir*r>r�INT_MAX�INT_MIN)rrKs  r�testInvalidFd_overflowz&COtherFileTests.testInvalidFd_overflowBsZ��	�������)�T�[�)�2C�a�2G�H�H�H����)�T�[�)�2C�a�2G�H�H�H�H�Hrc�J�|�td��5}|���}ddd��n#1swxYwYtjt��5}|���}ddd��n#1swxYwY|�||��dS)Nrm)rrEror��	open_coder))rr�expected�actuals    r�test_open_codezCOtherFileTests.test_open_codeIs���[�[��4�
(�
(�	 �A��v�v�x�x�H�	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �
�]�8�
$�
$�	���V�V�X�X�F�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����6�*�*�*�*�*s!�=�A�A�!B�B�	BN)	r�r�r�r�rr�rrNrSr�rrrIrI>sK������
�Z�F��J��I�I��\�I�+�+�+�+�+rrIc�&�eZdZejZdZd�ZdS)�PyOtherFileTestsr�c���|�td��5}|���}ddd��n#1swxYwYtd���5}t	jt��5}|���}ddd��n#1swxYwY|�||��|�|jg��ddd��dS#1swxYwYdS)NrmTr3)	rrErorr��_open_code_with_warningr)r�r5)rrrQrrRs     rrSzPyOtherFileTests.test_open_codeWs����[�[��4�
(�
(�	 �A��v�v�x�x�H�	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �
�$�
'�
'�
'�	0�1��.�x�8�8�
"�A�������
"�
"�
"�
"�
"�
"�
"�
"�
"�
"�
"����
"�
"�
"�
"����X�v�.�.�.�����
�B�/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�	0�	0sE�=�A�A�C�2B�C�B	�C�B	�4C�C �#C N)r�r�r�r�rr�rSr�rrrUrUSs/������
�\�F��J�
0�
0�
0�
0�
0rrUc��tj�t��rtjt��dSdSr)r rrrr�r�rr�tearDownModulerYds:��
�w�~�~�f����
�	�&�������r�__main__)$r�r rEr�r�r�weakrefr�	functoolsr�test.supportrrr	r
r�test.support.os_helperrr
r�test.support.warnings_helperr�collectionsrr�r�r�TestCaser�r�r�rIrUrYr��mainr�rr�<module>rcs^���
�
�
�	�	�	�	�	�	�	�	�����������������������������������������I�H�H�H�H�H�H�H�H�H�7�7�7�7�7�7� � � � � � �
�
�
�
�����B�B�B�B�B�B�B�B�H
�����]�H�$5���������m�X�%6����
W�W�W�W�W�W�W�W�t+�+�+�+�+�n�h�&7�+�+�+�*0�0�0�0�0�~�x�'8�0�0�0�"����z����H�M�O�O�O�O�O��r