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_xmlrpc.cpython-312.pyc

�

'ΜgQ�����ddlZddlZddlZddlZddlZddlZddlmZddlmZ	ddl
ZddlZ
ddl
Z
ddlZ
ddlZddlZddlZddlZddlZddlmZddlmZddlmZddlmZddlmZmZmZ	ddlZej>d�	�d
ddd
dge	j@d�de!d�ddde	jDd�e	jDd�e	jDejdd
dddd��d�gZ#Gd�dejH�Z%Gd�dejH�Z&Gd�d ejH�Z'Gd!�d"ejH�Z(Gd#�d$ejH�Z)Gd%�d&ejH�Z*dxa+xa,a-dMd'�Z.dNd(�Z/d)�Z0d*�Z1Gd+�d,ejH�Z2Gd-�d.e2�Z3Gd/�d0e2�Z4Gd1�d2e2�Z5Gd3�d4e2�Z6Gd5�d6e6�Z7Gd7�d8e6�Z8ejredud9�Gd:�d;e2��Z:ejredud9�Gd<�d=ejH��Z;Gd>�d?e2�Z<Gd@�dAejH�Z=GdB�dCe
jj|�Z?GdD�dEejH�Z@ej�dOdF��ZBGdG�dHejH�ZCGdI�dJejH�ZDdK�ZEeFdLk(rej��yy#e$rdZY��pwxYw)P�N)�mock)�support)�	os_helper)�
socket_helper)�threading_helper)�	ALWAYS_EQ�LARGEST�SMALLESTT)�modulezfoo@bar.baz.spamgH�zns�@i�z.zyx.41�my dog has fleasFu	䀀怀耀z
regular value�20050210T11:41:23)	��r�
��)�r����rrrrr)�astring�afloat�anint�
ashortlong�anotherlist�abase64�b64bytes�b64bytearray�boolean�unicodeuukey䀀�	datetime1�	datetime2�	datetime3c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�XMLRPCTestCasec��tjtf�}tj|�}|j	t|dd�y)Nr)�	xmlrpclib�dumps�alist�loads�assertEqual)�self�dump�loads   �-/usr/local/lib/python3.12/test/test_xmlrpc.py�test_dump_loadzXMLRPCTestCase.test_dump_load2s8������x�(�����t�$�������Q���
�+�c��tjdddddd�}|j|tjd��tj|f�}tj
|d�	�\}}|\}|j||�|j
t|�tj�|j|�tj
|d
�	�\}}|\}|j||�|j
t|�tj�|j|�tj
|d��\}}|\}|j||�|j
t|�tj�|j|�tj
|d
��\}}|\}|j||�|j
t|�tj�|j|�y)NrrrrrrrT��use_builtin_typesF)�use_datetime�	�datetimer*r&�DateTimer'r)�assertIs�type�assertIsNone�r+�dt�s�result�m�newdts      r.�test_dump_bare_datetimez&XMLRPCTestCase.test_dump_bare_datetime7s���
�
�
�t�Q��B��B�
7������Y�/�/�0C�D�E��O�O�R�E�"���O�O�A��>�	�����������#��
�
�d�5�k�8�#4�#4�5����!���O�O�A��?�	�����������#��
�
�d�5�k�9�#5�#5�6����!���O�O�A�D�9�	�����������#��
�
�d�5�k�8�#4�#4�5����!���O�O�A�E�:�	�����������#��
�
�d�5�k�9�#5�#5�6����!�r0c�V�tjdddddd�}|j|tjd��tj|f�}tj
|d�	�\}}|\}|j||�|j
t|�tj�|j|�tj
|d
�	�\}}|\}|j||�|j
t|�tj�|j|�y)Nrrrrrrz00010210T11:41:23Tr2Fr5r;s      r.�test_datetime_before_1900z(XMLRPCTestCase.test_datetime_before_1900Ys���
�
�
�q�1�b�"�b�"�
5������Y�/�/�0C�D�E��O�O�R�E�"���O�O�A��>�	�����������#��
�
�d�5�k�8�#4�#4�5����!���O�O�A��?�	�����������#��
�
�d�5�k�9�#5�#5�6����!�r0c�(�tj�}tjtj|fd���\\}}|j	|j
t�tj|fd��}|j	|t�y)NT��methodresponse)r&r7r)r'�assertIsInstance�value�str)r+�d�new_d�dummyr=s     r.�test_bug_1164912zXMLRPCTestCase.test_bug_1164912ksq����� ��%�O�O�I�O�O�Q�D�;?�-A�B���%�5����e�k�k�3�/�
�O�O�U�H�T�:�����a��%r0c���Gd�dt�}|�}d|_d|_tjtj
|f��\\}}|j
||j�y)Nc��eZdZy)�-XMLRPCTestCase.test_newstyle_class.<locals>.TN)�__name__�
__module__�__qualname__�r0r.�TrPvs��r0rU�d�Hello)�object�x�yr&r)r'r*�__dict__)r+rU�t�t2rLs     r.�test_newstyle_classz"XMLRPCTestCase.test_newstyle_classusV��	��	�
�C��������"������!��)>�?���"������Q�Z�Z�(r0c�V�|jttjddzf�y)Nr�c)�assertRaises�
OverflowErrorr&r'�r+s r.�test_dump_big_longz!XMLRPCTestCase.test_dump_big_long~s�����-����1�b�5�(�Cr0c�T�|jttjddif�y)N�rr�r�ra�	TypeErrorr&r'rcs r.�test_dump_bad_dictz!XMLRPCTestCase.test_dump_bad_dict�s�����)�Y�_�_���|�o�Fr0c��gd�}ddd|g}|j|�|jttj|f�y)Nrfrg��)�appendrarir&r')r+�lr\s   r.�test_dump_recursive_seqz&XMLRPCTestCase.test_dump_recursive_seq�s7����
�q��1�I��	��������)�Y�_�_�q�d�;r0c�n�ddd�}d|d�}||d<|jttj|f�y)Nr)�1�2rg)�3rJr\rh�r+rJr\s   r.�test_dump_recursive_dictz'XMLRPCTestCase.test_dump_recursive_dict�s5����N����N����#�����)�Y�_�_�q�d�;r0c�D�tjdkDr/|jttj
t
d�f�t	j
tjtjf�|jttj
tjdzf�|jttj
tjdz
f�d�}t	j�}|jtj|�|jtj|�|jt|jtjdz|�|jt|jtjdz
|�y)Ni����rc��y�NrT�r=s r.�dummy_writez5XMLRPCTestCase.test_dump_big_int.<locals>.dummy_write����r0)�sys�maxsizerarbr&r'�int�MAXINT�MININT�
Marshaller�dump_int�r+r|r?s   r.�test_dump_big_intz XMLRPCTestCase.test_dump_big_int�s#���;�;�� ����m�Y�_�_�"�5�z�m�
-�	����)�)�9�+;�+;�<�=����-����$�+�+�A�-�/�	1����-����$�+�+�A�-�/�	1�	�
� � �"��	�
�
�9�#�#�[�1�	�
�
�9�#�#�[�1����-����#�*�*�1�,�k�	;����-����#�*�*�1�,�k�	;r0c��tjtd�f�tjttj�ttj�f�tjttjdz�ttjdz
�f�d�}tj
�}|j
tj|�|j
tj|�|j
tjdz|�|j
tjdz
|�y)Nrx�*c��yrzrTr{s r.r|z4XMLRPCTestCase.test_dump_double.<locals>.dummy_write�r}r0)r&r'�floatr�r�r��dump_doubler�s   r.�test_dump_doublezXMLRPCTestCase.test_dump_double�s�������w��)�*�����y�/�/�0��y�/�/�0�2�	3�����y�/�/�"�4�5��y�/�/�"�4�5�7�	8�	�
� � �"��	�
�
�i�&�&��4�	�
�
�i�&�&��4�	�
�
�i�&�&��+�[�9�	�
�
�i�&�&��+�[�9r0c��tdgz}tdgzf}tj|d��}|j|tj|�dd�|jttj|f�y)NT)�
allow_noner)r(r&r'r*r)rari)r+rH�arg1�strgs    r.�test_dump_nonezXMLRPCTestCase.test_dump_none�si����������� �����t��5������#�/�/�$�/��2�1�5�	7����)�Y�_�_�t�g�>r0c���ddi}tj|fd��}d|z}|jtj|�dd|�|j	dd�}|jtj|�dd|�tj|fdd�	�}|jtj|�dd|�|j	dd�}|jtj|�dd|�d
}tj|fd|��}|jtj|�dd|�|jtj|�d|�y)
Nukey€¤u
value€¤�iso-8859-15��encodingz,<?xml version='1.0' encoding='iso-8859-15'?>r�xmlcharrefreplaceT)r�rFumethod€¤)r��
methodnamer)r&r'r*r)�encode)r+rHr�r�s    r.�test_dump_encodingz!XMLRPCTestCase.test_dump_encoding�sM�� �"�$������x�-�@��=��D���������.�q�1�!�4�e�<��{�{�=�*=�>���������.�q�1�!�4�e�<�����x�-�.2�4���������.�q�1�!�4�e�<��{�{�=�*=�>���������.�q�1�!�4�e�<�'�
�����x�-�*4�6���������.�q�1�!�4�e�<��������.�q�1�:�>r0c�b�d}|j|tj|��tttjfD]�}||�}tj
|f�}tj|d��\}}|\}|j||�|jt|�t�|j|�tj|d��\}}|\}|j||�|jt|�tj�|j|���y)Nr
Tr2F)
r*r&�Binary�bytes�	bytearrayr'r)r8r9r:)r+�sample�type_rHr=r>r?�newvalues        r.�test_dump_byteszXMLRPCTestCase.test_dump_bytes�s���$�������!1�!1�&�!9�:��I�y�'7�'7�7�E��&�M�E������)�A�!����T�B�I�F�A� �K�X����X�v�.��M�M�$�x�.�%�0����a� �!����U�C�I�F�A� �K�X����X�v�.��M�M�$�x�.�)�*:�*:�;����a� �8r0c��tj}d}|j|tj|�d}|j|tj|�d}|j|tj|�y)Nz6<params><param><value><spam/></value></param></params>zT<params><param><value><array><value><spam/></value></array></value></param></params>z�<params><param><value><struct><member><name>a</name><value><spam/></value></member><member><name>b</name><value><spam/></value></member></struct></value></param></params>)r&�
ResponseErrorrar))r+r��datas   r.�test_loads_unsupportedz%XMLRPCTestCase.test_loads_unsupported�sf��!�/�/�
�G�����-����$�?�4��	
���-����$�?�5��	
���-����$�?r0c���d|z}tj|fi|��\}}|\}|j||�|jt	|�t	|��|j|�y)Nz1<params><param><value>%s</value></param></params>)r&r)r*r8r9r:)r+r=rH�kwargsr,r>r?r�s        r.�check_loadszXMLRPCTestCase.check_loads�s^��B�Q�F���O�O�D�3�F�3�	����������5�)��
�
�d�8�n�d�5�k�2����!�r0c��|j}|dd�|dd�|dd�|dd�|dd�|d	d�|d
d�|dd
�|dtjd��|ddd��|dtjd��|dt	jdddddd�d��|dddg�|dddd��y)N�stringz<string>string</string>u4<string>𝔘𝔫𝔦𝔠𝔬𝔡𝔢 string</string>u#𝔘𝔫𝔦𝔠𝔬𝔡𝔢 stringz<int>2056183947</int>i��zz<int>-2056183947</int>iuq�z<i4>2056183947</i4>z<double>46093.78125</double>g���@z<boolean>0</boolean>Fz%<base64>AGJ5dGUgc3RyaW5n/w==</base64>s
byte string�Tr2z6<dateTime.iso8601>20050210T11:41:23</dateTime.iso8601>rrrrrrrzR<array><data><value><int>1</int></value><value><int>2</int></value></data></array>rz�<struct><member><name>b</name><value><int>2</int></value></member><member><name>a</name><value><int>1</int></value></member></struct>)�a�b)r�r&r�r7r6�r+�checks  r.�test_load_standard_typesz'XMLRPCTestCase.test_load_standard_types�s���� � ��
�h��!�
�'��2�
�D�Fk�l�
�%�z�2�
�&��4�
�#�Z�0�
�,�k�:�
�$�e�,�
�5����5�6�	8�
�5�$��	>�
�F�� � �!4�5�	7�
�F�����a��R��R�8� $�	&�	� �"#�Q��	)�	��"#��+�	-r0c���|j}|dd�|dd�|dd�|dd�|dd�|d	d
�|dd�|d
tjd��y)Nz<nil/>z	<ex:nil/>z<i1>205</i1>��z<i2>20561</i2>iQPz<i8>9876543210</i8>l�`	z-<biginteger>98765432100123456789</biginteger>l5�?�4*UUz<float>93.78125</float>grW@z.<bigdecimal>9876543210.0123456789</bigdecimal>z9876543210.0123456789)r��decimal�Decimalr�s  r.�test_load_extension_typesz(XMLRPCTestCase.test_load_extension_typessr��� � ��
�h���
�k�4� �
�n�c�"�
���&�
�#�Z�0�
�=�"�	$�
�'��2�
�>��o�o�5�6�	8r0c�`�|j}d}tj|�5d|dzz}|jt�5|d|�d�d�ddd�|jt�5|d|�d�d�ddd�ddd�y#1swY�=xYw#1swY�xYw#1swYyxYw)Ni�rrrz<int>z</int>z<biginteger>z
</biginteger>)r�r�adjust_int_max_str_digitsra�
ValueError)r+r��	maxdigitsr=s    r.�test_limit_intzXMLRPCTestCase.test_limit_int$s���� � ���	�
�
.�
.�y�
9��y�1�}�%�A��"�"�:�.���a�S��'��.�/��"�"�:�.���Q�C�}�5�t�<�/�	:�
9�.�.��.�.��	:�
9�s;�B$�B�B$�-B�;B$�B	�B$�B!	�B$�$B-c��tjj�}|j|j	d�ddgif�y)Nz
user@host.tldzhost.tld)�
AuthorizationzBasic dXNlcg==)�xmlrpc�client�	Transportr*�
get_host_info)r+�transps  r.�test_get_host_infoz!XMLRPCTestCase.test_get_host_info.sA�����(�(�*������-�-�o�>�%�?�@�"�F�	Gr0c��	ddl}d}	tjj	d�j�y#t$rd}Y�<wxYw#t$r|j|d�Yyt$r|j|�YywxYw)NrTFzhttps://localhost:9999z&xmlrpc client's error with SSL support)
�ssl�ImportErrorr�r��ServerProxy�bad_function�NotImplementedError�assertFalse�OSError�
assertTrue)r+r��has_ssls   r.�test_ssl_presencez XMLRPCTestCase.test_ssl_presence5s~��	���G�	%��M�M�%�%�&>�?�L�L�N���	��G�	��#�	P����W�&N�O��	%��O�O�G�$�	%�s&�7�-A�A�A�B�%B�Bc�t��Gd�dtjj�}�fd�}tjjtj
df|��|j
�j�tj|��}|j�|j
|j�dj�j�}tj|�5}|j!|j#�d�|j!|j#�d�ddd�y#1swYyxYw)Nc� �eZdZdZdZd�Zd�Zy)�@XMLRPCTestCase.test_keepalive_disconnect.<locals>.RequestHandler�HTTP/1.1Fc���t|jjd��}|jj	|�|j
rd|_ytjdd��}|j�}|jtjj�|jdt|��|j!�|j"j%|�d|_d|_y)N�Content-LengthT)rmrEF)r��headers�get�rfile�read�handled�close_connectionr&r'r��
send_response�http�
HTTPStatus�OK�send_header�len�end_headers�wfile�write)r+�length�responses   r.�do_POSTzHXMLRPCTestCase.test_keepalive_disconnect.<locals>.RequestHandler.do_POSTHs����T�\�\�-�-�.>�?�@���
�
����'��<�<�,0�D�)��$�?�?�4��E��#�?�?�,���"�"�4�?�?�#5�#5�6�� � �!1�3�x�=�A�� � �"��
�
� � ��*�#���(-��%r0c��yrzrT)r+�format�argss   r.�log_messagezLXMLRPCTestCase.test_keepalive_disconnect.<locals>.RequestHandler.log_messageWs��r0N)rQrRrS�protocol_versionr�r�r�rTr0r.�RequestHandlerr�Ds��)���G�

.�
r0r�c����jjtd���j��j�y�Nr)�socket�
settimeoutr��handle_request)�servers�r.�
run_serverz<XMLRPCTestCase.test_keepalive_disconnect.<locals>.run_server[s1����M�M�$�$�U�1�X�.��!�!�#��!�!�#r0r)�targetz
http://{}:{}/rm)r�r��BaseHTTPRequestHandler�
HTTPServerr�HOST�
addCleanup�server_close�	threading�Thread�start�joinr��server_addressr&r�r*�method)r+r�r��thread�url�pr�s      @r.�test_keepalive_disconnectz(XMLRPCTestCase.test_keepalive_disconnectCs����	�T�[�[�?�?�	�.	$�
���'�'��);�);�Q�(?��P������+�+�,��!�!��4������������$�$�o�$�$�f�&;�&;�<��
�
"�
"�3�
'�1����Q�X�X�Z��+����Q�X�X�Z��+�(�
'�
'�s
�$AD.�.D7N)rQrRrSr/rArCrMr^rdrjrprvr�r�r�r�r�r�r�r�r�r�r�r�rrTr0r.r$r$0su��,�
�D�$&�)�D�G�<�<�;�,:� ?�?�*!�&@��-�68�=�G�%�%,r0r$c�F�eZdZGd�de�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�SimpleXMLRPCDispatcherTestCasec��eZdZdZy)�*SimpleXMLRPCDispatcherTestCase.DispatchExczSRaised inside the dispatched functions when checking for
        chained exceptionsN)rQrRrS�__doc__rTr0r.�DispatchExcrls��	r0rc����d}�fd�}tjj�}|j|��j	�j
�5}|j
d|�ddd��jjj|f��j|jj��j|jj�y#1swY�{xYw)z$Calls explicitly registered functionrfc�&���j|��rz)r)�paramsr+s �r.�dispatched_funczQSimpleXMLRPCDispatcherTestCase.test_call_registered_func.<locals>.dispatched_funcws����"�"�6�*�*r0rN)
r�r��SimpleXMLRPCDispatcher�register_functionrar�	_dispatchr*�	exceptionr�r:�	__cause__�__context__)r+�
exp_paramsr�
dispatcher�exc_ctxs`    r.�test_call_registered_funcz8SimpleXMLRPCDispatcherTestCase.test_call_registered_funcps����
�
�	+��]�]�9�9�;�
��$�$�_�5�
�
�
�t�/�/�
0�G�� � �!2�J�?�1�����*�*�/�/�*��?����'�+�+�5�5�6����'�+�+�7�7�8�	1�
0�s�C � C)c���d}Gd�d�}tjj�}|j|��|j	|j
�5}|j
d|�ddd�|jjj|f�|j|jj�|j|jj�y#1swY�{xYw)z3Calls a registered instance attribute as a functionrfc��eZdZd�Zy)�OSimpleXMLRPCDispatcherTestCase.test_call_instance_func.<locals>.DispatchedClassc�,�tj|��rz�rr)r+r
s  r.rz_SimpleXMLRPCDispatcherTestCase.test_call_instance_func.<locals>.DispatchedClass.dispatched_func�s��4�@�@��H�Hr0N)rQrRrSrrTr0r.�DispatchedClassr�s��
Ir0rrN�
r�r�r�register_instancerarrr*rr�r:rr)r+rrrrs     r.�test_call_instance_funcz6SimpleXMLRPCDispatcherTestCase.test_call_instance_func�s���
�
�	I�	I��]�]�9�9�;�
��$�$�_�%6�7�
�
�
�t�/�/�
0�G�� � �!2�J�?�1�����*�*�/�/�*��?����'�+�+�5�5�6����'�+�+�7�7�8�	1�
0�s�C)�)C2c���d}d}Gd�d�}tjj�}|j|��|j	|j
�5}|j
||�ddd�|jjj||f�|j|jj�|j|jj�y#1swY�|xYw)z4Calls the registered instance's `_dispatch` functionr�rfc��eZdZd�Zy)�LSimpleXMLRPCDispatcherTestCase.test_call_dispatch_func.<locals>.TestInstancec�.�tj||��rzr)r+r�r
s   r.rzVSimpleXMLRPCDispatcherTestCase.test_call_dispatch_func.<locals>.TestInstance._dispatch�s��4�@�@��F�$�$r0N)rQrRrSrrTr0r.�TestInstancer!�s��
$r0r#Nr)r+�
exp_methodrr#rrs      r.�test_call_dispatch_funcz6SimpleXMLRPCDispatcherTestCase.test_call_dispatch_func�s���
�
��
�	$�	$�
�]�]�9�9�;�
��$�$�\�^�4�
�
�
�t�/�/�
0�G�� � ��Z�8�1�����*�*�/�/�*�j�1I�J����'�+�+�5�5�6����'�+�+�7�7�8�	1�
0�s�C,�,C5c���tjj�}|jdd��|j	t
d�5|j
dd�ddd�y#1swYyxYw)z2Calls explicitly registered function which is NoneNr���name��param)r�r�rr
�assertRaisesRegex�	Exceptionr�r+rs  r.�test_registered_func_is_nonez;SimpleXMLRPCDispatcherTestCase.test_registered_func_is_none�sU���]�]�9�9�;�
��$�$�T��$�9�
�
#�
#�I�x�
8�� � ��:�6�9�
8�
8�s�A$�$A-c���tjj�}|jt	��|jtd�5|jdd�ddd�y#1swYyxYw)z>Attempts to call nonexistent function on a registered instancer�r)N)r�r�rrrXr+r,rr-s  r.�test_instance_has_no_funcz8SimpleXMLRPCDispatcherTestCase.test_instance_has_no_func�sR���]�]�9�9�;�
��$�$�V�X�.�
�
#�
#�I�x�
8�� � ��:�6�9�
8�
8�s�A*�*A3c��tjj�}|jtd�5|jdd�ddd�y#1swYyxYw)z2Calls a function that the dispatcher cannot locater�r)N)r�r�rr+r,rr-s  r.�test_cannot_locate_funcz6SimpleXMLRPCDispatcherTestCase.test_cannot_locate_func�sB���]�]�9�9�;�
�
�
#�
#�I�x�
8�� � ��:�6�9�
8�
8�s�A�AN)rQrRrSr,rrrr%r.r0r2rTr0r.rrks,���i��9�$9�&9�*7�7�7r0rc��eZdZd�Zy)�HelperTestCasec���|jtjd�d�|jtjd�d�|jtjd�d�y)Nza&bza&amp;bza<bza&lt;bza>bza&gt;b)r*r&�escapercs r.�test_escapezHelperTestCase.test_escape�sS������)�)�%�0�)�<�����)�)�%�0�(�;�����)�)�%�0�(�;r0N)rQrRrSr7rTr0r.r4r4�s��<r0r4c��eZdZd�Zd�Zd�Zy)�
FaultTestCasec��tjdd�}|jt|�d�|jt|�t	|��y)Nr��
Test Faultz<Fault 42: 'Test Fault'>)r&�Faultr*�reprrI)r+�fs  r.�	test_reprzFaultTestCase.test_repr�s?���O�O�B��-������a��"<�=�����a��#�a�&�)r0c��tjdd�}tj|f�}tj|�\\}}|j	|ddd��|j	|d�tj
�j|�}|j
tjtj|�y)Nr�r;)�	faultCode�faultString)r&r<r'r)r*r�ra)r+r>r=�newfr?s     r.�test_dump_faultzFaultTestCase.test_dump_fault�s����O�O�B��-���O�O�Q�D�!���_�_�Q�'�
��������R��M�N�����D�!�� � �"�(�(��+�����)�/�/�9�?�?�A�>r0c���|jttjjt
d�|j
tjj	t
d��y�N�__add�title)ra�AttributeErrorr�r��resolve_dotted_attributerIr�rcs r.�test_dotted_attributez#FaultTestCase.test_dotted_attribute�sC��	
���.� �-�-�@�@�#�w�	P�����
�
�>�>�s�G�L�Mr0N)rQrRrSr?rDrKrTr0r.r9r9�s��*�
?�Nr0r9c�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�DateTimeTestCasec�B�tjd�5}tjgd��}||_tj
�}t
j�}|jt|�tjd|��ddd�y#1swYyxYw)Nztime.localtime)	i���r��1r��r�%Y%m%dT%H:%M:%S)r�patch�time�struct_time�return_value�	localtimer&r7r*rI�strftime)r+�localtime_mock�time_structrYr\s     r.�test_defaultzDateTimeTestCase.test_default�sv��
�Z�Z�(�
)�^��*�*�3�5�K�*5�N�'����(�I��"�"�$�A����S��V�!�]�]�+<�i�H�
J�
*�
)�
)�s�A6B�Bc	��d}tj|�}|jt|�t	j
dt	j|���y�Ngl]�ޮ��ArT)r&r7r*rIrVrZrYrus   r.�	test_timezDateTimeTestCase.test_time�sD�������q�!������Q�����'8�$�.�.��:K�L�	Nr0c�h�d}tj|�}|jt|�d�y)N)	����	r�&�2rm�rz20070609T10:38:50)r&r7r*rIrus   r.�test_time_tuplez DateTimeTestCase.test_time_tuple�s,��'�����q�!������Q��!4�5r0c��tjd�}tj|�}|j	t|�tjd|��yr_)rVrYr&r7r*rIrZrus   r.�test_time_structz!DateTimeTestCase.test_time_struct�sA���N�N�,�-�����q�!������Q�����/@�!�!D�Er0c��tjdddddd�}tj|�}|jt	|�d�y)Nrbrrrgrlrmz20070102T03:04:05)r6r&r7r*rIrus   r.�test_datetime_datetimez'DateTimeTestCase.test_datetime_datetime�sA�����d�1�Q�q��1�-�����q�!������Q��!4�5r0c��tjdddddd�}tj|�}dt|�z}|j	t|�|�y)Nrbrrrgrlrmz%<DateTime '20070102T03:04:05' at %#x>)r6r&r7�idr*r=)r+rJr\�vals    r.r?zDateTimeTestCase.test_repr�sN�����d�1�Q�q��1�-�����q�!��
4�r�!�u�
<������a��#�&r0c
��d}tj�}|j|�tjtjdddddd��}|j	||�tj
|�}|j	||�y)Nz 20070908T07:11:13  rbrd�rOr�
)r&r7�decoder6r*�	_datetime)r+rJ�t1�trefr]s     r.�test_decodezDateTimeTestCase.test_decodesu��"��
�
�
�
!��
�	�	�!���!�!�(�"3�"3�D��1�Q�r�"�"E�F������T�"�
�
 �
 ��
#������T�"r0c���tjj�}tj|j	��}|j||k(�|j||k(�|tjd��z}|j||k\�|j||k�|jd�}|j||k(�|j||k(�tj|j	��}|j||k\�|j||k�|jd�}|j	�}|j|dk(�|j||k7�|j|t|�k(�|j||k7�|jt�5|td�kddd�|jt�5||kDddd�|jt�5|t|�kddd�|jt�5||k\ddd�|j|tk(�|j|tk7�|j|tk�|j|tkD�|j|tk�|j|tk\�|j|t k�|j|t kD�|j|t k�|j|t k\�y#1swY��mxYw#1swY��WxYw#1swY��8xYw#1swY��"xYw)Nrl)�secondsrT�asciii�)r6�nowr&r7�	timetupler��	timedeltarZr�r�r�rarir�rr	r
)r+r{�dtime�then�dstr�
dtime_then�dbytes�dtuples        r.�test_comparisonz DateTimeTestCase.test_comparisons������#�#�%���"�"�3�=�=�?�3��	
������%�����u��%��X�'�'��2�2�������
�&�������%��|�|�-�.�������
�&������
�&��'�'����(8�9�
����
�d�*�+�����z�)�*����W�%�����������$��'�������(�����)�F�"3�3�4�������(�
�
�
�y�
)��E�$�K��*�
�
�
�y�
)��F�N�*�
�
�
�y�
)��Y�v�&�&�*�
�
�
�y�
)��V�O�*�	
�����*�+�����)�+�,�������(�������)������(�)�����'�)�*������)�*������(�)�����(�*�+������)�*�%*�
)��
)�
)��
)�
)��
)�
)�s0�>L8�*M�
M�9M�8M�M�M�M)N)rQrRrSr]r`rhrjrlr?rwr�rTr0r.rMrM�s-��J�N�6�
F�
6�
'�#�,+r0rMc��eZdZd�Zd�Zd�Zy)�BinaryTestCasec�b�tj�}|jt|�d�y)N��r&r�r*rI)r+r\s  r.r]zBinaryTestCase.test_defaultEs$�����������Q���$r0c�|�d}tj|�}|jt|�t|d��y�Nsabc123��zlatin-1r�rus   r.�test_stringzBinaryTestCase.test_stringIs2��)�����Q�������Q���Q�	�!2�3r0c�:�d}tj|�}tj�}|j	|�|jt
|�t
|d��tj|�}|jt
|�t
|d��yr�)�base64�encodebytesr&r�rsr*rI�_binary)r+rJ�derur]s     r.rwzBinaryTestCase.test_decodeNsv��)��
�
�
��
"��
�
�
�
��
�	�	�"�
�����R��#�a��"3�4�
�
�
�r�
"������R��#�a��"3�4r0N)rQrRrSr]r�rwrTr0r.r�r�>s��%�4�
5r0r�c��Gd�d�}Gd�dtjj�}|stjj}|d||dd��}	|j	�|j
j
�\aadttfza	|j�|j�|j�|jt�|jd	�d
�|jd��}|jd�
�d��}|�}	|j|	d��|j!�|dkDr|j#�|dz}|dkDr�|j
j'�da|j!�y#t$$rY�8wxYw#|j
j'�da|j!�wxYw)Nc�,�eZdZd�Zd�ZGd�d�Zy)�&http_server.<locals>.TestInstanceClassc��||zSrzrT�r+rYrZs   r.�divz*http_server.<locals>.TestInstanceClass.div`�����6�Mr0c��|dk(ryy�Nr��This is the div functionrT�r+r(s  r.�_methodHelpz2http_server.<locals>.TestInstanceClass._methodHelpc����u�}�1�r0c��eZdZed��Zy)�.http_server.<locals>.TestInstanceClass.Fixturec��y)N�42rTrTr0r.�getDataz6http_server.<locals>.TestInstanceClass.Fixture.getDatahs��r0N)rQrRrS�staticmethodr�rTr0r.�Fixturer�gs��
�
��
r0r�N)rQrRrSr�r�r�rTr0r.�TestInstanceClassr�_s��	�	2�	�	r0r�c��eZdZd�Zy)�#http_server.<locals>.MyXMLRPCServerc�f�|jj�\}}|jd�||fS�NT�r��accept�setblocking�r+r=�ports   r.�get_requestz/http_server.<locals>.MyXMLRPCServer.get_requestm�/���k�k�(�(�*�G�A�t�
�M�M�$���d�7�Nr0N�rQrRrSr�rTr0r.�MyXMLRPCServerr�l���	r0r���	localhostrF)r��logRequests�bind_and_activate�http://%s:%dc��|SrzrT)rYs r.�<lambda>zhttp_server.<locals>.<lambda>�s��r0�têštc��y��This is my functionTrTrTr0r.�my_functionz http_server.<locals>.my_function�s��r0�addr'c��||zSrzrT�rYrZs  r.�_zhttp_server.<locals>._�s���q�5�Lr0T)�allow_dotted_namesrr)r�r��SimpleXMLRPCServer�SimpleXMLRPCRequestHandler�server_bindr��getsockname�ADDR�PORT�URL�server_activate� register_introspection_functions�register_multicall_functionsr
�powr�setr��TimeoutError�close)
�evt�numrequests�requestHandlerr�r�r��servr�r��testInstances
          r.�http_serverr�^s���������9�9������A�A���*�N�#+�&+�u�F�D�#������[�[�,�,�.�
��d�
�d�D�\�)�������-�-�/��)�)�+����s�#����{�H�5�	
�	�	�	�
 �	�
�	�	�U�	�	+�	�
,�	�(�*�����|���E����	��A�o����!��1��K��A�o�	
�����������	���
��
��	
�����������	�s%�DF
�
	F�F�F�F�.G
c��Gd�d�}d�}Gd�dtjj�}|stjj}Gd�d|�}Gd�d	�}|d
|dd��}|jjd
�|j
�	|jj�\aa	dttfza
|j�gd�}	|	D]e}
|j|
tjj��}|j�|j�|j!|
fd�d��g|j#|	d�j!t$�|j#|	d�j!d�d�|jd|��|j'�|dkDr|j)�|dz}|dkDr�|jj-�da	|j'�y#t*$rY�8wxYw#|jj-�da	|j'�wxYw)Nc��eZdZd�Zd�Zy)�,http_multi_server.<locals>.TestInstanceClassc��||zSrzrTr�s   r.r�z0http_multi_server.<locals>.TestInstanceClass.div�r�r0c��|dk(ryyr�rTr�s  r.r�z8http_multi_server.<locals>.TestInstanceClass._methodHelp�r�r0N)rQrRrSr�r�rTr0r.r�r��s��	�	2r0r�c��yr�rTrTr0r.r�z&http_multi_server.<locals>.my_function�s��r0c��eZdZd�Zy)�)http_multi_server.<locals>.MyXMLRPCServerc�f�|jj�\}}|jd�||fSr�r�r�s   r.r�z5http_multi_server.<locals>.MyXMLRPCServer.get_request�r�r0Nr�rTr0r.r�r��r�r0r�c��eZdZgZy)�+http_multi_server.<locals>.MyRequestHandlerN)rQrRrS�	rpc_pathsrTr0r.�MyRequestHandlerr��s���	r0r�c��eZdZdd�Zy)�+http_multi_server.<locals>.BrokenDispatcherNc��td��)Nzbroken dispatcher)�RuntimeError)r+r��dispatch_method�paths    r.�_marshaled_dispatchz?http_multi_server.<locals>.BrokenDispatcher._marshaled_dispatch�s���2�3�3r0�NN)rQrRrSr�rTr0r.�BrokenDispatcherr��s��	4r0r�r�F)r�r�rgr�)
�/foo�/foo/bar�/foo?k=v�	/foo#frag�
/foo?k=v#fragr��/�/RPC2�?k=v�#fragc��|SrzrT)rs r.r�z#http_multi_server.<locals>.<lambda>�s��qr0�testrrc��||zSrzrTr�s  r.r�z#http_multi_server.<locals>.<lambda>�s��A�a�Cr0r��
/is/broken)r�r��MultiPathXMLRPCServerr�r�r�r�r�r�r�r�r��add_dispatcherrr�r�r
�get_dispatcherr�r�r�r�r�)r�r�r�r�r�r�r�r�r��pathsr�rJs            r.�http_multi_serverr�s���2�2������<�<������A�A���>��4�4��*�,<�&+�u�F�D��K�K���1������"��[�[�,�,�.�
��d�
�d�D�\�)������
��
�D��#�#�D�&�-�-�*N�*N�*P�Q�A�
�.�.�0�
�*�*�,�
���� 0�&�9�	�
	
���E�!�H�%�7�7��<����E�!�H�%�7�7���O����L�*:�*<�=����	��A�o����!��1��K��A�o�	
�����������	���
��
��	
�����������	�s%�D<H�	H�
H�H�H�.Ic���	|jdk(s|j�y|jjd�}|rd|j�vryyy#t$rt	|�}Y�-wxYw)z�Returns True if the given ProtocolError is the product of a server-side
       exception caused by the 'temporarily unavailable' response sometimes
       given by operations on non-blocking sockets.rNT�X-exceptionztemporarily unavailable)�errcoder�r�rIrI�lower)�e�exc_messs  r.�is_unavailable_exceptionr�si����9�9��?�a�i�i�/���9�9�=�=��/��
�-����1A�A��B�x��	���q�6���s�A�A�A'�&A'c���|sd�S�fd�}|S)Nc��|SrzrT)�funcs r.r�z)make_request_and_skipIf.<locals>.<lambda>�s��Dr0c����fd�}|S)Nc����	tjt�j�tj���#tjt
f$r}t
|�s�Yd}~�?d}~wwxYwrz)	r&r�r�r��
ProtocolErrorr�r�unittest�SkipTest)r+r�reasons  �r.�make_request_and_skipzImake_request_and_skipIf.<locals>.decorator.<locals>.make_request_and_skip�s_���
��%�%�c�*�6�6�8��#�#�F�+�+���+�+�W�5�
�/��2��3��
�s�'?�A.�A)�)A.rT)rrrs  �r.�	decoratorz*make_request_and_skipIf.<locals>.decorator�s���	,�%�$r0rT)�	conditionrrs ` r.�make_request_and_skipIfr�s���� � �%��r0c�0�eZdZdZdZee�Zd�Zd�Z	y)�BaseServerTestCaseNrc��dtjj_t	j
�|_|j|j|jf}t	j|j|��}|j�|j|j�|jj�|jj�y)NT�r�r�)r�r�r��_send_traceback_headerr��Eventr��
request_countr�r��
threadFuncr�r�r��wait�clear�r+�	serv_argsr�s   r.�setUpzBaseServerTestCase.setUps���BF��
�
�(�(�?��?�?�$����X�X�t�1�1�4�3F�3F�G�	��!�!����y�I������������$�	
���
�
�������r0c�v�|jj�dtjj_y�NF)r�rr�r�r�rrcs r.�tearDownzBaseServerTestCase.tearDowns%�����
�
��CH��
�
�(�(�?r0)
rQrRrSr�rr�r�rr"r%rTr0r.rrs!���N��M��k�*�J�
�Hr0rc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	e
ejjdk\d	�d
��Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�SimpleServerTestCasec
�*�	tjt�}|j|j	dd�d�y#tj
tf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)Nrcrq���
r�r�)
r&r�r�r*r�rr�r�fail�getattr�r+rrs   r.�test_simple1z!SimpleServerTestCase.test_simple1#sy��	E��%�%�c�*�A����Q�U�U�1�Q�Z��.���'�'��1�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�s�;>�B�,B
�
Bc
�8�d}d}	tjt�}|j|j	||�||z�y#tj
tf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)NuPŷtuhơnr*r�r�)
r&r�r�r*r�rr�rr+r,�r+�start_string�
end_stringrrs     r.�
test_nonasciiz"SimpleServerTestCase.test_nonascii-s���C��;�
�	E��%�%�c�*�A����Q�U�U�<��<�)�J�6�
8���'�'��1�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�s�>A�B�,B�Bc
�P�d}d}	tjtd��}|j|j	||�||z�y#tj
tjf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)N�€�¤r�r�r*r�r��r&r�r�r*r�rr��errorrr+r,r0s     r.�test_client_encodingz)SimpleServerTestCase.test_client_encoding:s������
�	E��%�%�c�M�B�A����Q�U�U�<��<�)�J�6�
8���'�'����6�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�s�AA�#B%�*,B � B%c
�@�	tjtd��}|j|j	d�d�y#tj
tjf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)Nrzr�r�r*r�r�)r&r�r�r*�têštrr�r8rr+r,r-s   r.�test_nonascii_methodnamez-SimpleServerTestCase.test_nonascii_methodnameHs}��	E��%�%�c�G�<�A����Q�X�X�b�\�2�.���'�'����6�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�s�<?�#B�",B�Bc�X�tjtjj	t
t��5}|jdd�|j�}ddd�|jjd�|j|jd�y#1swY�BxYw)N�POSTz/this-is-not-validi�z	Not Found)�
contextlib�closingr�r��HTTPConnectionr�r��request�getresponser*�statusr)r+�connr�s   r.�test_404zSimpleServerTestCase.test_404Rs|���
�
���� :� :�4�� F�
G�4��L�L��!5�6��'�'�)�H�H�	
������#�.�������+�6�H�
G�s�#B � B)c
�j�tgd��}	tjt�}|jj�}|j
t|�|�y#tjtf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)N)
r�r�r�r�r�zsystem.listMethodszsystem.methodHelpzsystem.methodSignaturezsystem.multicallr�r*r�r�)r�r&r�r��system�listMethodsr*rr�rr+r,)r+�expected_methodsr�methrs     r.�test_introspection1z(SimpleServerTestCase.test_introspection1\s���� +�,��	E��%�%�c�*�A��8�8�'�'�)�D����S��Y�(8�9���'�'��1�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�s�AA�B2�7,B-�-B2c
�@�	tjt�}|jj	d�}|j|d�y#tjtf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)Nr�r�r*r�r��r&r�r�rH�
methodHelpr*rr�rr+r,)r+r�divhelprs    r.�test_introspection2z(SimpleServerTestCase.test_introspection2ls���		E��%�%�c�*�A��h�h�)�)�%�0�G����W�&@�A���'�'��1�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E���AA	�	B�",B�Brz)Docstrings are omitted with -O2 and abovec
�@�	tjt�}|jj	d�}|j|d�y#tjtf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)Nr�r�r*r�r�rN)r+r�
myfunctionrs    r.�test_introspection3z(SimpleServerTestCase.test_introspection3xs���		E��%�%�c�*�A����,�,�]�;�J����Z�)>�?���'�'��1�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�rRc
�@�	tjt�}|jj	d�}|j|d�y#tjtf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)Nr�zsignatures not supportedr*r�r�)r&r�r�rH�methodSignaturer*rr�rr+r,)r+r�divsigrs    r.�test_introspection4z(SimpleServerTestCase.test_introspection4�s���	E��%�%�c�*�A��X�X�-�-�e�4�F����V�%?�@���'�'��1�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�rRc
��	tjt�}tj|�}|j	dd�|jdd�|j
dd�|�\}}}|j|d�|j|d�|j|d�y#tjtf$r;}t|�s&|j|�d	t|d
d����Yd}~yYd}~yd}~wwxYw)Nrrgrcrq�r�rmr)r*r�r�)
r&r�r��	MultiCallr�r�r�r*rr�rr+r,)r+r�	multicall�
add_result�
pow_result�
div_resultrs       r.�test_multicallz#SimpleServerTestCase.test_multicall�s���	E��%�%�c�*�A�!�+�+�A�.�I��M�M�!�A���M�M�!�A���M�M�#�b�!�1:��.�J�
�J����Z��-����Z��.����Z��1���'�'��1�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�s�B%B(�(C<�,C7�7C<c
���	tjt�}tj|�}|j	�|�}|j|jddd�|j|jddd�y#tjtf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)	NrrArrBz@<class 'Exception'>:method "this_is_not_exists" is not supportedr*r�r�)r&r�r�r\�this_is_not_existsr*�resultsrr�rr+r,)r+rr]r>rs     r.�test_non_existing_multicallz0SimpleServerTestCase.test_non_existing_multicall�s���	E��%�%�c�*�A�!�+�+�A�.�I��(�(�*��[�F�
���V�^�^�A�.�{�;�Q�?����V�^�^�A�.�}�=�#�
$���'�'��1�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�s�B	B�C �%,C�C c���|jttjjt
d�|j
tjj	t
d��|j�yrF)rarIr�r�rJrIr�r.rcs r.rKz*SimpleServerTestCase.test_dotted_attribute�sQ�����.� �-�-�@�@�#�w�	P�	
����
�
�>�>�s�G�L�M�	
���r0c��tjdttfz�}|jj�}|j
|d�y)N�http://%s:%d/RPC2r�)r&r�r�r�r�r�r*)r+r�r�s   r.�test_allow_dotted_names_truez1SimpleServerTestCase.test_allow_dotted_names_true�s>���&�&�':�d�D�\�'I�J���~�~�%�%�'������t�$r0c��tjdttfz�}|j	|jdd�d�y)Nrhr��éuaé)r&r�r�r�r*r��r+r�s  r.�test_unicode_hostz&SimpleServerTestCase.test_unicode_host�s7���&�&�':�d�D�\�'I�J��������C��0�'�:r0c���tjtjtt
f��5}|j
dt�dt
�d�jd��ddd�y#1swYyxYw)Nz@POST /RPC2 HTTP/1.0
Content-Length: 100

bye HTTP/1.1
Host: �:z2
Accept-Encoding: identity
Content-Length: 0

rz)r?r@r��create_connectionr�r��sendr�)r+rEs  r.�test_partial_postz&SimpleServerTestCase.test_partial_post�sb��
�
�
�� 8� 8�$��� F�
G�4��I�I�� $�f�A�d�V�,2�2�
39�&��/�
C�H�
G�
G�s�0A,�,A5c��tjt�5}|jdd�|j	|d�j
d�ddd�|j
d�j
d�y#1swY�,xYw)Nrrg�	transportr�)r&r�r�r��assertNotEqual�_connectionr*rls  r.�test_context_managerz)SimpleServerTestCase.test_context_manager�sl��
�
"�
"�3�
'�6��J�J�q�!������{� 3� ?� ?� ,�
.�(�	
�����,�8�8�%�	'�	(�
'�s�5A:�:Bc��	tjt�5}|jdd�ddd�|jd�jd�y#1swY�,xYw#tj$rY�DwxYw)Nrr�rtr�)r&r�r�r�r<r*rvrls  r.�!test_context_manager_method_errorz6SimpleServerTestCase.test_context_manager_method_error�sh��	��&�&�s�+�v��
�
�1�c�"�,�	
�����,�8�8�%�	'�	,�+�����	��	�s'�A%�A�A%�A"�A%�%A;�:A;N)rQrRrSr.r3r9r<rFrLrQrr~�flags�optimizerUrYrarerKrirmrrrwryrTr0r.r'r'"s���E�E�E�E�7�
E� 
E��S�Y�Y�/�/�1�4�@�B�
E�B�
E�E�E�"E�*�%�;�C�'�'r0r'c�$�eZdZedd��Zd�Zy)�SimpleServerEncodingTestCaseNc� �t|||d�y)Nr�)r�)r�r�r�r�s    r.rz'SimpleServerEncodingTestCase.threadFunc�s���C��n�m�Dr0c
�L�d}d}	tjt�}|j|j	||�||z�y#tj
tjf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)Nr5r6r*r�r�r7r0s     r.�test_server_encodingz1SimpleServerEncodingTestCase.test_server_encoding�s������
�	E��%�%�c�*�A����Q�U�U�<��<�)�J�6�
8���'�'����6�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�s�>A�#B#�(,B�B#r�)rQrRrSr�rr�rTr0r.r}r}�s���E��E�Er0r}c���eZdZee�ZdZd�Zd�Ze	jd�d��Ze	jd�d��Ze	jd�d��Z
e	jd�d��Ze	jd�d	��Ze	jd�d
��Ze	jd�d��Ze	jd�d��Ze	jd�d
��Zy)�MultiPathServerTestCaserc���tjtdz�}|j|j	dd�d�|jtj|jdd�y)Nr�rcrqr))r&r�r�r*r�rar<r��r+rs  r.�
test_path1z"MultiPathServerTestCase.test_path1sL���!�!�#�f�*�-��������q���T�*����)�/�/�1�5�5�!�Q�7r0c���tjtdz�}|j|j	dd�d�|jtj|jdd�y)Nr�rcrq�)r&r�r�r*r�rar<r�r�s  r.�
test_path2z"MultiPathServerTestCase.test_path2sL���!�!�#�j�.�1��������q���S�)����)�/�/�1�5�5�!�Q�7r0�walltimec��tjtdz�}|jtj|j
dd�y)Nr�rcrq�r&r�r�rar<r�r�s  r.�
test_path3z"MultiPathServerTestCase.test_path3
s3���!�!�#�l�"2�3�����)�/�/�1�5�5�!�Q�7r0c��tjtdz�}|jtj|j
dd�y)Nz/invalidrcrqr�r�s  r.�test_invalid_pathz)MultiPathServerTestCase.test_invalid_paths2���!�!�#�j�.�1�����)�/�/�1�5�5�!�Q�7r0c�|�tjtdz�}|j|j	�d�y)Nr��r&r�r�r*r�r�s  r.�test_path_query_fragmentz0MultiPathServerTestCase.test_path_query_fragments-���!�!�#�o�"5�6���������?�3r0c�|�tjtdz�}|j|j	�d�y)Nr�r�r�s  r.�test_path_fragmentz*MultiPathServerTestCase.test_path_fragments,���!�!�#�k�/�2���������;�/r0c�|�tjtdz�}|j|j	�d�y)Nr�r�r�s  r.�test_path_queryz'MultiPathServerTestCase.test_path_querys,���!�!�#�j�.�1���������:�.r0c�v�tjt�}|j|j	�d�y)Nr�r�r�s  r.�test_empty_pathz'MultiPathServerTestCase.test_empty_path#s(���!�!�#�&���������7�+r0c�|�tjtdz�}|j|j	�d�y)Nr�r�r�s  r.�test_root_pathz&MultiPathServerTestCase.test_root_path(s,���!�!�#��)�,���������3�'r0c�|�tjtdz�}|j|j	�d�y)Nr�r�r�s  r.�test_empty_path_queryz-MultiPathServerTestCase.test_empty_path_query-s,���!�!�#��,�/���������6�*r0c�|�tjtdz�}|j|j	�d�y)Nr�r�r�s  r.�test_empty_path_fragmentz0MultiPathServerTestCase.test_empty_path_fragment2s,���!�!�#��-�0���������7�+r0N)rQrRrSr�rrrr�r�r�requires_resourcer�r�r�r�r�r�r�r�r�rTr0r.r�r��sE���/�0�J��M�8�
8�
�W���z�*�8�+�8��W���z�*�8�+�8��W���z�*�4�+�4��W���z�*�0�+�0��W���z�*�/�+�/��W���z�*�,�+�,��W���z�*�(�+�(��W���z�*�+�+�+��W���z�*�,�+�,r0r�c�T�eZdZGd�dejj
�ZeZd�Zy)�BaseKeepaliveServerTestCasec�L�eZdZejj
ZdZgZd�Z	d�Z
y)�*BaseKeepaliveServerTestCase.RequestHandlerr�c��|jjg�t|j�dz
|_|jj|�Sr�)�
myRequestsrnr��reqidx�parentClass�handlercs r.r�z1BaseKeepaliveServerTestCase.RequestHandler.handleAs@���O�O�"�"�2�&��d�o�o�.�q�0�D�K��#�#�*�*�4�0�0r0c��|jj|�}|j|jj	|j
�|Srz)r��handle_one_requestr�r�rn�raw_requestline)r+r>s  r.r�z=BaseKeepaliveServerTestCase.RequestHandler.handle_one_requestEs>���%�%�8�8��>�F��O�O�D�K�K�(�/�/��0D�0D�E��Mr0N)rQrRrSr�r�r�r�r�r�r�r�rTr0r.r�r�=s&���m�m�>�>��%���
�	1�	r0r�c�N�g|j_tj|�Srz)r�r�rr"rcs r.r"z!BaseKeepaliveServerTestCase.setUpKs!��)+����&�!�'�'��-�-r0N)	rQrRrSr�r�r�r�r�r"rTr0r.r�r�:s$������A�A��$�N�.r0r�c��eZdZd�Zy)�KeepaliveServerTestCase1c���tjt�}|j|j	dd�d�|j|j	dd�d�|j|j	dd�d�|d��|jt|jj�d�|jt|jjd�d�y)Nrcrqr)r�rrr�	r&r�r�r*r�r�r�r��assertGreaterEqualr�s  r.�test_twoz!KeepaliveServerTestCase1.test_twoSs����!�!�#�&��������q���T�*�������q���T�*�������q���T�*���'�
��	
����T�0�0�;�;�<�a�@�	
����D�$7�$7�$B�$B�2�$F� G��Kr0N)rQrRrSr�rTr0r.r�r�Rs��
Lr0r�c��eZdZdZd�Zd�Zy)�KeepaliveServerTestCase2rc�(�tjt�}|j|j	dd�d�|j|j	dd�d�|j|j	dd�d�|d��|j|j	dd�d�|j|j	dd�d�|j|j	dd�d�|d��|jt|jj�d�|jt|jjd�d�|jt|jjd�d�y)Nrcrqr)r�rr���r�r�s  r.�
test_closez#KeepaliveServerTestCase2.test_closeis3���!�!�#�&��������q���T�*�������q���T�*�������q���T�*���'�
��������q���T�*�������q���T�*�������q���T�*���'�
��	
����T�0�0�;�;�<�a�@�����D�$7�$7�$B�$B�2�$F� G��K�����D�$7�$7�$B�$B�2�$F� G��Kr0c�b�tjt�}|j|j	dd�d�|d�j�|j|j	dd�d�|d��|jt
|jj�d�y)Nrcrqr)rtr�r)	r&r�r�r*r�r�r�r�r�r�s  r.�test_transportz'KeepaliveServerTestCase2.test_transport|s����!�!�#�&��������q���T�*�	�+�����������q���T�*���'�
������T�0�0�;�;�<�a�@r0N)rQrRrSrr�r�rTr0r.r�r�es���M�L�&Ar0r�z
requires gzipc��eZdZGd�dejj
�ZeZGd�dej�Z	d�Z
d�Zd�Zd�Z
y	)
�GzipServerTestCasec�B�eZdZejj
ZdZd�Zy)�!GzipServerTestCase.RequestHandlerr�c��t|jd�|j_|jj|�S)N�content-length)r�r��	__class__�content_lengthr�r�rcs r.r�z)GzipServerTestCase.RequestHandler.do_POST�s4��,/����=M�0N�,O�D�N�N�)��#�#�+�+�D�1�1r0N)	rQrRrSr�r�r�r�r�r�rTr0r.r�r��s���m�m�>�>��%��	2r0r�c��eZdZdZd�Zd�Zy)�GzipServerTestCase.TransportFc��t|jdd��|_tjj||�S)Nr�r)r��	getheader�response_lengthr&r��parse_response)r+r�s  r.r�z+GzipServerTestCase.Transport.parse_response�s6��!$�X�%7�%7�8H�!�%L�!M�D� ��&�&�5�5�d�H�E�Er0c��|jr|jdd�tjj	|||�S)NzContent-Encoding�gzip)�	fake_gzip�	putheaderr&r��send_content)r+�
connection�bodys   r.r�z)GzipServerTestCase.Transport.send_content�s5���~�~��$�$�%7��@��&�&�3�3�D�*�d�K�Kr0N)rQrRrSr�r�r�rTr0r.r�r��s���	�	F�	Lr0r�c�.�tj|�yrz)rr"rcs r.r"zGzipServerTestCase.setUp�s��� � ��&r0c��|j�}d|_tjt|��}|j|j
dd�d�|jj}d|_|j|j
dd�d�|jj}|j||kD�|d��y�N�rtrcrqr)rr�)
r��encode_thresholdr&r�r�r*r�r�r�r�)r+r\rr�r�s     r.�test_gzip_requestz$GzipServerTestCase.test_gzip_request�s����N�N���!����!�!�#��3��������q���T�*����.�.�����������q���T�*����.�.������!�����'�
�r0c�H�|j�}d|_d|_tjt
|��}|j
tjtjd��}|5|jdd�ddd�|d��y#1swY�xYw)NTr�z\b400\brcrqr�)r�r�r�r&r�r�r+r�re�compiler�)r+r\r�cms    r.�test_bad_gzip_requestz(GzipServerTestCase.test_bad_gzip_request�s{���N�N���!�������!�!�#��3��
�
#�
#�I�$;�$;�$&�J�J�z�$:�<��
�
�E�E�!�Q�K����'�
���R�s�/B�B!c���|j�}tjt|��}|jj
}d|j_|j
|jdd�d�|j}d|j_|j
|jdd�d�|d��|j}||j_|j||kD�yr�)
r�r&r�r�r�r�r*r�r�r�)r+r\r�oldr�r�s      r.�test_gzip_responsez%GzipServerTestCase.test_gzip_response�s����N�N����!�!�#��3���!�!�2�2��/3����,�������q���T�*�
����/0����,�������q���T�*���'�
��
����/2����,�����!��r0N)rQrRrSr�r�r�r�r�r&r�r"r�r�r�rTr0r.r�r��sG��2����A�A�2�$�N�L�I�'�'�L�'�
�	�r0r�c��eZdZd�Zy)�GzipUtilTestCasec��d}d|z}tj|�}tj|�}|jt	|�|�d|dzz}tj|�}|jtd�5tj|�ddd�tj|d��y#1swY�!xYw)Ni@�rz#max gzipped payload length exceededr)�
max_decode)r&�gzip_encode�gzip_decoder*r�r+r�)r+�max_gzip_decoder��encoded�decodeds     r.�test_gzip_decode_limitz'GzipUtilTestCase.test_gzip_decode_limit�s���*����&���'�'��-���'�'��0������W���7���!�+�,���'�'��-��
�
#�
#�J�$I�K��!�!�'�*�K�	���g�"�5�	K�K�s�B6�6B?N)rQrRrSr�rTr0r.r�r��s��6r0r�c���eZdZGd�dejj
�ZeZgd�Z�fd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Z�xZS)�HeadersServerTestCasec�"��eZdZdZ�fd�Z�xZS)�$HeadersServerTestCase.RequestHandlerNc�V��|j|j_t�|��Srz)r�r��test_headers�superr��r+r�s �r.r�z,HeadersServerTestCase.RequestHandler.do_POST�s ���*.�,�,�D�N�N�'��7�?�$�$r0)rQrRrSr�r��
__classcell__�r�s@r.r�r��s�����	%�	%r0r�)�HostzAccept-EncodingzContent-Typez
User-Agentr�c�B��d|j_t�|�
�Srz)r�r�r�r"r�s �r.r"zHeadersServerTestCase.setUp�s���+/����(��w�}��r0c�&�t|jt|j��z�}|j	t|j��|�|j�D]&\}}|j
|j|�|��(yrz)�sorted�standard_headers�list�keys�assertListEqual�itemsr*r�)r+r��
additional�
expected_keys�keyrHs      r.�assertContainsAdditionalHeadersz5HeadersServerTestCase.assertContainsAdditionalHeaders�sn���t�4�4�t�J�O�O�<M�7N�N�O�
����V�G�L�L�N�3�]�C�$�*�*�,�J�C�����W�[�[��-�u�5�-r0c���tjtdg��}|j|j	dd�d�|j
j}|j|ddi�y)N��X-Test�foo�r�rcrqr)rr�r&r�r�r*r�r�r�r��r+rr�s   r.�test_headerz!HeadersServerTestCase.test_header�sX���!�!�#�0A�/B�C��������q�!��d�+��%�%�2�2���,�,�W�x��6G�Hr0c���tjtddg��}|j|j	dd�d�|j
j}|j|ddd	��y)
Nr�)�
X-Test-Second�barrrcrqr)rr)rrrrs   r.�test_header_manyz&HeadersServerTestCase.test_header_many�sc���!�!��+�-E�F�
H��������q�!��d�+��%�%�2�2���,�,����>�	@r0c���tjtg��}|j|j	dd�d�|j
j}|j|i�y)Nrrcrqr)rrs   r.�test_header_emptyz'HeadersServerTestCase.test_header_emptysO���!�!�#�r�2��������q�!��d�+��%�%�2�2���,�,�W�b�9r0c���tjtd��}|j|j	dd�d�|j
j}|j|ddi�y)N)r�rrcrqr)rrrrs   r.�test_header_tuplez'HeadersServerTestCase.test_header_tuple
sU���!�!�#�/C�D��������q�!��d�+��%�%�2�2���,�,�W�x��6G�Hr0c���tjtddij���}|j	|jdd�d�|jj}|j|ddi�y)Nrrrrcrqr))	r&r�r�r�r*r�r�r�r�rs   r.�test_header_itemsz'HeadersServerTestCase.test_header_itemssb���!�!�#��%�/@�/F�/F�/H�I��������q�!��d�+��%�%�2�2���,�,�W�x��6G�Hr0)rQrRrSr�r�r�r�r�r�r"r�rr	rr
rr�r�s@r.r�r��sO���%����A�A�%�$�N����6�I�@�:�I�Ir0r�c��eZdZd�Zd�Zd�Zy)�ServerProxyTestCasec�P�tjj|�d|_y)Nzhttp://fake.localhost)r�TestCaser"r�rcs r.r"zServerProxyTestCase.setUps��������%�+��r0c�|�tj|j�}|j|d��d�y)Nr�)r&r�r�r*r�s  r.r�zServerProxyTestCase.test_close$s.���!�!�$�(�(�+�������7���t�,r0c��tj�}tj|j|��}|j	|d�|�y)Nr�rt)r&r�r�r�r*)r+r\rs   r.r�z"ServerProxyTestCase.test_transport(s:�����!���!�!�$�(�(�a�8������;���+r0N)rQrRrSr"r�r�rTr0r.rrs��+�-�,r0rc� ��eZdZd�fd�	Z�xZS)�FailingMessageClassc�P��|j�}|dk(ryt�|�	||�S)Nr�zI am broken)rr�r�)r+r��failobjr�s   �r.r�zFailingMessageClass.get1s+����i�i�k���"�"� ��w�{�3��(�(r0rz)rQrRrSr�r�r�s@r.rr0s
���)�)r0rc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�FailingServerTestCasec�F�tj�|_|jdf}tjt|��}|j�|j
|j�|jj�|jj�y)Nrr)
r�rr�r�r�r�r�r�rrr s   r.r"zFailingServerTestCase.setUp9se���?�?�$����X�X�q�M�	��!�!��9�E������������$�	
���
�
�������r0c���|jj�dtjj_tjj}|tjj_
yr$)r�rr�r�r�rr�r��HTTPMessager��MessageClass)r+�
default_classs  r.r%zFailingServerTestCase.tearDownEsB�����
�
��BG��
�
�(�(�?����/�/�
�@M��
�
�0�0�=r0c
���tjjj}|j	|d�dtjj_	tjt�}|j	|jdd�d�y#t
jtf$r;}t|�s&|j|�dt|dd����Yd}~yYd}~yd}~wwxYw)	NFTrcrqr)r*r�r�)r�r�r�rr*r&r�r�r�rr�rr+r,)r+�flagvalrrs    r.�
test_basicz FailingServerTestCase.test_basicNs����-�-�2�2�I�I������%�(�CG��
�
�(�(�?�	E��%�%�c�*�A����Q�U�U�1�Q�Z��.���'�'��1�	E�+�A�.��	�	�a���I�r�)B�C�D�D�/��	E�s�;B�C'�,,C"�"C'c��ttjj_	tjt�}|jdd�|jd�y#t
jtf$r�}t|�snt|d�r]|j|jj!d�du�|j|jj!d�du�Yd}~yYd}~yYd}~yd}~wwxYw)Nrcrq�ProtocolError not raisedr�r�X-traceback)rr�r�r�rr&r�r�r�r+rr�r�hasattrr�r�r�r-s   r.�test_fail_no_infoz'FailingServerTestCase.test_fail_no_info`s���@S��
�
�0�0�=�
	2��%�%�c�*�A�
�E�E�!�A�J�
�I�I�0�1���'�'��1�	F�+�A�.�7�1�i�3H�����	�	�
�
�m� <�� D�E�����	�	�
�
�m� <�� D�E�E�4I�.��	F�s�+A"�"C>�;A/C9�9C>c�B�ttjj_dtjj
_	tjt�}|jdd�|jd�y#tjtf$r�}t|�sot|d�r^d}|j!|j"j%d�|�|j'|j"j%d�du�Yd}~yYd}~yYd}~yd}~wwxYw)	NTrcrqr%r�z5invalid literal for int() with base 10: 'I am broken'rr&)rr�r�r�rr�rr&r�r�r�r+rr�rr'r*r�r�r�)r+rr�expected_errs    r.�test_fail_with_infoz)FailingServerTestCase.test_fail_with_infops���@S��
�
�0�0�=�CG��
�
�(�(�?�	2��%�%�c�*�A�
�E�E�!�A�J�
�I�I�0�1���'�'��1�	J�+�A�.�7�1�i�3H�V��� � ������}�!=�|�L�����	�	�
�
�m� <�D� H�I�I�	4I�.��	J�s�+B�D�A0D�DN)rQrRrSr"r%r#r(r+rTr0r.rr8s��
�N�E�$2� 2r0rc#��K�tj}tjtj�|��t_	tj��|t_y#|t_wxYw�w)zhA variation on support.captured_stdout() which gives a text stream
    having a `buffer` attribute.
    r�N)r~�stdout�io�
TextIOWrapper�BytesIO)r��orig_stdouts  r.�captured_stdoutr2�sH����
�*�*�K��!�!�"�*�*�,��B�C�J�!��j�j�� ��
��[��
�s�AA4�A$�A4�$
A1�1A4c�$�eZdZd�Zd�Zd�Zd�Zy)�CGIHandlerTestCasec�J�tjj�|_yrz)r�r��CGIXMLRPCRequestHandler�cgircs r.r"zCGIHandlerTestCase.setUp�s���=�=�8�8�:��r0c��d|_yrz)r7rcs r.r%zCGIHandlerTestCase.tearDown�s	����r0c���tj�5}d|d<t|jj��5}|jj�ddd�j
d�|j�}|j�d}dj|j�dd�}|j|d	�|j|d
�ddd�y#1swY��xYw#1swYyxYw)N�GET�REQUEST_METHODr�rr� rrl�400zBad Request)r�EnvironmentVarGuardr2r7r�r��seekr��splitr�r*)r+�env�data_outr�rD�messages      r.�test_cgi_getzCGIHandlerTestCase.test_cgi_get�s���
�
*�
*�
,��$)�C� �!�!�$�(�(�*;�*;�<�����'�'�)�=�
�M�M�!���]�]�_�F��\�\�^�A�&�F��h�h�v�|�|�~�a��2�3�G����V�U�+����W�m�4�-�
,�=�<��	-�
,�s#�&C-�C!�BC-�!C*	�&C-�-C6c��d}tj�5}t|jj��5}tj�5}|j|�|jd�tt|��|d<|jj�ddd�ddd�ddd�jd�|j�}|jtjtj |dd�||j#d�d}|j%t't)j*d|�j-d��t|��y#1swY��xYw#1swY��xYw#1swY��xYw)	Naw<?xml version='1.0'?>
        <methodCall>
            <methodName>test_method</methodName>
            <params>
                <param>
                    <value><string>foo</string></value>
                </param>
                <param>
                    <value><string>bar</string></value>
                </param>
            </params>
        </methodCall>
        r�r�CONTENT_LENGTH�,z<?xmlzContent-Length: (\d+)r)rr>r2r7r�r�captured_stdinr�r?rIr�r�r�rar&r<r)�findr*r�r��search�group)r+r�rArB�data_inr��contents       r.�test_cgi_xmlrpc_responsez+CGIHandlerTestCase.test_cgi_xmlrpc_response�s(�����
*�
*�
,��
�d�h�h�&7�&7�
8�H�
�
#�
#�
%���M�M�$���L�L��O�$'��D�	�N�C� �!��H�H�#�#�%�	&�9�-�	�
�
�a�������	
���)�/�/�9�?�?�F�2�3�K�H�����W�-�.�/�������	�	�2�F�;�A�A�!�D�E���L�	�+&�
%��9�
8��-�
,�s;�!F�E4�
AE(�!E4�)F�(E1�-E4�4E=	�9F�F	N)rQrRrSr"r%rDrNrTr0r.r4r4�s��;��5�$(r0r4c��eZdZd�Zd�Zd�Zy)�UseBuiltinTypesTestCasec�B��g�_d}tjdddddd�}tj||fd�}�fd	�}tj
j
d
dd
��}|j|�|j|��jt�j�d��j\}}�j�j||g��jt|�tj��jt|�t�y)
Nr
i�rm�����foobarc�<���jj|�yrz)�log�extend)r�r+s �r.rVz>UseBuiltinTypesTestCase.test_use_builtin_types.<locals>.foobar�s����H�H�O�O�D�!r0T)r�r�r3r)rXr6r&r'r�r�rr
r�r*r�r8r9r�)r+�expected_bytes�
expected_date�	marshaledrV�handler�mybytes�mydates`       r.�test_use_builtin_typesz.UseBuiltinTypesTestCase.test_use_builtin_types�s�������,�� �)�)�$��2�r�2�r�B�
��O�O�^�]�$C�X�N�	�	"��-�-�6�6��d�d�7�D���!�!�&�)��#�#�I�.�����T�X�X���*��(�(����������N�M�#B�C��
�
�d�6�l�H�$5�$5�6��
�
�d�7�m�U�+r0c�z�tjjd��}|j|j�y)NTr2)r�r�r6r�r3)r+r]s  r.�*test_cgihandler_has_use_builtin_types_flagzBUseBuiltinTypesTestCase.test_cgihandler_has_use_builtin_types_flag�s+���-�-�7�7�$�7�O������1�1�2r0c��tjjdd��}|j�|j	|j
�y)Nr�Tr2)r�r�r�r�r�r3rls  r.�,test_xmlrpcserver_has_use_builtin_types_flagzDUseBuiltinTypesTestCase.test_xmlrpcserver_has_use_builtin_types_flag�s?�����1�1�2B�"�2�$����������0�0�1r0N)rQrRrSr`rbrdrTr0r.rPrP�s��,�(3�2r0rPc�t�tj�}tjtjg|���yrz)r�threading_setupr�addModuleCleanup�threading_cleanup)�thread_infos r.�setUpModulerj�s*��"�2�2�4�K����.�@�@�O�;�Or0�__main__r�rz)zutf-8)Hr�r6r�r~rVrr�
xmlrpc.clientr�r&�
xmlrpc.serverr��http.clientr��http.serverr�r�r�r.r?r�r�test.supportrrrrr	r
r�r��requires_working_socketr�r�r7r(rr$rr4r9rMr�r�r�r�r�rrrrr'r}r�r�r�r��skipIfr�r�r�rrrr�contextmanagerr2r4rPrjrQ�mainrTr0r.�<module>rus(��
���
����!����
��	�	���"�&�)�5�5��� ����t�,�'����#��%�Y�%�%�&9�:�)�#�$7�8��)�'�)�y�)�)�*=�>�)�y�)�)�;�=�)�y�)�)�)��)�)�$��2�r�2�r�B�D�
�	
��$x,�X�&�&�x,�v	T7�X�%6�%6�T7�n<�X�&�&�<�N�H�%�%�N�.\+�x�(�(�\+�~5�X�&�&�5�6����t�c�
>�@D�P�"� H��*�*�H�6D'�-�D'�NE�#5�E�(8,�0�8,�z.�"4�.�0L�:�L�&A�:�A�D��������/�@�+�@�0�@�F��������/�6�x�(�(�6�0�6�&:I�.�:I�|,�(�+�+�,�&)�$�+�+�1�1�)�K2�H�-�-�K2�\���	!��	!�A��*�*�A�H2�h�/�/�2�BP�
�z���H�M�M�O���I/���D��s�,K�K!� K!

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