Your IP : 216.73.216.196


Current Path : /opt/alt/python37/lib64/python3.7/test/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/test/__pycache__/test_call.cpython-37.pyc

B

� f]:�@s�ddlZddlZddlmZyddlZWnek
r@dZYnXddlZddlZddlZddl	Z	Gdd�dej
�ZGdd�dej
�ZeGdd�dej
��Z
d	d
�Zdd�ZGd
d�d�Ze�Ze�ZeGdd�dej
��Zedkr�e��dS)�N)�cpython_onlyc@seZdZdd�ZdS)�
FunctionCallscCsZt�ddg�}|�d�t|���}dd�}|f|�}|�|t�|�t|���|�dS)N)�a�)�b�rc[s|S)N�)�kwrr�3/opt/alt/python37/lib64/python3.7/test/test_call.py�fnsz+FunctionCalls.test_kwargs_order.<locals>.fn)�collections�OrderedDict�move_to_end�list�itemsZassertIsInstance�dict�assertEqual)�selfZod�expectedrZresrrr
�test_kwargs_orders

zFunctionCalls.test_kwargs_orderN)�__name__�
__module__�__qualname__rrrrr
rsrc@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�Zd5S)6�CFunctionCallscCs|�tij�dS)N)�assertRaises�	TypeError�__contains__)rrrr
�
test_varargs0%szCFunctionCalls.test_varargs0cCsi�d�dS)Nr)r)rrrr
�
test_varargs1(szCFunctionCalls.test_varargs1cCs|�tijdd�dS)Nrr)rrr)rrrr
�
test_varargs2+szCFunctionCalls.test_varargs2cCs(yijd�Wntk
r"YnXdS)Nr)rr)rrrr
�test_varargs0_ext.sz CFunctionCalls.test_varargs0_extcCsijd�dS)N)r)r)rrrr
�test_varargs1_ext4sz CFunctionCalls.test_varargs1_extcCs,yijd�Wntk
r"YnXt�dS)N)rr)rr�RuntimeError)rrrr
�test_varargs2_ext7s
z CFunctionCalls.test_varargs2_extcCs|jtijdd�dS)Nr)�x)rrr)rrrr
�test_varargs1_kw?szCFunctionCalls.test_varargs1_kwcCs|jtijddd�dS)Nr)r$�y)rrr)rrrr
�test_varargs2_kwBszCFunctionCalls.test_varargs2_kwcCsi��dS)N)�keys)rrrr
�test_oldargs0_0EszCFunctionCalls.test_oldargs0_0cCs|�tijd�dS)Nr)rrr()rrrr
�test_oldargs0_1HszCFunctionCalls.test_oldargs0_1cCs|�tijdd�dS)Nrr)rrr()rrrr
�test_oldargs0_2KszCFunctionCalls.test_oldargs0_2cCsijd�dS)Nr)r()rrrr
�test_oldargs0_0_extNsz"CFunctionCalls.test_oldargs0_0_extcCs,yijd�Wntk
r"YnXt�dS)N)r)r(rr")rrrr
�test_oldargs0_1_extQs
z"CFunctionCalls.test_oldargs0_1_extcCs,yijd�Wntk
r"YnXt�dS)N)rr)r(rr")rrrr
�test_oldargs0_2_extYs
z"CFunctionCalls.test_oldargs0_2_extcCs.yijdd�Wntk
r$YnXt�dS)Nr)r$)r(rr")rrrr
�test_oldargs0_0_kwas
z!CFunctionCalls.test_oldargs0_0_kwcCs|jtijdd�dS)Nr)r$)rrr()rrrr
�test_oldargs0_1_kwisz!CFunctionCalls.test_oldargs0_1_kwcCs|jtijddd�dS)Nr)r$r&)rrr()rrrr
�test_oldargs0_2_kwlsz!CFunctionCalls.test_oldargs0_2_kwcCs|�tgj�dS)N)rr�count)rrrr
�test_oldargs1_0oszCFunctionCalls.test_oldargs1_0cCsg�d�dS)Nr)r2)rrrr
�test_oldargs1_1rszCFunctionCalls.test_oldargs1_1cCs|�tgjdd�dS)Nrr)rrr2)rrrr
�test_oldargs1_2uszCFunctionCalls.test_oldargs1_2cCs,ygjd�Wntk
r"YnXt�dS)Nr)r2rr")rrrr
�test_oldargs1_0_extxs
z"CFunctionCalls.test_oldargs1_0_extcCsgjd�dS)N)r)r2)rrrr
�test_oldargs1_1_ext�sz"CFunctionCalls.test_oldargs1_1_extcCs,ygjd�Wntk
r"YnXt�dS)N)rr)r2rr")rrrr
�test_oldargs1_2_ext�s
z"CFunctionCalls.test_oldargs1_2_extcCs|jtgjdd�dS)Nr)r$)rrr2)rrrr
�test_oldargs1_0_kw�sz!CFunctionCalls.test_oldargs1_0_kwcCs|jtgjidd�dS)Nr)r$)rrr2)rrrr
�test_oldargs1_1_kw�sz!CFunctionCalls.test_oldargs1_1_kwcCs|jtgjddd�dS)Nr)r$r&)rrr2)rrrr
�test_oldargs1_2_kw�sz!CFunctionCalls.test_oldargs1_2_kwN)rrrrrrr r!r#r%r'r)r*r+r,r-r.r/r0r1r3r4r5r6r7r8r9r:r;rrrr
r#s4rc@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;S)<�CFunctionCallsErrorMessagescCsd}|�t|ij�dS)Nz7__contains__\(\) takes exactly one argument \(0 given\))�assertRaisesRegexrr)r�msgrrr
r�sz)CFunctionCallsErrorMessages.test_varargs0cCsd}|�t|ijdd�dS)Nz7__contains__\(\) takes exactly one argument \(2 given\)rr)r=rr)rr>rrr
r�sz)CFunctionCallsErrorMessages.test_varargs2cCsd}|�t|tjddd�dS)Nz@^from_bytes\(\) takes at most 2 positional arguments \(3 given\)�a�littleF)r=r�int�
from_bytes)rr>rrr
�
test_varargs3�sz)CFunctionCallsErrorMessages.test_varargs3cCsd}|jt|ijdd�dS)Nz+__contains__\(\) takes no keyword argumentsr)r$)r=rr)rr>rrr
r%�sz,CFunctionCallsErrorMessages.test_varargs1_kwcCsd}|jt|ijddd�dS)Nz+__contains__\(\) takes no keyword argumentsr)r$r&)r=rr)rr>rrr
r'�sz,CFunctionCallsErrorMessages.test_varargs2_kwcCsd}|jt|tdd�dS)Nz#bool\(\) takes no keyword argumentsr)r$)r=r�bool)rr>rrr
�test_varargs3_kw�sz,CFunctionCallsErrorMessages.test_varargs3_kwcCsd}|jt|gjdd�dS)Nz&^index\(\) takes no keyword arguments$r)r$)r=r�index)rr>rrr
�test_varargs4_kw�sz,CFunctionCallsErrorMessages.test_varargs4_kwcCsd}|jt|tdd�dS)Nz(^hasattr\(\) takes no keyword arguments$r)r$)r=r�hasattr)rr>rrr
�test_varargs5_kw�sz,CFunctionCallsErrorMessages.test_varargs5_kwcCsd}|jt|tdd�dS)Nz(^getattr\(\) takes no keyword arguments$r)r$)r=r�getattr)rr>rrr
�test_varargs6_kw�sz,CFunctionCallsErrorMessages.test_varargs6_kwcCsd}|jt|tdd�dS)Nz%^next\(\) takes no keyword arguments$r)r$)r=r�next)rr>rrr
�test_varargs7_kw�sz,CFunctionCallsErrorMessages.test_varargs7_kwcCsd}|jt|tjdd�dS)Nz%^pack\(\) takes no keyword arguments$r)r$)r=r�struct�pack)rr>rrr
�test_varargs8_kw�sz,CFunctionCallsErrorMessages.test_varargs8_kwcCsd}|jt|tjdd�dS)Nz*^pack_into\(\) takes no keyword arguments$r)r$)r=rrNZ	pack_into)rr>rrr
�test_varargs9_kw�sz,CFunctionCallsErrorMessages.test_varargs9_kwcCs d}|jt|t��jdd�dS)Nz&^index\(\) takes no keyword arguments$r)r$)r=rr�dequerF)rr>rrr
�test_varargs10_kw�sz-CFunctionCallsErrorMessages.test_varargs10_kwcCs&d}|jt|tjjt�d�dd�dS)Nz%^pack\(\) takes no keyword arguments$�r)r$)r=rrNZStructrO)rr>rrr
�test_varargs11_kw�sz-CFunctionCallsErrorMessages.test_varargs11_kwcCsd}|jt|ttd�dS)Nz-^staticmethod\(\) takes no keyword arguments$)�func)r=r�staticmethod�id)rr>rrr
�test_varargs12_kw�sz-CFunctionCallsErrorMessages.test_varargs12_kwcCsd}|jt|ttd�dS)Nz,^classmethod\(\) takes no keyword arguments$)rV)r=r�classmethodrX)rr>rrr
�test_varargs13_kw�sz-CFunctionCallsErrorMessages.test_varargs13_kwcCs d}|jt|tjdddd�dS)Nz:^product\(\) takes at most 1 keyword argument \(2 given\)$rrr)�repeat�foo)r=r�	itertools�product)rr>rrr
�test_varargs14_kw�sz-CFunctionCallsErrorMessages.test_varargs14_kwc	Cs d}|jt|tddddd�dS)Nz?^ImportError\(\) takes at most 2 keyword arguments \(3 given\)$rrr�)�name�pathr])r=r�ImportError)rr>rrr
�test_varargs15_kw�sz-CFunctionCallsErrorMessages.test_varargs15_kwc	Cs d}|jt|tddddd�dS)Nz7^min\(\) takes at most 2 keyword arguments \(3 given\)$rrrra)�default�keyr])r=r�min)rr>rrr
�test_varargs16_kw�sz-CFunctionCallsErrorMessages.test_varargs16_kwcCs$d}|jt|tddddddd�	dS)	Nz9^print\(\) takes at most 4 keyword arguments \(5 given\)$rrrra��)�sep�end�file�flushr])r=r�print)rr>rrr
�test_varargs17_kw�sz-CFunctionCallsErrorMessages.test_varargs17_kwcCsd}|�t|ijd�dS)Nz'keys\(\) takes no arguments \(1 given\)r)r=rr()rr>rrr
r*�sz+CFunctionCallsErrorMessages.test_oldargs0_1cCsd}|�t|ijdd�dS)Nz'keys\(\) takes no arguments \(2 given\)rr)r=rr()rr>rrr
r+�sz+CFunctionCallsErrorMessages.test_oldargs0_2cCsd}|jt|ijdd�dS)Nz#keys\(\) takes no keyword argumentsr)r$)r=rr()rr>rrr
r0�sz.CFunctionCallsErrorMessages.test_oldargs0_1_kwcCsd}|jt|ijddd�dS)Nz#keys\(\) takes no keyword argumentsr)r$r&)r=rr()rr>rrr
r1�sz.CFunctionCallsErrorMessages.test_oldargs0_2_kwcCsd}|�t|gj�dS)Nz0count\(\) takes exactly one argument \(0 given\))r=rr2)rr>rrr
r3�sz+CFunctionCallsErrorMessages.test_oldargs1_0cCsd}|�t|gjdd�dS)Nz0count\(\) takes exactly one argument \(2 given\)rr)r=rr2)rr>rrr
r5sz+CFunctionCallsErrorMessages.test_oldargs1_2cCsd}|jt|gjdd�dS)Nz$count\(\) takes no keyword argumentsr)r$)r=rr2)rr>rrr
r9sz.CFunctionCallsErrorMessages.test_oldargs1_0_kwcCsd}|jt|gjidd�dS)Nz$count\(\) takes no keyword argumentsr)r$)r=rr2)rr>rrr
r:sz.CFunctionCallsErrorMessages.test_oldargs1_1_kwcCsd}|jt|gjddd�dS)Nz$count\(\) takes no keyword argumentsr)r$r&)r=rr2)rr>rrr
r;sz.CFunctionCallsErrorMessages.test_oldargs1_2_kwN) rrrrrrCr%r'rErGrIrKrMrPrQrSrUrYr[r`rerirqr*r+r0r1r3r5r9r:r;rrrr
r<�s:r<cCs||gS)Nr)�arg1�arg2rrr
�pyfuncsrtcCsdS)N�noargrrrrr
�pyfunc_noargsrvc@s4eZdZdd�Zdd�Zedd��Zedd��Zd	S)
�PythonClasscCs||gS)Nr)rrrrsrrr
�methodszPythonClass.methodcCsdS)Nrur)rrrr
�method_noargszPythonClass.method_noargcCsdS)NrZr)�clsrrr
�class_method szPythonClass.class_methodcCsdS)NrWrrrrr
�
static_method$szPythonClass.static_methodN)	rrrrxryrZr{rWr|rrrr
rwsrwc@sPeZdZedddgfeddfejddfejddfej	dddgfej
ddfejddfejddfedefe
defed	efed
dfedd
fejddfejjdeffZed	ddiddgfedddd�ddgfej	d	ddiddgfej	dddd�ddgfegfddidfejdddidfejdddd�dffZdd�Zdd�Zdd�Zdd�Zd d!�Zd"S)#�
FastCallTests)rrrrrrurZrW)Zhello)r)rk�	rk)i��!)��
)sr@rs)rrrsrfr~)s�	byteorderr@s)�bytesr�cCs|tkrdS|�||�dS)N)�
IGNORE_RESULTr)r�resultrrrr
�check_resultpszFastCallTests.check_resultc
Cshxb|jD]X\}}}|j||d��:t�||�}|�||�|sVt�|d�}|�||�WdQRXqWdS)N)rV�args)�
CALLS_POSARGS�subTest�	_testcapiZpyobject_fastcallr�)rrVr�rr�rrr
�
test_fastcalluszFastCallTests.test_fastcallc
Cs�x�|jD]�\}}}|j||d��rt�||d�}|�||�t�||i�}|�||�|s�t�|dd�}|�||�t�|di�}|�||�WdQRXqWxL|jD]B\}}}}|j|||d�� t�|||�}|�||�WdQRXq�WdS)N)rVr�)rVr��kwargs)r�r�r�Zpyobject_fastcalldictr��CALLS_KWARGS)rrVr�rr�r�rrr
�test_fastcall_dict�sz FastCallTests.test_fastcall_dictc
Cs
x�|jD]�\}}}|j||d��rt�||d�}|�||�t�||d�}|�||�|s�t�|dd�}|�||�t�|dd�}|�||�WdQRXqWxh|jD]^\}}}}|j|||d��<t|���}|t|���}t�|||�}|�||�WdQRXq�WdS)N)rVr�r)rVr�r�)	r�r�r�Zpyobject_fastcallkeywordsr�r��tupler(�values)rrVr�rr�r�Zkwnamesrrr
�test_fastcall_keywords�s"z$FastCallTests.test_fastcall_keywordscCs2Gdd�d�}||�d�}tddd|f|j�dS)Nc@s"eZdZdgZdd�Zdd�ZdS)z>FastCallTests.test_fastcall_clearing_dict.<locals>.IntWithDictr�c[s
||_dS)N)r�)rr�rrr
�__init__�szGFastCallTests.test_fastcall_clearing_dict.<locals>.IntWithDict.__init__cSs|j��t��dS)Nr)r��clear�gcZcollect)rrrr
�__int__�s
zFFastCallTests.test_fastcall_clearing_dict.<locals>.IntWithDict.__int__N)rrr�	__slots__r�r�rrrr
�IntWithDict�sr�)�dont_inherit�passrT�exec)�compiler�)rr�r$rrr
�test_fastcall_clearing_dict�sz)FastCallTests.test_fastcall_clearing_dictN)rrrrtrvrwr{r|�PYTHON_INSTANCErxry�globalsr�rX�dirrh�divmodrArB�datetimeZnowr��maxr�r�r�r�r�r�rrrr
r}/s6






r}�__main__)r�ZunittestZtest.supportrr�rdrNrr^r�ZTestCaserrr<rtrvrwr��objectr�r}r�mainrrrr
�<module>s0
r
{