Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/unittest/test/testmock/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/unittest/test/testmock/__pycache__/testhelpers.cpython-35.pyc



��Yf�l�@sddlZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZmZddl
m
Z
Gdd�de�ZGdd�dej�ZGdd	�d	ej�ZGd
d�dej�ZGdd
�d
ej�Zedkrej�dS)�N)	�call�_Call�create_autospec�	MagicMock�Mock�ANY�	_CallList�patch�PropertyMock)�datetimec@s7eZdZdd�Zdd�Zddd�ZdS)�	SomeClasscCsdS)N�)�self�a�br
r
�G/opt/alt/python35/lib64/python3.5/unittest/test/testmock/testhelpers.py�one
sz
SomeClass.onecCsdS)Nr
)rr
r
r�twosz
SomeClass.twoNcCsdS)Nr
)rrr
r
r�threeszSomeClass.three)�__name__�
__module__�__qualname__rrrr
r
r
rrsrc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�AnyTestcCs]|jtt��t�}|t�|jt�t�}|dt�|jdt�dS)N�foo)�assertEqualr�objectr�assert_called_with)r�mockr
r
r�test_anys	

	
zAnyTest.test_anycCs0|jtt�d�|jtt�d�dS)Nz<ANY>)r�reprr�str)rr
r
r�	test_repr#szAnyTest.test_reprcCs<t�}|tj�dtj��|jtdt�dS)Nr)rr�nowrr)rrr
r
r�test_any_and_datetime(s	zAnyTest.test_any_and_datetimec	Cst�}tj�}Gdd�dt�}x�tj�|�fD]�}|j�||d|d|�|j|d|d|�|�jd|d|�ttdtdt�tjtdtdt�t�t�jdtdt�g}|j||j	�|j|j	|�qAWdS)	Nc@s(eZdZdd�Zdd�ZdS)z9AnyTest.test_any_mock_calls_comparison_order.<locals>.FoocSsdS)NFr
)r�otherr
r
r�__eq__3sz@AnyTest.test_any_mock_calls_comparison_order.<locals>.Foo.__eq__cSsdS)NTr
)rr$r
r
r�__ne__5sz@AnyTest.test_any_mock_calls_comparison_order.<locals>.Foo.__ne__N)rrrr%r&r
r
r
r�Foo2sr'r�barZzingaZalphaZa1Zz99)
rrr"r�
reset_mock�methodrrr�
mock_calls)rr�dr'�expectedr
r
r�$test_any_mock_calls_comparison_order/s	
$z,AnyTest.test_any_mock_calls_comparison_orderN)rrrrr!r#r.r
r
r
rrsrc@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%S)&�CallTestcCs�t�}|j|t��|j|td��|j|tff��|j|tif��|j|tdff��|j|tdif��|j|tdfif��|j|td��|j|tdff��|j|tdif��|j|tdfif��td�}|j|td��|j|td��|j|tdif��|j|tddif��td�}|j|td��|j|tddif��td�}|j|td��|j|tddif��|j|td ��|j|tdd!if��td
dif�}|j|tdfd
dif��|j|tdd
dif��|j|tfd
dif��|j|td
dif��dS)"N�rr(�bazZspam����r)r0)r�r2r3r4)r6�r2r3r4)r7�r2r3r4)r0r8)r2r3r4)r2r3r4�r2r3r5)r9�r2r3r4)r0r:)r2r3r4�r2r3r5)rr;�r2r3r5)r0r<)r2r3r5�r2r3r5)r(r=)r2r3r5)rr�assertNotEqual)r�kallr
r
r�test_call_with_callKs<	%""zCallTest.test_call_with_callcCs�t�}|j|f�|j|d�|j|ff�|j|dff�|j|dfif�|j|dif�|j|if�dS)Nr)r)rr)r�argsr
r
r�test_empty__Callps	zCallTest.test_empty__CallcCs�tdfif�}|j|d�|j|dff�|j|dfif�|j|dif�|j|ff�|j|f�|j|if�|j|d�|j|dff�|j|dif�dS)Nrr()r)r()rrr>)rrAr
r
r�test_named_empty_call|szCallTest.test_named_empty_callcCsetdif�}|j|d�|j|d	�|j|dd
if�|j|dif�dS)Nr2r3r4r)r2r3r4�r2r3r4)rD�r2r3r4)rrE)r2r3r4)r2r3r4)rr)rrAr
r
r�test_call_with_args�s
zCallTest.test_call_with_argscCshtddif�}|j|d�|j|ddif�|j|d
�|j|dif�dS)Nrr2r3r4)r2r3r4�r2r3r4)rrG)r2r3r4�r2r3r4)rH)r2r3r4)rrr>)rrAr
r
r�test_named_call_with_args�s
z"CallTest.test_named_call_with_argsc	Cs�tftdddd�f�}|j|tdddd�f�|j|dtdddd�f�|j|dftdddd�f�|j|ftdddd�f�dS)Nrr4rr5r)r�dictr)rrAr
r
r�test_call_with_kwargs�s
!"%(zCallTest.test_call_with_kwargsc	Cs�tdftdddd�f�}|j|dtdddd�f�|j|dftdddd�f�|j|tdddd�f�|j|ftdddd�f�dS)Nrrr4rr5)rrJrr>)rrAr
r
r�test_named_call_with_kwargs�s
$%("z$CallTest.test_named_call_with_kwargscCsmtdif�}|j|tddd��|jtddd�|�|jtddd�|g�dS)Nr2r3r4)r2r3r4)rrr�assertIn)rrAr
r
r�#test_call_with_args_call_empty_name�sz,CallTest.test_call_with_args_call_empty_namecCss|jtd�tdd��|jtd�tddd�k�|jtdif�tddd�k�dS)	Nr2r3r4�r2r3r4)rO�r2r3r4)rP)r2r3)r>rr�assertFalseZ
assertTrue)rr
r
r�test_call_ne�s%zCallTest.test_call_necCsPtd�}x=dd|tfD])}|j||�|j||k�qWdS)Nr2r3r4�r2r3r4)rS)r�intr>rQ)rr?�valuer
r
r�test_call_non_tuples�szCallTest.test_call_non_tuplescCs�|jtt��d�|jttd��d�|jttdddif��d	�|jttd
dddif��d�|jtt�d�|jtt�d�|jtt��d�|jttd��d
�|jttdd��d�|jtt�j�d�|jttd�jjdd�j�d�|jtt�jdddd��d�|jtt���d�|jttd�d��d�|jtt��j�jj	d��d�dS)Nzcall()rz
call.foo()r2r3r4rrzcall(1, 2, 3, a='b')r(zcall.bar(1, 2, 3, a='b')rzcall(1)Zzz�thingzcall(zz='thing')z
call().foozcall().foo.bar().bingzcall().foo(1, 2, a=3)zcall()()z	call()(2)zcall()().bar().baz.beep(1))r)r2r3r4)r2r3r4)
rrrrr rr(�bingr1�beep)rr
r
rr!�s,!$'"!zCallTest.test_reprcCs�|jt�dfif�|jtdddddd�dd
ddddif�t�}|dd	d�|d
ddd�|j|jtdd	d�td
ddd�g�dS)Nr0rr(rr4rr5r2r3rr�)rr()rrr�call_args_list)rrr
r
r�	test_call�s	zCallTest.test_callcCs�|jtjd�ddif�|jtjjdd�dfddif�t�}|jddd�|jjddd	d
�|j|jtjddd�tjjddd	d
�g�dS)Nr2r�fishZeggszbar.bazr3r4rrrZ)r2)rrrr(r1r�method_calls)rrr
r
r�test_attribute_call�s"	zCallTest.test_attribute_callc	Cs�td�jd�jddd�}|j|dd	tdd�f�t�}|dddddd�|j|jtdddddd��|j|jtddd��|j|jtdddddd�g�|j|j	tdddddd�g�t�}|jd�j��j
jdd�tjd�j��j
jdd�}|j|j	d
|�|j|j	|j��dS)Nr2r3r4rr5z().foo().barrrZ)r4���)
rrr(rrJr�	call_argsr>r[r+r1rY�	call_list)r�resultrZ	last_callr
r
r�test_extended_call�s$"	(++	%'zCallTest.test_extended_callcCsVt�}|d�|jtd�j�|j�t�}|d�jd�|jtd�jd�j�|j�t�}|d�jd�d�|jtd�jd�d�j�|j�t�}t|d�jd�d�jjj	d�d��td�jd�d�jjj	d�d�j
�}|j|j�|j�dS)Nr2r3r4r5�)rrrrbr+r*rTrr(r1�__int__)rrr?r
r
r�test_call_lists	
	
	$
	46zCallTest.test_call_listcCsS|jtt�t�}t|�|j|jtg�|jtg|j�dS)N)rrrrrTr+)r�mr
r
r�
test_call_any%s
	
zCallTest.test_call_anycCs�tdddifdd�}|jt|�d�|j|dd	�|j|dddi�td
ddif�}|j||�dS)Nr2r3rr4rTr)r2r3)r2r3)r2r3)rr�len)rrAZ
other_argsr
r
r�test_two_args_call.szCallTest.test_two_args_callcCsa|jtfd�dd�|jtd	�dd�|jtd
ddif�dd�dS)Nrrr(�barzr0ZhelloZworld�r(rl)rm)r(rl)rr)rr
r
r�test_call_with_name7szCallTest.test_call_with_nameN)rrrr@rBrCrFrIrKrLrNrRrVr!r\r_rdrgrirkrnr
r
r
rr/Is$%	
	
		r/c@sxeZdZdd�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=S)>�SpecSignatureTestcCs>|jtt|d�|jdd�|jjdd�|jt|jjdd�|jt|jd�|j�|jj�|jt|jjd�|jt|jd�|j�|jj�|jt|jjd�|jt|jdd�|jd�|jjd�|jdd�|jjdd�dS)Nrr2r3r4r5r)	�assertRaises�AttributeError�getattrrr�AssertionError�	TypeErrorrr)rrr
r
r�_check_someclass_mock?s(	

	

	
z'SpecSignatureTest._check_someclass_mockcCs9tt�}|j|�tt��}|j|�dS)N)rrru)rrr
r
r�
test_basicZs
zSpecSignatureTest.test_basiccCspdd�}t|dd�}|j|�d�Gdd�dt�}t|dd�}|j|�d�dS)NcSsdS)Nr
r
r
r
r�fbsz>SpecSignatureTest.test_create_autospec_return_value.<locals>.fZreturn_valuerc@seZdZdS)z@SpecSignatureTest.test_create_autospec_return_value.<locals>.FooN)rrrr
r
r
rr'gsr')rrr)rrwrr'r
r
r�!test_create_autospec_return_valueasz3SpecSignatureTest.test_create_autospec_return_valuecCs:tt�}t|�|j�|j|jjd�dS)Nr)rrTr)rrfZ
call_count)rrhr
r
r�test_autospec_reset_mockns

z*SpecSignatureTest.test_autospec_reset_mockcCsUGdd�dt�}tj|d�}|j�}|�jd�|jd�dS)Nc@seZdZdd�ZdS)z;SpecSignatureTest.test_mocking_unbound_methods.<locals>.FoocSsdS)Nr
)rrr
r
rrwsz?SpecSignatureTest.test_mocking_unbound_methods.<locals>.Foo.fooN)rrrrr
r
r
rr'vsr'rr2)rr	�startrr)rr'�pZmock_foor
r
r�test_mocking_unbound_methodsus
z.SpecSignatureTest.test_mocking_unbound_methodscCsudSGdd�dt�}t|�}|�}|jt|jd�|jd�|jjd�|jt|j�)Nc@seZdZdd�ZdS)zCSpecSignatureTest.test_create_autospec_unbound_methods.<locals>.FoocSsdS)Nr
)rr
r
rr�szGSpecSignatureTest.test_create_autospec_unbound_methods.<locals>.Foo.fooN)rrrrr
r
r
rr'�sr'r2)rrrprtrr)rr'�klass�instancer
r
r�$test_create_autospec_unbound_methods�s	
z6SpecSignatureTest.test_create_autospec_unbound_methodscCs?Gdd�dt�}t|dd�}|j|jd�dS)Nc@seZdZdZdS)zESpecSignatureTest.test_create_autospec_keyword_arguments.<locals>.Foor4N)rrrrr
r
r
rr'�sr'r�3)rrrr)rr'rhr
r
r�&test_create_autospec_keyword_arguments�sz8SpecSignatureTest.test_create_autospec_keyword_argumentscCsrdddd�}t|�}|d�|jd�|jt|dd�|ddd�|jddd�dS)NrcSsdS)Nr
)rrr
r
rr�szJSpecSignatureTest.test_create_autospec_keyword_only_arguments.<locals>.foor2r3r4)rrrprt)rrrhr
r
r�+test_create_autospec_keyword_only_arguments�s

z=SpecSignatureTest.test_create_autospec_keyword_only_argumentscCsKt�}dd�}||_t|�}|jd�|jjd�dS)NcSsdS)Nr
)rr
r
rrw�sz@SpecSignatureTest.test_function_as_instance_attribute.<locals>.frX)rrwrr)r�objrwrr
r
r�#test_function_as_instance_attribute�s		
z5SpecSignatureTest.test_function_as_instance_attributecCs�tg�}|jd�|jjd�|jtt|d�Gdd�dt�}t|�}|jjd�|jjjd�|jtt|jd�dS)Nrc@seZdZgZdS)z0SpecSignatureTest.test_spec_as_list.<locals>.FooN)rrrrr
r
r
rr'�sr'r4)r�appendrrprqrrrr)rrr'r
r
r�test_spec_as_list�s
z#SpecSignatureTest.test_spec_as_listcCsMGdd�dt�}t|�}x$||jfD]}|j|�q2WdS)Nc@seZdZe�ZdS)z.SpecSignatureTest.test_attributes.<locals>.SubN)rrrr�attrr
r
r
r�Sub�sr�)rrr�ru)rr�Zsub_mockrr
r
r�test_attributes�sz!SpecSignatureTest.test_attributescCs)Gdd�dt�}t|�}|jd�|jjd�|jtt|jd�|jd�|jjd�|jt|jdd�|jtt|jd�|j	ddg�|j	jddg�|jtt|j	d�|j
jd�|j
jjd�|jtt|j
d�dS)Nc@s(eZdZdd�ZeZiZdS)zGSpecSignatureTest.test_builtin_functions_types.<locals>.BuiltinSubclasscSsdS)Nr
)r�argr
r
rr(�szKSpecSignatureTest.test_builtin_functions_types.<locals>.BuiltinSubclass.barN)rrrr(�sortedr�r
r
r
r�BuiltinSubclass�sr�r4rr(r2r3)�listrr�rrprqrrr(rtr�r��pop)rr�rr
r
r�test_builtin_functions_types�s

z.SpecSignatureTest.test_builtin_functions_typescCsGdd�dt�}t|�}|jdd�|j�|jd�tjdd�tj�tjd�g}|j|j|�|jjdd�|jj�|jjd�|j	tjjdd�tjj�tjjd�g�|j|j|�dS)Nc@seZdZe�ZdS)z0SpecSignatureTest.test_method_calls.<locals>.SubN)rrrrr�r
r
r
rr��sr�r2r3r4)
rrrrrrrr^r��extend)rr�rr-r
r
r�test_method_calls�s

*
4z#SpecSignatureTest.test_method_callscCs�Gdd�dt�}t|�}|jt|�g�|jtt|�|jtt|j�|jt|�g�|j|dt�|j|jdt�dS)Nc@seZdZiZdS)z=SpecSignatureTest.test_magic_methods.<locals>.BuiltinSubclassN)rrrr�r
r
r
rr�sr�r)	r�rrrprtrTr��assertIsInstancer)rr�rr
r
r�test_magic_methodssz$SpecSignatureTest.test_magic_methodscCs�Gdd�dt�}xk||�fD]Z}t|dd�}|j|�|jtt|dd�|jtt|jdd�q&WdS)Nc@seZdZe�ZdS)z,SpecSignatureTest.test_spec_set.<locals>.SubN)rrrrr�r
r
r
rr�sr�Zspec_setTrr()rrrurprq�setattrr�)rr��specrr
r
r�
test_spec_sets
zSpecSignatureTest.test_spec_setcCs�Gdd�dt�}Gdd�d|�}Gdd�dt|�}x{||�||�||�fD]X}t|�}|jdd�|jjdd�|jd	d
�|jjd	d
�qgWdS)Nc@s4eZdZedd��Zedd��ZdS)z/SpecSignatureTest.test_descriptors.<locals>.FoocSsdS)Nr
)�clsrrr
r
rrwsz1SpecSignatureTest.test_descriptors.<locals>.Foo.fcSsdS)Nr
)rrr
r
r�gsz1SpecSignatureTest.test_descriptors.<locals>.Foo.gN)rrr�classmethodrw�staticmethodr�r
r
r
rr'sr'c@seZdZdS)z/SpecSignatureTest.test_descriptors.<locals>.BarN)rrrr
r
r
r�Bar#sr�c@seZdZdS)z/SpecSignatureTest.test_descriptors.<locals>.BazN)rrrr
r
r
r�Baz&sr�r2r3r4r5)rrrrw�assert_called_once_withr�)rr'r�r�r�rr
r
r�test_descriptorss(z"SpecSignatureTest.test_descriptorscCs�Gdd�dt�}||_t|�}|�|j|jj�|j�|jj�|j|jtj�tjj�g�|j	|j
|j�|j|j
|j�|j
j
�|jt|jj
j�dS)Nc@s(eZdZdd�ZdZeZdS)z+SpecSignatureTest.test_recursive.<locals>.AcSsdS)Nr
)rr
r
rr4sz-SpecSignatureTest.test_recursive.<locals>.A.azfoo bar bazN)rrrrrr(r
r
r
r�A3sr�)r�BrrQZcalledrrr^rZassertIsrr(�assertIsNot�lowerrprsr)rr�rr
r
r�test_recursive2s	

(
z SpecSignatureTest.test_recursivecCs�Gdd�dt�}t|�}|j||��xy||�fD]h}|jdd�|jjdd�|jjd�|jt|jdd�|jtt|d�qEWt|��}|jd�|jjd�|jjdd�|jt|jdd�|jtt|d�|jt|�|j	j
d�|j	j
jd�|j	j
jd	d�|jtt|j	d
�|j	�j
d�|j	�j
jd�|j	�j
jd	d�|jtt|j	�d
�dS)Nc@s2eZdZdd�ZGdd�de�ZdS)z@SpecSignatureTest.test_spec_inheritance_for_classes.<locals>.FoocSsdS)Nr
)r�xr
r
rrKszBSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.ac@seZdZdd�ZdS)zDSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.BarcSsdS)Nr
)r�yr
r
rrwNszFSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.Bar.fN)rrrrwr
r
r
rr�Msr�N)rrrrrr�r
r
r
rr'Jsr'r�rerr(rrZr�r�)rrr�rrrprtrqrrr�rw)rr'Z
class_mockZ	this_mockZ
instance_mockr
r
r�!test_spec_inheritance_for_classesIs0
z3SpecSignatureTest.test_spec_inheritance_for_classescCs�Gdd�dt�}||_t|�}|�}|jtt|d�|j�}|jtt|d�t|��}|jtt|d�|jt|�|j�}|jtt|d�dS)Nc@seZdZdZdS)z+SpecSignatureTest.test_inherit.<locals>.Foor4N)rrrrr
r
r
rr'rsr'r)rr'rrprqrrrt)rr'rr~Z
attr_instanceZcall_resultr
r
r�test_inheritqs		zSpecSignatureTest.test_inheritcCs�td�tt�td�tt�ti�tt�tg�tt�tt��tt�td�tt�td�tt�td�td�dS)Nr2rg�?y�?FT)rrTr rJr��set�float�complex)rr
r
r�
test_builtins�s 














zSpecSignatureTest.test_builtinscCs�dd�}t|�}|jt|�|dd�|jdd�|jddd�|jdddd�||_t|�}|jt|j�|jdd�|jjdd�|jjdddd�dS)	NcSsdS)Nr
)rrr
r
rrw�sz*SpecSignatureTest.test_function.<locals>.fr2r3rrr4r5)rrprtrrw)rrwrr
r
r�
test_function�s
	zSpecSignatureTest.test_functioncs�Gdd�dt��G�fdd�dt�}t|��|jt�fdd���jdd�|jt�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)rq)rr��typer
r
r�__get__�szCSpecSignatureTest.test_skip_attributeerrors.<locals>.Raiser.__get__)rrrr�r
r
r
r�Raiser�sr�cs+eZdZ��Zedd��ZdS)z@SpecSignatureTest.test_skip_attributeerrors.<locals>.RaiserClasscSs||S)Nr
)rrr
r
r�existing�szISpecSignatureTest.test_skip_attributeerrors.<locals>.RaiserClass.existingN)rrr�raiserr�r�r
)r�r
r�RaiserClass�s	r�cs�jddd�S)Nr2r3r4)r�)r�)�sr
r�<lambda>�sz=SpecSignatureTest.test_skip_attributeerrors.<locals>.<lambda>r2r3cs�jS)N)Znonexistingr
)r�r
rr��s)	rrrprtr�rqr�rr()rr�r�r
)r�r�r�test_skip_attributeerrors�s	z+SpecSignatureTest.test_skip_attributeerrorscCs�Gdd�dt�}t|�}|jt|�|d�|jd�|jdd�|jt|jd�|dd�|jdd�|jdddd�|jt|jdddd�dS)	Nc@seZdZddd�ZdS)z3SpecSignatureTest.test_signature_class.<locals>.Foor4cSsdS)Nr
)rrrr
r
r�__init__�sz<SpecSignatureTest.test_signature_class.<locals>.Foo.__init__N)rrrr�r
r
r
rr'�sr'r2rr3r5rer)rrrprtr�rsr)rr'rr
r
r�test_signature_class�s


z&SpecSignatureTest.test_signature_classcCs$Gdd�dt�}t|�dS)Nc@seZdZdS)z6SpecSignatureTest.test_class_with_no_init.<locals>.FooN)rrrr
r
r
rr'�sr')rr)rr'r
r
r�test_class_with_no_init�sz)SpecSignatureTest.test_class_with_no_initcCs5Gdd�dt�}t|�}|dd�|jdd�|jdddd�|jt|d�|dd�}|jt|�|dd�|jd�|jdd�|d�|jd�|jdd�t|dd��}|dd�|jdd�|jt|�|d�|jd�dS)Nc@s(eZdZdd�Zdd�ZdS)z;SpecSignatureTest.test_signature_callable.<locals>.CallablecSsdS)Nr
)rr�r�r
r
rr��szDSpecSignatureTest.test_signature_callable.<locals>.Callable.__init__cSsdS)Nr
)rrr
r
r�__call__�szDSpecSignatureTest.test_signature_callable.<locals>.Callable.__call__N)rrrr�r�r
r
r
r�Callable�sr�r2r3r�r�r)rrr�rprtr)rr�rr~r
r
r�test_signature_callable�s(






z)SpecSignatureTest.test_signature_callablecCs�Gdd�dt�}t|�}|�}|j�|jt|d�|jt|�|jt|d�t|��}|jt|�|jt|d�dS)Nc@seZdZdd�ZdS)zASpecSignatureTest.test_signature_noncallable.<locals>.NonCallablecSsdS)Nr
)rr
r
rr�szJSpecSignatureTest.test_signature_noncallable.<locals>.NonCallable.__init__N)rrrr�r
r
r
r�NonCallablesr�r)rrr�rprt)rr�rr~r
r
r�test_signature_noncallables	
z,SpecSignatureTest.test_signature_noncallablecCs\Gdd�dt�}t|�}|j}|j|td��|j�|jj�dS)Nc@seZdZdZdS)z8SpecSignatureTest.test_create_autospec_none.<locals>.FooN)rrrr(r
r
r
rr'sr')rrr(�assertNotIsInstancer�rr�)rr'rZnoner
r
r�test_create_autospec_nones	
z+SpecSignatureTest.test_create_autospec_nonecCs�Gdd�dt�}t|�}|jd�|jjd�|jjdd�|jdd�|jjd�|jjdd�dS)Nc@seZdZdd�ZdS)zMSpecSignatureTest.test_autospec_functions_with_self_in_odd_place.<locals>.FoocSsdS)Nr
)rrr
r
rrw szOSpecSignatureTest.test_autospec_functions_with_self_in_odd_place.<locals>.Foo.fN)rrrrwr
r
r
rr'sr'�
r)rrrwr)rr'rr
r
r�.test_autospec_functions_with_self_in_odd_places
z@SpecSignatureTest.test_autospec_functions_with_self_in_odd_placecs�Gdd�dt��Gdd�dt��G��fdd�dt�}t|�}�fdd�}||j�||j�||j�||j�dS)	Nc@s7eZdZdd�Zddd�Zdd�ZdS)zCSpecSignatureTest.test_autospec_data_descriptor.<locals>.DescriptorcSs
||_dS)N)rU)rrUr
r
rr�.szLSpecSignatureTest.test_autospec_data_descriptor.<locals>.Descriptor.__init__NcSs|dkr|S|jS)N)rU)rr�r�r
r
rr�1szKSpecSignatureTest.test_autospec_data_descriptor.<locals>.Descriptor.__get__cSsdS)Nr
)rr�rUr
r
r�__set__6szKSpecSignatureTest.test_autospec_data_descriptor.<locals>.Descriptor.__set__)rrrr�r�r�r
r
r
r�
Descriptor-sr�c@seZdZdS)zCSpecSignatureTest.test_autospec_data_descriptor.<locals>.MyPropertyN)rrrr
r
r
r�
MyProperty9sr�csIeZdZdgZedd��Z�dd��Z�d�ZdS)z<SpecSignatureTest.test_autospec_data_descriptor.<locals>.Foo�slotcSsdS)Nr4r
)rr
r
r�prop?szASpecSignatureTest.test_autospec_data_descriptor.<locals>.Foo.propcSsdS)Nr5r
)rr
r
r�subpropCszDSpecSignatureTest.test_autospec_data_descriptor.<locals>.Foo.subprop�*N)rrr�	__slots__�propertyr�r��descr
)r�r�r
rr'<s	r'cs`�j|t�|ddd�|jddd�|jddd�|jjddd�dS)Nr2r3r4r5rerZ)r�r�abcr�)Z	mock_attr)rr
r�check_data_descriptorKs
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|tjtjtj��}|j|�t�t|�}|�|j�|j�|ddd�|jddd�dS)Nr5rerZ)	�types�
MethodType�timeZctimer�r rr�r))r�methZmockedr
r
r�'test_autospec_on_bound_builtin_function]s

z9SpecSignatureTest.test_autospec_on_bound_builtin_functionN)!rrrrurvrxryr|rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
rro=s<


(1roc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestCallListcCs�t�}|j|jt�|dd�|dd�|dd�|dd�xQtdd�tdd�tdd�tdd�fD]}|j||j�q�Wtdd�tdd�g}|j||j�tdd�tdd�g}|j||j�tdd�tdd�g}|j||j�tdd�g}|j||j�|jtd�|j�|jtd�g|j�dS)	Nr2r3rr4r5rrZr])rr�r[rrrMZassertNotIn)rrr?Zcallsr
r
r�!test_args_list_contains_call_listls$	



=z.TestCallList.test_args_list_contains_call_listcCset�}|dd�|jdd�|jj�jddd�d}|jt|j�|�dS)	Nr2r3rr4r]�catZdogzU[call(1, 2),
 call.foo(a=3),
 call.foo.bar(),
 call.foo.bar().baz('fish', cat='dog')])rrr(r1rr r+)rrr-r
r
r�test_call_list_str�s	
zTestCallList.test_call_list_strcCs�tdtdt�}|j�}ztj|j�t�}|j|j�|j|j	t
�t
�g�d|_|j|j	t
�t
�t
d�g�Wd|j�XdS)Nz%s.SomeClass.oneZnew_callabler4)r	rr
rzrrr�rrr+r�stop)rr{rr�r
r
r�test_propertymock�s
	
	,zTestCallList.test_propertymockcCsXt�}t�}|t|�_|j}|j�|j|t�|j|t�dS)N)rr
r�rr�r�r�)rrhr{Zreturnedr
r
r�test_propertymock_returnvalue�s			
z*TestCallList.test_propertymock_returnvalueN)rrrr�r�r�r�r
r
r
rr�jsr��__main__)r�r�ZunittestZ
unittest.mockrrrrrrrr	r
rrrZTestCaserr/ror�r�mainr
r
r
r�<module>s@
3���/G