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/test/__pycache__/test_operator.cpython-310.opt-2.pyc
o

�i0`�@sXddlZddlZddlZddlmZddlmZejddgd�Zejddgd�Z	Gdd	�d	�Z
Gd
d�de�ZGdd
�d
�Z
Gdd�d�ZGdd�deej�Ze�e	d�Gdd�deej��ZGdd�d�ZGdd�deej�Ze�e	d�Gdd�deej��Ze�e	d�Gdd�deej��Ze�e	d�Gdd�deej��Zedkr�e��dSdS) �N)�support)�
import_helper�operator�	_operator)Zblocked)Zfreshc@�<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�Seq1cC�
||_dS�N��lst��selfr�r�//usr/local/lib/python3.10/test/test_operator.py�__init__�
z
Seq1.__init__cC�
t|j�Sr	��lenr�r
rrr�__len__rzSeq1.__len__cC�
|j|Sr	r
�r
�irrr�__getitem__rzSeq1.__getitem__cC�|j|jSr	r
�r
�otherrrr�__add__�zSeq1.__add__cC�
|j|Sr	r
rrrr�__mul__rzSeq1.__mul__cC�
||jSr	r
rrrr�__rmul__rz
Seq1.__rmul__N�	�__name__�
__module__�__qualname__rrrrr!r#rrrrr�rc@r)�Seq2cCrr	r
rrrrrrz
Seq2.__init__cCrr	rrrrrrrzSeq2.__len__cCrr	r
rrrrr!rzSeq2.__getitem__cCrr	r
rrrrr#rzSeq2.__add__cCr r	r
rrrrr!%rzSeq2.__mul__cCr"r	r
rrrrr#'rz
Seq2.__rmul__Nr$rrrrr)r(r)c@�eZdZdd�ZdS)�BadIterablecC�t�r	)�ZeroDivisionErrorrrrr�__iter__+�zBadIterable.__iter__N)r%r&r'r.rrrrr+*�r+c@sDeZdZdd�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(dMdN�Z)dOS)P�OperatorTestCasecC�|j}|�t|j�|�t|jdd�|�|�dd��|�|�dd��|�|�dd��|�|�dd��|�|�dd��|�|�dd��dS�	Ny�?y@�r���?��@)�module�assertRaises�	TypeError�lt�assertFalse�
assertTrue�r
rrrr�test_lt0�zOperatorTestCase.test_ltcC�|j}|�t|j�|�t|jdd�|�|�dd��|�|�dd��|�|�dd��|�|�dd��|�|�dd��|�|�dd��dSr3)r9r:r;�ler=r>r?rrr�test_le;rAzOperatorTestCase.test_lecC�|j}Gdd�dt�}|�t|j�|�t|j|�|��|�|�dd��|�|�dd��|�|�dd��|�|�dd��|�|�dd��|�|�dd��dS)	Nc@r*)z#OperatorTestCase.test_eq.<locals>.CcSr,r	��SyntaxErrorrrrr�__eq__Ir/z*OperatorTestCase.test_eq.<locals>.C.__eq__N)r%r&r'rHrrrr�CHr0rIr4rr5r6r7r8)r9�objectr:r;�eqrGr=r>�r
rrIrrr�test_eqF�zOperatorTestCase.test_eqcCrE)	Nc@r*)z#OperatorTestCase.test_ne.<locals>.CcSr,r	rFrrrr�__ne__Wr/z*OperatorTestCase.test_ne.<locals>.C.__ne__N)r%r&r'rOrrrrrIVr0rIr4rr5r6r7r8)r9rJr:r;�nerGr>r=rLrrr�test_neTrNzOperatorTestCase.test_necCr2r3)r9r:r;�ger>r=r?rrr�test_gebrAzOperatorTestCase.test_gecCrBr3)r9r:r;�gtr>r=r?rrr�test_gtmrAzOperatorTestCase.test_gtcCsL|j}|�t|j�|�t|jd�|�|�d�d�|�|�d�d�dS)N���r4)r9r:r;�abs�assertEqualr?rrr�test_absxs
zOperatorTestCase.test_abscC�>|j}|�t|j�|�t|jdd�|�|�dd�d�dS)N���)r9r:r;�addrXr?rrr�test_add�zOperatorTestCase.test_addcCs>|j}|�t|j�|�t|jdd�|�|�dd�d�dS)N��
)r9r:r;�and_rXr?rrr�test_bitwise_and�r`z!OperatorTestCase.test_bitwise_andcCs�|j}|�t|j�|�t|jdd�|�|�dd�d�|�|�ddgddg�gd��|�|�td	d
g�tdg��gd��|�|�td	d
g�tdg��gd��|�t|jd
d�dS)N�pyZthonZpythonr4r7r[r\)r4r7r[r\��r])rfrgr]�
�)r9r:r;�concatrXrr)r?rrr�test_concat�s &&zOperatorTestCase.test_concatcCs�|j}|�t|j�|�t|jdd�|�t|jt�d�|�|�gd�d�d�|�|�gd�d�d�td�}|�|�||dg|�d�|�|�ididgi�d�dS)	Nr4)r4r7r4r[r4r\r[rfr�nan�r7)r9r:r;�countOfr-r+rX�float�r
rrlrrr�test_countOf�s zOperatorTestCase.test_countOfcCsV|j}gd�}|�t|j|�|�t|j|d�|�|�|d��|�|gd��dS)N�r\r[r7r4r4)r\r7r4)r9r:r;�delitem�assertIsNonerX�r
r�arrr�test_delitem�szOperatorTestCase.test_delitemcCs@|j}|�t|jd�|�t|jdd�|�|�dd�d�dS)Nrfr7)r9r:r;�floordivrXr?rrr�
test_floordiv��zOperatorTestCase.test_floordivcCs@|j}|�t|jd�|�t|jdd�|�|�dd�d�dS)Nrfr7g@)r9r:r;�truedivrXr?rrr�test_truediv�rzzOperatorTestCase.test_truedivcCsF|j}td�}|�t|j�|�t|j|d�|�|�|d�d�dS)Nrbr7)r9�ranger:r;�getitemrXrurrr�test_getitem�s
zOperatorTestCase.test_getitemcCs�|j}|�t|j�|�t|jdd�|�t|jt�d�|�|�gd�d�d�|�t|jgd�d�td�}|�|�||dg|�d�|�|�ididgi�d�dS)Nr4rrr[rrlrmr7)	r9r:r;�indexOfr-r+rX�
ValueErrorrorprrr�test_indexOf�s zOperatorTestCase.test_indexOfcCs:|j}|�t|j�|�t|jd�|�|�d�d�dS)Nr\���)r9r:r;�invertrX�invr?rrr�test_invert�szOperatorTestCase.test_invertcCsd|j}|�t|j�|�t|jdd�|�|�dd�d�|�|�dd�d�|�t|jdd�dS)N�*rfr4rbrr7rV)r9r:r;�lshiftrXr�r?rrr�test_lshift��zOperatorTestCase.test_lshiftcCs>|j}|�t|j�|�t|jdd�|�|�dd�d�dS)Nr�rfr7r4)r9r:r;�modrXr?rrr�test_mod�r`zOperatorTestCase.test_modcCrZ)Nrfr7rb)r9r:r;�mulrXr?rrr�test_mul�r`zOperatorTestCase.test_mulcCsJ|j}|�t|j�|�t|jdd�Gdd�d�}|�|�dd�dS)Nr�c@r*)z'OperatorTestCase.test_matmul.<locals>.McSs|dS)Nr4rrrrr�
__matmul__�sz2OperatorTestCase.test_matmul.<locals>.M.__matmul__N)r%r&r'r�rrrr�M�r0r��))r9r:r;�matmulrX)r
rr�rrr�test_matmul�s
zOperatorTestCase.test_matmulcCsp|j}|�t|j�|�t|jd�|�|�d�d�|�|�d�d�|�|�d�d�|�|�d�d�dS�Nrfr�r)r9r:r;�negrXr?rrr�test_neg��zOperatorTestCase.test_negcCrZ)Nrbrfra)r9r:r;�or_rXr?rrr�test_bitwise_or�r`z OperatorTestCase.test_bitwise_orcCsp|j}|�t|j�|�t|jd�|�|�d�d�|�|�d�d�|�|�d�d�|�|�d�d�dSr�)r9r:r;�posrXr?rrr�test_pos�r�zOperatorTestCase.test_poscCsb|j}|�t|j�|�t|jdd�|�|�dd�d�|�t|jd�|�t|jddd�dS)Nr[rf��r4r7)r9r:r;�powrXr?rrr�test_powszOperatorTestCase.test_powcCsd|j}|�t|j�|�t|jdd�|�|�dd�d�|�|�dd�d�|�t|jdd�dS)Nr�rfr4r7rrV)r9r:r;�rshiftrXr�r?rrr�test_rshiftr�zOperatorTestCase.test_rshiftcCsj|j}|�t|j�|�t|jdd�|�t|jt�d�|�|�td�d��|�|�td�d��dS)Nr4r\r7rf)	r9r:r;�containsr-r+r>r}r=r?rrr�
test_containsszOperatorTestCase.test_containscCsr|j}ttd��}|�t|j|�|�t|j|dd�|�|�|dd��|�|gd��|�t|j|dd�dS)Nr[rr7)r7r4r7r\)	r9�listr}r:r;�setitemrtrX�
IndexErrorrurrr�test_setitemszOperatorTestCase.test_setitemcCrZ)Nrfr7r[)r9r:r;�subrXr?rrr�test_sub$r`zOperatorTestCase.test_subcCs||j}Gdd�dt�}|�t|j�|�t|j|��|�|�d��|�|�dg��|�|�d��|�|�g��dS)Nc@r*)z&OperatorTestCase.test_truth.<locals>.CcSr,r	rFrrrr�__bool__-r/z/OperatorTestCase.test_truth.<locals>.C.__bool__N)r%r&r'r�rrrrrI,r0rIrfr)r9rJr:r;�truthrGr>r=rLrrr�
test_truth*szOperatorTestCase.test_truthcCrZ)N��r])r9r:r;�xorrXr?rrr�test_bitwise_xor6r`z!OperatorTestCase.test_bitwise_xorcC�\|j}d}}|dd�|dd�}|�t|j�|�|�||��|�|�||��dS�NZxyzpdqr[)r9r:r;�is_r>r=�r
rrv�b�crrr�test_is<�zOperatorTestCase.test_iscCr�r�)r9r:r;�is_notr=r>r�rrr�test_is_notDr�zOperatorTestCase.test_is_notcCs|j}Gdd�d�}|�}d|_|�d�}|�||�d�|�t|�|�t||d�|jt||dd�|�d�}|�t||�|�t|jd�|�t|j�|�}d	|_d
|_d|_	|�|�dd
d�|�d�|�t|jd�Gdd�dt
�}|�t|�d�|��|�}d|_|�|_d|j_|�d�}|�||�d�|�t||j�|�dd�}|�||�d�|�ddd�}|�t||�|�d�}|�t||�|�d�}|�t||�|�|j_d|jj_|�d�}|�||�d�|�ddd�}|�||�d�dS)Nc@�eZdZdS)z+OperatorTestCase.test_attrgetter.<locals>.AN�r%r&r'rrrr�AN�r��arthur�nameZdent)ZsurnameZrankr7�X�Y�Z�x�z�y)r�r�r�)r�rr�c@r*)z+OperatorTestCase.test_attrgetter.<locals>.CcSr,r	rF�r
r�rrr�__getattr__er/z7OperatorTestCase.test_attrgetter.<locals>.C.__getattr__N)r%r&r'r�rrrrrIdr0rI�foo�thomasz
child.name)r�r�zchild.child.namezchild.z.child�johnson)r�r�r�)
r9r��
attrgetterrXr:r;�AttributeErrorr�r�r�rJrG�child)r
rr�rv�f�recordrIrrr�test_attrgetterLsT







z OperatorTestCase.test_attrgettercCs|j}d}|�d�}|�||�d�|�t|�|�t||d�|jt||dd�|�d�}|�t||�Gdd�dt�}|�t|�d�|��|�d	�}|�t||�|�t|j�td
d�}|�d�}|�||�d
�|�d
�}|�t	||�gd�}|�d�}|�t
t||��gd��|�t||d�gd��t
tt
td���}|�|�ddd�|�d�|�t|�ddd�|�td�}	|�|�d�|	�d�|�|�tdd��|	�d�Gdd�dt�}
|�|�d�|
d��d�|�|�d�gd ��d�|�|�d�td!d"��d!�dS)#N�ABCDEr7rIr[)�sizerbc@r*)z+OperatorTestCase.test_itemgetter.<locals>.CcSr,r	rFr�rrrr�r/z7OperatorTestCase.test_itemgetter.<locals>.C.__getitem__N)r%r&r'rrrrrrI�r0r�r��val)�keyr�Znonkey)�Zappler[�Zbananar7�Zpearrf�Zoranger4r4)r[r7rfr4)r�r�r�r��rf)�2Z10�5r�ZabcderV�er\)r��dc@seZdZ	dS)z+OperatorTestCase.test_itemgetter.<locals>.TNr�rrrr�T�sr�r�abcrv)rvr�r��d��)r9�
itemgetterrXr:r;r�rJrG�dict�KeyErrorr��map�sorted�strr}�tuple�slice)r
rrvr�rIr�Z	inventoryZgetcount�data�tr�rrr�test_itemgetter�sF






� z OperatorTestCase.test_itemgettercCs|j}|�t|j�|�t|jd�Gdd�d�}|�}|�d�}|�t||�|�ddd�}|�||�d�|�t|�|�t||d�|jt||dd�|�d	�}|�||�d
�|�t|||�|jd	dd�}|�||�d�|jd
ddd�}|�||�d�dS)Nr�c@�&eZdZdd�Zd	dd�Zdd�ZdS)
z-OperatorTestCase.test_methodcaller.<locals>.Ac_�|d|dS�Nrr4r�r
�args�kwdsrrrr���z1OperatorTestCase.test_methodcaller.<locals>.A.foor�cS�|Sr	r�r
r�rrr�bar�r/z1OperatorTestCase.test_methodcaller.<locals>.A.barc_�|d|dfS�Nr�r
r�r�r�rrr�baz�r�z1OperatorTestCase.test_methodcaller.<locals>.A.bazN�r��r%r&r'r�r�r�rrrrr���
r�r�r4r7r[)�spamr�r�rf�r�r�r��eggs)r�r
)r�r)r9r:r;�methodcallerr�rX)r
rr�rvr�rrr�test_methodcaller�s&

z"OperatorTestCase.test_methodcallercCs8|j}Gdd�dt�}|�}|�|�|d�d�|�|�|d�d�|�|�|d�d�|�|�|d�d�|�|�|d�d�|�|�|d�d	�|�|�	|d�d
�|�|�
|d�d�|�|�|d�d�|�|�|d�d
�|�|�
|d�d�|�|�|d�d�|�|�|d�d�|�|�||�d�dS)Nc@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)z(OperatorTestCase.test_inplace.<locals>.CcS�dS)N�iaddrrrrr�__iadd__��z1OperatorTestCase.test_inplace.<locals>.C.__iadd__cSr)N�iandrrrrr�__iand__�rz1OperatorTestCase.test_inplace.<locals>.C.__iand__cSr)N�	ifloordivrrrrr�
__ifloordiv__�rz6OperatorTestCase.test_inplace.<locals>.C.__ifloordiv__cSr)N�ilshiftrrrrr�__ilshift__�rz4OperatorTestCase.test_inplace.<locals>.C.__ilshift__cSr)N�imodrrrrr�__imod__�rz1OperatorTestCase.test_inplace.<locals>.C.__imod__cSr)N�imulrrrrr�__imul__�rz1OperatorTestCase.test_inplace.<locals>.C.__imul__cSr)N�imatmulrrrrr�__imatmul__�rz4OperatorTestCase.test_inplace.<locals>.C.__imatmul__cSr)N�iorrrrrr�__ior__�rz0OperatorTestCase.test_inplace.<locals>.C.__ior__cSr)N�ipowrrrrr�__ipow__�rz1OperatorTestCase.test_inplace.<locals>.C.__ipow__cSr)N�irshiftrrrrr�__irshift__�rz4OperatorTestCase.test_inplace.<locals>.C.__irshift__cSr)N�isubrrrrr�__isub__�rz1OperatorTestCase.test_inplace.<locals>.C.__isub__cSr)N�itruedivrrrrr�__itruediv__�rz5OperatorTestCase.test_inplace.<locals>.C.__itruediv__cSr)N�ixorrrrrr�__ixor__�rz1OperatorTestCase.test_inplace.<locals>.C.__ixor__cSr)Nrfrrrrrr�rz4OperatorTestCase.test_inplace.<locals>.C.__getitem__N)r%r&r'rrr
rrrrrrrrrrrrrrrrI�srIrfrrr	rr
rrrrrrrr)r9rJrXrrr	rr
rrrrrrrr�iconcat)r
rrIr�rrr�test_inplace�s"zOperatorTestCase.test_inplacecCs8|j}Gdd�dt�}|�|�gd�d�|�|�tgd���d�|�|�|d��d�|�|�|t�d�d�|�|�|t�d�d�|�t��|�|d	��Wd�n1s\wY|�t��|�|d
��Wd�n1sxwY|�t	��|�|t	��Wd�dS1s�wYdS)Nc@seZdZdd�Zdd�ZdS)z,OperatorTestCase.test_length_hint.<locals>.XcSrr	)�value)r
r!rrrr�rz5OperatorTestCase.test_length_hint.<locals>.X.__init__cSst|j�tur
|j�|jSr	)�typer!rrrr�__length_hint__�sz<OperatorTestCase.test_length_hint.<locals>.X.__length_hint__N)r%r&r'rr#rrrrr��sr�r7r)r4r7r[r[r\r�r����)
r9rJrX�length_hint�iter�NotImplementedr;r:r��LookupError)r
rr�rrr�test_length_hint�s 
��"�z!OperatorTestCase.test_length_hintcCsZ|j}dd�t|�D�}|D]}t||�}t|d|�d�dd�}|r*|�||�qdS)NcSsg|]	}|�d�s|�qS)�_)�
startswith)�.0r�rrr�
<listcomp>sz<OperatorTestCase.test_dunder_is_original.<locals>.<listcomp>�__r*)r9�dir�getattr�stripZassertIs)r
r�namesr�ZorigZdunderrrr�test_dunder_is_original	s
��z(OperatorTestCase.test_dunder_is_originalN)*r%r&r'r@rDrMrQrSrUrYr_rdrkrqrwryr|rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr r)r3rrrrr1/sP

				53!r1c@�eZdZeZdS)�PyOperatorTestCaseN)r%r&r'�py_operatorr9rrrrr5sr5zrequires _operatorc@r4)�COperatorTestCaseN)r%r&r'�
c_operatorr9rrrrr7sr7c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�OperatorPickleTestCasecCs~t�tjd|j��t�||�}Wd�n1swYt�tjd|j��
t�|�Wd�S1s8wYdS)Nr)	rZ	swap_item�sys�modulesr9�pickle�dumps�module2�loads)r
�obj�protoZpickledrrr�copys�$�zOperatorPickleTestCase.copyc	CsF|jj}Gdd�d�}|�}d|_d|_d|_|�|_|�|j_d|jj_tt	j
d�D]t}|j|d��d|d	�}|�||�}|�
t|�t|��|�
||�||��|d	d
d�}|�||�}|�
t|�t|��|�
||�||��|d�}|�||�}|�
t|�t|��|�
||�||��Wd�n1s�wYq,dS)
Nc@r�)z1OperatorPickleTestCase.test_attrgetter.<locals>.ANr�rrrrr�$r�r�r�r�r��Vr4�rAr�r�r�zt.u.v)r9r�r�r�r�r��u�vr}r<�HIGHEST_PROTOCOL�subTestrBrX�repr)r
r�r�rvrAr��f2rrrr�"s4

���z&OperatorPickleTestCase.test_attrgetterc	Cs�|jj}d}ttjd�D]V}|j|d��F|d�}|�||�}|�t|�t|��|�||�||��|ddd�}|�||�}|�t|�t|��|�||�||��Wd�n1s^wYq
dS)Nr�r4rDr7rr\)	r9r�r}r<rGrHrBrXrI)r
r�rvrAr�rJrrrr�>s���z&OperatorPickleTestCase.test_itemgetterc	CsJ|jj}Gdd�d�}|�}ttjd�D]�}|j|d��}|d�}|�||�}|�t|�t|��|�||�||��|ddd�}|�||�}|�t|�t|��|�||�||��|ddd	�}|�||�}|�t|�t|��|�||�||��|d
ddd
�}|�||�}|�||�||��Wd�n1s�wYqdS)Nc@r�)
z3OperatorPickleTestCase.test_methodcaller.<locals>.Ac_r�r�rr�rrrr�Pr�z7OperatorPickleTestCase.test_methodcaller.<locals>.A.foor�cSr�r	rr�rrrr�Rr/z7OperatorPickleTestCase.test_methodcaller.<locals>.A.barc_r�r�rr�rrrr�Tr�z7OperatorPickleTestCase.test_methodcaller.<locals>.A.bazNr�r�rrrrr�Or�r�r4rDr�r�r7rfr�r�rr�r�)	r9rr}r<rGrHrBrXrI)r
rr�rvrAr�rJrrrrMs.���z(OperatorPickleTestCase.test_methodcallerN)r%r&r'rBr�r�rrrrrr9s
r9c@�eZdZeZeZdS)�PyPyOperatorPickleTestCaseN)r%r&r'r6r9r>rrrrrLlsrLc@�eZdZeZeZdS)�PyCOperatorPickleTestCaseN)r%r&r'r6r9r8r>rrrrrNp�rNc@rM)�CPyOperatorPickleTestCaseN)r%r&r'r8r9r6r>rrrrrPurOrPc@rK)�CCOperatorPickleTestCaseN)r%r&r'r8r9r>rrrrrQzrOrQ�__main__)Zunittestr<r:�testrZtest.supportrZimport_fresh_moduler6r8rrJr)r+r1ZTestCaser5Z
skipUnlessr7r9rLrNrPrQr%�mainrrrr�<module>s@��g
Q


�