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.10/unittest/test/testmock/__pycache__/testhelpers.cpython-310.opt-2.pyc
o

�ip��@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�Zedkrse��dSdS)�N)
�call�_Call�create_autospec�	MagicMock�Mock�ANY�	_CallList�patch�PropertyMock�	_callable)�datetime��partialc@s&eZdZdd�Zdd�Zddd�ZdS)	�	SomeClasscC�dS�N���self�a�brr�?/usr/local/lib/python3.10/unittest/test/testmock/testhelpers.py�one�z
SomeClass.onecCrrr�rrrr�tworz
SomeClass.twoNcCrrr�rrrrr�threerzSomeClass.threer)�__name__�
__module__�__qualname__rrrrrrrrsrc@�<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�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�strrrrr�	test_repr"szAnyTest.test_reprcCs,t�}|t��t��d�|jttd�dSr#)rr�nowr(rr)rrr�test_any_and_datetime'szAnyTest.test_any_and_datetimecCs�t�}Gdd�dt�}t��|�fD]C}|��||||d�|j|||d�|�j||d�ttttd�tjtttd�t�t�jttd�g}|�||j	�|�|j	|�qdS)Nc@�eZdZdd�Zdd�ZdS)z9AnyTest.test_any_mock_calls_comparison_order.<locals>.FoocSrrr�r�otherrrr�__eq__1rz@AnyTest.test_any_mock_calls_comparison_order.<locals>.Foo.__eq__cSrrrr2rrr�__ne__2rz@AnyTest.test_any_mock_calls_comparison_order.<locals>.Foo.__ne__N)rrr r4r5rrrr�Foo0�r6�r%�bar)Zzinga�alpha)Za1Zz99)
rr'rr/�
reset_mock�methodrrr&�
mock_calls)rr*r6�d�expectedrrr�$test_any_mock_calls_comparison_order.s��z,AnyTest.test_any_mock_calls_comparison_ordercCsNGdd�d�}t�}||�d�|�ttd�g�|�td�|�td�dS)Nc@�eZdZdd�ZdS)z%AnyTest.test_any_no_spec.<locals>.FoocSrrrr2rrrr4Frz,AnyTest.test_any_no_spec.<locals>.Foo.__eq__N�rrr r4rrrrr6E�r6��r�assert_has_callsrrr(�assert_any_call�rr6r*rrr�test_any_no_specCszAnyTest.test_any_no_speccCsRGdd�d�}t|d�}||�d�|�ttd�g�|�td�|�td�dS)Nc@rA)z*AnyTest.test_any_and_spec_set.<locals>.FoocSrrrr2rrrr4Qrz1AnyTest.test_any_and_spec_set.<locals>.Foo.__eq__NrBrrrrr6PrCr6)�specrDrErHrrr�test_any_and_spec_setNs
zAnyTest.test_any_and_spec_setN)	rrr r+r.r0r@rIrKrrrrr"sr"c@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)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)rMrrMrr$�r9r�bazZspam��rD��)rMrRrR)�rDrS�)r%rU)rMrUrU)r9rUr9rrT�rr&�assertNotEqual)r�kallrrr�test_call_with_call\s<zCallTest.test_call_with_callcCsjt�}|�|d�|�|d�|�|d�|�|d�|�|ddif�|�|dif�|�|if�dS)Nrr$rN�r%rr%)rr&�r�argsrrr�test_empty__Call�szCallTest.test_empty__CallcCs�tddif�}|�|d�|�|d�|�|ddif�|�|dif�|�|d�|�|d�|�|if�|�|d�|�|d�|�|dif�dS)	Nr%rr$r[rN)r9rOr9rWr\rrr�test_named_empty_call�szCallTest.test_named_empty_callcCsftdif�}|�|d�|�|d�|�|ddif�|�|dif�|�|jd�|�|ji�dS)NrRrQ�r%rRr%)rr&r]�kwargsr\rrr�test_call_with_args�szCallTest.test_call_with_argscCshtddif�}|�|d�|�|ddif�|�|jd�|�|ji�|�|d�|�|dif�dS)Nr%rRr`rQ)rr&r]rarXr\rrr�test_named_call_with_args�sz"CallTest.test_named_call_with_argsc	Cs�tdtddd�f�}|�|tddd�f�|�|dtddd�f�|�|ddtddd�f�|�|dtddd�f�|�|jd�|�|jtddd��dS)NrrTrV�rrr%)r�dictr&r]rar\rrr�test_call_with_kwargs�szCallTest.test_call_with_kwargsc	Cs�tddtddd�f�}|�|dtddd�f�|�|ddtddd�f�|�|jd�|�|jtddd��|�|tddd�f�|�|dtddd�f�dS)Nr%rrTrVrd)rrer&r]rarXr\rrr�test_named_call_with_kwargs�sz$CallTest.test_named_call_with_kwargscCsNtdif�}|�|tddd��|�tddd�|�|�tddd�|g�dS)NrRrDrSrT)rr&r�assertInr\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)NrQrDrSrT�rDrS)rXrr�assertFalse�
assertTruerrrr�test_call_ne�s"zCallTest.test_call_necCs8td�}dd|tfD]}|�||�|�||k�q
dS)NrQrD)r�intrXrk)rrY�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()r$z
call.foo()rRrrzcall(1, 2, 3, a='b')r9zcall.bar(1, 2, 3, a='b')rrDzcall(1)�thing)�zzzcall(zz='thing')z
call().foorT�rzcall().foo.bar().bingrSzcall().foo(1, 2, a=3)zcall()()z	call()(2)zcall()().bar().baz.beep(1))
r&r,rrr-r%r9�bingrP�beeprrrrr.�s6�����zCallTest.test_reprcCs||�t�ddif�|�tddddd�ddddd�f�t�}|d	d
d�|ddd�|�|jtd	d
d�tddd�g�dS)
NrMrr%r9rTrV)rrr8rDrS�rd)r&rr�call_args_listr)rrr�	test_call�s��zCallTest.test_callcCs�|�t�d�ddif�|�tjjdd�ddddif�t�}|�dd	d
�|jjd
dd�|�|jt�dd	d
�tjjd
dd�g�dS)
NrDr%)rDZeggs)�fishzbar.bazrryrSrTrvrd)r&rr%r9rPr�method_callsr)rrr�test_attribute_call
s��zCallTest.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)NrDrSrTrVrsz().foo().bar�rTrdrv���)
rr%r9r&rerZ	call_argsrXrwr=rPru�	call_list)r�resultr*Z	last_callrrr�test_extended_callszCallTest.test_extended_callcCs@tdd�j}tdd�j}|�||�|�||�|�||�dS�NrD��xrS)rr%r&rXrrrr�test_extended_not_equal*s
z CallTest.test_extended_not_equalcCsHtdd���j}tdd���j}|�||�|�||�|�||�dSr�)rr%r9r&rXrrrr�test_nested_calls_not_equal2s
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)NrDrSrTrV�)rr&rr~r=r<rnr%r9rP�__int__)rr*rYrrr�test_call_list:s"��$$zCallTest.test_call_listcCs>|�tt�t�}t|�|�|jtg�|�tg|j�dSr)r&rrrrnr=�r�mrrr�
test_call_anyOs
zCallTest.test_call_anycCshtdddifdd�}|�t|�d�|�|dd�|�|dddi�tdddif�}|�||�dS)	NrjrrTT)rrSrrD)rr&�len)rr]Z
other_argsrrr�test_two_args_callXszCallTest.test_two_args_callcCsJ|�tdd�dd�|�td�dd�|�tdddif�dd�dS)	Nrr%r)�r9ZbarzrMr�ZhelloZworld)r&rrrrr�test_call_with_nameas zCallTest.test_call_with_namec	Cs�t�}|���d�|�|jt�t���t����d�t������g�t�}d|���d<|�|jt�t���t����dd�g�t�}t|����|�|jt�t���t�����g�dS)Nr9rD)	rr%r&r=r�__getitem__�__setitem__�iter�__iter__r�rrr�test_dunder_callfs$*���zCallTest.test_dunder_callN)rrr rZr^r_rbrcrfrgrirmrpr.rxr{r�r�r�r�r�r�r�r�rrrrrLZs,%		rLc@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)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMS)N�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)Nr%rDrSrTrVrs)	�assertRaises�AttributeError�getattrrr(�AssertionError�	TypeErrorrrr)rrr�_check_someclass_mock}s.
�
�
�
z'SpecSignatureTest._check_someclass_mockcCs*tt�}|�|�tt��}|�|�dSr)rrr�r)rrr�
test_basic�s

zSpecSignatureTest.test_basiccCsPdd�}t|dd�}|�|�d�Gdd�dt�}t|dd�}|�|�d�dS)NcSrrrrrrr�f�rz>SpecSignatureTest.test_create_autospec_return_value.<locals>.fr%��return_valuec@�eZdZdS)z@SpecSignatureTest.test_create_autospec_return_value.<locals>.FooN�rrr rrrrr6��r6)rr&r')rr�r*r6rrr�!test_create_autospec_return_value�sz3SpecSignatureTest.test_create_autospec_return_valuecCs,tt�}t|�|��|�|jjd�dS)Nr)rrnr;r&r�Z
call_countr�rrr�test_autospec_reset_mock�sz*SpecSignatureTest.test_autospec_reset_mockcCs>Gdd�dt�}t�|d�}|��}|��d�|�d�dS)Nc@rA)z;SpecSignatureTest.test_mocking_unbound_methods.<locals>.FoocSrrr)rr%rrrr%�rz?SpecSignatureTest.test_mocking_unbound_methods.<locals>.Foo.fooN�rrr r%rrrrr6�rCr6r%rD)r'r	�startr%r()rr6�pZmock_foorrr�test_mocking_unbound_methods�s
z.SpecSignatureTest.test_mocking_unbound_methodscCs.Gdd�dt�}t|dd�}|�|jd�dS)Nc@�eZdZdZdS)zESpecSignatureTest.test_create_autospec_keyword_arguments.<locals>.FoorTN�rrr rrrrrr6��r6�3rs)r'rr&r)rr6r�rrr�&test_create_autospec_keyword_arguments�sz8SpecSignatureTest.test_create_autospec_keyword_argumentscCsVdd�dd�}t|�}|d�|�d�|�t|dd�|ddd�|jddd�dS)N�rcSrrrrdrrrr%�rzJSpecSignatureTest.test_create_autospec_keyword_only_arguments.<locals>.foorDrSrT)rr(r�r�)rr%r�rrr�+test_create_autospec_keyword_only_arguments�s
z=SpecSignatureTest.test_create_autospec_keyword_only_argumentscCs6t�}dd�}||_t|�}|�d�|j�d�dS)NcSrrrrsrrrr��rz@SpecSignatureTest.test_function_as_instance_attribute.<locals>.frt)rr�rr()r�objr�r*rrr�#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)Nr%c@seZdZgZdS)z0SpecSignatureTest.test_spec_as_list.<locals>.FooNr�rrrrr6�r�r6rT)r�appendr(r�r�r�r'r%)rr*r6rrr�test_spec_as_list�s
z#SpecSignatureTest.test_spec_as_listcCs6Gdd�dt�}t|�}||jfD]}|�|�qdS)Nc@�eZdZe�ZdS)z.SpecSignatureTest.test_attributes.<locals>.SubN�rrr r�attrrrrr�Sub��
r�)rrr�r�)rr�Zsub_mockr*rrr�test_attributes�s
�z!SpecSignatureTest.test_attributescs�Gdd�dt��G�fdd�dt�}t|�}|�d�|�t��|��Wd�n1s/wY|�t��|�dd�Wd�dS1sKwYdS)Nc@rA)zVSpecSignatureTest.test_spec_has_descriptor_returning_function.<locals>.CrazyDescriptorcSs|durdd�SdS)NcSrrrr�rrr�<lambda>�rzpSpecSignatureTest.test_spec_has_descriptor_returning_function.<locals>.CrazyDescriptor.__get__.<locals>.<lambda>r)rr�Ztype_rrr�__get__���z^SpecSignatureTest.test_spec_has_descriptor_returning_function.<locals>.CrazyDescriptor.__get__N�rrr r�rrrr�CrazyDescriptor��r�cseZdZ��ZdS)zNSpecSignatureTest.test_spec_has_descriptor_returning_function.<locals>.MyClassN)rrr �	some_attrr�r�rr�MyClass�s
r�rDrS)r'rr�r�r�)rr�r*rr�r�+test_spec_has_descriptor_returning_function�s

�"�z=SpecSignatureTest.test_spec_has_descriptor_returning_functioncs�G�fdd�dt����}|�t��|jWd�n1s wY|�|�d�d�t|�}|�d�|�t��|��Wd�n1sKwY|�t��|�dd�Wd�dS1sgwYdS)Ncs&eZdZ��fdd�Zdd�Z�ZS)zISpecSignatureTest.test_spec_has_function_not_in_bases.<locals>.CrazyClasscst�|���dgS)N�crazy)�super�__dir__r)�
CrazyClass�	__class__rrr�
szQSpecSignatureTest.test_spec_has_function_not_in_bases.<locals>.CrazyClass.__dir__cSs|dkrdd�St|��)Nr�cS�|Srrr�rrrr�rzgSpecSignatureTest.test_spec_has_function_not_in_bases.<locals>.CrazyClass.__getattr__.<locals>.<lambda>�r�)r�itemrrr�__getattr__szUSpecSignatureTest.test_spec_has_function_not_in_bases.<locals>.CrazyClass.__getattr__)rrr r�r��
__classcell__r�r�)r�rr�sr��*rDrS)r'r�r�r3r&r�rr�)r�instr*rr�r�#test_spec_has_function_not_in_bases	s
�

�"�z5SpecSignatureTest.test_spec_has_function_not_in_basescCs�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>.BuiltinSubclasscSrrr)r�argrrrr9'rzKSpecSignatureTest.test_builtin_functions_types.<locals>.BuiltinSubclass.barN)rrr r9�sortedr�rrrr�BuiltinSubclass&�r�rTr%r9rDrS)�listrr�r(r�r�r�r9r�r�r��pop�rr�r*rrr�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@r�)z0SpecSignatureTest.test_method_calls.<locals>.SubNr�rrrrr�?r�r�rDrSrT)
rrrrrrr&rzr��extend)rr�r*r?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)rrr r�rrrrr�Ur�r�r%)	r�rr&r�r�rnr��assertIsInstancerr�rrr�test_magic_methodsTsz$SpecSignatureTest.test_magic_methodscCs`Gdd�dt�}||�fD] }t|dd�}|�|�|�tt|dd�|�tt|jdd�q
dS)Nc@r�)z,SpecSignatureTest.test_spec_set.<locals>.SubNr�rrrrr�cr�r�T)Zspec_setr%r9)rrr�r�r��setattrr�)rr�rJr*rrr�
test_spec_setbs
�zSpecSignatureTest.test_spec_setcCs�Gdd�dt�}Gdd�d|�}Gdd�dt|�}||�||�||�fD] }t|�}|�dd�|j�dd�|�d	d
�|j�d	d
�q$dS)Nc@s$eZdZedd��Zedd��ZdS)z/SpecSignatureTest.test_descriptors.<locals>.FoocSrrr)�clsrrrrrr�p�z1SpecSignatureTest.test_descriptors.<locals>.Foo.fcSrrrrdrrr�grr�z1SpecSignatureTest.test_descriptors.<locals>.Foo.gN)rrr �classmethodr��staticmethodr�rrrrr6os

r6c@r�)z/SpecSignatureTest.test_descriptors.<locals>.BarNr�rrrr�Baru�r�c@r�)z/SpecSignatureTest.test_descriptors.<locals>.BazNr�rrrr�Bazwr�r�rDrSrTrV)r'rrr��assert_called_once_withr�)rr6r�r�rJr*rrr�test_descriptorsns�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>.AcSrrrrrrrr�rz-SpecSignatureTest.test_recursive.<locals>.A.azfoo bar bazN)rrr rr%r9rrrr�A�r�r�)r'�BrrkZcalledrr&rzrZassertIsr%r9�assertIsNot�lowerr�r�r()rr�r*rrr�test_recursive�s

z SpecSignatureTest.test_recursivecCs^Gdd�dt�}t|�}|�||��||�fD]&}|jdd�|jjdd�|j�d�|�t|jdd�|�tt|d�qt|��}|�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>.FoocSrrr)rr�rrrr�rzBSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.ac@rA)zDSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.BarcSrrr)r�yrrrr��rzFSpecSignatureTest.test_spec_inheritance_for_classes.<locals>.Foo.Bar.fN�rrr r�rrrrr��rCr�N)rrr rr'r�rrrrr6�sr6r�r�r%r9rrv)r�r�)r'rr�rr(r�r�r�r�r�r�)rr6Z
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@r�)z+SpecSignatureTest.test_inherit.<locals>.FoorTNr�rrrrr6�r�r6r)r'r6rr�r�r�r�)rr6r*�instanceZ
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)NrDr%g�?y�?FT)rrnr-rer��set�float�complexrrrr�
test_builtins�s 
zSpecSignatureTest.test_builtinscCs�dd�}t|�}|�t|�|dd�|�dd�|jddd�|jddd�||_t|�}|�t|j�|�dd�|j�dd�|jjddd�dS)	NcSrrrrdrrrr��rz*SpecSignatureTest.test_function.<locals>.frDrSr�rdrTrV)rr�r�r(r��rr�r*rrr�
test_function�s
zSpecSignatureTest.test_functioncs�Gdd�dt��G�fdd�dt�}|�|�dd�d�t|��|�t�fdd	��|���dd��jj�|�t�fd
d	���j}|j	|j
fdS)Nc@seZdZddd�ZdS)z;SpecSignatureTest.test_skip_attributeerrors.<locals>.RaiserNcSs|durtd��dS)Nz$Can only be accessed via an instancer�)rr��typerrrr��r�zCSpecSignatureTest.test_skip_attributeerrors.<locals>.Raiser.__get__rr�rrrr�Raiser��r�cseZdZ��Zedd��ZdS)z@SpecSignatureTest.test_skip_attributeerrors.<locals>.RaiserClasscSs||Srrrdrrr�existingszISpecSignatureTest.test_skip_attributeerrors.<locals>.RaiserClass.existingN)rrr �raiserr�r�r)r�rr�RaiserClasssr�rDrSrTcs��ddd�S)NrDrSrT)r�r���srrr�sz=SpecSignatureTest.test_skip_attributeerrors.<locals>.<lambda>cs�jSr)Znonexistingrrrrr�s)r'r&r�rr�r�r�r�r�r%r9)rr�r�r)r�rr�test_skip_attributeerrors�sz+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>.FoorTcSrrrrrrr�__init__rz<SpecSignatureTest.test_signature_class.<locals>.Foo.__init__Nr|�rrr rrrrrr6r�r6rDrsrSrVr�rd)r'rr�r�r�r�r(rHrrr�test_signature_classs

z&SpecSignatureTest.test_signature_classcCsGdd�dt�}t|�dS)Nc@r�)z6SpecSignatureTest.test_class_with_no_init.<locals>.FooNr�rrrrr6*r�r6)r'r)rr6rrr�test_class_with_no_init'sz)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@r1)z;SpecSignatureTest.test_signature_callable.<locals>.CallablecSrrr)rr�r�rrrr1rzDSpecSignatureTest.test_signature_callable.<locals>.Callable.__init__cSrrrrrrr�__call__2rzDSpecSignatureTest.test_signature_callable.<locals>.Callable.__call__N)rrr rrrrrr�Callable0r7rrDrS�r�r�rrs)r'rr�r�r�r()rrr*r�rrr�test_signature_callable/s(





z)SpecSignatureTest.test_signature_callablecCsvGdd�dt�}t|�}|�}|��|�t|d�|�t|�|�t|d�t|��}|�t|�|�t|d�dS)Nc@rA)zASpecSignatureTest.test_signature_noncallable.<locals>.NonCallablecSrrrrrrrrMr�zJSpecSignatureTest.test_signature_noncallable.<locals>.NonCallable.__init__Nrrrrr�NonCallableLrCrr)r'rr�r�r�)rrr*r�rrr�test_signature_noncallableKs
z,SpecSignatureTest.test_signature_noncallablecCsDGdd�dt�}t|�}|j}|�|td��|��|j��dS)Nc@seZdZdZdS)z8SpecSignatureTest.test_create_autospec_none.<locals>.FooN)rrr r9rrrrr6]r�r6)r'rr9�assertNotIsInstancer�r%r�)rr6r*Znonerrr�test_create_autospec_none\sz+SpecSignatureTest.test_create_autospec_nonecCsfGdd�dt�}t|�}|�d�|j�d�|jjdd�|jdd�|j�d�|jjdd�dS)Nc@rA)zMSpecSignatureTest.test_autospec_functions_with_self_in_odd_place.<locals>.FoocSrrr)rrrrrr�jrzOSpecSignatureTest.test_autospec_functions_with_self_in_odd_place.<locals>.Foo.fNr�rrrrr6irCr6�
r)r'rr�r()rr6rrrr�.test_autospec_functions_with_self_in_odd_placehs
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
||_dSr)ro)rrorrrrws
zLSpecSignatureTest.test_autospec_data_descriptor.<locals>.Descriptor.__init__NcSr�rr)rr�r�rrrr�zr�zKSpecSignatureTest.test_autospec_data_descriptor.<locals>.Descriptor.__get__cSrrr)rr�rorrr�__set__}rzKSpecSignatureTest.test_autospec_data_descriptor.<locals>.Descriptor.__set__r)rrr rr�rrrrr�
Descriptorvs
rc@r�)zCSpecSignatureTest.test_autospec_data_descriptor.<locals>.MyPropertyNr�rrrr�
MyPropertyr�rcs2eZdZdgZedd��Z�dd��Z�d�ZdS)z<SpecSignatureTest.test_autospec_data_descriptor.<locals>.Foo�slotcSrrrrrrr�prop�r�zASpecSignatureTest.test_autospec_data_descriptor.<locals>.Foo.propcSrrrrrrr�subprop�r�zDSpecSignatureTest.test_autospec_data_descriptor.<locals>.Foo.subpropr�N)rrr �	__slots__�propertyrr�descr)rrrrr6�s

r6csH��|t�|ddd�|�ddd�|�ddd�|j�ddd�dS)NrDrSrTrVr�rv)r�r�abcr�)Z	mock_attrrrr�check_data_descriptor�s
zNSpecSignatureTest.test_autospec_data_descriptor.<locals>.check_data_descriptor)r'rrrrrr)rr6r%rr)rrrr�test_autospec_data_descriptorus	
	

z/SpecSignatureTest.test_autospec_data_descriptorcCs\t�tjt���}|�|�t�t|�}|�|��|��|ddd�|�ddd�dS)NrVr�rv)	�types�
MethodType�time�ctimer�r-rr�r;)r�methZmockedrrr�'test_autospec_on_bound_builtin_function�sz9SpecSignatureTest.test_autospec_on_bound_builtin_functioncCs0Gdd�d�}|�}t|�}|�t|d��dS)Nc@rA)zESpecSignatureTest.test_autospec_getattr_partial_function.<locals>.FoocSstdd�|�S)NcSr�rr)�namerrrr��rzcSpecSignatureTest.test_autospec_getattr_partial_function.<locals>.Foo.__getattr__.<locals>.<lambda>r
)rZ	attributerrrr��szQSpecSignatureTest.test_autospec_getattr_partial_function.<locals>.Foo.__getattr__N)rrr r�rrrrr6�r�r6r)rrk�hasattr)rr6�proxyZautospecrrr�&test_autospec_getattr_partial_function�sz8SpecSignatureTest.test_autospec_getattr_partial_functioncCspdd�}t|�}|dd�|ddd�|�t�|�t�|��|�|jtdd�tddd�g�|�t|d�dS)NcSrrrr	rrr�myfunc�rz=SpecSignatureTest.test_spec_inspect_signature.<locals>.myfuncrDrSr	)rr&�inspect�	signaturer=rr�r�)rr'r*rrr�test_spec_inspect_signature�s
 z-SpecSignatureTest.test_spec_inspect_signaturec	Cs�ddtdtdtdtfdd�}|�|dd	d
d�d�t|�}|dd	d
d�|dd
d�|�t�|�t�|��|�|jtdd	d
d�tdd
d�g�|�t|d�|jt|dd	d
d
d�dS)Nrrr�c�returncSs|||Srr)rrr+rrrr%�szFSpecSignatureTest.test_spec_inspect_signature_annotations.<locals>.foorDrSrT)r+rvrV)r)	rnr&rr(r)r=rr�r�)rr%r*rrr�'test_spec_inspect_signature_annotations�s$z9SpecSignatureTest.test_spec_inspect_signature_annotationscCs"dd�}t|�}|�|jd�dS)NcSsdS)NZnoperrrrrr��rz>SpecSignatureTest.test_spec_function_no_name.<locals>.<lambda>Zfuncopy)rr&r)r�funcr*rrr�test_spec_function_no_name�sz,SpecSignatureTest.test_spec_function_no_namecCshdd�}t|�}|d�|�td�g�|�t��|�td�g�Wd�dS1s-wYdS)NcSrrrrsrrrr��rz@SpecSignatureTest.test_spec_function_assert_has_calls.<locals>.frDrS)rrFrr�r�r�rrr�#test_spec_function_assert_has_calls�s"�z5SpecSignatureTest.test_spec_function_assert_has_callscCs\dd�}t|�}|d�|�d�|�t��|�d�Wd�dS1s'wYdS)NcSrrrrsrrrr��rz?SpecSignatureTest.test_spec_function_assert_any_call.<locals>.frDrS)rrGr�r�r�rrr�"test_spec_function_assert_any_call�s
"�z4SpecSignatureTest.test_spec_function_assert_any_callcCsvdd�}t�}t||d�}|d�d�|�|jtd�g�|�|jtd�g�|��|�|jg�|�|jg�dS)NcSrrrrsrrrr��rz:SpecSignatureTest.test_spec_function_reset_mock.<locals>.fr�rDrS)rrr&r=rr;)rr��rvr*rrr�test_spec_function_reset_mock�sz/SpecSignatureTest.test_spec_function_reset_mockN))rrr r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
rrrrr"r&r*r-r/r0r1r3rrrrr�{sN


&
,


		r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestCallListcCst�}|�|jt�|dd�|dd�|dd�|dd�tdd�tdd�tdd�tdd�fD]	}|�||j�q0tdd�tdd�g}|�||j�tdd�tdd�g}|�||j�tdd�tdd�g}|�||j�tdd�g}|�||j�|�td�|j�|�td�g|j�dS)	NrDrSrTrsrVrvr�ry)rr�rwrrrhZassertNotIn)rr*rYZcallsrrr�!test_args_list_contains_call_list�s$



(z.TestCallList.test_args_list_contains_call_listcCsJt�}|dd�|jdd�|j��jddd�d}|�t|j�|�dS)	NrDrSrTrsryZdog)�catzU[call(1, 2),
 call.foo(a=3),
 call.foo.bar(),
 call.foo.bar().baz('fish', cat='dog')])rr%r9rPr&r-r=)rr*r?rrr�test_call_list_strs
�zTestCallList.test_call_list_strcCs�tdttd�}|��}z4tj|��t�}|j|��|�|j	t
�t
�g�d|_|�|j	t
�t
�t
d�g�W|��dS|��w)Nz%s.SomeClass.one)Znew_callablerT)r	rr
r�rrr�r(r&r=r�stop)rr�r*rrrr�test_propertymock&szTestCallList.test_propertymockcCs@t�}t�}|t|�_|j}|��|�|t�|�|t�dSr)rr
r�r%r�r�r
)rr�r�Zreturnedrrr�test_propertymock_returnvalue8s
z*TestCallList.test_propertymock_returnvalueN)rrr r5r7r9r:rrrrr4�s
r4c@r!)�TestCallablePredicatecCs(ttttttfD]	}|�t|��qdSr)r-�bytesrnr��tuplerrlr)rr�rrr�	test_typeEs�zTestCallablePredicate.test_typecCs&Gdd�d�}|�}|�t|��dS)Nc@rA)z>TestCallablePredicate.test_call_magic_method.<locals>.CallablecSrrrrrrrrKrzGTestCallablePredicate.test_call_magic_method.<locals>.Callable.__call__N)rrr rrrrrrJrCr)rlr)rrr�rrr�test_call_magic_methodIsz,TestCallablePredicate.test_call_magic_methodcC�"Gdd�d�}|�t|j��dS)Nc@�eZdZedd��ZdS)zATestCallablePredicate.test_staticmethod.<locals>.WithStaticMethodcSrrrrrrr�
staticfuncQr�zLTestCallablePredicate.test_staticmethod.<locals>.WithStaticMethod.staticfuncN)rrr r�rBrrrr�WithStaticMethodP�rC)rlrrB)rrCrrr�test_staticmethodO�z'TestCallablePredicate.test_staticmethodcCr@)Nc@�eZdZed�ZdS)zMTestCallablePredicate.test_non_callable_staticmethod.<locals>.BadStaticMethodN)rrr r��not_callablerrrr�BadStaticMethodVrCrI�rkrrH)rrIrrr�test_non_callable_staticmethodU�z4TestCallablePredicate.test_non_callable_staticmethodcCr@)Nc@rA)z?TestCallablePredicate.test_classmethod.<locals>.WithClassMethodcSrrr)r�rrr�	classfunc\r�zITestCallablePredicate.test_classmethod.<locals>.WithClassMethod.classfuncN)rrr r�rMrrrr�WithClassMethod[rDrN)rlrrM)rrNrrr�test_classmethodZrFz&TestCallablePredicate.test_classmethodcCr@)Nc@rG)zKTestCallablePredicate.test_non_callable_classmethod.<locals>.BadClassMethodN)rrr r�rHrrrr�BadClassMethodarCrPrJ)rrPrrr�test_non_callable_classmethod`rLz3TestCallablePredicate.test_non_callable_classmethodN)	rrr r>r?rErKrOrQrrrrr;Csr;�__main__)r(rrZunittestZ
unittest.mockrrrrrrrr	r
rr�	functoolsrr'rZTestCaser"rLr�r4r;r�mainrrrr�<module>s.0E#G#�