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

�

'ΜgA���ddlZddlZddlZddlZddlZddlmZmZddlm	Z	m
Z
ejd�ZdZ
Gd�dej�ZGd�d	ej �Zed
k(rej&�yy)�N)�findfile�warnings_helper)�TESTFN�unlink�imghdr))�
python.png�png)z
python.gif�gif)z
python.bmp�bmp)z
python.ppm�ppm)z
python.pgm�pgm)z
python.pbm�pbm)z
python.jpg�jpeg)zpython-raw.jpgr)z
python.ras�rast)z
python.sgi�rgb)zpython.tiff�tiff)z
python.xbm�xbm)zpython.webp�webp)z
python.exr�exrc��eZdZd�Zd�Zy)�UnseekableIOc�"�tj��N��io�UnsupportedOperation��selfs �-/usr/local/lib/python3.12/test/test_imghdr.py�tellzUnseekableIO.tell����%�%�%�c�"�tj�rr)r�args�kwargss   r�seekzUnseekableIO.seek!r!r"N)�__name__�
__module__�__qualname__r r&�r"rrrs��&�&r"rc�d�eZdZed��Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zy)�
TestImghdrc��tdd��|_t|jd�5}|j�|_ddd�y#1swYyxYw)Nr�
imghdrdata��subdir�rb)r�testfile�open�read�testdata)�cls�streams  r�
setUpClasszTestImghdr.setUpClass%s9����\�B���
�#�,�,��
%��!�;�;�=�C�L�&�
%�
%�s�A�Ac�"�tt�yr)rrrs r�tearDownzTestImghdr.tearDown+s	���v�r"c	��tD]�\}}t|d��}|jtj	|�|�t|d�5}|jtj	|�|�ddd�t|d�5}|j
�}ddd�|jtj	d�|�|jtj	dt|��|���y#1swY��xYw#1swY�mxYw)Nr.r/r1)�
TEST_FILESr�assertEqualr�whatr3r4�	bytearray)r�filename�expectedr7�datas     r�	test_datazTestImghdr.test_data.s���",��H�h����>�H����V�[�[��2�H�=��h��%��� � ����V�!4�h�?�&��h��%���{�{�}��&����V�[�[��t�4�h�?����V�[�[��y���?��J�#-�&�%��%�%�s�&C6�D�6C?	�D	c	��tD]e\}}|j|��5t|d��}|jtjt
j|��|�ddd��gy#1swY�rxYw)N)r@r.r/)r<�subTestrr=rr>�pathlib�Path)rr@rAs   r�test_pathlike_filenamez!TestImghdr.test_pathlike_filename9s\��",��H�h����x��0�#�H�\�B��� � ����W�\�\�(�-C�!D�h�O�1�0�#-�0�0�s�AA0�0A9	c���d�}tjj|�|jtjj�|jtj
dd�d�y)Nc�(�|jd�ryy)N�eggs�ham)�
startswith)�h�files  r�
test_jumboz1TestImghdr.test_register_test.<locals>.test_jumbo@s���|�|�G�$��%r"rKrL)r�tests�append�
addCleanup�popr=r>)rrPs  r�test_register_testzTestImghdr.test_register_test?sL��	�	�����J�'�������(�(�)�������T�7�3�U�;r"c��ttd�5}|jd�|j�}|j|j�ddd�ttd�5}|j�|j
tj|�d�|j
|j�|�ddd�y#1swY�yxYw#1swYyxYw)N�wbs
ababagalamagar1r	)	r3r�writer r5r&r=rr>)rr7�poss   r�
test_file_poszTestImghdr.test_file_posGs���
�&�$�
�6��L�L�)�*��+�+�-�C��L�L����'� ��&�$�
�6��K�K������V�[�[��0�%�8����V�[�[�]�C�0� �
�	 �
�� �
�s�=C�&AC�C�Cc�>�|jt�5tj�ddd�|jt�5tjd�ddd�|jt�5tj|j
d�ddd�|jt�5tjt
j|j
��ddd�t|j
d�5}|jt�5tj|j��ddd�ddd�y#1swY��,xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY�DxYw#1swYyxYw)N�r1)
�assertRaises�	TypeErrorrr>�AttributeErrorr2�os�fsencoder3�fileno)r�fs  r�
test_bad_argszTestImghdr.test_bad_argsQs���
�
�
�y�
)��K�K�M�*�
�
�
�~�
.��K�K���/�
�
�
�y�
)��K�K��
�
�q�)�*�
�
�
�~�
.��K�K����D�M�M�2�3�/�
�$�-�-��
&�!��"�"�>�2����A�H�H�J�'�3�'�
&�*�
)��
.�
.��
)�
)��
.�
.��3�2��'�
&�sS�E�E"�;!E/�93E;�
F� $F�F�E�"E,�/E8�;F�F	�F�Fc�\�dD]'}|jtjd|���)y)N)s�PN
s�sY�scutecats	000000JFIsGIF80)�assertIsNonerr>)r�headers  r�test_invalid_headerszTestImghdr.test_invalid_headers^s)��!�F�
���f�k�k�$��7�8�
!r"c�f�tj�5tjdt�tD]�\}}t|d��}t
|d�5}|j�jd�}ddd�|jt�5tjtj��ddd�|jt�5tjd�ddd���	ddd�y#1swY��xYw#1swY�UxYw#1swY��xYw#1swYyxYw)N�ignorer.r/r1�latin1)�warnings�catch_warnings�simplefilter�BytesWarningr<rr3r4�decoder]r^rr>r�StringIO)rr@�_r7rBs     r�test_string_datazTestImghdr.test_string_datags���
�
$�
$�
&��!�!�(�L�9�)���!�#�H�\�B���(�D�)�V�!�;�;�=�/�/��9�D�*��&�&�y�1��K�K����D� 1�2�2��&�&�y�1��K�K��d�+�2�1�
 *�'�
&�*�)��1�1��1�1��'�
&�sT�AD'� D�5D'�)D�;D'�D�/
D'�D�D'�D�D'�D$� D'�'D0c��|jt�5tjd�ddd�y#1swYyxYw)N�missing)r]�FileNotFoundErrorrr>rs r�test_missing_filezTestImghdr.test_missing_filess)��
�
�
�0�
1��K�K�	�"�2�
1�
1�s�5�>c��t|jd�}|j�|jt�5}t
j
|�ddd�tj|j�}|j�|jt�5}t
j
|�ddd�y#1swY�lxYw#1swYyxYw)Nr1)
r3r2�closer]�
ValueErrorrr>r�BytesIOr5�rr7�cms   r�test_closed_filezTestImghdr.test_closed_filews����d�m�m�T�*������
�
�
�z�
*�b��K�K���+����D�M�M�*������
�
�
�z�
*�b��K�K���+�
*�	+�
*��+�
*�s�B=�C	�=C�	Cc�`�ttd�5}|j|j�ddd�t	td�5}|jtj�5tj|�ddd�ddd�y#1swY�`xYw#1swY�xYw#1swYyxYw)NrWr1)
r3rrXr5rr]rrrr>)rr7s  r�test_unseekablezTestImghdr.test_unseekable�sw��
�&�$�
�6��L�L����'� �
�&�$�
'�6��"�"�2�#:�#:�;����F�#�<�(�
'� �
��<�;��(�
'�s/�B� B$�%B�;B$�B�B!	�B$�$B-c�$�ttd�5}|j|j�|j	d�|jt�5}tj|�ddd�ddd�y#1swY�xYw#1swYyxYw)NrWr)	r3rrXr5r&r]�OSErrorrr>r|s   r�test_output_streamzTestImghdr.test_output_stream�sd��
�&�$�
�6��L�L����'��K�K��N��"�"�7�+�r����F�#�,� �
�,�+�� �
�s$�AB�A:�)B�:B	�?B�BN)r'r(r)�classmethodr8r:rCrHrUrZrdrhrsrwr~r�r�r*r"rr,r,$sR���)��)�
�	K�P�<�1�(�9�
,�#� �$�$r"r,�__main__)rr`rF�unittestrl�test.supportrr�test.support.os_helperrr�import_deprecatedrr<�FileIOr�TestCaser,r'�mainr*r"r�<module>r�sr��	�	����2�1�	*��	*�	*�8�	4���
�"&�2�9�9�&�i$��"�"�i$�V�z���H�M�M�O�r"

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