Viewing File: /opt/alt/python35/lib/python3.5/site-packages/mock/tests/__pycache__/testhelpers.cpython-35.pyc



¬?ïVpã@sddlZddlZddlmZmZmZmZmZm	Z	m
Z
ddlmZm
Z
ddlmZGdd„deƒZGdd„dejƒZGd	d
„d
ejƒZGdd„dejƒZGd
d„dejƒZedkrejƒdS)éN)ÚcallÚcreate_autospecÚ	MagicMockÚMockÚANYÚpatchÚPropertyMock)Ú_CallÚ	_CallList)Údatetimec@s7eZdZdd„Zdd„Zddd„ZdS)Ú	SomeClasscCsdS)N©)ÚselfÚaÚbr
r
ú/testhelpers.pyÚonesz
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__7sz@AnyTest.test_any_mock_calls_comparison_order.<locals>.Foo.__eq__cSsdS)NTr
)rr$r
r
rÚ__ne__9sz@AnyTest.test_any_mock_calls_comparison_order.<locals>.Foo.__ne__N)rrrr%r&r
r
r
rÚFoo6sr'rÚbarZzingaÚalphaZa1Zz99)
rrr"rÚ
reset_mockÚmethodrrrÚ
mock_calls)rrÚdr'Úexpectedr
r
rÚ$test_any_mock_calls_comparison_order3s	
$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#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)r1)úfoo©r3r4r5)r8©r3r4r5)r9©r3r4r5)r1r:)r3r4r5)r3r4r5©r3r4r6)r;©r3r4r5)r1r<)r3r4r5©r3r4r6)r7r=©r3r4r6)r1r>)r3r4r6©r3r4r6)zbarr?)r3r4r6)r	rÚassertNotEqual)rÚkallr
r
rÚtest_call_with_callOs<	%""zCallTest.test_call_with_callcCs˜tƒ}|j|fƒ|j|dƒ|j|ffƒ|j|dffƒ|j|dfifƒ|j|difƒ|j|ifƒdS)Nr)zfoo)r	r)rÚargsr
r
rÚtest_empty__Callts	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()zfoo)zbar)r	rr@)rrCr
r
rÚtest_named_empty_call€szCallTest.test_named_empty_callcCsetdifƒ}|j|dƒ|j|d	ƒ|j|dd
ifƒ|j|difƒdS)Nr3r4r5r)r3r4r5©r3r4r5)rF©r3r4r5)zfoorG)r3r4r5)r3r4r5)r	r)rrCr
r
rÚtest_call_with_argss
zCallTest.test_call_with_argscCshtddifƒ}|j|dƒ|j|ddifƒ|j|d
ƒ|j|difƒdS)Nrr3r4r5)r3r4r5©r3r4r5)zfoorI)r3r4r5©r3r4r5)rJ)r3r4r5)r	rr@)rrCr
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)Nrr5rr6r)r	Údictr)rrCr
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)Nrrr5rr6)r	rLrr@)rrCr
r
rÚtest_named_call_with_kwargs¬s
$%("z$CallTest.test_named_call_with_kwargscCsmtdifƒ}|j|tdddƒƒ|jtdddƒ|ƒ|jtdddƒ|gƒdS)Nr3r4r5)r3r4r5)r	rrÚassertIn)rrCr
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)	Nr3r4r5©r3r4r5)rQ©r3r4r5)rR)r3r4)r@r	rÚassertFalseZ
assertTrue)rr
r
rÚtest_call_ne½s%zCallTest.test_call_necCsPtdƒ}x=dd|tfD])}|j||ƒ|j||kƒqWdS)Nr3r4r5©r3r4r5)rU)r	Úintr@rS)rrAÚ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()r3r4r5rrzcall(1, 2, 3, a='b')r(zcall.bar(1, 2, 3, a='b')rzcall(1)ÚzzÚthingzcall(zz='thing')z
call().foozcall().foo.bar().bingzcall().foo(1, 2, a=3)zcall()()z	call()(2)zcall()().bar().baz.beep(1))zfoo)r3r4r5)r3r4r5)
rrr	rr rr(Úbingr2Ú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)Nr1rr(rr5rr6r3r4rré)zfoozbar)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)Nr3rÚfishZeggszbar.bazr4r5rrr])r3)rrrr(r2rÚ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)Nr3r4r5rr6z().foo().barrr])r5éÿÿÿÿ)
rrr(rrLrÚ	call_argsr@r^r,r2r\Ú	call_list)rÚresultrZ	last_callr
r
rÚtest_extended_calls$"	(++	%'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)Nr3r4r5r6é)rrrrer,r+rVrr(r2Ú__int__)rrrAr
r
rÚtest_call_lists	
	
	$
	46zCallTest.test_call_listcCsS|jttƒtƒ}t|ƒ|j|jtgƒ|jtg|jƒdS)N)rrrrrVr,)rÚmr
r
rÚ
test_call_any)s
	
zCallTest.test_call_anycCsŽtdddifddƒ}|jt|ƒdƒ|j|dd	ƒ|j|dddiƒtd
ddifƒ}|j||ƒdS)Nr3r4rr5rTr)r3r4)r3r4)r3r4)r	rÚlen)rrCZ
other_argsr
r
rÚtest_two_args_call2szCallTest.test_two_args_callN)rrrrBrDrErHrKrMrNrPrTrXr!r_rbrgrjrlrnr
r
r
rr0Ms"%	
	
	r0c@sùeZdZdd„Zdd„Zdd„Zdd„Zd	d
„Zej	dd„ƒZ
d
d„Zeje
jdƒdd„ƒZdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zeje
jd"ƒd#d$„ƒZd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Z eje
jd3ƒd4d5„ƒZ!d6d7„Z"eje
jd3ƒd8d9„ƒZ#d:d;„Z$d<d=„Z%d>d?„Z&d@dA„Z'dBdC„Z(dDdE„Z)dFS)GÚ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)Nrr3r4r5r6r)	Ú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_basicYs
zSpecSignatureTest.test_basiccCspdd„}t|ddƒ}|j|ƒdƒGdd„dtƒ}t|ddƒ}|j|ƒdƒdS)NcSsdS)Nr
r
r
r
rÚfasz>SpecSignatureTest.test_create_autospec_return_value.<locals>.fZreturn_valuerc@seZdZdS)z@SpecSignatureTest.test_create_autospec_return_value.<locals>.FooN)rrrr
r
r
rr'fsr')rrr)rrwrr'r
r
rÚ!test_create_autospec_return_value`sz3SpecSignatureTest.test_create_autospec_return_valuecCs:ttƒ}t|ƒ|jƒ|j|jjdƒdS)Nr)rrVr*rriZ
call_count)rrkr
r
rÚtest_autospec_reset_mockms

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
rrvsz?SpecSignatureTest.test_mocking_unbound_methods.<locals>.Foo.fooN)rrrrr
r
r
rr'usr'rr3)rrÚstartrr)rr'ÚpZmock_foor
r
rÚtest_mocking_unbound_methodsts
z.SpecSignatureTest.test_mocking_unbound_methodscCsuGdd„dtƒ}t|ƒ}|ƒ}|jt|jdƒ|jdƒ|jjdƒ|jt|jƒdS)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'r3)rrrprtrr)rr'ÚklassÚinstancer
r
rÚ$test_create_autospec_unbound_methodss	
z6SpecSignatureTest.test_create_autospec_unbound_methodscCs?Gdd„dtƒ}t|ddƒ}|j|jdƒdS)Nc@seZdZdZdS)zESpecSignatureTest.test_create_autospec_keyword_arguments.<locals>.Foor5N)rrrrr
r
r
rr'‘sr'rÚ3)rrrr)rr'rkr
r
rÚ&test_create_autospec_keyword_argumentssz8SpecSignatureTest.test_create_autospec_keyword_argumentsz(Keyword only arguments Python 3 specificcCsƒd}i}t||ƒ|d}t|ƒ}|dƒ|jdƒ|jt|ddƒ|dddƒ|jdddƒdS)Nz def foo(a, *, b=None):
    pass
rr3r4rr5)Úexecrrrprt)rZfunc_defÚ	namespacerrkr
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>.fr[)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'r5)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Žr5rr(r3r4)Úlistrr‡rrprqrrr(rtrr‰Ú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Šr3r4r5)
rrrrrrrrar‰Ú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)	rrrrprtrVr‰ÚassertIsInstancer)rrŽrr
r
rÚtest_magic_methodsÿs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_set
s
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rc@seZdZdS)z/SpecSignatureTest.test_descriptors.<locals>.BazN)rrrr
r
r
rÚBaz%sržr3r4r5r6)rrrrwÚassert_called_once_withrš)rr'rržr—rr
r
rÚtest_descriptorss(z"SpecSignatureTest.test_descriptorsz No old style classes in Python 3csöGdd„dƒ‰G‡fdd†dˆƒ}x~ˆˆƒ||ƒfD]d}t|ƒ}|jddƒ|jjddƒ|jtt|dƒ|jtt|jdƒqHW|jjddƒ|jjjddƒ|jtt|jdƒdS)Nc@seZdZdd„ZdS)z5SpecSignatureTest.test_old_style_classes.<locals>.FoocSsdS)Nr
)rrrr
r
rrw4sz7SpecSignatureTest.test_old_style_classes.<locals>.Foo.fN)rrrrwr
r
r
rr'3sr'cseZdZ”ƒZdS)z5SpecSignatureTest.test_old_style_classes.<locals>.BarN)rrrršr
)r'r
rr7srr3r4r)rrwrŸrprqrrrš)rrr—rr
)r'rÚtest_old_style_classes1sz(SpecSignatureTest.test_old_style_classescCsÚ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
rrIsz-SpecSignatureTest.test_recursive.<locals>.A.azfoo bar bazN)rrrrrr(r
r
r
rÚAHsr¢)rÚBrrSZcalledrrrarZassertIsrr(ÚassertIsNotÚlowerrprsr)rr¢rr
r
rÚtest_recursiveGs	

(
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
rr`szBSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.ac@seZdZdd„ZdS)zDSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.BarcSsdS)Nr
)rÚyr
r
rrwcszFSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.Bar.fN)rrrrwr
r
r
rrbsrN)rrrrrrr
r
r
rr'_sr'r§rhrr(rr]r¨rš)rrr¤rrrprtrqrrrrw)rr'Z
class_mockZ	this_mockZ
instance_mockr
r
rÚ!test_spec_inheritance_for_classes^s0
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>.Foor5N)rrrrr
r
r
rr'‡sr'r)rr'rrprqrrrt)rr'rr~Z
attr_instanceZcall_resultr
r
rÚtest_inherit†s		zSpecSignatureTest.test_inheritcCs§tdƒttƒtdƒttƒtiƒttƒtgƒttƒttƒƒttƒtdƒttƒtdƒttƒtdƒtdƒdS)Nr3rgð?yð?FT)rrVr rLrÚ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>.fr3r4rrr5r6)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)Nr3r4r5)r³)r§)Úsr
rÚ<lambda>Ôsz=SpecSignatureTest.test_skip_attributeerrors.<locals>.<lambda>r3r4csˆjS)N)Znonexistingr
)r¶r
rr·Ös)	rrrprtr³rqr´rr()rrµr…r
)r²r¶rÚtest_skip_attributeerrorsÆs	z+SpecSignatureTest.test_skip_attributeerrorscCsjGdd„dtƒ}t|ƒ}|jt|ƒ|dƒ|jdƒ|ddƒ|jddƒdS)Nc@seZdZddd„ZdS)z3SpecSignatureTest.test_signature_class.<locals>.Foor5cSsdS)Nr
)rrrr
r
rÚ__init__ßsz<SpecSignatureTest.test_signature_class.<locals>.Foo.__init__N)rrrr¹r
r
r
rr'Þsr'r3r6rh)rrrprtrŸr)rr'rr
r
rÚtest_signature_classÝs


z&SpecSignatureTest.test_signature_classz no old style classes in Python 3cCsÂGdd„dƒ}t|ƒ}|jt|ƒ|dƒ|jdƒ|jddƒ|jt|jdƒ|ddƒ|jddƒ|jddddƒ|jt|jddddƒdS)	Nc@seZdZddd„ZdS)z=SpecSignatureTest.test_signature_old_style_class.<locals>.Foor5cSsdS)Nr
)rrrr
r
rr¹ïszFSpecSignatureTest.test_signature_old_style_class.<locals>.Foo.__init__N)rrrr¹r
r
r
rr'îsr'r3rr4r6rhr)rrprtrŸrsr)rr'rr
r
rÚtest_signature_old_style_classìs


z0SpecSignatureTest.test_signature_old_style_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_initsz)SpecSignatureTest.test_class_with_no_initcCs!Gdd„dƒ}t|ƒdS)Nc@seZdZdS)z@SpecSignatureTest.test_old_style_class_with_no_init.<locals>.FooN)rrrr
r
r
rr'sr')r)rr'r
r
rÚ!test_old_style_class_with_no_initsz3SpecSignatureTest.test_old_style_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ÚCallablesr¿r3r4r§r¨r)rrrŸrprtr)rr¿rr~r
r
rÚtest_signature_callables(






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¹1szJSpecSignatureTest.test_signature_noncallable.<locals>.NonCallable.__init__N)rrrr¹r
r
r
rÚNonCallable0srÁr)rrrŸrprt)rrÁrr~r
r
rÚtest_signature_noncallable/s	
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'Asr')rrr(ÚassertNotIsInstancer°rrŸ)rr'rZnoner
r
rÚtest_create_autospec_none@s	
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
rrwNszOSpecSignatureTest.test_autospec_functions_with_self_in_odd_place.<locals>.Foo.fN)rrrrwr
r
r
rr'Msr'é
r)rrrwr)rr'rr
r
rÚ.test_autospec_functions_with_self_in_odd_placeLs
z@SpecSignatureTest.test_autospec_functions_with_self_in_odd_placecCs‹Gdd„dtƒ}t|ƒ}|j}|j|tƒ|dddƒ|jdddƒ|jdddƒ|jjdddƒdS)	Nc@s"eZdZedd„ƒZdS)z5SpecSignatureTest.test_autospec_property.<locals>.FoocSsdS)Nr5r
)rr
r
rr\sz9SpecSignatureTest.test_autospec_property.<locals>.Foo.fooN)rrrÚpropertyrr
r
r
rr'[sr'r3r4r5r6rhr])rrrr”rÚabcrŸ)rr'rZ
mock_propertyr
r
rÚtest_autospec_propertyZs	z(SpecSignatureTest.test_autospec_propertycCs{Gdd„dtƒ}t|ƒ}|j}|dddƒ|jdddƒ|jdddƒ|jjdddƒdS)	Nc@seZdZdgZdS)z2SpecSignatureTest.test_autospec_slots.<locals>.FoorN)rrrÚ	__slots__r
r
r
rr'lsr'r3r4r5r6rhr])rrrrÈrŸ)rr'rZ	mock_slotr
r
rÚtest_autospec_slotsks	z%SpecSignatureTest.test_autospec_slotsN)*rrrrurvrxryr|ÚunittestZexpectedFailurerrZ
skipUnlessÚsixÚPY3r„r†rˆr‹r‘r“r•r˜r ÚskipIfr¡r¦r©rªr®r¯r¸rºr»r¼r½rÀrÂrÄrÆrÉrËr
r
r
rro<sB
!
!(!!	roc@saeZdZdd„Zdd„Zejejdƒdd„ƒZ	dd	„Z
d
d„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)	Nr3r4rr5r6rr]r`)rr”r^r
rrOZassertNotIn)rrrAZcallsr
r
rÚ!test_args_list_contains_call_list{s$	



=z.TestCallList.test_args_list_contains_call_listcCsetƒ}|ddƒ|jddƒ|jjƒjdddƒd}|jt|jƒ|ƒdS)	Nr3r4rr5r`ÚcatZdogzU[call(1, 2),
 call.foo(a=3),
 call.foo.bar(),
 call.foo.bar().baz('fish', cat='dog')])rrr(r2rr r,)rrr.r
r
rÚtest_call_list_str”s	
zTestCallList.test_call_list_strz)Unicode is properly handled with Python 3cCsUtƒ}Gdd„dtƒ}|tdƒ|ƒi|jt|jƒdƒdS)Nc@seZdZdd„ZdS)z9TestCallList.test_call_list_unicode.<locals>.NonAsciiReprcSsdS)Nõér
)rr
r
rÚ__repr__©szBTestCallList.test_call_list_unicode.<locals>.NonAsciiRepr.__repr__N)rrrrÕr
r
r
rÚNonAsciiRepr¨srÖru[call(a=é)])rrÚunicoderr r,)rrrÖr
r
rÚtest_call_list_unicode£s	z#TestCallList.test_call_list_unicodec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_callabler5)rrrrzr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)rrr°rrŸr”rÃ)rrkr{Zreturnedr
r
rÚtest_propertymock_returnvalueÃs			
z*TestCallList.test_propertymock_returnvalueN)rrrrÑrÓrÌrÏrÍrÎrØrÚrÛr
r
r
rrÐys
!rÐÚ__main__)rÍZ	unittest2rÌrrrrrrrrZ	mock.mockr	r
rrrZTestCaserr0rorÐrÚmainr
r
r
rÚ<module>s4
3ïÿÿ?U
Back to Directory File Manager