Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_call.cpython-38.opt-2.pyc
U

>��g�S�@sddlZddlZddlmZzddlZWnek
r@dZYnXddlZddlZddlZddl	Z	Gdd�dej
�ZGdd�dej
�ZeGdd�dej
��Z
d	d
�Zdd�ZGd
d�d�Ze�Ze�ZeGdd�dej
��ZdZdZdd�Zdd�ZGdd�dej
�Zedk�re��dS)�N)�cpython_onlyc@seZdZdd�ZdS)�
FunctionCallscCsZt�ddg�}|�d�t|���}dd�}|f|�}|�|t�|�t|���|�dS)N)�a�)�b�rc[s|S�N�)�kwr	r	�-/opt/cppython/lib/python3.8/test/test_call.py�fnsz+FunctionCalls.test_kwargs_order.<locals>.fn)�collections�OrderedDict�move_to_end�list�itemsZassertIsInstance�dict�assertEqual)�selfZod�expectedr�resr	r	r�test_kwargs_orders

zFunctionCalls.test_kwargs_orderN)�__name__�
__module__�__qualname__rr	r	r	rrsrc@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�dSr��assertRaises�	TypeError�__contains__�rr	r	r�
test_varargs0%szCFunctionCalls.test_varargs0cCsi�d�dS�Nr�rr r	r	r�
test_varargs1(szCFunctionCalls.test_varargs1cCs|�tijdd�dS�Nrrrr r	r	r�
test_varargs2+szCFunctionCalls.test_varargs2cCs(zijd�Wntk
r"YnXdS�Nr	)rrr r	r	r�test_varargs0_ext.sz CFunctionCalls.test_varargs0_extcCsijd�dS�N�rr#r r	r	r�test_varargs1_ext4sz CFunctionCalls.test_varargs1_extcCs,zijd�Wntk
r"YnXt�dS�N�rr)rr�RuntimeErrorr r	r	r�test_varargs2_ext7s
z CFunctionCalls.test_varargs2_extcCs|jtijdd�dS�Nr��xrr r	r	r�test_varargs1_kw?szCFunctionCalls.test_varargs1_kwcCs|jtijddd�dS�Nr�r2�yrr r	r	r�test_varargs2_kwBszCFunctionCalls.test_varargs2_kwcCsi��dSr��keysr r	r	r�test_oldargs0_0EszCFunctionCalls.test_oldargs0_0cCs|�tijd�dSr"�rrr9r r	r	r�test_oldargs0_1HszCFunctionCalls.test_oldargs0_1cCs|�tijdd�dSr%r;r r	r	r�test_oldargs0_2KszCFunctionCalls.test_oldargs0_2cCsijd�dSr'r8r r	r	r�test_oldargs0_0_extNsz"CFunctionCalls.test_oldargs0_0_extcCs,zijd�Wntk
r"YnXt�dSr)�r9rr.r r	r	r�test_oldargs0_1_extQs
z"CFunctionCalls.test_oldargs0_1_extcCs,zijd�Wntk
r"YnXt�dSr,r?r r	r	r�test_oldargs0_2_extYs
z"CFunctionCalls.test_oldargs0_2_extcCs.zijdd�Wntk
r$YnXt�dSr0r?r r	r	r�test_oldargs0_0_kwas
z!CFunctionCalls.test_oldargs0_0_kwcCs|jtijdd�dSr0r;r r	r	r�test_oldargs0_1_kwisz!CFunctionCalls.test_oldargs0_1_kwcCs|jtijddd�dSr4r;r r	r	r�test_oldargs0_2_kwlsz!CFunctionCalls.test_oldargs0_2_kwcCs|�tgj�dSr�rr�countr r	r	r�test_oldargs1_0oszCFunctionCalls.test_oldargs1_0cCsg�d�dS)Nr�rFr r	r	r�test_oldargs1_1rszCFunctionCalls.test_oldargs1_1cCs|�tgjdd�dS)NrrrEr r	r	r�test_oldargs1_2uszCFunctionCalls.test_oldargs1_2cCs,zgjd�Wntk
r"YnXt�dSr'�rFrr.r r	r	r�test_oldargs1_0_extxs
z"CFunctionCalls.test_oldargs1_0_extcCsgjd�dS)N�rrHr r	r	r�test_oldargs1_1_ext�sz"CFunctionCalls.test_oldargs1_1_extcCs,zgjd�Wntk
r"YnXt�dSr,rKr r	r	r�test_oldargs1_2_ext�s
z"CFunctionCalls.test_oldargs1_2_extcCs|jtgjdd�dSr0rEr r	r	r�test_oldargs1_0_kw�sz!CFunctionCalls.test_oldargs1_0_kwcCs|jtgjidd�dSr0rEr r	r	r�test_oldargs1_1_kw�sz!CFunctionCalls.test_oldargs1_1_kwcCs|jtgjddd�dSr4rEr r	r	r�test_oldargs1_2_kw�sz!CFunctionCalls.test_oldargs1_2_kwN)rrrr!r$r&r(r+r/r3r7r:r<r=r>r@rArBrCrDrGrIrJrLrNrOrPrQrRr	r	r	rr#s4rc@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�CFunctionCallsErrorMessagescCsd}|�t|ij�dS)Nz7__contains__\(\) takes exactly one argument \(0 given\)��assertRaisesRegexrr�r�msgr	r	rr!�sz)CFunctionCallsErrorMessages.test_varargs0cCsd}|�t|ijdd�dS)Nz7__contains__\(\) takes exactly one argument \(2 given\)rrrTrVr	r	rr&�sz)CFunctionCallsErrorMessages.test_varargs2cCsd}|�t|tjddd�dS)Nz@^from_bytes\(\) takes exactly 2 positional arguments \(3 given\)�a�littleF)rUr�int�
from_bytesrVr	r	r�
test_varargs3�sz)CFunctionCallsErrorMessages.test_varargs3cCs,d}|�t|ij�d}|�t|ij�dS)Nz'get expected at least 1 argument, got 0zexpected 1 argument, got 0)rUr�get�__delattr__rVr	r	r�test_varargs1min�sz,CFunctionCallsErrorMessages.test_varargs1mincCsd}|�t|t�dS)Nz,getattr expected at least 2 arguments, got 0�rUr�getattrrVr	r	r�test_varargs2min�sz,CFunctionCallsErrorMessages.test_varargs2mincCsd}|�t|tdd�dS)Nz(input expected at most 1 argument, got 2rr)rUr�inputrVr	r	r�test_varargs1max�sz,CFunctionCallsErrorMessages.test_varargs1maxcCsd}|�t|ijddd�dS)Nz'get expected at most 2 arguments, got 3rr�)rUrr]rVr	r	r�test_varargs2max�sz,CFunctionCallsErrorMessages.test_varargs2maxcCsd}|jt|ijdd�dS)N�+__contains__\(\) takes no keyword argumentsrr1rTrVr	r	rr3�sz,CFunctionCallsErrorMessages.test_varargs1_kwcCsd}|jt|ijddd�dS)Nrgrr5rTrVr	r	rr7�sz,CFunctionCallsErrorMessages.test_varargs2_kwcCsd}|jt|tdd�dS)Nz#bool\(\) takes no keyword argumentsrr1)rUr�boolrVr	r	r�test_varargs3_kw�sz,CFunctionCallsErrorMessages.test_varargs3_kwcCsd}|jt|gjdd�dS�Nz&^index\(\) takes no keyword arguments$rr1)rUr�indexrVr	r	r�test_varargs4_kw�sz,CFunctionCallsErrorMessages.test_varargs4_kwcCsd}|jt|tdd�dS)Nz(^hasattr\(\) takes no keyword arguments$rr1)rUr�hasattrrVr	r	r�test_varargs5_kw�sz,CFunctionCallsErrorMessages.test_varargs5_kwcCsd}|jt|tdd�dS)Nz(^getattr\(\) takes no keyword arguments$rr1r`rVr	r	r�test_varargs6_kw�sz,CFunctionCallsErrorMessages.test_varargs6_kwcCsd}|jt|tdd�dS)Nz%^next\(\) takes no keyword arguments$rr1)rUr�nextrVr	r	r�test_varargs7_kw�sz,CFunctionCallsErrorMessages.test_varargs7_kwcCsd}|jt|tjdd�dS)N�%^pack\(\) takes no keyword arguments$rr1)rUr�struct�packrVr	r	r�test_varargs8_kw�sz,CFunctionCallsErrorMessages.test_varargs8_kwcCsd}|jt|tjdd�dS)Nz*^pack_into\(\) takes no keyword arguments$rr1)rUrrs�	pack_intorVr	r	r�test_varargs9_kw�sz,CFunctionCallsErrorMessages.test_varargs9_kwcCs d}|jt|t��jdd�dSrj)rUrr
�dequerkrVr	r	r�test_varargs10_kw�sz-CFunctionCallsErrorMessages.test_varargs10_kwcCs&d}|jt|tjjt�d�dd�dS)Nrr�rr1)rUrrs�StructrtrVr	r	r�test_varargs11_kw�sz-CFunctionCallsErrorMessages.test_varargs11_kwcCsd}|jt|ttd�dS)Nz-^staticmethod\(\) takes no keyword arguments$��func)rUr�staticmethod�idrVr	r	r�test_varargs12_kw�sz-CFunctionCallsErrorMessages.test_varargs12_kwcCsd}|jt|ttd�dS)Nz,^classmethod\(\) takes no keyword arguments$r})rUr�classmethodr�rVr	r	r�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)rUr�	itertools�productrVr	r	r�test_varargs14_kw�s�z-CFunctionCallsErrorMessages.test_varargs14_kwc	Cs d}|jt|tddddd�dS)Nz?^ImportError\(\) takes at most 2 keyword arguments \(3 given\)$rrrre)�name�pathr�)rUr�ImportErrorrVr	r	r�test_varargs15_kw�s�z-CFunctionCallsErrorMessages.test_varargs15_kwc	Cs d}|jt|tddddd�dS)Nz7^min\(\) takes at most 2 keyword arguments \(3 given\)$rrrre)�default�keyr�)rUr�minrVr	r	r�test_varargs16_kw�s�z-CFunctionCallsErrorMessages.test_varargs16_kwcCs$d}|jt|tddddddd�	dS)	Nz9^print\(\) takes at most 4 keyword arguments \(5 given\)$rrrre��)�sep�end�file�flushr�)rUr�printrVr	r	r�test_varargs17_kw�s�z-CFunctionCallsErrorMessages.test_varargs17_kwcCsd}|�t|ijd�dS)Nz'keys\(\) takes no arguments \(1 given\)r�rUrr9rVr	r	rr<�sz+CFunctionCallsErrorMessages.test_oldargs0_1cCsd}|�t|ijdd�dS)Nz'keys\(\) takes no arguments \(2 given\)rrr�rVr	r	rr=sz+CFunctionCallsErrorMessages.test_oldargs0_2cCsd}|jt|ijdd�dS)N�#keys\(\) takes no keyword argumentsrr1r�rVr	r	rrCsz.CFunctionCallsErrorMessages.test_oldargs0_1_kwcCsd}|jt|ijddd�dS)Nr�rr5r�rVr	r	rrDsz.CFunctionCallsErrorMessages.test_oldargs0_2_kwcCsd}|�t|gj�dS)Nz0count\(\) takes exactly one argument \(0 given\)�rUrrFrVr	r	rrGsz+CFunctionCallsErrorMessages.test_oldargs1_0cCsd}|�t|gjdd�dS)Nz0count\(\) takes exactly one argument \(2 given\)rrr�rVr	r	rrJsz+CFunctionCallsErrorMessages.test_oldargs1_2cCsd}|jt|gjdd�dS�N�$count\(\) takes no keyword argumentsrr1r�rVr	r	rrPsz.CFunctionCallsErrorMessages.test_oldargs1_0_kwcCsd}|jt|gjidd�dSr�r�rVr	r	rrQsz.CFunctionCallsErrorMessages.test_oldargs1_1_kwcCsd}|jt|gjddd�dS)Nr�rr5r�rVr	r	rrRsz.CFunctionCallsErrorMessages.test_oldargs1_2_kwN)$rrrr!r&r\r_rbrdrfr3r7rirlrnrorqrurwryr|r�r�r�r�r�r�r<r=rCrDrGrJrPrQrRr	r	r	rrS�sBrScCs||gSrr	��arg1�arg2r	r	r�pyfunc$sr�cCsdS�N�noargr	r	r	r	r�pyfunc_noarg(sr�c@s4eZdZdd�Zdd�Zedd��Zedd��Zd	S)
�PythonClasscCs||gSrr	)rr�r�r	r	r�method-szPythonClass.methodcCsdSr�r	r r	r	r�method_noarg0szPythonClass.method_noargcCsdS)Nr�r	)�clsr	r	r�class_method3szPythonClass.class_methodcCsdS)Nrr	r	r	r	r�
static_method7szPythonClass.static_methodN)	rrrr�r�r�r�rr�r	r	r	rr�,s
r�c@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)#�
FastCallTestsr-rrr	r�r�r)ZhellorM)r��	r�)i��!)��
)�rYr�r�r�r�)r��	byteorderrYr�)�bytesr�cCs|tkrdS|�||�dSr)�
IGNORE_RESULTr)r�resultrr	r	r�check_result�szFastCallTests.check_resultc
Csd|jD]X\}}}|j||d��:t�||�}|�||�|sTt�|d�}|�||�W5QRXqdS)N�r~�args)�
CALLS_POSARGS�subTest�	_testcapiZpyobject_fastcallr�)rr~r�rr�r	r	r�
test_fastcall�szFastCallTests.test_fastcallc
Cs�|jD]�\}}}|j||d��rt�||d�}|�||�t�||i�}|�||�|s�t�|dd�}|�||�t�|di�}|�||�W5QRXq|jD]B\}}}}|j|||d�� t�|||�}|�||�W5QRXq�dS)Nr��r~r��kwargs)r�r�r�Zpyobject_fastcalldictr��CALLS_KWARGS)rr~r�rr�r�r	r	r�test_vectorcall_dict�sz"FastCallTests.test_vectorcall_dictc
Cs|jD]�\}}}|j||d��rt�||d�}|�||�t�||d�}|�||�|s�t�|dd�}|�||�t�|dd�}|�||�W5QRXq|jD]^\}}}}|j|||d��<t|���}|t|���}t�|||�}|�||�W5QRXq�dS)Nr�r	r�)	r�r�r��pyobject_vectorcallr�r��tupler9�values)rr~r�rr�r��kwnamesr	r	r�test_vectorcall�s"zFastCallTests.test_vectorcallcCs2Gdd�d�}||�d�}tddd|f|j�dS)Nc@s"eZdZdgZdd�Zdd�ZdS)z>FastCallTests.test_fastcall_clearing_dict.<locals>.IntWithDictr�c[s
||_dSr)r�)rr�r	r	r�__init__�szGFastCallTests.test_fastcall_clearing_dict.<locals>.IntWithDict.__init__cSs|j��t��dSr")r��clear�gcZcollectr r	r	r�	__index__�s
zHFastCallTests.test_fastcall_clearing_dict.<locals>.IntWithDict.__index__N)rrr�	__slots__r�r�r	r	r	r�IntWithDict�sr�)�dont_inherit�passrz�exec)�compiler�)rr�r2r	r	r�test_fastcall_clearing_dict�sz)FastCallTests.test_fastcall_clearing_dictN)rrrr�r�r�r�r��PYTHON_INSTANCEr�r��globalsr�r��dirr��divmodrZr[�datetimeZnowr��maxr�r�r�r�r�r�r	r	r	rr�Bs:





�/�
r�iicCs|Srr	r r	r	r�testfunction�sr�cCs|Srr	)rr
r	r	r�testfunction_kw�sr�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
TestPEP590cCs�ddl}|�d�t�}|�tt�jt@�|�tt	j
�jt@�|�tt	j�jt@�|�tt�jt@�|�t|�jt@�|�tj
jt@�|�tjjt@�|�tjjt@�Gdd�dtj
�}|�|jt@�dS)Nrrc@seZdZdS)zDTestPEP590.test_method_descriptor_flag.<locals>.MethodDescriptorHeapN�rrrr	r	r	r�MethodDescriptorHeap�sr�)�	functools�	lru_cacher��assertFalse�type�repr�	__flags__�Py_TPFLAGS_METHOD_DESCRIPTOR�
assertTruer�append�__add__r��MethodDescriptorBase�MethodDescriptorDerived�MethodDescriptorNopGet)rr��cachedr�r	r	r�test_method_descriptor_flag�sz&TestPEP590.test_method_descriptor_flagcCsn|�tjjt@�|�tjjt@�|�tjjt@�|�tjjt@�Gdd�dtj�}|�|jt@�dS)Nc@seZdZdS)z=TestPEP590.test_vectorcall_flag.<locals>.MethodDescriptorHeapNr�r	r	r	rr�	sr�)	r�r�r�r��Py_TPFLAGS_HAVE_VECTORCALLr�r�r��MethodDescriptor2)rr�r	r	r�test_vectorcall_flagszTestPEP590.test_vectorcall_flagcCs(ttd��}t��}|�||�|�dS)Nr�)r��ranger�r�ZassertIs)rr��fr	r	r�test_vectorcall_override
sz#TestPEP590.test_vectorcall_overridecs�ttd�fidftjgdfidfgjdidftdgfddidftdidftdddidft��did	ft�	�did	ft�
�did
fg	}ddlm�m}ddl
m}dd
lm}�fdd�}|D]P\}}}}	|�t|���0|s�|�|	|||��|�|	||||��W5QRXq�Gdd�dtj�}
Gdd�dtj�}Gdd�d�}Gdd�d|tj�}
|tjifdd	idfijifdd	idf|
�did	f|�didf|
�did	fg7}|D]�\}}}}	|�t|����|dd�}|||d�}||�}|�s0|�|	||��|�|	�||d��|�|	||��|�|	||��|�|	|||��|�|	||||��|�|	|||��|�|	|||��W5QRX�q�dS)N�*rr*�$�start�)r�r
TF)r��pyvectorcall_call)�
MethodType)�partialcs ||���}t|�}�|||�Sr)r�r�)r~r�r�r��r�r	r�
vectorcall/sz.TestPEP590.test_vectorcall.<locals>.vectorcallc@seZdZdS)z8TestPEP590.test_vectorcall.<locals>.MethodDescriptorHeapNr�r	r	r	rr�=sr�c@seZdZdd�ZdS)z>TestPEP590.test_vectorcall.<locals>.MethodDescriptorOverriddencSsdS)N�newr	)r�nr	r	r�__call__AszGTestPEP590.test_vectorcall.<locals>.MethodDescriptorOverridden.__call__N)rrrr�r	r	r	r�MethodDescriptorOverridden@sr�cseZdZ�fdd�Z�ZS)z-TestPEP590.test_vectorcall.<locals>.SuperBasecst�j|�Sr��superr��rr���	__class__r	rr�Esz6TestPEP590.test_vectorcall.<locals>.SuperBase.__call__�rrrr��
__classcell__r	r	rr�	SuperBaseDsrcseZdZ�fdd�Z�ZS)z9TestPEP590.test_vectorcall.<locals>.MethodDescriptorSupercst�j|�Srr�r�rr	rr�IszBTestPEP590.test_vectorcall.<locals>.MethodDescriptorSuper.__call__rr	r	rr�MethodDescriptorSuperHsrr�r�r)�lenr�rr��sumr�r�r�r�r�r�r�r��typesr�r�r�r��strrr�update)rZcallsr�r�r�r�r~r�r�rr�r�rrZargs1�meth�wrappedr	r�rr�sX

�
 �zTestPEP590.test_vectorcallN)rrrr�r�r�r�r	r	r	rr��s
r��__main__)r�ZunittestZtest.supportrr�r�rsr
r�r�ZTestCaserrrSr�r�r�r��objectr�r�r�r�r�r�r�r�mainr	r	r	r�<module>s<
rw


F1le Man4ger