Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_unittest/testmock/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_unittest/testmock/__pycache__/testpatch.cpython-312.pyc

�

*Μg�����ddlZddlZddlmZddlZddlZddlmZddlm	Z	m
Z
ddlmZddl
mZddlmZmZmZmZmZmZmZmZmZmZmZdZej8eZd	ezZdd
�Z ejBa"ejFZ$Gd�de%�Z&d
ezZ'e&fd�Z(Gd�de%�Z)Gd�dejT�Z+edk(rejX�yy)�N)�OrderedDict)�support)�	SomeClass�is_instance)�
DirsOnSysPath)�uncache)�NonCallableMock�
CallableMixin�sentinel�	MagicMock�Mock�NonCallableMagicMock�patch�_patch�DEFAULT�call�_get_target�builtinsz%s.PTModulec�h��G�fd�dt�}|s�fd�}�fd�}||_||_|�S)Nc���eZdZ�fd�Zy)�_get_proxy.<locals>.Proxyc���t�|�S�N)�getattr��self�name�objs  ��B/usr/local/lib/python3.12/test/test_unittest/testmock/testpatch.py�__getattr__z%_get_proxy.<locals>.Proxy.__getattr__s����3��%�%�N)�__name__�
__module__�__qualname__r )rs�r�Proxyrs���	&r!r%c� ��t�||�yr)�setattr)rr�valuers   �r�__setattr__z_get_proxy.<locals>.__setattr__"s����C��u�%r!c���t�|�yr)�delattrrs  �r�__delattr__z_get_proxy.<locals>.__delattr__$s
����C��r!)�objectr)r,)r�get_onlyr%r)r,s`    r�
_get_proxyr/s5���&��&��	&�	�'���'����7�Nr!c�X�eZdZd�Zd�Zd�ZdZed��Ze	d��Z
Gd�de�Zy	)
�Fooc��yr��r�as  r�__init__zFoo.__init__1s��4r!c��yrr3r4s  r�fzFoo.f2s��Dr!c��yrr3�rs r�gzFoo.g3s��r!�barc��yrr3r3r!r�
static_methodzFoo.static_method6s��r!c��yrr3)�clss r�class_methodzFoo.class_method9s��r!c��eZdZd�Zy)�Foo.Barc��yrr3r:s rr5z	Foo.Bar.a=s��Tr!N�r"r#r$r5r3r!r�BarrC<s��r!rFN)
r"r#r$r6r8r;�foo�staticmethodr>�classmethodrAr-rFr3r!rr1r10s8�����
�C����������f�r!r1z%s.Fooc��yrr3�r5�bs  r�functionrMBs��r!c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�	Containerc��i|_yr��valuesr:s rr6zContainer.__init__Fs	����r!c� �|j|SrrQ�rrs  r�__getitem__zContainer.__getitem__Is���{�{�4� � r!c�"�||j|<yrrQ)rrr(s   r�__setitem__zContainer.__setitem__Ls��!����D�r!c��|j|=yrrQrTs  r�__delitem__zContainer.__delitem__Os���K�K��r!c�,�t|j�Sr)�iterrRr:s r�__iter__zContainer.__iter__Rs���D�K�K� � r!N)r"r#r$r6rUrWrYr\r3r!rrOrOEs���!�"��!r!rOc���eZdZdwd�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�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdD�ZFdE�ZGdF�ZHdG�ZIdH�ZJdI�ZKdJ�ZLdK�ZMdL�ZNdM�ZOdN�ZPdO�ZQdP�ZRdQ�ZSdR�ZTdS�ZUdT�ZVdU�ZWdV�ZXdW�ZYdX�ZZe[dYdZ�d[��Z\e[dYd\�d]��Z]d^�Z^d_�Z_d`�Z`da�Zadb�Zbdc�Zcdd�Zdde�Zedf�Zfdg�Zgdh�Zhdi�Zidj�Zjdk�Zkdl�Zldm�Zmdn�Zndo�Zodp�Zpdq�Zqdr�Zrds�Zsdt�Ztdu�Zuyv)x�	PatchTestc��t}|st}|jt|�|j	t||��|j
t|t��yr)rr	�assertRaises�	TypeError�
assertTruer�assertFalser
)rr�magic�	MockClasss    r�assertNotCallablezPatchTest.assertNotCallableYsG��(�	��'�I����)�S�)�����C��3�4�����S�-�8�9r!c�����Gd�dt��tj�dtj���fd��}|��j	�j
tjd�y)Nc�$�eZdZejZy)�4PatchTest.test_single_patchobject.<locals>.SomethingN�r"r#r$r�Original�	attributer3r!r�	Somethingrid�
�� �)�)�Ir!rmrlc�\���j�jtjd�y�N�	unpatched��assertEqualrlr�Patched�rmrs��r�testz/PatchTest.test_single_patchobject.<locals>.testgs!������Y�0�0�(�2B�2B�K�Pr!�patch not restored�r-rrrtrsrlrk�rrvrms` @r�test_single_patchobjectz!PatchTest.test_single_patchobjectcsa���	*��	*�
���i��h�.>�.>�	?�	Q�
@�	Q�	
������,�,�h�.?�.?�-�	/r!c��d}|jt|�5tjdd�ddd�y#1swYyxYw)Nz>'Something' must be the actual object to be patched, not a strrm�do_something)�assertRaisesRegexrarr-)r�msgs  r�&test_patchobject_with_string_as_targetz0PatchTest.test_patchobject_with_string_as_targetos1��N��
�
#�
#�I�s�
3��L�L��n�5�4�
3�
3�s	�9�Ac�����Gd�dt��tj�dd���fd��}|��j�jtj
d�y)Nc�$�eZdZejZy)�7PatchTest.test_patchobject_with_none.<locals>.SomethingNrjr3r!rrmr�urnr!rmrlc�>���j�jd�yrp)�assertIsNonerlrus��rrvz2PatchTest.test_patchobject_with_none.<locals>.testxs������i�1�1�;�?r!rw)r-rrsrlrrkrys` @r�test_patchobject_with_nonez$PatchTest.test_patchobject_with_nonetsZ���	*��	*�
���i��d�	3�	@�
4�	@�	
������,�,�h�.?�.?�-�	/r!c����Gd�dt��tj�dtj�tj�dtj���fd���}|��j�jtjd��j�jtjd�y)Nc�<�eZdZejZejZy)�6PatchTest.test_multiple_patchobject.<locals>.SomethingN�r"r#r$rrkrl�	Original2�next_attributer3r!rrmr����� �)�)�I�%�/�/�Nr!rmrlr�c����j�jtjd��j�jtj
d�yrp)rsrlrrtr��Patched2rus��rrvz1PatchTest.test_multiple_patchobject.<locals>.test�sG���
���Y�0�0�(�2B�2B�(�
*����Y�5�5�x�7H�7H�(�
*r!rw)
r-rrrtr�rsrlrkr�r�rys` @r�test_multiple_patchobjectz#PatchTest.test_multiple_patchobject�s����	0��	0�
���i��h�.>�.>�	?�	���i�!1�8�3D�3D�	E�	*�
F�
@�	*�	
������,�,�h�.?�.?�-�	/�����1�1�8�3E�3E�-�	/r!c���t}tdtztj�d��}	tj
a|�|j
ttj
�|ay#|awxYw)N�%s.somethingc��yrr3r3r!rrvz8PatchTest.test_object_lookup_is_quite_lazy.<locals>.test����r!)�	somethingrr"r�
Something2�replacement_valuers�r�originalrvs   r� test_object_lookup_is_quite_lazyz*PatchTest.test_object_lookup_is_quite_lazy�sa����	�~��(�(�*=�*=�	>�	�
?�	�	!� �2�2�I��F����Y��(B�(B�C� �I���I�s�;A-�-A1c���tdtztj��fd��}|��j	t
jtjd�tdtztj�tdtztj��fd���}�j	t
jtjd��j	t
jtjd�|��j	t
jtjd��j	t
jtjd�t�}tj|_tdtz|��fd��}|�|��jt|d�y)Nr�c�d���jtjtjd�yrp)rs�PTModuler�rr�r:s�rrvz"PatchTest.test_patch.<locals>.test�s$������X�/�/��1D�1D�(�
*r!rwz%s.something_elsec�����jtjtjd��jtj
tjd�yrp)rsr�r�rr��something_else�
SomethingElser:s�rrvz"PatchTest.test_patch.<locals>.test�sG���
���X�/�/��1D�1D�(�
*����X�4�4�h�6L�6L�(�
*r!�%s.openc�\���jtdd�tjd�y)N�filename�rzopen not patched)rs�openr�Handler:s�rrvz"PatchTest.test_patch.<locals>.test�s#������T�*�c�2�H�O�O�/�
1r!)rr"rr�rsr�r�rmr�r�r
r��return_value�builtin_string�assertNotEqualr�)rrv�mocks`  r�
test_patchzPatchTest.test_patch�sp���	�~��(�(�*=�*=�	>�	*�
?�	*�	
������+�+�X�-?�-?�-�	/�
�~��(�(�*=�*=�	>�	�"�X�-�x�/E�/E�	F�	*�
G�
?�	*�	
����+�+�X�-?�-?�-�	/�����0�0�(�2H�2H�-�	/�	
������+�+�X�-?�-?�-�	/�����0�0�(�2H�2H�-�	/��v��$�O�O���	�y�>�)�4�	0�	1�
1�	1�	
�������D�$�(<�=r!c���tdtztj��fd��}|��j	t
jjd�y)Nz%s.SomeClass.class_attributec�x���jtjjtj
d�yrp)rsr�r�class_attributer�ClassAttributer:s�rrvz2PatchTest.test_patch_class_attribute.<locals>.test�s-���
���X�/�/�?�?�%�4�4�k�
Cr!rw)rr"rr�r�r�rr��rrvs` r�test_patch_class_attributez$PatchTest.test_patch_class_attribute�sS���	�-��8��&�&�
(�	C�
(�	C�	
�����(�,�,�<�<�.�	0r!c������Gd�dt��tj�d���fd��}|�tj�d�tj�d�����fd���}dx��|tjtj�\��|tjtj�y)Nc�<�eZdZejZejZy)�:PatchTest.test_patchobject_with_default_mock.<locals>.TestN)r"r#r$rrkr�r��
something2r3r!r�Testr��s�� �)�)�I�!�+�+�Jr!r�r�c�n���j|�jd��j|td�y)N�"Mock not passed into test function�.patch with two arguments did not create a mock)rsr��assertIsInstancer)r�r�rs ��rrvz:PatchTest.test_patchobject_with_default_mock.<locals>.test�s3������T�4�>�>�A�
C��!�!�$�	�L�
Nr!r�c����j|tjd��j|tjd��j|�jd��j|�j
d��j
|td��j
|td��j�|d��j�|d�||fS)Nz0Patched function didn't receive initial argumentz/Patched function didn't receive second argumentr�z)Second Mock not passed into test functionr�zunexpected value for mock1)	rsr�this1�this2r�r�r�rr�)r�r��mock1�mock2r��
outerMock1�
outerMock2rs    ����rrvz:PatchTest.test_patchobject_with_default_mock.<locals>.test�s����
���U�H�N�N�O�
Q����U�H�N�N�N�
P����U�D�O�O�A�
C����U�D�N�N�H�
J��!�!�%��L�
N��!�!�%��L�
N�
���
�E�3O�P����
�E�3O�P��%�<�r!)r-rrr�r�)rrvr�r�r�s` @@@r�"test_patchobject_with_default_mockz,PatchTest.test_patchobject_with_default_mock�s����	,�6�	,�
���d�K�	(�	N�
)�	N�	
��	���d�K�	(�	���d�L�	)�	 �
*�
)�	 �&#'�&�
�Z�!%�h�n�n�h�n�n�!E��
�J�	
�X�^�^�X�^�^�,r!c�T��tdtzt���fd��}|�y)N�%s.SomeClass��specc����jt|��jttjt
���j
td��y)Nc�"�tjSr�r�
not_wibbler3r!r�<lambda>z>PatchTest.test_patch_with_spec.<locals>.test.<locals>.<lambda>
�
��i�6J�6Jr!�rsrrbr�wibblerr`�AttributeError��
MockSomeClassrs �rrvz,PatchTest.test_patch_with_spec.<locals>.test�=������Y�
�6��O�O�K�	�(8�(8�)�D�E����n�.J�Kr!)rr"rr�s` r�test_patch_with_speczPatchTest.test_patch_with_specs*���	�~��(�y�	9�	L�
:�	L�
	
�r!c�d��tjtdt���fd��}|�y)Nr�r�c�����jtj|��jt	tjj
t���jtd��y)Nc�6�tjjSr�rr�r�r3r!rr�zDPatchTest.test_patchobject_with_spec.<locals>.test.<locals>.<lambda>���i�&?�&?�&J�&Jr!�	rsrr�rbrr�rr`r���
MockAttributers �rrvz2PatchTest.test_patchobject_with_spec.<locals>.test�Q������Y�6�6�
�F��O�O�K�	�(A�(A�(H�(H�'0�2�
3����n�J�
Lr!�rr-rr�s` r�test_patchobject_with_specz$PatchTest.test_patchobject_with_specs-���	���i�!2��	C�	L�
D�	L�	
�r!c�N��tdtzdg���fd��}|�y)Nr�r�r�c����jt|��jttjt
���j
td��y)Nc�"�tjSrr�r3r!rr�zFPatchTest.test_patch_with_spec_as_list.<locals>.test.<locals>.<lambda> r�r!r�r�s �rrvz4PatchTest.test_patch_with_spec_as_list.<locals>.testr�r!�rr"r�s` r�test_patch_with_spec_as_listz&PatchTest.test_patch_with_spec_as_lists,���	�~��(��z�	:�	L�
;�	L�
	
�r!c�^��tjtddg���fd��}|�y)Nr�r�r�c�����jtj|��jt	tjj
t���jtd��y)Nc�6�tjjSrr�r3r!rr�zLPatchTest.test_patchobject_with_spec_as_list.<locals>.test.<locals>.<lambda>,r�r!r�r�s �rrvz:PatchTest.test_patchobject_with_spec_as_list.<locals>.test&r�r!r�r�s` r�"test_patchobject_with_spec_as_listz,PatchTest.test_patchobject_with_spec_as_list%s/���	���i�!2�(��	D�	L�
E�	L�	
�r!c�x��tdtz�tdtzdg���fd���}|�y)Nr�r�r�r�c����jt|��jttjt
���j
td��y)Nc�"�tjSrr�r3r!rr�zMPatchTest.test_nested_patch_with_spec_as_list.<locals>.test.<locals>.<lambda>8r�r!r�)r��MockOpenrs  �rrvz;PatchTest.test_nested_patch_with_spec_as_list.<locals>.test3s?���
���Y�
�6��O�O�K�	�(8�(8�)�D�E����n�.J�Kr!)rr�r"r�s` r�#test_nested_patch_with_spec_as_listz-PatchTest.test_nested_patch_with_spec_as_list1s>���	�y�>�)�	*�	�~��(��z�	:�	L�
;�
+�	L�	
�r!c�L��tdtzd���fd��}|�y)Nr�Tr�c�~����jt���j�jt�fd��y)Nc����jSr�r��r�s�rr�zIPatchTest.test_patch_with_spec_as_boolean.<locals>.test.<locals>.<lambda>C����m�6N�6Nr!�rsrr�r`r�r�s`�rrvz7PatchTest.test_patch_with_spec_as_boolean.<locals>.test=�-������Y�
�6�� � ����n�.N�Or!r�r�s` r�test_patch_with_spec_as_booleanz)PatchTest.test_patch_with_spec_as_boolean<s*���	�~��(�t�	4�	P�
5�	P�	
�r!c�\��tjtdd���fd��}|�y)NrTr�c�~����jt���j�jt�fd��y)Nc����jSrr�r�s�rr�zPPatchTest.test_patch_object_with_spec_as_boolean.<locals>.test.<locals>.<lambda>Or�r!r�r�s`�rrvz>PatchTest.test_patch_object_with_spec_as_boolean.<locals>.testIr�r!)rr-r�r�s` r�&test_patch_object_with_spec_as_booleanz0PatchTest.test_patch_object_with_spec_as_booleanHs+���	���h��$�	7�	P�
8�	P�	
�r!c�L��tdtzd���fd��}|�y)Nr�Tr�c�����jt|t��|���j���j�jt�fd��y)Nc����jSrr�)�instances�rr�zVPatchTest.test_patch_class_acts_with_spec_is_inherited.<locals>.test.<locals>.<lambda>]s���h�6I�6Ir!)rbrrrfr�r`r�)r�r�rs @�rrvzDPatchTest.test_patch_class_acts_with_spec_is_inherited.<locals>.testUsC����O�O�K�
�y�A�B�$��H��"�"�8�,��O�O����n�.I�Jr!r�r�s` r�,test_patch_class_acts_with_spec_is_inheritedz6PatchTest.test_patch_class_acts_with_spec_is_inheritedTs*���	�~��(�t�	4�	K�
5�	K�	
�r!c���tdtztjd���fd��}|��j	t
d��y)N�
%s.froobleT��createc�N���jttj�yr)rs�froobler�Froobler:s�rrvzLPatchTest.test_patch_with_create_mocks_non_existent_attributes.<locals>.testcs������W�h�&6�&6�7r!c��tSr�rr3r!rr�zPPatchTest.test_patch_with_create_mocks_non_existent_attributes.<locals>.<lambda>h���Wr!)rr�rrr`�	NameErrorr�s` r�4test_patch_with_create_mocks_non_existent_attributesz>PatchTest.test_patch_with_create_mocks_non_existent_attributesbsA���	�|�n�,�h�.>�.>�t�	L�	8�
M�	8�	
�����)�_�5r!c���tjtdtjd���fd��}|��jt
td��y)NrTrc�b���jtjtj�yr)rsrrrrr:s�rrvzRPatchTest.test_patchobject_with_create_mocks_non_existent_attributes.<locals>.testls������Y�.�.��0@�0@�Ar!)rr-rrrrc�hasattrr�s` r�:test_patchobject_with_create_mocks_non_existent_attributeszDPatchTest.test_patchobject_with_create_mocks_non_existent_attributesksI���	���i��H�,<�,<�T�	J�	B�
K�	B�	
�������I�6�7r!c���|jt�5tdtztj
�d��}|�ddd�|jtd��y#1swY�!xYw)Nr�c��yrr3r3r!rrvz9PatchTest.test_patch_wont_create_by_default.<locals>.testv���r!c��tSrrr3r!rr�z=PatchTest.test_patch_wont_create_by_default.<locals>.<lambda>zrr!)r`r�rr�rrrr�s  r�!test_patch_wont_create_by_defaultz+PatchTest.test_patch_wont_create_by_defaulttsV��
�
�
�~�
.�
�<�.�0�(�2B�2B�
C��D���F�	/�
	
���)�_�5�/�
.�s�/A%�%A.c��|jt�5tjtdt
j�d��}|�ddd�|jttd��y#1swY�)xYw)N�ordc��yrr3r3r!rrvz?PatchTest.test_patchobject_wont_create_by_default.<locals>.testrr!)	r`r�rr-rrrrcrr�s  r�'test_patchobject_wont_create_by_defaultz1PatchTest.test_patchobject_wont_create_by_default}s[��
�
�
�~�
.�
�\�\�)�U�H�,<�,<�
=��>���F�/�	
�����E�2�3�	/�
.�s�7A5�5A>c��ttdz�d��}ttdz�d��}|j|�d�|j|�d�y)Nz.ordc�&�d|_td�S)N�e�c)r�r)�mock_ords r�test_ordz>PatchTest.test_patch_builtins_without_create.<locals>.test_ord�s��$'�H�!��s�8�Or!z.openc��|j}d|j_td�}|j�}|j�|S)N�abcdzdoesnotexists.txt)r��readr��close)�	mock_open�m�fobj�datas    r�	test_openz?PatchTest.test_patch_builtins_without_create.<locals>.test_open�s=���&�&�A�"(�A�F�F���+�,�D��9�9�;�D��J�J�L��Kr!rr�rr"rs)rrr%s   r�"test_patch_builtins_without_createz,PatchTest.test_patch_builtins_without_create�sa��	�x���	�	�
 �	�
�x���	 �	�
!�	�	
�����S�)������f�-r!c�����Gd�dt��tj�dtd�����fd��}|��j�j	�t
j�y)Nc��eZdZed��Zy)�5PatchTest.test_patch_with_static_methods.<locals>.Fooc�"�tjSr)r�Staticr3r!r�wootz:PatchTest.test_patch_with_static_methods.<locals>.Foo.woot�s�����&r!N)r"r#r$rHr-r3r!rr1r*�s��
�
'��
'r!r1r-c�"�tjSr)rrtr3r!rr�z:PatchTest.test_patch_with_static_methods.<locals>.<lambda>�s
���8H�8Hr!c�b���j�j�tj�yr)rsr-rrt)r1rs��r�	anonymousz;PatchTest.test_patch_with_static_methods.<locals>.anonymous�s������S�X�X�Z��)9�)9�:r!)r-rrHrsr-rr,)rr0r1s` @r�test_patch_with_static_methodsz(PatchTest.test_patch_with_static_methods�sV���	'�&�	'�

���c�6�<�0H�#I�	J�	;�
K�	;����������X�_�_�5r!c���tj}tjtdd��fd��}|��j	tj|�y)Nr1c�F���jtjd�y�Nr1)rsrr1r:s�rr0z-PatchTest.test_patch_local.<locals>.anonymous�s������X�\�\�5�1r!)rr1rr-rs)rrGr0s`  r�test_patch_localzPatchTest.test_patch_local�sD����l�l��	���h��u�	-�	2�
.�	2���������s�+r!c����Gd�dt�}|��tj�_tj�dd���fd��}|��j	�jtj�y)Nc��eZdZdZy)�'PatchTest.test_patch_slots.<locals>.Foo)r1N)r"r#r$�	__slots__r3r!rr1r8�s�� �Ir!r1c�>���j�jd�yr4)rsr1�rGrs��rr0z-PatchTest.test_patch_slots.<locals>.anonymous�s������S�W�W�e�,r!)r-rr1rrs)rr1r0rGs`  @r�test_patch_slotszPatchTest.test_patch_slots�s_���	!�&�	!��e���,�,���	���c�5�%�	(�	-�
)�	-���������(�,�,�/r!c�D���Gd�dt��G��fd�dt�}tj�dtj�|�}|�}|j	�|j��j
�jtjd�y)Nc�$�eZdZejZy)�=PatchTest.test_patchobject_class_decorator.<locals>.SomethingNrjr3r!rrmr?�rnr!rmc�&��eZdZ��fd�Z��fd�Zy)�7PatchTest.test_patchobject_class_decorator.<locals>.Fooc�\���j�jtjd�yrprr��
other_selfrmrs ��r�test_methodzCPatchTest.test_patchobject_class_decorator.<locals>.Foo.test_method�s$���� � ��!4�!4�h�6F�6F�!,�.r!c�\���j�jtjd�y�Nznon-test method patched)rsrlrrkrCs ��r�not_test_methodzGPatchTest.test_patchobject_class_decorator.<locals>.Foo.not_test_method�s$���� � ��!4�!4�h�6G�6G�!:�<r!N)r"r#r$rErHrus��rr1rA�s
���
.�
<r!r1rlrw)	r-rrrtrErHrsrlrk)rr1r8rms`  @r� test_patchobject_class_decoratorz*PatchTest.test_patchobject_class_decorator�sz���	*��	*�	<�&�	<�E�e�l�l�9�k�8�3C�3C�D�S�I���E��	�
�
��	��������,�,�h�.?�.?�-�	/r!c�x��Gd�dt�}G�fd�dt�}tdtz�|�}|�}|j�|j	��j|jtjd��jtjtjd�y)Nc�$�eZdZejZy)�7PatchTest.test_patch_class_decorator.<locals>.SomethingNrjr3r!rrmrL�rnr!rmc�&��eZdZdZ�fd�Z�fd�Zy)�1PatchTest.test_patch_class_decorator.<locals>.Foo�whateverc�H���jtj|d�yrp)rsr�r�)rD�mock_somethingrs  �rrEz=PatchTest.test_patch_class_decorator.<locals>.Foo.test_method�s���� � ��!3�!3�^�!,�.r!c�d���jtjtjd�yrG)rsr�r�rrm)rDrs �rrHzAPatchTest.test_patch_class_decorator.<locals>.Foo.not_test_method�s$���� � ��!3�!3�X�5G�5G�!:�<r!N)r"r#r$�test_class_attrrErHr:s�rr1rN�s���(�O�
.�
<r!r1r�rw)r-rr"rErHrsrlrrkr�r�rm)rrmr1r8s`   r�test_patch_class_decoratorz$PatchTest.test_patch_class_decorator�s����	*��	*�		<�&�		<�/�e�N�X�-�.�s�3���E��	�
�
��	��������,�,�h�.?�.?�-�	/�����+�+�X�-?�-?�-�	/r!c�6���Gd�dt��tj�dtj�tj�dtj���fd���}|��j	�j
tjd�y)Nc�<�eZdZejZejZy)�3PatchTest.test_patchobject_twice.<locals>.SomethingNr�r3r!rrmrW�r�r!rmrlc�\���j�jtjd�yrprrrus��rrvz.PatchTest.test_patchobject_twice.<locals>.test�s#���
���Y�0�0�(�2B�2B�K�Pr!rwrxrys` @r�test_patchobject_twicez PatchTest.test_patchobject_twice�s}���	0��	0�
���i��h�.>�.>�	?�	���i��h�.>�.>�	?�	Q�
@�
@�	Q�	
������,�,�h�.?�.?�-�	/r!c����t�dd���j�}tj���fd��}|��j	�|�tj�ddi���fd��}|��j	�|�tj�dg���fd��}|��j	�|�y)	Nr���initial�otherc� ��d�d<�d=d�d<y�N�r5r\�something elser]r3�rGs�rrvz'PatchTest.test_patch_dict.<locals>.test�����C��H��I��+�C��Lr!r5rLc�f���jt��d��j�dd�y�Nr`r5rL�rs�lenr;s��rrvz'PatchTest.test_patch_dict.<locals>.test�+������S��X�q�)����S��X�s�+r!rKc�f���jt��d��j�dd�yrerfr;s��rrvz'PatchTest.test_patch_dict.<locals>.testrhr!�r-�copyr�dictrs�rr�rvrGs`  @r�test_patch_dictzPatchTest.test_patch_dicts���� �(�[�9���8�8�:��	���C��	,�
�	,�
	
������h�'�	���C�#�s��	$�	,�
%�	,�	
������h�'�	���C�*��	&�	,�
'�	,�	
������h�'r!c�|���t��t��d<d�d<�jj�}t	j
���fd��}|��j
�j|�t	j
�ddi���fd��}|��j
�j|�y)Nr\r�r]c� ��d�d<�d=d�d<yr_r3rbs�rrvz=PatchTest.test_patch_dict_with_container_object.<locals>.test(rcr!r5rLc�z���jt�j�d��j�dd�yre)rsrgrRr;s��rrvz=PatchTest.test_patch_dict_with_container_object.<locals>.test2s/������S����_�a�0����S��X�s�+r!�rOr-rRrkrrlrsrms`  @r�%test_patch_dict_with_container_objectz/PatchTest.test_patch_dict_with_container_object!s�����k�����I��#��G���:�:�?�?�$��	���C��	,�
�	,�
	
��������X�.�	���C�#�s��	$�	,�
%�	,�	
��������X�.r!c����t�dd���j�}tj�d����fd��}|��j	�|�tj�ddid����fd��}|��j	�|�tj�d	gd����fd
��}|��j	�|�y)Nr�r[T��clearc�>���j�i�d�d<d�d<y�Nr`r5rar]�rsr;s��rrvz2PatchTest.test_patch_dict_with_clear.<locals>.test@s%������S�"�%��C��H�+�C��Lr!r5rLc�.���j�ddi�y�Nr5rLryr;s��rrvz2PatchTest.test_patch_dict_with_clear.<locals>.testJ�������S�3��*�-r!rKc�.���j�ddi�yr{ryr;s��rrvz2PatchTest.test_patch_dict_with_clear.<locals>.testRr|r!rjrms`  @r�test_patch_dict_with_clearz$PatchTest.test_patch_dict_with_clear<s���� �(�[�9���8�8�:��	���C�t�	$�	,�
%�	,�
	
������h�'�	���C�#�s��4�	0�	.�
1�	.�	
������h�'�	���C�*��T�	2�	.�
3�	.�	
������h�'r!c����t��t��d<d�d<�jj�}t	j
�d����fd��}|��j
�j|�t	j
�ddid����fd	��}|��j
�j|�y)
Nr\r�r]Truc�R���j�ji�d�d<d�d<yrx�rsrRr;s��rrvzGPatchTest.test_patch_dict_with_container_object_and_clear.<locals>.testbs)������S�Z�Z��,��C��H�+�C��Lr!r5rLc�B���j�jddi�yr{r�r;s��rrvzGPatchTest.test_patch_dict_with_container_object_and_clear.<locals>.testls������S�Z�Z�#�s��4r!rrrms`  @r�/test_patch_dict_with_container_object_and_clearz9PatchTest.test_patch_dict_with_container_object_and_clear[s�����k�����I��#��G���:�:�?�?�$��	���C�t�	$�	,�
%�	,�
	
��������X�.�	���C�#�s��4�	0�	5�
1�	5�	
��������X�.r!c��ddi}tj|d��5}|j|ddi�ddd�|j|ddi�y#1swY�xYw)Nr5rLr)r5)rrlrs)rrG�patcheds   r�"test_patch_dict_as_context_managerz,PatchTest.test_patch_dict_as_context_managerusQ���C�j��
�Z�Z��s�
#�w����W�s�C�j�1�$�����s�C�j�)�$�
#�s�A�Ac�<�i}tdtzt��tdtzt�d��tjtt��tj|�d�����}|j|jd�y)Nr�T��autospecc��yrr3r3r!r�	some_namez0PatchTest.test_name_preserved.<locals>.some_names��r!r�)rr"r-rrlrs)rrGr�s   r�test_name_preservedzPatchTest.test_name_preserved|sy����	�~��(�&�(�	3�	�~��(�&�(�T�	B�	���i���	*�	���C���
�
+�
C�
4�	�����+�+�[�9r!c���i}tj|ddi�d��}|jt�5|�ddd�|j	|i�y#1swY�xYw)Nr5rLc��td��)N�Konrad�rr3r!rrvz1PatchTest.test_patch_with_exception.<locals>.test�s
���H�%�%r!)rrlr`rrs)rrGrvs   r�test_patch_with_exceptionz#PatchTest.test_patch_with_exception�s]����	���C�#�s��	$�	&�
%�	&��
�
�y�
)��F�*�	
����b�!�*�
)�s�A�A"c�T��tjdddi��fd��}|�y)Nz
os.environ�
konrad_delongz
some valuec�F���jdtj�y)Nr�)�assertIn�os�environr:s�rrvz3PatchTest.test_patch_dict_with_string.<locals>.test�s����M�M�/�2�:�:�6r!)rrlr�s` r�test_patch_dict_with_stringz%PatchTest.test_patch_dict_with_string�s-���	���L�?�L�"A�	B�	7�
C�	7�	
�r!c�&��tjj�}tjdddi��fd��}	ddit_|��jtjddi�|t_y#|t_wxYw)Nz*test.test_unittest.testmock.support.targetr<�BARc�L���jtjddd��y)N�BAZr��rGr<)rsr�targetr:s�rrvz<PatchTest.test_patch_dict_decorator_resolution.<locals>.test�s������W�^�^�U�5�-I�Jr!rGr�)rr�rkrrlrsr�s`  r�$test_patch_dict_decorator_resolutionz.PatchTest.test_patch_dict_decorator_resolution�sx����>�>�&�&�(��	���@�5�%�.�	Q�	K�
R�	K�	&�#�U�^�G�N��F����W�^�^�e�U�^�<�%�G�N��X�G�N�s�6B�
Bc��tdtztd��d��}|jt|�tj
tdtd��d��}|jt|�tdtzd��d��}|jt|�tj
tdd��d	��}|jt|�y)
Nr�T�r��spec_setc��d|_y�NrG��z�res rrvz+PatchTest.test_patch_spec_set.<locals>.test��	���I�Kr!rc��d|_yr�r�r�s rrvz+PatchTest.test_patch_spec_set.<locals>.test�r�r!�r�c��d|_yr�r�r�s rrvz+PatchTest.test_patch_spec_set.<locals>.test�r�r!c��d|_yr�r�r�s rrvz+PatchTest.test_patch_spec_set.<locals>.test�r�r!)rr"rr`r�r-rr�s  r�test_patch_spec_setzPatchTest.test_patch_spec_set�s���	�~��(�y�4�	H�	 �
I�	 �	
���.�$�/�	���g�{��T�	J�	 �
K�	 �	
���.�$�/�	�~��(�4�	8�	 �
9�	 �	
���.�$�/�	���g�{�T�	:�	 �
;�	 �	
���.�$�/r!c�d�tdtzd��d��}|jt|�y)Nr�Tr�c� �|�}d|_yr�r�)rer�s  rrvz-PatchTest.test_spec_set_inherit.<locals>.test�s�� �{�H��H�Jr!)rr"r`r�r�s  r�test_spec_set_inheritzPatchTest.test_spec_set_inherit�s2��	�~��(�4�	8�	�
9�	�	
���.�$�/r!c�H�t}tdtz�}|jt|�|j	�}	|j||�|jt|�|j
�|jt|�y#|j
�wxYw)Nr�)r�rr"�assertIs�start�assertIsNot�stop)rr��patcherr�s    r�test_patch_start_stopzPatchTest.test_patch_start_stop�sv�������1�2���
�
�i��*��}�}���	����T�8�,��M�M�)�T�*��L�L�N��
�
�i��*��
�L�L�N�s�(B�B!c�d�ttdd�}|j|j��y�Nr<r`)r�foo_namer�r��rr�s  r�test_stop_without_startz!PatchTest.test_stop_without_start�s$����%��+�����'�,�,�.�)r!c��ttdd�}|j�|j�|j	|j��yr�)rr�r�r�r�r�s  r�test_stop_idempotentzPatchTest.test_stop_idempotent�s6����%��+���
�
���������'�,�,�.�)r!c�Z�t}tjtdd�}|j	t|�|j�}	|j
|d�|j	t|�|j�|j	t|�y#|j�wxYw)Nr�rG)r�rr-r�r�r�rsr�)rr�r��replaceds    r�test_patchobject_start_stopz%PatchTest.test_patchobject_start_stop�sy�����,�,�x��e�<���
�
�i��*��=�=�?��	����X�u�-��M�M�)�X�.��L�L�N��
�
�i��*��
�L�L�N�s�	(B�B*c�:�ddi}|j�}tj|dgd��}|j||�|j	�	|j|ddi�|j�|j||�y#|j�wxYw)NrGr<��spam�eggsTrur�r�)rkrrlrsr�r��r�dr�r�s    r�test_patch_dict_start_stopz$PatchTest.test_patch_dict_start_stop�s���
�E�N���6�6�8���*�*�Q�!1� 2�$�?������H�%��
�
��	����Q��� 0�1��L�L�N�����H�%��
�L�L�N�s�B�Bc��ddi}|j�}tj|dgd��}|j|j	��|j||�y)NrGr<r�Tru)rkrrlrcr�rsr�s    r�"test_patch_dict_stop_without_startz,PatchTest.test_patch_dict_stop_without_startsP��
�E�N���6�6�8���*�*�Q�!1� 2�$�?���������(�����H�%r!c�����|�ddi��j�}G��fd�dt�}tj�ddid��|�}|j	�|�|�}|j
�|j	�|�|j�|j	�|�|�}|j
�|j	�|�|j�|j	�|�y)	Nr�r�c�&��eZdZ��fd�Z��fd�Zy)�7PatchTest.test_patch_dict_class_decorator.<locals>.Testc�.���j�ddi�y�NrGr<ry�rr��thiss ��r�
test_firstzBPatchTest.test_patch_dict_class_decorator.<locals>.Test.test_first����� � ��U�E�N�3r!c�.���j�ddi�yr�ryr�s ��r�test_secondzCPatchTest.test_patch_dict_class_decorator.<locals>.Test.test_secondr�r!N)r"r#r$r�r�)r�r�s��rr�r�s
���
4�
4r!r�rGr<Tru)rkr-rrlrsr�r�)rr�r�rvr�r�s    @@r�test_patch_dict_class_decoratorz)PatchTest.test_patch_dict_class_decorators������
�V����6�6�8��	4�6�	4�9�u�z�z�!�e�U�^�4�8��>������H�%��v�����������H�%����������H�%��v�����������H�%����������H�%r!c�f���Gd�dt�}Gd�d�}|||�|fD]�}t|��tj�dd���fd��}|��j�jd��j|jd��jd�j���y)Nc��eZdZdZy)�0PatchTest.test_get_only_proxy.<locals>.SomethingrGN�r"r#r$rGr3r!rrmr�/����Cr!rmc��eZdZdZy)�4PatchTest.test_get_only_proxy.<locals>.SomethingElserGNr�r3r!rr�r�1r�r!r�rGr<c�>���j�jd�y�Nr<�rsrG��proxyrs��rrvz+PatchTest.test_get_only_proxy.<locals>.test7����� � ����E�2r!�r-r/rrsrG�assertNotIn�__dict__�rrmr��thingrvr�s`    @r�test_get_only_proxyzPatchTest.test_get_only_proxy.s����	��	�	�	��
�y�{�M�I�E��u�%�E�
�\�\�%���
.�
3�/�
3��F����U�Y�Y��.����U�Y�Y��.����U�E�N�N�3�Jr!c�j���Gd�dt�}Gd�d�}|||�|fD]�}t|d���tj�dd���fd	��}|��j�jd��j|jd��jd�j���y)
Nc��eZdZdZy)�6PatchTest.test_get_set_delete_proxy.<locals>.SomethingrGNr�r3r!rrmr�Ar�r!rmc��eZdZdZy)�:PatchTest.test_get_set_delete_proxy.<locals>.SomethingElserGNr�r3r!rr�r�Cr�r!r�F)r.rGr<c�>���j�jd�yr�r�r�s��rrvz1PatchTest.test_get_set_delete_proxy.<locals>.testIr�r!r�r�s`    @r�test_get_set_delete_proxyz#PatchTest.test_get_set_delete_proxy@s����	��	�	�	��
�y�{�M�I�E��y�5�9�E�
�\�\�%���
.�
3�/�
3��F����U�Y�Y��.����U�Y�Y��.����U�E�N�N�3�Jr!c�H�tdt�d�}ttfi|��}|j	�}|j�|j
t|�|j|jj�d�|j|jt�y)N�!��side_effectzfoo.bar.return_valuerG)�KeyErrorrrr�r�r�r`rsrGr<r��r�kwargsr�r�s    r�test_patch_keyword_argsz!PatchTest.test_patch_keyword_argsRsv��!)�2�"��&����+�F�+���}�}����������(�D�)�����������,����d�h�h�	�2r!c�^�tdt�d�}tjtdfi|��}|j�}|j
�|jt|�|j|jj�d�|j|jt�y)Nr�r�r8)r�rrr-r1r�r�r`rsrGr<r�r�s    r�test_patch_object_keyword_argsz(PatchTest.test_patch_object_keyword_args_s|��!)�2�"��&���,�,�s�C�2�6�2���}�}����������(�D�)�����������,����d�h�h�	�2r!c�*�ddi}|j�}tj|ddd��}|j�	|j	|tddd���|j�|j	||�y#|j�wxYw)NrGr<r`��)rGr<�baz)rkrrlr�rsr�)rr�rkr�s    r�test_patch_dict_keyword_argsz&PatchTest.test_patch_dict_keyword_argslsw���5�>���}�}����*�*�X�1�!��;���
�
��	����X�t��q�a�'@�A��L�L�N�����4�(��
�L�L�N�s�B�Bc�r����Gd�dt�}�fd���fd�����fd�}ttd��|�}|�}�jt|�|�t
jt}tj|dd��|�}|�}�jt|�|�y)	Nc�8�eZdZd�Zd�Zd�ZdZGd�de�Zy)�$PatchTest.test_autospec.<locals>.Booc��yrr3r4s  rr6z-PatchTest.test_autospec.<locals>.Boo.__init__}s��4r!c��yrr3r4s  rr8z&PatchTest.test_autospec.<locals>.Boo.f~s��Dr!c��yrr3r:s rr;z&PatchTest.test_autospec.<locals>.Boo.gs��r!r<c��eZdZd�Zy)�(PatchTest.test_autospec.<locals>.Boo.Barc��yrr3r:s rr5z*PatchTest.test_autospec.<locals>.Boo.Bar.a�s��Tr!NrEr3r!rrFr�s��!r!rFN)	r"r#r$r6r8r;rGr-rFr3r!r�Boor|s��'� ���C�
"�f�
"r!r	c�d��|d�|jd��jt|�y�N�)�assert_called_withr`ra�r�rs �r�_testz&PatchTest.test_autospec.<locals>._test�s(�����G��#�#�A�&����i��.r!c����|jd�|jjd��jt|j�|j	�|jj��jt|jd��jt
t|d�|jj�|jjj��jt
t|jd�|j�|jj�|jj�|jjj��jt|jjd�|j�j�|j�jj��jt|j�jd��jt
t|jd��jt
t|j�d�y)Nr�hr<rL)r8r
r`rar;r�rrG�lowerrFr5rs �r�_test2z'PatchTest.test_autospec.<locals>._test2�sx����F�F�1�I��F�F�%�%�a�(����i����0��F�F�H��F�F�%�%�'����i�����3����n�g�t�S�A��H�H�N�N���H�H�N�N�-�-�/����n�g�t�x�x��G��H�H�J��H�H�'�'�)��H�H�J�J�L��H�H�J�J�)�)�+����i������Q�7��H�H�J�L�L�N��H�H�J�L�L�+�+�-����i�������q�9����n�g�t�x�x��E����n�g�t�x�x�z�3�Gr!c�p���|��|��|d���j|t�|Sr)r�r1)r�rrrs ���rrMz)PatchTest.test_autospec.<locals>.function�s/����$�K��4�L��4��7�O��M�M�$��$��Kr!Tr�r1)r-rr�r�r1�sys�modulesr")rr	rMrvr��modulerrs`     @@r�
test_autospeczPatchTest.test_autospec{s����	"�&�	"�	/�
	H�:	�.�u�X��-�h�7���v������d�#������X�&��9�u�|�|�F�E�D�9�(�C���v������d�#��r!c�L��tdtzd���fd��}|�y)N�%s.functionTr�c�N��tj��jttj��jttj
�td��jttj�tj
d�tj	�tj�tdd�tj
dd��jtt��jtttd�y)Nr�r`rG)
rM�assert_not_calledr`�AssertionError�
assert_called�assert_called_oncer
rar�rrs �rrvz.PatchTest.test_autospec_function.<locals>.test�s�����&�&�(����n�h�.D�.D�E����n�h�.I�.I�J��Q�K����n�h�.H�.H�I��'�'��*��"�"�$��'�'�)��Q��N��'�'��1�-����i��2����n�g�x��Gr!r�r�s` r�test_autospec_functionz PatchTest.test_autospec_function�s*���	�}�x�'�$�	7�
	H�
8�
	H�	
�r!c�l�tdtzdd��d��}|�}|j|d�y)NrTr`)r�r�c��tdd�S)Nrr)rM)�
mock_functions rrvz.PatchTest.test_autospec_keywords.<locals>.test�s���A�q�>�!r!r&)rrv�results   r�test_autospec_keywordsz PatchTest.test_autospec_keywords�s>��	�}�x�'�$��
�	"�
�	"���������#r!c��tdtzd��5}tj�|j	�ddd�y#1swYyxYw)Nz%s.Foo.static_methodTr�)rr"r1r>�assert_called_once_with�r�methods  r�test_autospec_staticmethodz$PatchTest.test_autospec_staticmethod�s9��
�)�H�4�t�
D�������*�*�,�E�
D�
D���%A�Ac��tdtzd��5}tj�|j	�ddd�y#1swYyxYw)Nz%s.Foo.class_methodTr�)rr"r1rAr(r)s  r�test_autospec_classmethodz#PatchTest.test_autospec_classmethod�s9��
�(�8�3�d�
C�v������*�*�,�D�
C�
C�r,c	�@�Gd�d�}|jddd��tj|dd�	�5}|ddd��|jt|�|jt|d�|jt|dddd
��ddd�y#1swYyxYw)Nc��eZdZedd��Zy)�;PatchTest.test_autospec_staticmethod_signature.<locals>.Fooc��yrr3)r5rLrs   rr>zIPatchTest.test_autospec_staticmethod_signature.<locals>.Foo.static_method�s��.2r!N��
)r"r#r$rHr>r3r!rr1r1�s��
�2��2r!r1rrr`�rr>Tr�r�)r>rr-r`ra�rr1r*s   r�$test_autospec_staticmethod_signaturez.PatchTest.test_autospec_staticmethod_signature�s���	3�	3�	���!�Q�!��$�
�\�\�#���
>�&��1�a�1�����i��0����i���3����i���A�q�A��>�	?�
>�
>���AB�Bc	�@�Gd�d�}|jddd��tj|dd�	�5}|ddd��|jt|�|jt|d�|jt|dddd
��ddd�y#1swYyxYw)Nc��eZdZedd��Zy)�:PatchTest.test_autospec_classmethod_signature.<locals>.Fooc��yrr3)r@r5rLrs    rrAzGPatchTest.test_autospec_classmethod_signature.<locals>.Foo.class_method�s��26r!Nr3)r"r#r$rIrAr3r!rr1r;�s��
�6��6r!r1rrr`r5rATr�r�)rArr-r`rar6s   r�#test_autospec_classmethod_signaturez-PatchTest.test_autospec_classmethod_signature�s���	7�	7�	����A���#�
�\�\�#�~��
=���1�a�1�����i��0����i���3����i���A�q�A��>�	>�
=�
=�r8c��tdtzdd��}|jt|j�t
jt}tj|ddd��}|jt|j�y)Nrr`T)�newr�rM)rr"r`rar�rrr-)rr�rs   r�test_autospec_with_newz PatchTest.test_autospec_with_news_���
��0�a�$�G�����)�W�]�]�3����X�&���,�,�v�z�q�4�H�����)�W�]�]�3r!c��Gd�dt�}tt|��}|j�}	|j	||�|j	|j
t�|j�y#|j�wxYw)Nc��eZdZgZy)�0PatchTest.test_autospec_with_object.<locals>.BarN)r"r#r$�extrar3r!rrFrCs���Er!rFr�)r1rr�r�r�rD�listr�)rrFr�r�s    r�test_autospec_with_objectz#PatchTest.test_autospec_with_objectsc��	�#�	���3�/���}�}���	��!�!�$��,��!�!�$�*�*�d�3��L�L�N��G�L�L�N�s�2A5�5Bc���t}ttd��}|j�}	|j	||�|j	|d�|�|j�y#|j�wxYw)NTr�r`)r1rr�r�r�r�)r�FooClassr�r�s    r�test_autospec_inheritsz PatchTest.test_autospec_inheritssZ������4�0���}�}���	��!�!�$��1��!�!�$�q�'�8�4��L�L�N��G�L�L�N�s�*A$�$A6c��ttd��}|j�}	|jdt	|��|jdt	|j
��|jdt	|d���|jdt	|d�j
��|j
�y#|j
�wxYw)NTr�z name='Foo'z
 name='Foo.f'z
 name='Foo()'z name='Foo().f')rr�r�r��reprr8r�)rr�r�s   r�test_autospec_namezPatchTest.test_autospec_name(s�����4�0���}�}���	��M�M�-��d��4��M�M�/�4����<�8��M�M�/�4��T�
�+;�<��M�M�+�T�$�t�*�,�,�-?�@��L�L�N��G�L�L�N�s�BC�Cc��tjtdt��d��}	|�tjddd�}|j|�}|jd|�y#tj�}Y�TxYw)Nr8c��t�r)rr3r!rrvz'PatchTest.test_tracebacks.<locals>.test6s�� � r!rzraise AssertionError)	rr-r1r�exc_info�unittest�TextTestResult�_exc_info_to_stringr�)rrv�errr%�	tracebacks     r�test_tracebackszPatchTest.test_tracebacks5sv��	���c�3���	)�	!�
*�	!�	!��F��(�(��t�Q�7���.�.�s�D�9�	��
�
�,�i�8��	!��,�,�.�C�s�A.�.Bc��ttt��}|j�}|j	�|j�}|j	�|j||�||fD]}|j
|��y)N��new_callable)rr�rr�r�r�rf�rr��m1�m2r�s     r�test_new_callable_patchz!PatchTest.test_new_callable_patchCsc����/C�D��
�]�]�_������
�]�]�_����������R� ���F�D��"�"�2�&�r!c��tjtdt��}|j	�}|j�|j	�}|j�|j
||�||fD]}|j|��y)Nr8rW)rr-r1rr�r�r�rfrYs     r�test_new_callable_patch_objectz(PatchTest.test_new_callable_patch_objectPsi���,�,�s�C�6J�K��
�]�]�_������
�]�]�_����������R� ���F�D��"�"�2�&�r!c�>��G�fd�dt��tt�dd��}|j�}	|j	t|���|j
�jtdd���|j�y#|j�wxYw)Nc���eZdZdZ�fd�Zy)�:PatchTest.test_new_callable_keyword_arguments.<locals>.BarNc���|�_yr�r��rr�rFs  �rr6zCPatchTest.test_new_callable_keyword_arguments.<locals>.Bar.__init__`�
���#��
r!�r"r#r$r�r6�rFs�rrFra^�
����F�
$r!rFrr)rX�arg1�arg2)rirj)
r-rr�r�r��typersr�rlr�)rr�r"rFs   @r�#test_new_callable_keyword_argumentsz-PatchTest.test_new_callable_keyword_arguments]sq���	$�&�	$�
��s���C���M�M�O��	��M�M�$�q�'�3�'����S�Z�Z��1�1�)=�>��L�L�N��G�L�L�N�s�AB
�
Bc����G�fd�dt��tt����}|j�	|j	�j
t
����|j�tt����}|j�	|j	�j
t
����|j�y#|j�wxYw#|j�wxYw)Nc���eZdZdZ�fd�Zy)�-PatchTest.test_new_callable_spec.<locals>.BarNc���|�_yrrcrds  �rr6z6PatchTest.test_new_callable_spec.<locals>.Bar.__init__orer!rfrgs�rrFromrhr!rF�rXr�r�)rXr�r�)r-rr�r�rsr�rlr�)rr�rFs  @r�test_new_callable_specz PatchTest.test_new_callable_specls����	$�&�	$�
��s��=���
�
��	����S�Z�Z��3��8��L�L�N���s�S�A���
�
��	����S�Z�Z��s�);�<��L�L�N��
�L�L�N��
�L�L�N�s�&C�&C�C�C-c�.�dtz}t|t��}|jt|j
�t|td��}|j�}	|j
|d��|j�y#|j�wxYw)Nz	%s.weeeeerWT)rXrF)rd)r�rr	r`r�r�rfr�)r�non_existent_attr�pr"s    r�test_new_callable_createz"PatchTest.test_new_callable_create�sv��'�(�2���#�/�B�����.�!�'�'�2��#�/��
��
�G�G�I��	��"�"�1�E�"�2�
�F�F�H��A�F�F�H�s�B�Bc���|jtttt	�t
��|jttjtdt	�t
��y)N)r?rXr8)r`�
ValueErrorrr�r-rr1r:s r�'test_new_callable_incompatible_with_newz1PatchTest.test_new_callable_incompatible_with_new�sK�������x�V�X�I�	�	
�	
�������c�3�F�H�"�	�	
r!c��|jttttd��|jttj
tdtd��y)NT)rXr�r8)r`rxrr�rr-r1r:s r�,test_new_callable_incompatible_with_autospecz6PatchTest.test_new_callable_incompatible_with_autospec�sH�������x�i��	�	
�	
�������c�3�Y��	�	
r!c�T�Gd�dt�}tttt|f}|D]h}dD]a}|di}t	t
fd|i|��}|j
�}	|j}|jtt|d�|j��c�jy#|j�wxYw)Nc��eZdZy)�>PatchTest.test_new_callable_inherit_for_mocks.<locals>.MockSubN�r"r#r$r3r!r�MockSubr~����r!r�r�TrX�x)r
r	rrrr�r�r�r`r�rr�)	rr��MockClasses�Klass�argr�rur"r�s	         r�#test_new_callable_inherit_for_mocksz-PatchTest.test_new_callable_inherit_for_mocks�s���	�d�	�
�1�9�d�G�
��!�E�)���t����(�A��A�&�A���G�G�I��� �~�~�H��%�%�n�g�x��M��F�F�H�*�!���F�F�H�s�(B�B'c�`�Gd�dt�}tt|d��}|j�}	|j	t||��|j
tt|d�|j�|j|jt�y#|j�wxYw)Nc��eZdZd�Zy)�>PatchTest.test_new_callable_inherit_non_mock.<locals>.NotAMockc��||_yrr�)rr�s  rr6zGPatchTest.test_new_callable_inherit_non_mock.<locals>.NotAMock.__init__�s	�� ��	r!N)r"r#r$r6r3r!r�NotAMockr��s��
!r!r�Trqr�)
r-rr�r�rbrr`r�rr�rsr�r1)rr�rur"s    r�"test_new_callable_inherit_non_mockz,PatchTest.test_new_callable_inherit_non_mock�s��	!�v�	!�
�(���=��
�G�G�I��	��O�O�K��8�4�5����n�g�q�.�I�
�F�F�H��������%��
�F�F�H�s�7B�B-c�����|�t�G��fd�dt�}ttt��|�}|�j�|�j
�|jt��y)Nc�&��eZdZ��fd�Zd�Zd�Zy)�>PatchTest.test_new_callable_class_decorating.<locals>.SomeTestc����jt���jt|��jtt�yr)r�r1r�r�r)r�mock_foor�rvs  ��rrzDPatchTest.test_new_callable_class_decorating.<locals>.SomeTest._test�s7��� �� � ��h�/���
�
�c�8�,�%��%�%�c�9�5r!c�&�|j|�yr�r�rr�s  r�test_twozGPatchTest.test_new_callable_class_decorating.<locals>.SomeTest.test_two�����
�
�8�$r!c�&�|j|�yrr�r�s  r�test_onezGPatchTest.test_new_callable_class_decorating.<locals>.SomeTest.test_one�r�r!N�r"r#r$rr�r�)r�rvs��r�SomeTestr��s���
6�

%�
%r!r�rW)r1r-rr�rr�r�r�)rr�r�rvs  @@r�"test_new_callable_class_decoratingz,PatchTest.test_new_callable_class_decorating�sX�������
	%�v�
	%�;�5��	�:�8�D���
�����
�����
�
�c�8�$r!c�����t�tj}tj}tjt
dd��}tjtdd��}||fD]�}|j
�	�jt���jtjd��jtjd�|j��jt���jtj|��jtj|���tjt
dd����fd��}|�y#|j�wxYw)Nrr)r8r;r`r�c����jt���jtjd��jtjd�y)Nr`r�)r�r1rsr8r;)�original_foors��rrvz+PatchTest.test_patch_multiple.<locals>.test�s9����M�M�#�|�,����S�U�U�A�&����S�U�U�A�&r!)
r1r8r;r�multipler�r�r�rsr�)r�
original_f�
original_g�patcher1�patcher2r�rvr�s`      @r�test_patch_multiplezPatchTest.test_patch_multiple�s������U�U�
��U�U�
��>�>�(�a�1�5���>�>�#��a�0����)�G��M�M�O�
��
�
�c�<�0�� � �����*�� � �����*������M�M�#�|�,����S�U�U�J�/����S�U�U�J�/�*�
����A��	+�	'�
,�	'�
	
�������s
�9AE$�$E6c��|jttjt�|jttjt
�yr)r`rxrr�r�r1r:s r�test_patch_multiple_no_kwargsz'PatchTest.test_patch_multiple_no_kwargs�s.�����*�e�n�n�h�?����*�e�n�n�c�:r!c�>���t�tj}tj}tjt
tdt����fd��}|��jtj|��jtj|�y)Nr`�r8r;rGc�n���jt���jtj|��jtjd��jtj
|��j
t|t���j
t|t��y�Nr`�	r�r1r8rsr;rGrbrr)r8rGr�rs  ��rrvz8PatchTest.test_patch_multiple_create_mocks.<locals>.testso����M�M�#�|�,��M�M�#�%�%��#����S�U�U�A�&��M�M�#�'�'�3�'��O�O�K��9�5�6��O�O�K��Y�7�8r!�r1r8r;rr�r�rrs)rr�r�rvr�s`   @r� test_patch_multiple_create_mocksz*PatchTest.test_patch_multiple_create_mockssj������U�U�
��U�U�
�	����G�q�g�	>�	9�
?�	9�	
��������
�+�������
�+r!c���tj}tj}tjtdd�}d|_tjtdt�}d|_|g|_|�fd��}|��jtj|��jtj|�y)Nr8r`r;c����jtj|��jtjd�yr�)r�r1r;rsr8)r;rs �rrvzHPatchTest.test_patch_multiple_create_mocks_different_order.<locals>.tests)����M�M�#�%�%��#����S�U�U�A�&r!)	r1r8r;rr-�attribute_namer�additional_patchersrs)rr�r�r�r]rvs`     r�0test_patch_multiple_create_mocks_different_orderz:PatchTest.test_patch_multiple_create_mocks_different_orders�����U�U�
��U�U�
��,�,�s�C��+��!$������S�#�w�/��"���',�g��#�	�	'�
�	'�	
��������
�+�������
�+r!c�@����t�tj}tj}tjt
t��tjt
t��tt
dz��fd����}tjt
t��tt
dz�tjt
t���fd����}tt
dz�tjt
t��tjt
t���fd����}��fd��|�|�|��jtj|��jtj|�y)N)r8rbz.gc����|fi|��yrr3�r;r�rs  �r�test1z?PatchTest.test_patch_multiple_stacked_decorators.<locals>.test1-����
�!��v�r!c����|fi|��yrr3r�s  �r�test2z?PatchTest.test_patch_multiple_stacked_decorators.<locals>.test23r�r!c����|fi|��yrr3r�s  �r�test3z?PatchTest.test_patch_multiple_stacked_decorators.<locals>.test39r�r!c���|jd�}|jd�}�j|��jt���jtj|��jtj
|��jtj|��jt|t���jt|t���jt|t��y)Nr8rG)
�poprcr�r1r8r;rGrbrr)r;r�r8rGr�rs    ��rrz?PatchTest.test_patch_multiple_stacked_decorators.<locals>._test?s�����
�
�3��A��*�*�U�#�C����V�$��M�M�#�|�,��M�M�#�%�%��#��M�M�#�%�%��#��M�M�#�'�'�3�'��O�O�K��9�5�6��O�O�K��9�5�6��O�O�K��Y�7�8r!r�)rr�r�r�r�r�rr�s`     @@r�&test_patch_multiple_stacked_decoratorsz0PatchTest.test_patch_multiple_stacked_decorators(s������U�U�
��U�U�
�	����G�	,�	����g�	.�	�x�$��	�	�
 �
/�
-�	�
����G�	,�	�x�$��	�	����g�	.�	�
/�
 �
-�	�
�x�$��	�	����G�	,�	����g�	.�	�
/�
-�
 �	�	9�	��
��
��������
�+�������
�+r!c��t}tj}tj}tjt
tdt��}|j�}	|d}|d}|jt|�tddg��|jt|�|jtj|�|jtj|�|jt|t��|jt|t��|j�|jtj|�|jtj|�y#|j�wxYw)Nr`r�r8rG)r1r8r;rr�r�rr�rs�setr�rGrbrrr�)rr�r�r�r�r%r8rGs        r�(test_patch_multiple_create_mocks_patcherz2PatchTest.test_patch_multiple_create_mocks_patcherSs�����U�U�
��U�U�
��.�.��W��w�G�������	��s��A���-�C����S��[�#�s�E�l�*;�<��M�M�#�|�,��M�M�#�%�%��#��M�M�#�'�'�3�'��O�O�K��9�5�6��O�O�K��Y�7�8��L�L�N�������
�+�������
�+��
�L�L�N�s
�CE2�2Fc����|�t�tj}tj}G��fd�dt�}t	j
ttdt��|�}|�}|j�|j�|jtj|�|jtj|�y)Nc�&��eZdZ��fd�Zd�Zd�Zy)�@PatchTest.test_patch_multiple_decorating_class.<locals>.SomeTestc�z���jt���jtj|��jtjd��jtj
|��jt|t���jt|t��yr�r�)rr8rGr�rvs   ��rrzFPatchTest.test_patch_multiple_decorating_class.<locals>.SomeTest._testts{�����
�
�c�<�0���
�
�c�e�e�Q�'� �� � �����*���
�
�c�g�g�s�+������A�y� 9�:������C�� ;�<r!c�(�|j||�yrr��rr8rGs   rr�zIPatchTest.test_patch_multiple_decorating_class.<locals>.SomeTest.test_two|����
�
�1�c�"r!c�(�|j||�yrr�r�s   rr�zIPatchTest.test_patch_multiple_decorating_class.<locals>.SomeTest.test_one~r�r!Nr�)r�rvs��rr�r�rs���
=�
#�
#r!r�r`r�)r1r8r;r-rr�r�rr�r�rs)rr�r�r�r�r�rvs     @@r�$test_patch_multiple_decorating_classz.PatchTest.test_patch_multiple_decorating_classls���������U�U�
��U�U�
�
	#�v�
	#�
�5�>�>���1�'�
�
����
��
����
����������
�+�������
�+r!c��tjtd��}|jt|j
�tjtdd��}|j�	|j
tjd�|j�|jttd��y#|j�wxYw)N�blam)r�T)r�r)rr�r1r`r�r�rsr�r�rcrr�s  r�test_patch_multiple_createz$PatchTest.test_patch_multiple_create�s����.�.��6�2�����.�'�-�-�8��.�.��6�$�?���
�
��	����S�X�X�v�.��L�L�N������f�-�.��
�L�L�N�s�) B9�9Cc�p�tjttddg��}|j	�}	|jtj|d�tjjd�tjjd�tjjjd�tjjjd�|jtttjdd�|j�y#|j�wxYw)Nr5rL)rGr�rGrrr)rr�r1rr�rsrGr5rLr
r`r�r'r�)rr�r%s   r�test_patch_multiple_spec_setz&PatchTest.test_patch_multiple_spec_set�s����.�.��'�S�#�J�G�������	����S�W�W�f�U�m�4��G�G�I�I�a�L��G�G�I�I�a�L��G�G�I�I�(�(��+��G�G�I�I�(�(��+����n�g�s�w�w��T�J��L�L�N��G�L�L�N�s�CD#�#D5c�@�Gd�dt�}tjttt|��}|j�}	|j
tj|d�|j
tj|d�|jtj|�|jtj|�|jtjtj�|j�y#|j�wxYw)Nc��eZdZy)�9PatchTest.test_patch_multiple_new_callable.<locals>.ThingNrr3r!r�Thingr��r�r!r�)r8r;rXr8r;)r-rr�r1rr�r�r8r;r�r�r�)rr�r�r%s    r� test_patch_multiple_new_callablez*PatchTest.test_patch_multiple_new_callable�s���	�F�	��.�.��7�g�E�
�������	��M�M�#�%�%����-��M�M�#�%�%����-��!�!�#�%�%��/��!�!�#�%�%��/����S�U�U�C�E�E�*��L�L�N��G�L�L�N�s
�B4D�Dc�2�tj}tj}tjtdd�tjtdd�tjtdd�d����}tjtdd�tjtdd�tjtdd�d����}tjtdd�tjtdd�tjtdd�d����}|||fD]X}|jt|�|jtj|�|jtj|��Zy)Nr;r�missingr8c��yrr3r3r!r�thing1z3PatchTest.test_nested_patch_failure.<locals>.thing1����r!c��yrr3r3r!r�thing2z3PatchTest.test_nested_patch_failure.<locals>.thing2�r�r!c��yrr3r3r!r�thing3z3PatchTest.test_nested_patch_failure.<locals>.thing3�r�r!)r1r8r;rr-r`r�rs)rr�r�r�r�r��funcs       r�test_nested_patch_failurez#PatchTest.test_nested_patch_failure�s2���U�U�
��U�U�
�	���c�3��	"�	���c�9�a�	(�	���c�3��	"��
#�
)�
#�	�	���c�9�a�	(�	���c�3��	"�	���c�3��	"��
#�
#�
)�	�	���c�3��	"�	���c�3��	"�	���c�9�a�	(��
)�
#�
#�	��F�F�*�D����n�d�3����S�U�U�J�/����S�U�U�J�/�+r!c��tj}tj}tj}d�}t	j
tdd�t	j
td|��t	j
tdd�d����}t	j
td|��t	j
tdd�t	j
tdd�d����}t	j
tdd�t	j
tdd�t	j
td|��d	����}|||fD]x}|j
t|�|jtj|�|jtj|�|jtj|��zy)
Nc��td���N�crasherr�r3r!rr�z4PatchTest.test_new_callable_failure.<locals>.crasher��
���I�&�&r!r;rrGrWr8c��yrr3r3r!rr�z3PatchTest.test_new_callable_failure.<locals>.thing1�r�r!c��yrr3r3r!rr�z3PatchTest.test_new_callable_failure.<locals>.thing2�r�r!c��yrr3r3r!rr�z3PatchTest.test_new_callable_failure.<locals>.thing3�r�r!)	r1r8r;rGrr-r`rrs)	rr�r�r�r�r�r�r�r�s	         r�test_new_callable_failurez#PatchTest.test_new_callable_failure�sV���U�U�
��U�U�
��w�w��	'�
���c�3��	"�	���c�5�w�	7�	���c�3��	"��
#�
8�
#�	�	���c�5�w�	7�	���c�3��	"�	���c�3��	"��
#�
#�
8�	�	���c�3��	"�	���c�3��	"�	���c�5�w�	7��
8�
#�
#�	��F�F�*�D����i��.����S�U�U�J�/����S�U�U�J�/����S�W�W�l�3�	+r!c���tj}tj}tjtdd�}d|_tjtdd�}d|_tjtdd�}d|_||g||gfD]g}||_|d��}|jt|�|jtj|�|jtj|��iy)Nr8rr;r�c��yrr3r3r!rr�z3PatchTest.test_patch_multiple_failure.<locals>.funcrr!)
r1r8r;rr-r�r�r`r�rs)rr�r�r��good�bad�additionalsr�s        r�test_patch_multiple_failurez%PatchTest.test_patch_multiple_failure�s����U�U�
��U�U�
��,�,�s�C��+��!$����|�|�C��a�(��!����l�l�3�	�1�-��&��� �#�;��d��3�K�*5�G�'�
�������n�d�3����S�U�U�J�/����S�U�U�J�/�4r!c�\�tj}tj}tj}d�}t	j
tdd�}d|_t	j
tdd�}d|_t	j
td|��}d|_||g||gfD]�}||_|d��}	|jt|	�|jtj|�|jtj|�|jtj|���y)Nc��td��r�r�r3r!rr�zCPatchTest.test_patch_multiple_new_callable_failure.<locals>.crasherr�r!r8rr;rGrWc��yrr3r3r!rr�z@PatchTest.test_patch_multiple_new_callable_failure.<locals>.func rr!)r1r8r;rGrr-r�r�r`rrs)
rr�r�r�r�r�r�r�r�r�s
          r�(test_patch_multiple_new_callable_failurez2PatchTest.test_patch_multiple_new_callable_failures����U�U�
��U�U�
��w�w��	'��,�,�s�C��+��!$����|�|�C��a�(��!����l�l�3��G�<��"��� �#�;��d��3�K�*5�G�'�
�������i��.����S�U�U�J�/����S�U�U�J�/����S�W�W�l�3�4r!c�����tdtfddi�}|��tj�d����fd��}|��j	�j
d�y)Nr1�fish�tasty�nearly gone)r�c�>���j�jd�y)Nr�)rsr�r;s��rrvz=PatchTest.test_patch_multiple_string_subclasses.<locals>.test,s������S�X�X�}�5r!)rk�strrr�rsr�)rr1rvrGs`  @r�%test_patch_multiple_string_subclassesz/PatchTest.test_patch_multiple_string_subclasses)sW����5�3�&�6�7�"3�4���e��	����-�	0�	6�
1�	6�	
��������7�+r!zunittest.mock.patch.TEST_PREFIXrGc�j�Gd�dt�}tj|dd�|�}|�}|j|j�d�|j|j	�d�|j|j�d�|j|j
�d�y)Nc�(�eZdZdZd�Zd�Zd�Zd�Zy)�-PatchTest.test_patch_test_prefix.<locals>.Foor�c��|jSr�r�r:s r�foo_onez5PatchTest.test_patch_test_prefix.<locals>.Foo.foo_one9����z�z�!r!c��|jSrr�r:s r�foo_twoz5PatchTest.test_patch_test_prefix.<locals>.Foo.foo_two;rr!c��|jSrr�r:s rr�z6PatchTest.test_patch_test_prefix.<locals>.Foo.test_one=rr!c��|jSrr�r:s rr�z6PatchTest.test_patch_test_prefix.<locals>.Foo.test_two?rr!N)r"r#r$r�r�rr�r�r3r!rr1r�6s���E�
"�
"�
"�
"r!r1r��changedr�)r-rrsr�rr�r�)rr1rGs   r�test_patch_test_prefixz PatchTest.test_patch_test_prefix4s���
	"�&�
	"�4�e�l�l�3���3�C�8���e���������	�2��������	�2���������4���������4r!r<c���G�fd�dt�}ddi�tj�d��|�}|�}|j|j	�ddi�|j|j�ddi�|j|j
�ddi�|j|j�ddi�y)Nc�6��eZdZ�fd�Z�fd�Z�fd�Z�fd�Zy)�2PatchTest.test_patch_dict_test_prefix.<locals>.Fooc���t��Sr�rl�r�the_dicts �r�bar_onez:PatchTest.test_patch_dict_test_prefix.<locals>.Foo.bar_oneN�
����H�~�%r!c���t��Srrrs �r�bar_twoz:PatchTest.test_patch_dict_test_prefix.<locals>.Foo.bar_twoPrr!c���t��Srrrs �rr�z;PatchTest.test_patch_dict_test_prefix.<locals>.Foo.test_oneRrr!c���t��Srrrs �rr�z;PatchTest.test_patch_dict_test_prefix.<locals>.Foo.test_twoTrr!N)r"r#r$rrr�r�)r
s�rr1r	Ms���
&�
&�
&�
&r!r1�keyr�r)r)r-rrlrsrrr�r�)rr1rGr
s   @r�test_patch_dict_test_prefixz%PatchTest.test_patch_dict_test_prefixKs����	&�&�	&��:�&��1�e�j�j��y�1�#�6��
�U����������	�(:�;���������	�(:�;��������%��)<�=��������%��)<�=r!c��dD]�}tdtzfi|di��}|j�}	|jdt	|��|jdt	|j
��|jdt	|���|jdt	|�j
��|j
���y#|j
�wxYw)N�r�r�r�r�Tz name='SomeClass'z! name='SomeClass.class_attribute'z name='SomeClass()'z# name='SomeClass().class_attribute')rr"r�r�rKr�r�)rr�rur"s    r�test_patch_with_spec_mock_reprz(PatchTest.test_patch_with_spec_mock_repras���3�C��n�x�/�?�C��;�?�A����	�A�
��
�
�1�4��7�;��
�
�A�"�1�#4�#4�5�7��
�
�3�T�!�#�Y�?��
�
�C�"�1�3�#6�#6�7�9�����4������s�B
C	�	Cc��tdd��5}|jdt|jj	���|jdt|j�j	���ddd�y#1swYyxYw)N�#test.test_unittest.testmock.supportTr�z" name='support.SomeClass.wibble()'z$ name='support.SomeClass().wibble()')rr�rKrr�)rr"s  r�test_patch_nested_autospec_reprz)PatchTest.test_patch_nested_autospec_reprpsf��
�8�4�
H�A��M�M�>��q�{�{�1�1�3�4�
6��M�M�@��q�{�{�}�3�3�5�6�
8�I�
H�
H�s�A+B�Bc��dD�]�}tdtzfi|di��}|j�}	|j�t	j�g}|j|j|�|j|j|�|j|jjt	�g�|�}|jt	��|j|j|�|j�|jt	�j��|j|j|�|j|jt	j�g�|j|jjt	�g�|j|jt	j�g�|j����y#|j�wxYw)Nrr�T)
rr"r�r�rrs�
mock_calls�method_calls�appendr�)rr�rur"�kallsr%s      r�test_mock_calls_with_patchz$PatchTest.test_mock_calls_with_patchysZ��3�C��n�x�/�?�C��;�?�A����	�A�
����
�������� � ����u�5�� � �����7�� � ����!4�!4�t�v�h�?�������T�V�$�� � ����u�5��
�
�����T�V�]�]�_�-�� � ����u�5�� � ��!2�!2�T�[�[�]�O�D�� � ����!9�!9�D�F�8�D�� � ��!4�!4�t�{�{�}�o�F�����/4��.����s�F(G)�)G;c�~�td�}|jt|j�t	d�5t�}|tjd<d|_td�}d|_|j�|j�ddd�|jjd�y#1swY�&xYw)N�
squizz.squozz�squizz�r`)rr`�ImportErrorr�rr
rr�squozzr�rs)r�p1r$s   r�test_patch_imports_lazilyz#PatchTest.test_patch_imports_lazily�s���
�?�
#�����+�r�x�x�0�
�X�
��V�F�$*�C�K�K��!��F�M���'�B��F�M��H�H�J��G�G�I��	
�������*��
�s�AB3�3B<c�����Gd�d��G�fd�dt���fd�}|d�d��}td�5t�}|tjd<|jt|�ddd�|j�jd	t�|j�jd
d�|j�jdd
�y#1swY�kxYw)Nc��eZdZdZy)�;PatchTest.test_patch_propagates_exc_on_exit.<locals>.holder�NNNN)r"r#r$rOr3r!r�holderr,�s��'�Hr!r.c���eZdZd�fd�	ZeZy)�APatchTest.test_patch_propagates_exc_on_exit.<locals>.custom_patchNc�J��tj||||�|||f�_yr)r�__exit__rO)r�etype�val�tbr.s    �rr2zJPatchTest.test_patch_propagates_exc_on_exit.<locals>.custom_patch.__exit__�s"�������e�S�"�5�"'��b�.��r!r-)r"r#r$r2r�)r.s�r�custom_patchr0�s���
1��Dr!r6c�H��t|�\}}�||tdddddi�	S)NF)rr)r��getterrlr6s   �r�with_custom_patchzFPatchTest.test_patch_propagates_exc_on_exit.<locals>.with_custom_patch�s3��� +�F� 3��F�I���	�7�D�%���d�B��
r!r#c��t�r)�RuntimeError�r�s rrvz9PatchTest.test_patch_propagates_exc_on_exit.<locals>.test�s���r!r$rrzexception value not propagatedrz"exception traceback not propagated)
rrr
rrr`r;r�rO�assertIsNotNone)rr9rvr$r6r.s    @@r�!test_patch_propagates_exc_on_exitz+PatchTest.test_patch_propagates_exc_on_exit�s����	(�	(�	�6�	�	�
�?�	+�	�
,�	��X�
��V�F�$*�C�K�K��!����l�D�1�	�	
�
�
�f�o�o�a�(�,�7����V�_�_�Q�/�<�	>����V�_�_�Q�/�@�	B��
�s�4C�C#c���tjjtjjtj
�dd�}d�}�fd�}t
dd�5t|�5|d�|d�ddd�ddd�t
dd�5t|�5|d	�|d
�ddd�ddd�t
dd�5t|�5|d�|d�|d�|d�|d�|d�ddd�ddd�t
dd�5t|�5|d�|d�|d	�|d
�|d�|d�ddd�ddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY�[xYw#1swYyxYw)
N�test_importr$c�Z�t|�}|j�|j�yr�rr�r��rrus  r�checkz>PatchTest.test_name_resolution_import_rebinding.<locals>.check�����d��A�
�G�G�I�
�F�F�Hr!c�\��t|�}�jt|j�yr�rr`r�r��rrurs  �r�check_errorzDPatchTest.test_name_resolution_import_rebinding.<locals>.check_error�� ����d��A����n�a�g�g�6r!�package3zpackage3.submodulezpackage3.submodule.A.attrzpackage3.submodule.B.attrzpackage3.submodule:A.attrzpackage3.submodule:B.attrzpackage3:submodule.B.attrzpackage3:submodule.A.attr�r��path�join�dirnamerv�__file__rr�rrMrDrIs`   r�%test_name_resolution_import_rebindingz/PatchTest.test_name_resolution_import_rebinding�s����
�w�w�|�|�B�G�G�O�O�D�M�M�:�M�6�R��	�	7��Z�!5�
6�
�d�8K��-�.��3�4�9L�
6��Z�!5�
6�
�d�8K��-�.��3�4�9L�
6��Z�!5�
6�
�d�8K��-�.��3�4��-�.��3�4��-�.��3�4�
9L�
6��Z�!5�
6�
�d�8K��-�.��3�4��-�.��3�4��-�.��3�4�
9L�
6�
6�9L�8K��
6�
6��9L�8K��
6�
6��9L�8K��
6�
6��9L�8K��
6�
6���"F�.E;�?F�F �'F�8F �F8� 1F,�F8�-G�91G�*G�;F	�F�F�F	�F � F)�,F5	�1F8�8G�G
	�	G�Gc���tjjtjjtj
�dd�}d�}�fd�}t
dd�5t|�5|d�|d�ddd�ddd�t
dd�5t|�5|d	�|d
�ddd�ddd�t
dd�5t|�5|d�|d�|d�|d�|d�|d�ddd�ddd�t
dd�5t|�5|d�|d�|d	�|d
�|d�|d�ddd�ddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY�[xYw#1swYyxYw)
Nr@r$c�Z�t|�}|j�|j�yrrBrCs  rrDz?PatchTest.test_name_resolution_import_rebinding2.<locals>.check�rEr!c�\��t|�}�jt|j�yrrGrHs  �rrIzEPatchTest.test_name_resolution_import_rebinding2.<locals>.check_error�rJr!�package4zpackage4.submodulezpackage4.submodule.A.attrzpackage4.submodule.B.attrzpackage4.submodule:A.attrzpackage4.submodule:B.attrzpackage4:submodule.B.attrzpackage4:submodule.A.attrrLrQs`   r�&test_name_resolution_import_rebinding2z0PatchTest.test_name_resolution_import_rebinding2�s����w�w�|�|�B�G�G�O�O�D�M�M�:�M�6�R��	�	7��Z�!5�
6�
�d�8K��-�.��3�4�9L�
6��Z�!5�
6�
�d�8K��-�.��3�4�9L�
6��Z�!5�
6�
�d�8K��-�.��3�4��-�.��3�4��-�.��3�4�
9L�
6��Z�!5�
6�
�d�8K��-�.��3�4��-�.��3�4��-�.��3�4�
9L�
6�
6�9L�8K��
6�
6��9L�8K��
6�
6��9L�8K��
6�
6��9L�8K��
6�
6�rSc��dD]�}tdtzfddi|di��}|jt|j�|jt
d��ttfddi|di��}|j	�|j���y)N�r�r�r�z%s.doesnotexistrTc��tSr)�doesnotexistr3r!rr�z1PatchTest.test_create_and_specs.<locals>.<lambda>s��r!)rr"r`rar�r�MODNAMEr�)r�kwargrus   r�test_create_and_specszPatchTest.test_create_and_specss���5�E��'�(�2�'�4�'���
�'�A����i����1����i�)=�>��g�<�d�<�u�d�m�<�A�
�G�G�I�
�F�F�H�6r!c��t}dD]L}ttfddi|di��}|jt|j
�|j
t|��NdD]L}ttfddi|di��}|jt|j
�|j
t|��NdD]L}ttfddi|di��}|jt|j
�|j
t|��Ny)Nr�r�r�r�r�r�)r�r�r�)r�rr]r`rar�r�)rr�r^rus    r�test_multiple_specszPatchTest.test_multiple_specss�����)�E��g�8��8�e�Q�Z�8�A����i����1��M�M�(�H�-�*�
*�E��g�8��8�e�Q�Z�8�A����i����1��M�M�(�H�-�*�
.�E��g�4�A�4�%���4�A����i����1��M�M�(�H�-�.r!c��ttddd��}|j�}	|jd|_|j	�y#|j	�wxYw)NFrZr`)rr]r��does_not_existr�)rrur�s   r� test_specs_false_instead_of_nonez*PatchTest.test_specs_false_instead_of_none%sF���'����F���w�w�y��	����"#�D��
�F�F�H��A�F�F�H�s�A	�	Ac���dD]Q}ttfi|di��}|j�}	|jtt
|d�|j
��Sy#|j
�wxYw)Nrr�doesnotexit)rr]r�r`r�rr��rr^rur"s    r�test_falsey_speczPatchTest.test_falsey_spec0sY��5�E��g�,�%���,�A����	�A�
��!�!�.�'�1�m�L�����
6������s�A�A*c��dD]p}ttfddi|di��}|j�}	|jtt
|dd�|jtt|d�|j��ry#|j�wxYw)Nrar�Tr\r�)rr]r�r`r�r'rr�rhs    r�test_spec_set_truezPatchTest.test_spec_set_true:sw��)�E��g�>��>���
�>�A����	�A�
��!�!�.�'�1�"0�+�?��!�!�.�'�1�n�M�����*������s�9A7�7B	c���d}tt|��}|j�}	|jt	|��|j�y#|j�wxYw)N)�__call__r�)rr]r�rb�callabler��rr�rur"s    r�test_callable_spec_as_listz$PatchTest.test_callable_spec_as_listFsF�����'��%��
�G�G�I��	��O�O�H�Q�K�(�
�F�F�H��A�F�F�H���A�A"c���d}tt|��}|j�}	|jt	|��|j�y#|j�wxYw)Nr�r�)rr]r�rcrnr�ros    r�test_not_callable_spec_as_listz(PatchTest.test_not_callable_spec_as_listPsH�����'��%��
�G�G�I��	����X�a�[�)�
�F�F�H��A�F�F�H�rqc�Z����tj�tj�tj}t	dt
�j
�t	dt�j
�t	d����fd��}|��jtj|�y)N�	os.unlink�os.chdirzos.pathc����tj��jtj|��jtj
���jtj��yr)r�stopallr�r�rM�unlink�chdir)�	mock_pathrzrrys ���rr�z-PatchTest.test_patch_stopall.<locals>.patchedasB����M�M�O��M�M�"�'�'�9�-��M�M�"�)�)�V�,��M�M�"�(�(�E�*r!)	r�ryrzrMrr�r�r�r�)rrMr�rzrys`  @@r�test_patch_stopallzPatchTest.test_patch_stopallZst������������w�w��
�k�9�%�+�+�-�
�j�.�)�/�/�1�	�y�	�	+�
�	+�	�	��
�
�b�g�g�t�$r!c�����g�Gd�dt����fd�}dD�cgc]}||�j���c}tj�|j	�gd��ycc}w)Nc��eZdZdxZxZZy)�*PatchTest.test_stopall_lifo.<locals>.thingN)r"r#r$�one�two�threer3r!rr�rms�� $�$�C�$�#�r!r�c�T����G���fd�dt����fd��ddddddi�	S)Nc�&���eZdZ����fd�Z�xZS)�?PatchTest.test_stopall_lifo.<locals>.get_patch.<locals>.mypatchc�B���j��t�|��Sr)r�superr�)r�	__class__rl�mypatch�stoppeds ����rr�zDPatchTest.test_stopall_lifo.<locals>.get_patch.<locals>.mypatch.stoprs����N�N�9�-� ��$�4�6�6r!)r"r#r$r��
__classcell__)r�rlr�r�s@���rr�r�qs
���7�7r!r�c����Srr3r�s�rr�z@PatchTest.test_stopall_lifo.<locals>.get_patch.<locals>.<lambda>us���5r!F)r)rlr�r�r�s`@��r�	get_patchz.PatchTest.test_stopall_lifo.<locals>.get_patchps6���
7�
7�&�
7��=�)�T�4� �$��d�B�8�
8r!)r�r�r�)r�r�r�)r-r�rrxrs)rr�r4r�r�s   @@r�test_stopall_lifozPatchTest.test_stopall_lifoks]�����	%�F�	%�	8�,C�C�+B�C��3��	�	�	�+B�C�
�
�
������"9�:��	Ds�A'c�^��i}ddi}ddd��|j�}|j�}�j�}tj|ddd��j�tj|dd	i�j�tj���fd
��}|�|j	||�|j	||�|j�|�tj�|j||�|j||�|j�|�y)Nrr5�A�B�rr�I�IIrrLc����d=yrr3)�dic3s�rr�z2PatchTest.test_patch_dict_stopall.<locals>.patched�s
����Q�r!)rkrrlr�r�rsrx)r�dic1�dic2�origdic1�origdic2�origdic3r�r�s       @r�test_patch_dict_stopallz!PatchTest.test_patch_dict_stopall|s�������3�x���3����9�9�;���9�9�;���9�9�;��
�
�
�4�S�T�*�+�1�1�3�
�
�
�4�!�S��"�(�(�*�	���D�	�	�
�	�	�	����D�(�+����D�(�+�����x�(�
�
�
������x�(�����x�(�����x�(r!c�\�tj}tj}i}ddd�}|j�}|j�}t	dt
�j
�t	dt�j
�t	j|ddd��j
�t	j|�j
�|d=|jtj|�|jtj|�|j||�|j||�t	j�|jtj|�|jtj|�|j||�|j||�y)	Nr�r�r�rurvr�r�r)r�ryrzrkrr�r�r�rlr�r�rxr�rs)r�original_unlink�original_chdirr�r�r�r�s       r�!test_patch_and_patch_dict_stopallz+PatchTest.test_patch_and_patch_dict_stopall�s,���)�)���������3����9�9�;���9�9�;��
�k�9�%�+�+�-�
�j�.�)�/�/�1�
�
�
�4�S�T�*�+�1�1�3�
�
�
�4���� ���G�������O�4�������>�2����D�(�+����D�(�+�
�
�
���
�
�b�i�i��1��
�
�b�h�h��/�����x�(�����x�(r!c�J�dd�}tj|dd�5|j|�d�ddd�|j|�d�|j}tj|dd�5|j|jd�ddd�|j|j|�tj|dd	�5|j|jd	�ddd�|j|jt
�tj|d
t
dg��5|j|jt
dg��ddd�|j|jt
��dd�d
�}tj|dt
dg��5|j|�d�ddd�|j|�d�y#1swY���xYw#1swY��bxYw#1swY��xYw#1swY��xYw#1swY�TxYw)Nrc��|S)�TESTr3�r�s rrGz)PatchTest.test_special_attrs.<locals>.foo�s���Hr!�__defaults__)rr�__doc__�FUNr#�
testpatch2�__annotations__)�srr�c��|Srr3)r�r5s  rrGz)PatchTest.test_special_attrs.<locals>.foo�s���Hr!�__kwdefaults__)r�r)r)rr-rsr�r#r"rlr�)rrG�orig_docs   r�test_special_attrszPatchTest.test_special_attrs�s���	��\�\�#�~�u�
5����S�U�A�&�6�������"��;�;��
�\�\�#�y�%�
0����S�[�[�%�0�1�������h�/�
�\�\�#�|�\�
:����S�^�^�\�:�;��������2�
�\�\�#�0�$�
�|�2D�
E����S�0�0�$�
�|�2D�E�F�����,�,�d�f�5��	�
�\�\�#�/��z�l�1C�
D����S�U�A�&�E�������"�+6�
5��
1�
0��;�
:��F�
E��E�
D�s;�G&�6G3�H�4'H
�.H�&G0�3G=�H
�
H�H"c�z�t�}t�|d<d|d<|j�}tt	dtd���}t|j
��|z}tj|t|��5|jt|j
��|�ddd�|j||�tj||�5|jt|j
��|�ddd�|j||�y#1swY�vxYw#1swY�(xYw)Nr5�pythonrL�cdefghijklmnopqrstuvwxyz�)
rr-rkrE�zip�range�itemsrrlrs)rrGr��
update_values�patched_valuess     r�test_patch_orderdictzPatchTest.test_patch_orderdict�s����m���8��C����C���8�8�:���S�!;�U�2�Y�G�H�
��c�i�i�k�*�]�:��
�Z�Z��[��7�
8����T�#�)�)�+�.��?�9�	
����h�'�
�Z�Z��]�
+����T�#�)�)�+�.��?�,�	
����h�'�9�
8��
,�
+�s�*D%� *D1�%D.�1D:c��ddl}tjd�5tjd=tjd=tjd=tjd=td�d��}|�ddd�y#1swYyxYw)	Nrzsys.modulesrztest.test_unittest.testmockztest.test_unittestrv�%test.test_unittest.testmock.support.Xc��yrr3r<s rrvz9PatchTest.test_dotted_but_module_not_loaded.<locals>.test�s��r!)�#test.test_unittest.testmock.supportrrlrrr�s  r�!test_dotted_but_module_not_loadedz+PatchTest.test_dotted_but_module_not_loaded�sq��	3�
�Z�Z�
�
&����A�B����9�:����0�1����F�#��:�
;�
�<�
��F�'�
&�
&�s�AB�B	c���Gd�d�}dd|�fD]F}|j|��5|jt�5t|�ddd�ddd��Hy#1swY�xYw#1swY�_xYw)Nc��eZdZy)�*PatchTest.test_invalid_target.<locals>.FooNrr3r!rr1r��r�r!r1��)r�)�subTestr`rar)rr1r�s   r�test_invalid_targetzPatchTest.test_invalid_target�s`��	�	��2�s�u�o�F����V��,��&�&�y�1��&�M�2�-�,�&�1�1��-�,�s#�A+�A�A+�A(�$A+�+A4	c��tdt�d��d��}|jt�5|�ddd�y#1swYyxYw)Nr�r)r?r�c��yrr3r3r!rrvz@PatchTest.test_cant_set_kwargs_when_passing_a_mock.<locals>.test�s��r!)rr-r`rar�s  r�(test_cant_set_kwargs_when_passing_a_mockz2PatchTest.test_cant_set_kwargs_when_passing_a_mock�s<��	�6�F�H��	J��
K��
�
�
�y�
)��F�*�
)�
)�s�A�Ac�H�tdt���d��}|�y)Nz%test.test_unittest.testmock.support.grWc��yrr3)�_s rrvz/PatchTest.test_patch_proxy_object.<locals>.testr�r!)rrr�s  r�test_patch_proxy_objectz!PatchTest.test_patch_proxy_objects&��	�6�Y�[�	Q�	�
R�	�	
�r!N�T)vr"r#r$rfrzrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r	r
rrr'r1r5r<rIrTrYrnrsr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr!r&r+r.r7r=r@rFrIrLrUr\r^rlrrrvryr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr!r)r>rRrXr_rbrerirkrprsr|r�r�r�r�r�r�r�r�r�r3r!rr^r^Wst��:�
/�6�

/�/�(!�(>�V	0�'-�T�	��	��	�	��6�8�6�4�.�(6�,�0�/�,/�4
/� (�B/�6(�>/�4*�	:�
"��&�"0�20�
+�*�*�
+�&�&�&�>4�$4�$
3�
3�)�@�F�($�-�-�?�?�4�
��
�9�
'�
'���*�
�
��&
&� %�*�>;�
,�&,�*(,�V,�2,�B/�
� �$0�24�<0�04�:,��,�e�4�5�5�5�,�,�e�4�>�5�>�*�8��6
+�B�D 5�D5�>
�.�$��	���%�";�")�4)�2#�6(�&�&"��r!r^�__main__r�)-r�r�collectionsrrPrv�test.test_unittest.testmockrr�rr�test.support.import_helperr�test.test_importlib.utilr�
unittest.mockr	r
rrr
rrrrrrr�rr"r�r]r/rmr�r�r�r-r1r�rMrO�TestCaser^�mainr3r!r�<module>r�s���

�
�#���/�F�4�,��������;�;�x� ��
�(�
"����
�
�	��(�(��
�&�
��h�����!��!�$n��!�!�n�b=�z���H�M�M�O�r!

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