HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/unittest/test/testmock/__pycache__/testhelpers.cpython-37.opt-2.pyc
B

"��g	x�@s�ddlZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZddlmZddlmZGdd�de�ZGdd�dej�ZGd	d
�d
ej�ZGdd�dej�ZGd
d�dej�ZGdd�dej�Zedkr�e��dS)�N)
�call�_Call�create_autospec�	MagicMock�Mock�ANY�	_CallList�patch�PropertyMock�	_callable)�datetime)�partialc@s&eZdZdd�Zdd�Zddd�ZdS)	�	SomeClasscCsdS)N�)�self�a�brr�>/usr/local/lib/python3.7/unittest/test/testmock/testhelpers.py�onesz
SomeClass.onecCsdS)Nr)rrrr�twosz
SomeClass.twoNcCsdS)Nr)rrrrr�threeszSomeClass.three)N)�__name__�
__module__�__qualname__rrrrrrrrsrc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�AnyTestcCsF|�tt��t�}|t�|�t�t�}|td�|jtd�dS)N)�foo)�assertEqualr�objectr�assert_called_with)r�mockrrr�test_anys

zAnyTest.test_anycCs$|�tt�d�|�tt�d�dS)Nz<ANY>)r�reprr�str)rrrr�	test_repr%szAnyTest.test_reprcCs,t�}|t��t��d�|jttd�dS)N)r)rr�nowrr)rrrrr�test_any_and_datetime*szAnyTest.test_any_and_datetimecCs�t�}t��}Gdd�dt�}x�t��|�fD]�}|��||||d�|j|||d�|�j||d�ttttd�tjtttd�t�t�jttd�g}|�||j	�|�|j	|�q.WdS)Nc@seZdZdd�Zdd�ZdS)z9AnyTest.test_any_mock_calls_comparison_order.<locals>.FoocSsdS)NFr)r�otherrrr�__eq__5sz@AnyTest.test_any_mock_calls_comparison_order.<locals>.Foo.__eq__cSsdS)NTr)rr&rrr�__ne__7sz@AnyTest.test_any_mock_calls_comparison_order.<locals>.Foo.__ne__N)rrrr'r(rrrr�Foo4sr))r�bar)ZzingaZalpha)Za1Zz99)
rrr$r�
reset_mock�methodrrr�
mock_calls)rr�dr)�expectedrrr�$test_any_mock_calls_comparison_order1sz,AnyTest.test_any_mock_calls_comparison_orderN)rrrr r#r%r0rrrrrsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�CallTestcCst�}|�|t��|�|td��|�|td��|�|tif��|�|td��|�|tdif��|�|tddif��|�|td��|�|td��|�|tdif��|�|td	dif��td
�}|�|td
��|�|td��|�|tdif��|�|tddif��td
�}|�|td��|�|tddif��td�}|�|td��|�|tddif��|�|td��|�|tddif��tddif�}|�|tddddif��|�|tdddif��|�|tdddif��|�|tddif��dS)N)�)r)r2rr2r)r)r*r�bazZspam))���)r2)r4r5r6)r4r5r6))r4r5�)r)r4r5r7)r2)r4r5r7)r4r5r7)r*)r4r5r7r*rr6)rr�assertNotEqual)r�kallrrr�test_call_with_callMs<zCallTest.test_call_with_callcCsjt�}|�|d�|�|d�|�|d�|�|d�|�|ddif�|�|dif�|�|if�dS)Nr)r)r)rrr)rr)r�argsrrr�test_empty__CallrszCallTest.test_empty__CallcCs�tddif�}|�|d�|�|d�|�|ddif�|�|dif�|�|d�|�|d�|�|if�|�|d�|�|d�|�|dif�dS)	Nrr)r)rr)r)r*)r*rr*)rrr8)rr;rrr�test_named_empty_call~szCallTest.test_named_empty_callcCsJtdif�}|�|d�|�|d�|�|ddif�|�|dif�dS)N)r4r5r6))r4r5r6)r)r4r5r6r)rr)rr;rrr�test_call_with_args�s
zCallTest.test_call_with_argscCsLtddif�}|�|d�|�|ddif�|�|d�|�|dif�dS)Nr)r4r5r6)r)r4r5r6))r4r5r6)rrr8)rr;rrr�test_named_call_with_args�s
z"CallTest.test_named_call_with_argsc	Csxtdtddd�f�}|�|tddd�f�|�|dtddd�f�|�|ddtddd�f�|�|dtddd�f�dS)Nrr6r7)rrr)r�dictr)rr;rrr�test_call_with_kwargs�s
zCallTest.test_call_with_kwargsc	Csztddtddd�f�}|�|dtddd�f�|�|ddtddd�f�|�|tddd�f�|�|dtddd�f�dS)Nrrr6r7)rr)rr@rr8)rr;rrr�test_named_call_with_kwargs�s
z$CallTest.test_named_call_with_kwargscCsNtdif�}|�|tddd��|�tddd�|�|�tddd�|g�dS)N)r4r5r6r4r5r6)rrr�assertIn)rr;rrr�#test_call_with_args_call_empty_name�sz,CallTest.test_call_with_args_call_empty_namecCsR|�td�tdd��|�td�tddd�k�|�tdif�tddd�k�dS)N))r4r5r6r4r5r6)r4r5)r8rr�assertFalse�
assertTrue)rrrr�test_call_ne�szCallTest.test_call_necCs<td�}x.dd|tfD]}|�||�|�||k�qWdS)N))r4r5r6r4)r�intr8rE)rr9�valuerrr�test_call_non_tuples�szCallTest.test_call_non_tuplescCs^|�tt��d�|�ttd��d�|�ttdddif��d�|�ttddddif��d	�|�tt�d
�|�tt�d
�|�tt��d�|�ttd��d�|�ttd
d��d�|�tt�j�d�|�ttd�jjdd�j�d�|�tt�jdddd��d�|�tt���d�|�ttd�d��d�|�tt����j�	d��d�dS)Nzcall())rz
call.foo())r4r5r6rrzcall(1, 2, 3, a='b')r*zcall.bar(1, 2, 3, a='b')rr4zcall(1)�thing)Zzzzcall(zz='thing')z
call().foor6)rzcall().foo.bar().bingr5zcall().foo(1, 2, a=3)zcall()()z	call()(2)zcall()().bar().baz.beep(1))
rr!rrr"rr*�bingr3�beep)rrrrr#�s,zCallTest.test_reprcCs||�t�ddif�|�tddddd�ddddd�f�t�}|d	d
d�|ddd�|�|jtd	d
d�tddd�g�dS)
Nr2rrr*r6r7)rr)rr*r4r5�)rr)rrr�call_args_list)rrrrr�	test_call�szCallTest.test_callcCs�|�t�d�ddif�|�tjjdd�ddddif�t�}|�dd	d
�|jjd
dd�|�|jt�dd	d
�tjjd
dd�g�dS)
Nr4r)r4Zeggs)�fishzbar.bazrrQr5r6rN)rr)rrrr*r3r�method_calls)rrrrr�test_attribute_call�szCallTest.test_attribute_callc	Cstd��d�jddd�}|�|ddtdd�f�t�}|ddddd�|�|jtddddd��|�|jtddd��|�|jtddddd�g�|�|j	tddddd�g�t�}|�d����j
jd	d�t�d����j
jd	d�}|�|j	d
|�|�|j	|���dS)Nr4r5r6r7)rz().foo().bar)r6)rrrN���)
rrr*rr@r�	call_argsr8rOr-r3rM�	call_list)r�resultrZ	last_callrrr�test_extended_call�szCallTest.test_extended_callcCs@tdd�j}tdd�j}|�||�|�||�|�||�dS)Nr4)�xr5)rrrr8)rrrrrr�test_extended_not_equals
z CallTest.test_extended_not_equalcCsHtdd���j}tdd���j}|�||�|�||�|�||�dS)Nr4)rYr5)rrr*rr8)rrrrrr�test_nested_calls_not_equals
z$CallTest.test_nested_calls_not_equalcCs�t�}|d�|�td���|j�t�}|d��d�|�td��d���|j�t�}|d��d�d�|�td��d�d���|j�t�}t|d��d�d�jj�	d�d��td��d�d�jj�	d�d��
�}|�|��|j�dS)Nr4r5r6r7�)rrrrVr-r,rHrr*r3�__int__)rrr9rrr�test_call_list"s$$zCallTest.test_call_listcCs>|�tt�t�}t|�|�|jtg�|�tg|j�dS)N)rrrrrHr-)r�mrrr�
test_call_any7s
zCallTest.test_call_anycCshtdddifdd�}|�t|�d�|�|dd�|�|dddi�tdddif�}|�||�dS)	N)r4r5rr6T)rr5rr4)rr�len)rr;Z
other_argsrrr�test_two_args_call@szCallTest.test_two_args_callcCsJ|�tdd�dd�|�td�dd�|�tdddif�dd�dS)	Nrrr))r*�barzr2)r*rcZhelloZworld)rr)rrrr�test_call_with_nameIszCallTest.test_call_with_nameN)rrrr:r<r=r>r?rArBrDrGrJr#rPrSrXrZr[r^r`rbrdrrrrr1Ks(%	
	
		r1c@seZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCS)D�SpecSignatureTestcCs�|�tt|d�|�dd�|j�dd�|�t|jjdd�|�t|jd�|��|j��|�t|jjd�|�t|jd�|��|j��|�t|jjd�|�t|jdd�|�d�|j�d�|jdd�|jjdd�dS)Nrr4r5r6r7)r)	�assertRaises�AttributeError�getattrrr�AssertionError�	TypeErrorrr)rrrrr�_check_someclass_mockQs(


z'SpecSignatureTest._check_someclass_mockcCs*tt�}|�|�tt��}|�|�dS)N)rrrk)rrrrr�
test_basicls

zSpecSignatureTest.test_basiccCsPdd�}t|dd�}|�|�d�Gdd�dt�}t|dd�}|�|�d�dS)NcSsdS)Nrrrrr�ftsz>SpecSignatureTest.test_create_autospec_return_value.<locals>.fr)Zreturn_valuec@seZdZdS)z@SpecSignatureTest.test_create_autospec_return_value.<locals>.FooN)rrrrrrrr)ysr))rrr)rrmrr)rrr�!test_create_autospec_return_valuessz3SpecSignatureTest.test_create_autospec_return_valuecCs,tt�}t|�|��|�|jjd�dS)Nr)rrHr+rr]Z
call_count)rr_rrr�test_autospec_reset_mock�sz*SpecSignatureTest.test_autospec_reset_mockcCs>Gdd�dt�}t�|d�}|��}|��d�|�d�dS)Nc@seZdZdd�ZdS)z;SpecSignatureTest.test_mocking_unbound_methods.<locals>.FoocSsdS)Nr)rrrrrr�sz?SpecSignatureTest.test_mocking_unbound_methods.<locals>.Foo.fooN)rrrrrrrrr)�sr)rr4)rr	�startrr)rr)�pZmock_foorrr�test_mocking_unbound_methods�s
z.SpecSignatureTest.test_mocking_unbound_methodscCsdS)Nc@seZdZdd�ZdS)zCSpecSignatureTest.test_create_autospec_unbound_methods.<locals>.FoocSsdS)Nr)rrrrr�szGSpecSignatureTest.test_create_autospec_unbound_methods.<locals>.Foo.fooN)rrrrrrrrr)�sr)r4)rrrfrjrr)rr)�klass�instancerrr�$test_create_autospec_unbound_methods�sz6SpecSignatureTest.test_create_autospec_unbound_methodscCs.Gdd�dt�}t|dd�}|�|jd�dS)Nc@seZdZdZdS)zESpecSignatureTest.test_create_autospec_keyword_arguments.<locals>.Foor6N)rrrrrrrrr)�sr)�3)r)rrrr)rr)r_rrr�&test_create_autospec_keyword_arguments�sz8SpecSignatureTest.test_create_autospec_keyword_argumentscCsVdd�dd�}t|�}|d�|�d�|�t|dd�|ddd�|jddd�dS)N)rcSsdS)Nr)rrrrrr�szJSpecSignatureTest.test_create_autospec_keyword_only_arguments.<locals>.foor4r5r6)rrrfrj)rrr_rrr�+test_create_autospec_keyword_only_arguments�s
z=SpecSignatureTest.test_create_autospec_keyword_only_argumentscCs6t�}dd�}||_t|�}|�d�|j�d�dS)NcSsdS)Nr)rrrrrm�sz@SpecSignatureTest.test_function_as_instance_attribute.<locals>.frL)rrmrr)r�objrmrrrr�#test_function_as_instance_attribute�s
z5SpecSignatureTest.test_function_as_instance_attributecCsvtg�}|�d�|j�d�|�tt|d�Gdd�dt�}t|�}|j�d�|jj�d�|�tt|jd�dS)Nrc@seZdZgZdS)z0SpecSignatureTest.test_spec_as_list.<locals>.FooN)rrrrrrrrr)�sr)r6)r�appendrrfrgrhrr)rrr)rrr�test_spec_as_list�s
z#SpecSignatureTest.test_spec_as_listcCs:Gdd�dt�}t|�}x||jfD]}|�|�q$WdS)Nc@seZdZe�ZdS)z.SpecSignatureTest.test_attributes.<locals>.SubN)rrrr�attrrrrr�Sub�sr~)rrr}rk)rr~Zsub_mockrrrr�test_attributes�sz!SpecSignatureTest.test_attributescCs�Gdd�dt�}t|�}|�d�|j�d�|�tt|jd�|�d�|j�d�|�t|jdd�|�tt|jd�|�	ddg�|j	�ddg�|�tt|j	d�|j
�d�|j
j�d�|�tt|j
d�dS)Nc@seZdZdd�ZeZiZdS)zGSpecSignatureTest.test_builtin_functions_types.<locals>.BuiltinSubclasscSsdS)Nr)r�argrrrr*�szKSpecSignatureTest.test_builtin_functions_types.<locals>.BuiltinSubclass.barN)rrrr*�sortedr}rrrr�BuiltinSubclass�sr�r6rr*r4r5)�listrr{rrfrgrhr*rjr�r}�pop)rr�rrrr�test_builtin_functions_types�s

z.SpecSignatureTest.test_builtin_functions_typescCs�Gdd�dt�}t|�}|�dd�|��|�d�t�dd�t��t�d�g}|�|j|�|j�dd�|j��|j�d�|�	tj�dd�tj��tj�d�g�|�|j|�dS)Nc@seZdZe�ZdS)z0SpecSignatureTest.test_method_calls.<locals>.SubN)rrrrr}rrrrr~�sr~r4r5r6)
rrrrrrrrRr}�extend)rr~rr/rrr�test_method_calls�s

$z#SpecSignatureTest.test_method_callscCs|Gdd�dt�}t|�}|�t|�g�|�tt|�|�tt|j�|�t|�g�|�|dt�|�|jdt�dS)Nc@seZdZiZdS)z=SpecSignatureTest.test_magic_methods.<locals>.BuiltinSubclassN)rrrr}rrrrr�sr�r)	r�rrrfrjrHr}�assertIsInstancer)rr�rrrr�test_magic_methodssz$SpecSignatureTest.test_magic_methodscCsdGdd�dt�}xN||�fD]@}t|dd�}|�|�|�tt|dd�|�tt|jdd�qWdS)Nc@seZdZe�ZdS)z,SpecSignatureTest.test_spec_set.<locals>.SubN)rrrrr}rrrrr~!sr~T)Zspec_setrr*)rrrkrfrg�setattrr})rr~�specrrrr�
test_spec_set s
zSpecSignatureTest.test_spec_setcCs�Gdd�dt�}Gdd�d|�}Gdd�dt|�}xZ||�||�||�fD]@}t|�}|�dd�|j�dd�|�d	d
�|j�d	d
�qJWdS)Nc@s$eZdZedd��Zedd��ZdS)z/SpecSignatureTest.test_descriptors.<locals>.FoocSsdS)Nr)�clsrrrrrrm.sz1SpecSignatureTest.test_descriptors.<locals>.Foo.fcSsdS)Nr)rrrrr�g1sz1SpecSignatureTest.test_descriptors.<locals>.Foo.gN)rrr�classmethodrm�staticmethodr�rrrrr)-sr)c@seZdZdS)z/SpecSignatureTest.test_descriptors.<locals>.BarN)rrrrrrr�Bar5sr�c@seZdZdS)z/SpecSignatureTest.test_descriptors.<locals>.BazN)rrrrrrr�Baz8sr�r4r5r6r7)rrrrm�assert_called_once_withr�)rr)r�r�r�rrrr�test_descriptors,sz"SpecSignatureTest.test_descriptorscCs�Gdd�dt�}||_t|�}|�|�|jj�|��|j��|�|jt��tj��g�|�	|j
|j�|�|j
|j�|j
�
�|�t|jj
j�dS)Nc@seZdZdd�ZdZeZdS)z+SpecSignatureTest.test_recursive.<locals>.AcSsdS)Nr)rrrrrFsz-SpecSignatureTest.test_recursive.<locals>.A.azfoo bar bazN)rrrrrr*rrrr�AEsr�)r�BrrEZcalledrrrRrZassertIsrr*�assertIsNot�lowerrfrir)rr�rrrr�test_recursiveDs

z SpecSignatureTest.test_recursivecCsbGdd�dt�}t|�}|�||��xZ||�fD]L}|jdd�|jjdd�|j�d�|�t|jdd�|�tt|d�q2Wt|��}|�d�|j�d�|jjdd�|�t|jdd�|�tt|d�|�t|�|j	�
d�|j	j
�d�|j	j
jdd	�|�tt|j	d
�|�	��
d�|�	�j
�d�|�	�j
jdd	�|�tt|�	�d
�dS)Nc@s$eZdZdd�ZGdd�de�ZdS)z@SpecSignatureTest.test_spec_inheritance_for_classes.<locals>.FoocSsdS)Nr)rrYrrrr]szBSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.ac@seZdZdd�ZdS)zDSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.BarcSsdS)Nr)r�yrrrrm`szFSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.Bar.fN)rrrrmrrrrr�_sr�N)rrrrrr�rrrrr)\sr)r\)rYrr*rrN)r�r�)rrr�rrrfrjrgrhr�rm)rr)Z
class_mockZ	this_mockZ
instance_mockrrr�!test_spec_inheritance_for_classes[s0

z3SpecSignatureTest.test_spec_inheritance_for_classescCs�Gdd�dt�}||_t|�}|�}|�tt|d�|��}|�tt|d�t|��}|�tt|d�|�t|�|��}|�tt|d�dS)Nc@seZdZdZdS)z+SpecSignatureTest.test_inherit.<locals>.Foor6N)rrrrrrrrr)�sr)r)rr)rrfrgrhrj)rr)rrtZ
attr_instanceZcall_resultrrr�test_inherit�s
zSpecSignatureTest.test_inheritcCs�td�tt�td�tt�ti�tt�tg�tt�tt��tt�td�tt�td�tt�td�td�dS)Nr4rg�?y�?FT)rrHr"r@r��set�float�complex)rrrr�
test_builtins�s 
zSpecSignatureTest.test_builtinscCs�dd�}t|�}|�t|�|dd�|�dd�|jddd�|jddd�||_t|�}|�t|j�|�dd�|j�dd�|jjddd�dS)	NcSsdS)Nr)rrrrrrm�sz*SpecSignatureTest.test_function.<locals>.fr4r5)r)rrr6r7)rrfrjrrm)rrmrrrr�
test_function�s
zSpecSignatureTest.test_functioncsvGdd�dt��G�fdd�dt�}t|��|�t�fdd����dd�|�t�fd	d���j}|j|jfdS)
Nc@seZdZddd�ZdS)z;SpecSignatureTest.test_skip_attributeerrors.<locals>.RaiserNcSs|dkrtd��dS)Nz$Can only be accessed via an instance)rg)rry�typerrr�__get__�szCSpecSignatureTest.test_skip_attributeerrors.<locals>.Raiser.__get__)N)rrrr�rrrr�Raiser�sr�cseZdZ��Zedd��ZdS)z@SpecSignatureTest.test_skip_attributeerrors.<locals>.RaiserClasscSs||S)Nr)rrrrr�existing�szISpecSignatureTest.test_skip_attributeerrors.<locals>.RaiserClass.existingN)rrr�raiserr�r�r)r�rr�RaiserClass�sr�cs��ddd�S)Nr4r5r6)r�)rY)�srr�<lambda>��z=SpecSignatureTest.test_skip_attributeerrors.<locals>.<lambda>r4r5cs�jS)N)Znonexistingr)r�rrr��r�)	rrrfrjr�rgr�rr*)rr�ryr)r�r�r�test_skip_attributeerrors�sz+SpecSignatureTest.test_skip_attributeerrorscCs�Gdd�dt�}t|�}|�t|�|d�|�d�|jdd�|�t|jd�|dd�|�dd�|jddd�|jt|jddd�dS)	Nc@seZdZddd�ZdS)z3SpecSignatureTest.test_signature_class.<locals>.Foor6cSsdS)Nr)rrrrrr�__init__�sz<SpecSignatureTest.test_signature_class.<locals>.Foo.__init__N)r6)rrrr�rrrrr)�sr)r4)rr5r7r\)rr)rrrfrjr�rir)rr)rrrr�test_signature_class�s

z&SpecSignatureTest.test_signature_classcCsGdd�dt�}t|�dS)Nc@seZdZdS)z6SpecSignatureTest.test_class_with_no_init.<locals>.FooN)rrrrrrrr)�sr))rr)rr)rrr�test_class_with_no_init�sz)SpecSignatureTest.test_class_with_no_initcCs�Gdd�dt�}t|�}|dd�|�dd�|jddd�|�t|d�|dd�}|�t|�|dd�|�d�|jdd�|d�|�d�|jdd�t|dd��}|dd�|jdd�|�t|�|d�|�d�dS)Nc@seZdZdd�Zdd�ZdS)z;SpecSignatureTest.test_signature_callable.<locals>.CallablecSsdS)Nr)rrYr�rrrr��szDSpecSignatureTest.test_signature_callable.<locals>.Callable.__init__cSsdS)Nr)rrrrr�__call__�szDSpecSignatureTest.test_signature_callable.<locals>.Callable.__call__N)rrrr�r�rrrr�Callable�sr�r4r5)rYr�r)r)rrr�rfrjr)rr�rrtrrr�test_signature_callable�s(





z)SpecSignatureTest.test_signature_callablecCsvGdd�dt�}t|�}|�}|��|�t|d�|�t|�|�t|d�t|��}|�t|�|�t|d�dS)Nc@seZdZdd�ZdS)zASpecSignatureTest.test_signature_noncallable.<locals>.NonCallablecSsdS)Nr)rrrrr�szJSpecSignatureTest.test_signature_noncallable.<locals>.NonCallable.__init__N)rrrr�rrrr�NonCallablesr�r)rrr�rfrj)rr�rrtrrr�test_signature_noncallables
z,SpecSignatureTest.test_signature_noncallablecCsDGdd�dt�}t|�}|j}|�|td��|��|j��dS)Nc@seZdZdZdS)z8SpecSignatureTest.test_create_autospec_none.<locals>.FooN)rrrr*rrrrr)%sr))rrr*�assertNotIsInstancer�rr�)rr)rZnonerrr�test_create_autospec_none$sz+SpecSignatureTest.test_create_autospec_nonecCsfGdd�dt�}t|�}|�d�|j�d�|jjdd�|jdd�|j�d�|jjdd�dS)Nc@seZdZdd�ZdS)zMSpecSignatureTest.test_autospec_functions_with_self_in_odd_place.<locals>.FoocSsdS)Nr)rrrrrrm2szOSpecSignatureTest.test_autospec_functions_with_self_in_odd_place.<locals>.Foo.fN)rrrrmrrrrr)1sr)�
)r)rrrmr)rr)rrrr�.test_autospec_functions_with_self_in_odd_place0s
z@SpecSignatureTest.test_autospec_functions_with_self_in_odd_placecsvGdd�dt��Gdd�dt��G��fdd�dt�}t|�}�fdd�}||j�||j�||j�||j�dS)	Nc@s&eZdZdd�Zddd�Zdd�ZdS)	zCSpecSignatureTest.test_autospec_data_descriptor.<locals>.DescriptorcSs
||_dS)N)rI)rrIrrrr�@szLSpecSignatureTest.test_autospec_data_descriptor.<locals>.Descriptor.__init__NcSs|dkr|S|jS)N)rI)rryr�rrrr�CszKSpecSignatureTest.test_autospec_data_descriptor.<locals>.Descriptor.__get__cSsdS)Nr)rryrIrrr�__set__HszKSpecSignatureTest.test_autospec_data_descriptor.<locals>.Descriptor.__set__)N)rrrr�r�r�rrrr�
Descriptor?s
r�c@seZdZdS)zCSpecSignatureTest.test_autospec_data_descriptor.<locals>.MyPropertyN)rrrrrrr�
MyPropertyKsr�cs2eZdZdgZedd��Z�dd��Z�d�ZdS)z<SpecSignatureTest.test_autospec_data_descriptor.<locals>.Foo�slotcSsdS)Nr6r)rrrr�propQszASpecSignatureTest.test_autospec_data_descriptor.<locals>.Foo.propcSsdS)Nr7r)rrrr�subpropUszDSpecSignatureTest.test_autospec_data_descriptor.<locals>.Foo.subprop�*N)rrr�	__slots__�propertyr�r��descr)r�r�rrr)Nsr)csH��|t�|ddd�|�ddd�|�ddd�|j�ddd�dS)Nr4r5r6r7r\rN)r�r�abcr�)Z	mock_attr)rrr�check_data_descriptor]s
zNSpecSignatureTest.test_autospec_data_descriptor.<locals>.check_data_descriptor)rr�rr�r�r�r�)rr)rr�r)r�r�rr�test_autospec_data_descriptor>s
	


z/SpecSignatureTest.test_autospec_data_descriptorcCs\t�tjt���}|�|�t�t|�}|�|��|��|ddd�|�ddd�dS)Nr7r\rN)	�types�
MethodType�timeZctimer�r"rr�r+)rZmethZmockedrrr�'test_autospec_on_bound_builtin_functionosz9SpecSignatureTest.test_autospec_on_bound_builtin_functioncCs0Gdd�d�}|�}t|�}|�t|d��dS)Nc@seZdZdd�ZdS)zESpecSignatureTest.test_autospec_getattr_partial_function.<locals>.FoocSstdd�|�S)NcSs|S)Nr)�namerrrr��r�zcSpecSignatureTest.test_autospec_getattr_partial_function.<locals>.Foo.__getattr__.<locals>.<lambda>)r
)rZ	attributerrr�__getattr__�szQSpecSignatureTest.test_autospec_getattr_partial_function.<locals>.Foo.__getattr__N)rrrr�rrrrr)sr)r)rrE�hasattr)rr)�proxyZautospecrrr�&test_autospec_getattr_partial_function|sz8SpecSignatureTest.test_autospec_getattr_partial_functioncCspdd�}t|�}|dd�|ddd�|�t�|�t�|��|�|jtdd�tddd�g�|�t|d�dS)NcSsdS)Nr)rYr�rrr�myfunc�sz=SpecSignatureTest.test_spec_inspect_signature.<locals>.myfuncr4r5)rYr�)rr�inspect�getfullargspecr-rrfrj)rr�rrrr�test_spec_inspect_signature�s
 z-SpecSignatureTest.test_spec_inspect_signaturecCs�d
ttttd�dd�}t|�}|dddd�|ddd�|�t�|�t�|��|�|jtdddd�tddd�g�|�t|d�|jt|dddd	d�dS)Nr�)rr�c�returncSs|||S)Nr)rrr�rrrr�szFSpecSignatureTest.test_spec_inspect_signature_annotations.<locals>.foor4r5r6)r�r7)r�)	rHrrr�r�r-rrfrj)rrrrrr�'test_spec_inspect_signature_annotations�s$z9SpecSignatureTest.test_spec_inspect_signature_annotationsN)$rrrrkrlrnrorrrurwrxrzr|rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrreOsB


(1

rec@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestCallListcCs"t�}|�|jt�|dd�|dd�|dd�|dd�x:tdd�tdd�tdd�tdd�fD]}|�||j�qbWtdd�tdd�g}|�||j�tdd�tdd�g}|�||j�tdd�tdd�g}|�||j�tdd�g}|�||j�|�td�|j�|�td�g|j�dS)	Nr4r5r6)rr7rN)rrQ)rr�rOrrrCZassertNotIn)rrr9Zcallsrrr�!test_args_list_contains_call_list�s$



*z.TestCallList.test_args_list_contains_call_listcCsJt�}|dd�|jdd�|j��jddd�d}|�t|j�|�dS)	Nr4r5r6)rrQZdog)�catzU[call(1, 2),
 call.foo(a=3),
 call.foo.bar(),
 call.foo.bar().baz('fish', cat='dog')])rrr*r3rr"r-)rrr/rrr�test_call_list_str�s
zTestCallList.test_call_list_strcCs�tdttd�}|��}z^tj|��t�}|j|��|�|j	t
�t
�g�d|_|�|j	t
�t
�t
d�g�Wd|��XdS)Nz%s.SomeClass.one)Znew_callabler6)r	rr
rprrr�rrr-r�stop)rrqrr�rrr�test_propertymock�s zTestCallList.test_propertymockcCs@t�}t�}|t|�_|j}|��|�|t�|�|t�dS)N)rr
r�rr�r�r�)rr_rqZreturnedrrr�test_propertymock_returnvalue�s
z*TestCallList.test_propertymock_returnvalueN)rrrr�r�r�r�rrrrr��sr�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�TestCallablePredicatecCs,x&ttttttgD]}|�t|��qWdS)N)r"�bytesrHr��tuplerrFr)rryrrr�	test_type�szTestCallablePredicate.test_typecCs&Gdd�d�}|�}|�t|��dS)Nc@seZdZdd�ZdS)z>TestCallablePredicate.test_call_magic_method.<locals>.CallablecSsdS)Nr)rrrrr��szGTestCallablePredicate.test_call_magic_method.<locals>.Callable.__call__N)rrrr�rrrrr��sr�)rFr)rr�rtrrr�test_call_magic_method�sz,TestCallablePredicate.test_call_magic_methodcCs"Gdd�d�}|�t|j��dS)Nc@seZdZedd��ZdS)zATestCallablePredicate.test_staticmethod.<locals>.WithStaticMethodcSsdS)Nrrrrr�
staticfunc�szLTestCallablePredicate.test_staticmethod.<locals>.WithStaticMethod.staticfuncN)rrrr�r�rrrr�WithStaticMethod�sr�)rFrr�)rr�rrr�test_staticmethod�sz'TestCallablePredicate.test_staticmethodcCs"Gdd�d�}|�t|j��dS)Nc@seZdZed�ZdS)zMTestCallablePredicate.test_non_callable_staticmethod.<locals>.BadStaticMethodN)rrrr��not_callablerrrr�BadStaticMethodsr�)rErr�)rr�rrr�test_non_callable_staticmethodsz4TestCallablePredicate.test_non_callable_staticmethodcCs"Gdd�d�}|�t|j��dS)Nc@seZdZedd��ZdS)z?TestCallablePredicate.test_classmethod.<locals>.WithClassMethodcSsdS)Nr)r�rrr�	classfuncszITestCallablePredicate.test_classmethod.<locals>.WithClassMethod.classfuncN)rrrr�r�rrrr�WithClassMethodsr�)rFrr�)rr�rrr�test_classmethodsz&TestCallablePredicate.test_classmethodcCs"Gdd�d�}|�t|j��dS)Nc@seZdZed�ZdS)zKTestCallablePredicate.test_non_callable_classmethod.<locals>.BadClassMethodN)rrrr�r�rrrr�BadClassMethodsr�)rErr�)rr�rrr�test_non_callable_classmethod
sz3TestCallablePredicate.test_non_callable_classmethodN)	rrrr�r�r�r�r�r�rrrrr��sr��__main__)r�r�r�ZunittestZ
unittest.mockrrrrrrrr	r
rr�	functoolsr
rrZTestCaserr1rer�r�r�mainrrrr�<module>s(0
3[G&