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_descr.cpython-38.opt-1.pyc
U

>��gV��@sRddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZzddlZWnek
r�dZYnXGdd�dej�ZGdd�dej�ZGdd	�d	ej�ZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�dej�Zdd�Zedk�rNe�dS)�N)�deepcopy)�supportc@s�eZdZdd�Zd0dd�Zd1d	d
�Zd2d
d�Zd3dd�Zd4dd�Zd5dd�Z	dd�Z
dd�Zgfdd�Zd d!�Z
d"d#�Zd$d%�Zd&d'�Ze�d(�d)d*��Ze�d(�d+d,��Zd-d.�Zd/S)6�
OperatorsTestcOs�tjj|f|�|�ddddddddd	d
ddd
dddddddd�|_t|j���D],\}}|��rl|d}nd|}||j|<qRddddddd�|_t|j���D],\}}|��r�|d}nd|}||j|<q�dS)N�+�-�*�@�/z//�divmodz**z<<z>>�&�^�|�cmp�<�<=�==�!=�>�>=)�add�sub�mul�matmul�truediv�floordivr
�pow�lshift�rshift�and�xor�orr�lt�le�eq�ne�gt�gez(a, b)za %s b�abs�~�int�float)�pos�negr'�invertr)r*z(a)z%s a)�unittest�TestCase�__init__�binops�list�items�islower�unops)�self�args�kwargs�name�expr�r;�./opt/cppython/lib/python3.8/test/test_descr.pyr0sN�
�	
zOperatorsTest.__init__�len(a)�__len__c	Cs�d|i}|�t||�|�t|�}t||�}||jkrB|jd}q,|�t|d|�|j|�|�||�|�t||�}|�|�|�dS)N�ar�im_func��assertEqual�eval�type�getattr�__dict__�	__bases__)	r6r?�resr:�meth�d�t�m�bmr;r;r<�	unop_testHs


zOperatorsTest.unop_test�a+b�__add__c
Cs�||d�}|�t||�|�t|�}t||�}||jkrD|jd}q.|�t|d|�|j|�|�|||�|�t||�}	|�|	|�|�dS)N�r?�brr@rA)
r6r?rRrHr:rIrJrKrLrMr;r;r<�
binop_testXs



zOperatorsTest.binop_test�a[b:c]�__getitem__cCs�|||d�}|�t||�|�t|�}t||�}	||jkrF|jd}q0|�t|	d|	�|j|�|�|	|t||��|�t||�}
|�|
t||��|�dS)N�r?rR�crr@)rBrCrDrErFrG�slice)r6r?rRrWrHr:rIrJrKrLrMr;r;r<�sliceop_testgs


zOperatorsTest.sliceop_test�a+=b�__iadd__c
Cs�t|�|d�}t||�|�|d|�t|�}t||�}||jkrP|jd}q:|�t|d|�|j|�t|�|d<||d|�|�|d|�t|�|d<t|d|�}	|	|�|�|d|�dS)NrQr?rr@�r�execrBrDrErFrG)
r6r?rRrH�stmtrIrJrKrLrMr;r;r<�
setop_testus


zOperatorsTest.setop_test�a[b]=c�__setitem__cCs�t|�||d�}t||�|�|d|�t|�}t||�}	||jkrR|jd}q<|�t|	d|	�|j|�t|�|d<|	|d||�|�|d|�t|�|d<t|d|�}
|
||�|�|d|�dS)NrVr?rr@r\)r6r?rRrWrHr^rIrJrKrLrMr;r;r<�set2op_test�s



zOperatorsTest.set2op_test�a[b:c]=dcCs�t|�|||d�}t||�|�|d|�t|�}	||	jkrJ|	jd}	q4t|	|�}
|�t|
d|
�|	j|�t|�|d<|
|dt||�|�|�|d|�t|�|d<t|d|�}|t||�|�|�|d|�dS)N)r?rRrWrJr?rr@)rr]rBrDrFrGrErX)r6r?rRrWrJrHr^rIZ
dictionaryrKrLrMr;r;r<�setsliceop_test�s


zOperatorsTest.setsliceop_testc
Cs`|�dgdgddgdd�|�dddgdddd�|�dddgdd	dd�|�dddgddd
d�|�dddgd	dddgdd�|�dgdgddgd
d�|�ddgdddddddgdd�|�dddgddd�|�ddgdddddddgdd�|�ddgdddddddgdd�|�ddgddddgdd�|�ddddgddddgddddgdd�dS)N��rOrP��b in a�__contains__�r�a[b]rUrTrZr[�a*=b�__imul__r=r>�a*b�__mul__�b*a�__rmul__r`ra��rc)rSrYr_rNrbrd�r6r;r;r<�
test_lists�s"""$�zOperatorsTest.test_listsc	CsX|�ddd�dddd�|�ddd�dddd�|�ddd�dddd	�ddd�}g}t|���D]}|�|�qbg}t|�D]}|�|�q~|�||�g}|��D]}|�|�q�|�||�g}t�|�D]}|�|�q�|�||�ddd�}|�|dd
d�|�t	t
|�i�|�|�t	|��i�|�|�ddd�dddddd
�dd�dS)Nrfrj�rergrerhrirrkrUr=r>rg�rerfrgr`ra)
rSr2�keys�append�iterrB�__iter__�dictrNrC�repr�__repr__rb)r6rJ�l1�i�lr;r;r<�
test_dicts�s4

�zOperatorsTest.test_dictscCs�||d�}|j��D]>\}}||krd|}t||�rt||�}|�|||||�qt|j���D]<\}}||krbd|}t||�rbt||�}|�||||�qbdS)NrQz__%s__)r1r3�hasattrrCrSr2r5rN)r6r?rR�skipr|r9r:rHr;r;r<�number_operators�s




zOperatorsTest.number_operatorscCs~|�dd�|�d��d�|�d��d�Gdd�dt�}|�|d�d�z|�dWntk
rnYnX|�d	�dS)
N�drgrerc@seZdZdd�ZdS)z"OperatorsTest.test_ints.<locals>.CcSstS�N��NotImplemented�r6�otherr;r;r<rP�sz*OperatorsTest.test_ints.<locals>.C.__add__N)�__name__�
__module__�__qualname__rPr;r;r;r<�C�sr�rr�z+NotImplemented should have caused TypeError)r�rB�__bool__r)�	TypeError�fail�r6r�r;r;r<�	test_ints�szOperatorsTest.test_intscCs|�dd�dS)NgY@�@)r�rtr;r;r<�test_floatsszOperatorsTest.test_floatscCs�|jddddddddd	d
dg	d�Gd
d�dt�}|ddd�}|�t|�d�|�|jd�||dd�}|�t|�d�|�|jd�|d�}|�t|�d�|�|jd�dS)NyY@�@r!r"r%r&r)r*rr
�mod)r�c@s&eZdZdgZdd�Zdd�ZeZdS)z,OperatorsTest.test_complexes.<locals>.Number�precc_s"tj|f|��}|�dd�|_|S)Nr��)�complex�__new__�getr�)�clsr7�kwds�resultr;r;r<r�sz4OperatorsTest.test_complexes.<locals>.Number.__new__cSsJ|j}|jdkrd||jfS|jdkr6d||jfSd||j||jfS)N��%.*gz%.*gjz(%.*g+%.*gj))r��imag�real)r6r�r;r;r<r~s

z5OperatorsTest.test_complexes.<locals>.Number.__repr__N)r�r�r��	__slots__r�r~�__str__r;r;r;r<�Number
sr�g��Q�	@rs�r�z3.14rfz3.1gPm@z234.5r�)r�r�rBr}r�)r6r�r?r;r;r<�test_complexess"�zOperatorsTest.test_complexescCs2|�t�dd�tdd��|�t�dd�d�dS)Nr�g@r�reg�)rBr��__radd__r*�__rsub__rtr;r;r<�test_explicit_reverse_methods%sz+OperatorsTest.test_explicit_reverse_methods�"the module 'xxsubtype' is internalcCsXddl}ddl}d"dd�}||j|j<|�|dg�|dg�|ddg�dd�|�|dddg�ddd	d
�|�|dddg�ddd	d
�|�|dddg�dddd
�|�|dddg�dd|ddg�dd
�|�|dg�|dg�|ddg�dd�|�|ddg�d|ddddddg�dd�|�|dddg�ddd�|�|ddg�d|ddddddg�dd�|�|ddg�d|ddddddg�dd�|�|ddg�dd|ddg�dd�|�	|ddddg�dd|ddg�|ddddg�dd�Gdd�d|j�}|�}|�
|g�|�
|��d�|�d �|�
|d g�|�
|�
�d�|�d!�|�
|�
�d!�dS)#NrcSsddl}|�|�S�Nr)�	xxsubtype�spamlist)r��memo�spamr;r;r<r�/sz/OperatorsTest.test_spam_lists.<locals>.spamlistrerfrOrPrgrhrirjrkrUrTrZr[rlrmr=r>rnrorprqr`rarrrsrcc@seZdZdd�ZdS)z(OperatorsTest.test_spam_lists.<locals>.CcSsdS�Nrer;rtr;r;r<�fooL�z,OperatorsTest.test_spam_lists.<locals>.C.fooN�r�r�r�r�r;r;r;r<r�Ksr�r��*)N)�copyr��_deepcopy_dispatchr�rSrYr_rNrbrdrBr�ry�getstate�setstate)r6r�r�r�r�r?r;r;r<�test_spam_lists*sT
 � � �$�$�$�� �

zOperatorsTest.test_spam_listsc
Csddl}ddl}ddd�}||j|j<|�|ddd��dddd	�|�|ddd��dddd	�|�|ddd��ddd
d�|ddd��}g}t|���D]}|�|�q�g}t|�D]}|�|�q�|�	||�g}|�
�D]}|�|�q�|�	||�g}t|i���
|�D]}|�|��q|�	||�ddd�}||�}	|�|	ddd
�|�|	t
|�dd�|�|ddd��dd|dddd��dd�Gdd�d|j�}
|
�}|�	t|���g�|�	|��d�d|d<|�	t|���dg�|�	|��d�|�d�|�	|��d�dS)NrcSs2ddl}|��}t|���D]\}}|||<q|Sr�)r��spamdictr2r3)rJr�r��sd�k�vr;r;r<r�Zs

z/OperatorsTest.test_spam_dicts.<locals>.spamdictrfrjrvrerhrirkrUr=r>zrepr(a)r~rgrwr`rac@seZdZdd�ZdS)z(OperatorsTest.test_spam_dicts.<locals>.CcSsdSr�r;rtr;r;r<r�~r�z,OperatorsTest.test_spam_dicts.<locals>.C.fooNr�r;r;r;r<r�}sr��barr��r�r�r�)N)r�r�r�r�rSr2rxryrzrBr{rDrNr}rbr3r�r�r�)r6r�r�r�rJrr�r�Z	straightdZspamdr�r?r;r;r<�test_spam_dictsVsN

"�
zOperatorsTest.test_spam_dictscCs|�ttj���tj�dSr�)rB�range�sys�maxsizer>rtr;r;r<�test_wrap_lenfunc_bad_cast�sz(OperatorsTest.test_wrap_lenfunc_bad_castN)r=r>)rOrP)rTrU)rZr[)r`ra)rcra)r�r�r�r0rNrSrYr_rbrdrur�r�r�r�r�r�r�impl_detailr�r�r�r;r;r;r<rs&0





!
+
1rcs.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(�Z�fd)d*�Zejd+d,��Ze�d-�d.d/��Zd0d1�Zejd2d3��Ze�d-�d4d5��Zd6d7�Z d8d9�Z!d:d;�Z"e#j$d<d=��Z%d>d?�Z&e#j$d@dA��Z'dBdC�Z(dDdE�Z)dFdG�Z*e�dH�dIdJ��Z+dKdL�Z,dMdN�Z-dOdP�Z.dQdR�Z/e#�0e1j2j3dSkdT�dUdV��Z4ej5dWdX��Z6dYdZ�Z7d[d\�Z8d]d^�Z9�fd_d`�Z:dadb�Z;dcdd�Z<dedf�Z=dgdh�Z>didj�Z?dkdl�Z@dmdn�ZAdodp�ZBdqdr�ZCdsdt�ZDdudv�ZEdwdx�ZFdydz�ZGd{d|�ZHd}d~�ZIdd��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZd�d��Z[d�d��Z\d�d��Z]d�d��Z^d�d��Z_e�d��d�d���Z`d�d��Zad�d��Zbd�d��Zcd�d��Zdd�d��Zed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�dÄZkd�dńZld�dDŽZmd�dɄZnd�d˄Zod�d̈́Zpd�dτZqd�dфZrd�dӄZsd�dՄZtd�dׄZud�dلZvd�dۄZwd�d݄Zxd�d߄Zyd�d�Zzd�d�Z{d�d�Z|d�d�Z}d�d�Z~d�d�Z�fd�d�Z�e#�0e�d�kd�d�d��Z��Z�S)��ClassPropertiesAndMethodscCs|�t||�d||f�dS)Nz%r has no attribute %r)�
assertTruer��r6�objr9r;r;r<�
assertHasAttr�s
�z'ClassPropertiesAndMethods.assertHasAttrcCs|�t||�d||f�dS)Nz%r has unexpected attribute %r)�assertFalser�r�r;r;r<�assertNotHasAttr�s
�z*ClassPropertiesAndMethods.assertNotHasAttrc	s���ttt����it�t�}��|i���|jt���|t�G�fdd�dt�}��t|t��|d�}��|jd�|ddd�}��|ddko�|dd�|�}��|jd	���|��d	�|�	d
���|jd
���|��d
�|�	d���|jd���|��d���|dd
�d
|d<��|dd
�d}t
|�D]0}|�||<t
|�D]}|||||<�qh�qRt
|�D].}t
|�D]}��|||||��q��q�dS)Ncs@eZdZdZ�fdd�Zdd�Z�fdd�Zdd	�Zd
d�ZdS)
z6ClassPropertiesAndMethods.test_python_dicts.<locals>.C���csD|r��t|�d�|d|_|r@t|���D]\}}|||<q.dS�Nrer)rB�len�stater2r3)�
self_localr?�kwr�r�rtr;r<r0�s
z?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.__init__cSs|�|d�Sr�)r��r6�keyr;r;r<rU�szBClassPropertiesAndMethods.test_python_dicts.<locals>.C.__getitem__cs"��|td��t�|||�dSr�)�assertIsInstancerDr|ra)r�r��valuertr;r<ra�szBClassPropertiesAndMethods.test_python_dicts.<locals>.C.__setitem__cSs
||_dSr��r��r6r�r;r;r<r��sz?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.setstatecSs|jSr�r�rtr;r;r<r��sz?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.getstateN)	r�r�r�r�r0rUrar�r�r;rtr;r<r��sr�r�rerfr�r�r�r�r�
r���2)r��
issubclassr|r�rB�assertIs�	__class__r�r�r�r�)	r6rJr��a1�a2r?�Nr��jr;rtr<�test_python_dicts�s@


z+ClassPropertiesAndMethods.test_python_dictscCsnGdd�dt�}|�}|�dddg�|�|dd�|�|dd�|�|dd�|�|dd	�d
�dS)Nc@seZdZdd�ZdS)z6ClassPropertiesAndMethods.test_python_lists.<locals>.CcSs&t|t�r|j|jfSt�||�dS�Nr�)�
isinstancerX�start�stopr2rU�r6r�r;r;r<rU�s
zBClassPropertiesAndMethods.test_python_lists.<locals>.C.__getitem__N�r�r�r�rUr;r;r;r<r��sr�rrerfr��e�f��)r�r�)r2�extendrB�r6r�r?r;r;r<�test_python_lists�sz+ClassPropertiesAndMethods.test_python_listsc	sBGdd�dtd�}|�}|�|��d�|�d�|�|��d�Gdd�dt�}Gdd	�d	|d�}|�|��|�|�}|�|j|�Gd
d�dt�}Gdd�d|d�}|�|jd
�|�}|�|jd
�Gdd�dt��G�fdd�dt�}Gdd�d|d�}|�|jd�|�|j	d�|�
d|j�|�}|�|��d�G�fdd�dt��Gdd�d�d�}	Gdd�d|	�}
Gdd�d|	�}Gdd	�d	||
�}|�|��
�d�Gdd �d |
|�}|�|��
�d!�G�fd"d#�d#t��Gd$d�d�d�}	|	�}|�|d%�d&|_|�|jd&�|�|jd'�Gd(d)�d)���}Gd*d�d|d�}	Gd+d�d|	�}
Gd,d�d|	�}Gd-d	�d	||
�}|�|�jd�G�fd.d/�d/t��Gd0d�d�d�}|��jd
�|�}|�t|�|�|��jd
�Gd1d�dt�}|�}z
|�Wntk
�rYnX|�d2�Gd3d�dt�}	Gd4d�dt�}
Gd5d�dt|	d�}Gd6d	�d	|
|�}|�|	t|��g�G�fd7d8�d8t�}
G�fd9d:�d:|
�}Gd;d�d|
d�}	|�d8g�����Gd<d�d|d�}
|�d:d8g�����Gd=d�d|	|
�}|�d:d8g�����|�
d>|j�Gd?d@�d@|
|	�}|�d:d8g�����|�
d>|j�GdAd	�d	|td�}|�d:d8g�����|�
d>|j�GdBd �d ||
d�}|�d:d8g�����|�
d>|j�t���fdCdD�}GdEdF�dF|d�}GdGdH�dHt|d�}GdIdJ�dJ||d�}|��|�|��|�|��|�g�G��fdKdL�dL�}G��fdMdN�dN|�}GdOd�d|d�}	|�|t|	��|�dLg�����|�dLg�����GdPd�d|d�}
|�|t|
��|�dNdLg�����|�dNdLg�����GdQd�d|	|
�}|�|t|��|�dNdLg�����|�dNdLg�����GdRd@�d@|
|	�}|�|t|��|�dNdLg�����|�dNdLg�����|�t��GdSd	�d	|td�}W5QRXGdTd �d ||d�}|�|t|��|�dNdLg�����|�dNdLg�����GdUdV�dVt�|�}|�|t|��|�dNdLg�����|�dNdLg�����GdWdX�dX|t��}|�|t|��|�dNdLg�����|�dNdLg�����|�t��GdYdF�dF|t��}W5QRX|�t��GdZdF�dFt�|�}W5QRXdS)[Nc@s$eZdZdd�Zdd�Zdd�ZdS)�3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSs
d|_dSr��Z	_C__statertr;r;r<r0�sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.__init__cSs|jSr�r�rtr;r;r<r��sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.getstatecSs
||_dSr�r�r�r;r;r<r��sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.setstateN�r�r�r�r0r�r�r;r;r;r<r��sr���	metaclassrr�c@seZdZdd�ZdS)z<ClassPropertiesAndMethods.test_metaclass.<locals>._metaclasscSs|Sr�r;�r�r;r;r<�myself�r�zCClassPropertiesAndMethods.test_metaclass.<locals>._metaclass.myselfN)r�r�r�r�r;r;r;r<�
_metaclass�sr�c@seZdZdS��3ClassPropertiesAndMethods.test_metaclass.<locals>.DN�r�r�r�r;r;r;r<�D�sr�c@seZdZdd�ZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.M1cSsd|d<t�||||�S)Nre�__spam__�rDr�)r�r9�basesr|r;r;r<r��sz<ClassPropertiesAndMethods.test_metaclass.<locals>.M1.__new__N�r�r�r�r�r;r;r;r<�M1�src@seZdZdS�r�Nr�r;r;r;r<r��srec@seZdZdS)z;ClassPropertiesAndMethods.test_metaclass.<locals>._instanceNr�r;r;r;r<�	_instance�srcs$eZdZedd��Z�fdd�ZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.M2cSs t�|�}||_||_||_|Sr�)�objectr�r9rr|)r�r9rr|r6r;r;r<r��s

z<ClassPropertiesAndMethods.test_metaclass.<locals>.M2.__new__cs<��}|jD]*}|�d�rqt|||j|�||��q|S)N�__)r|�
startswith�setattr�__get__)r6�itr��rr;r<�__call__s

z=ClassPropertiesAndMethods.test_metaclass.<locals>.M2.__call__N)r�r�r��staticmethodr�rr;r
r;r<�M2�s
rc@seZdZdd�ZdS)r�cSsdS�Nr�r;rtr;r;r<r�	sz8ClassPropertiesAndMethods.test_metaclass.<locals>.C.spamN�r�r�r�r�r;r;r;r<r�sr;r�r�cseZdZ��fdd�Z�ZS)z;ClassPropertiesAndMethods.test_metaclass.<locals>.autosupercsZt�|��||||�}|dd�dkr4|dd�}q|rBd|}nd}t||t|��|S)Nre�_z
_%s__superZ__super)�superr�r
)r�r9rr|r�)r��	autosuperr;r<r�s�
zCClassPropertiesAndMethods.test_metaclass.<locals>.autosuper.__new__�r�r�r�r��
__classcell__r;)r�r�r<rsrc@seZdZdd�ZdS)�3ClassPropertiesAndMethods.test_metaclass.<locals>.AcSsdS�N�Ar;rtr;r;r<rI#sz8ClassPropertiesAndMethods.test_metaclass.<locals>.A.methN�r�r�r�rIr;r;r;r<r"src@seZdZdd�ZdS)�3ClassPropertiesAndMethods.test_metaclass.<locals>.BcSsd|j��S�N�B��	_B__superrIrtr;r;r<rI&sz8ClassPropertiesAndMethods.test_metaclass.<locals>.B.methNrr;r;r;r<r%src@seZdZdd�ZdS)r�cSsd|j��S�Nr���	_C__superrIrtr;r;r<rI)sz8ClassPropertiesAndMethods.test_metaclass.<locals>.C.methNrr;r;r;r<r�(sc@seZdZdd�ZdS)r�cSsd|j��S�Nr�)�	_D__superrIrtr;r;r<rI,sz8ClassPropertiesAndMethods.test_metaclass.<locals>.D.methNrr;r;r;r<r�+sZDCBAc@seZdZdd�ZdS)�3ClassPropertiesAndMethods.test_metaclass.<locals>.EcSsd|j��S)N�E)Z	_E__superrIrtr;r;r<rI0sz8ClassPropertiesAndMethods.test_metaclass.<locals>.E.methNrr;r;r;r<r(/sr(ZEBCAcseZdZ��fdd�Z�ZS)z>ClassPropertiesAndMethods.test_metaclass.<locals>.autopropertyc	s�i}|��D]v\}}|�d�rL|dd�}|�|d�\}}|}||f||<q|�d�r|dd�}|�|d�\}}|}||f||<q|��D]\}\}}t||�||<q�t�|��||||�S)NZ_get_rr)NNZ_set_)r3r	r��propertyrr�)	r�r9rr|�hitsr��valr��set)r��autopropertyr;r<r�7s&

�zFClassPropertiesAndMethods.test_metaclass.<locals>.autoproperty.__new__rr;)r-rr<r-4sr-c@seZdZdd�Zdd�ZdS)rcSs|jSr���_A__xrtr;r;r<�_get_xIs�:ClassPropertiesAndMethods.test_metaclass.<locals>.A._get_xcSs||_dSr�r.�r6�xr;r;r<�_set_xKsz:ClassPropertiesAndMethods.test_metaclass.<locals>.A._set_xN)r�r�r�r0r4r;r;r;r<rHsr3r�i�c@seZdZdS)z@ClassPropertiesAndMethods.test_metaclass.<locals>.multimetaclassNr�r;r;r;r<�multimetaclassSsr5c@seZdZdd�ZdS)rcSsdSrr;rtr;r;r<r0Wsr1N�r�r�r�r0r;r;r;r<rVsc@seZdZdd�ZdS)rcSsd|j��Sr)r!r0rtr;r;r<r0Zsz:ClassPropertiesAndMethods.test_metaclass.<locals>.B._get_xNr6r;r;r;r<rYsc@seZdZdd�ZdS)r�cSsd|j��Sr")r$r0rtr;r;r<r0]sz:ClassPropertiesAndMethods.test_metaclass.<locals>.C._get_xNr6r;r;r;r<r�\sc@seZdZdd�ZdS)r�cSsd|j��Sr%)r&r0rtr;r;r<r0`sz:ClassPropertiesAndMethods.test_metaclass.<locals>.D._get_xNr6r;r;r;r<r�_scseZdZdZ�fdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.Trcs�jd7_dSr���counter�r6r7��Tr;r<r0gsz<ClassPropertiesAndMethods.test_metaclass.<locals>.T.__init__N)r�r�r�r8r0r;r:r;r<r;esr;c@seZdZdSrr�r;r;r;r<r�isc@seZdZdSrr�r;r;r;r<r�psz5calling object w/o call method should raise TypeErrorc@seZdZdd�ZdS)rc_stj||�Sr�r�r7r8r;r;r<r�ysz;ClassPropertiesAndMethods.test_metaclass.<locals>.A.__new__Nrr;r;r;r<rxsc@seZdZdS�rNr�r;r;r;r<r|sc@seZdZdSrr�r;r;r;r<r�sc@seZdZdSr�r�r;r;r;r<r��scs.eZdZe��fdd��Zedd��Z�ZS)z7ClassPropertiesAndMethods.test_metaclass.<locals>.AMetacs��d�t��||||�S)N�AMeta�ryrr���mclsr9r�ns�r��	new_callsr;r<r��s
z?ClassPropertiesAndMethods.test_metaclass.<locals>.AMeta.__new__cSsiSr�r;�rAr9rr;r;r<�__prepare__�szCClassPropertiesAndMethods.test_metaclass.<locals>.AMeta.__prepare__�r�r�r�rr��classmethodrFrr;�rDrr<r>�sr>cs2eZdZe��fdd��Ze�fdd��Z�ZS)z7ClassPropertiesAndMethods.test_metaclass.<locals>.BMetacs��d�t��||||�S)N�BMetar?r@rCr;r<r��s
z?ClassPropertiesAndMethods.test_metaclass.<locals>.BMeta.__new__cst��||�}d|d<|S)NT�BMeta_was_here)rrFr@rr;r<rF�szCClassPropertiesAndMethods.test_metaclass.<locals>.BMeta.__prepare__rGr;rIrr<rJ�srJc@seZdZdS�rNr�r;r;r;r<r�sc@seZdZdSr=r�r;r;r;r<r�sc@seZdZdSrr�r;r;r;r<r��srKc@seZdZdS�z4ClassPropertiesAndMethods.test_metaclass.<locals>.C2Nr�r;r;r;r<�C2�srNc@seZdZdSr�r�r;r;r;r<r��sc@seZdZdS�r'Nr�r;r;r;r<r(�scs�Sr�r;r<)�markerr;r<�func�sz6ClassPropertiesAndMethods.test_metaclass.<locals>.funcc@seZdZdS�z3ClassPropertiesAndMethods.test_metaclass.<locals>.XNr�r;r;r;r<�X�srSc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.YNr�r;r;r;r<�Y�srTc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.ZNr�r;r;r;r<�Z�srUcs.eZdZ��fdd�Ze�fdd��Z�ZS)z:ClassPropertiesAndMethods.test_metaclass.<locals>.ANotMetacs��d�t��|�S�N�ANotMetar?�rAr7r8rCr;r<r��s
zBClassPropertiesAndMethods.test_metaclass.<locals>.ANotMeta.__new__cs��d�iSrV�ryrE)�
prepare_callsr;r<rF�s
zFClassPropertiesAndMethods.test_metaclass.<locals>.ANotMeta.__prepare__�r�r�r�r�rHrFrr;�rDrZrr<rW�srWcs0eZdZ��fdd�Ze��fdd��Z�ZS)z:ClassPropertiesAndMethods.test_metaclass.<locals>.BNotMetacs��d�t��|�S�N�BNotMetar?rXrCr;r<r��s
zBClassPropertiesAndMethods.test_metaclass.<locals>.BNotMeta.__new__cs��d�t��||�Sr])ryrrFrE)r�rZr;r<rF�s
zFClassPropertiesAndMethods.test_metaclass.<locals>.BNotMeta.__prepare__r[r;r\rr<r^�sr^c@seZdZdSrLr�r;r;r;r<r�sc@seZdZdSr=r�r;r;r;r<r�sc@seZdZdSrr�r;r;r;r<r��sc@seZdZdSrMr�r;r;r;r<rN�sc@seZdZdSr�r�r;r;r;r<r�
sc@seZdZdSrOr�r;r;r;r<r(
sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.FNr�r;r;r;r<�Fsr_c@seZdZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.F2Nr�r;r;r;r<�F2sr`c@seZdZdSrRr�r;r;r;r<rS(sc@seZdZdSrRr�r;r;r;r<rS+s)rDrBr�r�r�r�rrr9r�assertInr|r�rIr�r3r/r8r�r�r��clearrF�assertRaisesr))r6r�r?r�r�rJrrWrrrr(r5r>rJrNrQrSrTrUrWr^r_r`r;)r;rr-rrPrDrZr<�test_metaclass�s$


		z(ClassPropertiesAndMethods.test_metaclasscs�g�tt��G��fdd�d��}|d�}d|_|j}|`|��dddg�zGdd	�d	tjt�}Wntk
rxYnX|�d
�dS)NcsBeZdZ�fdd�Z��fdd�Z��fdd�Z��fdd�Zd	S)
z<ClassPropertiesAndMethods.test_module_subclasses.<locals>.MMcs��||�dSr�)r0�r6r9)�MTr;r<r03szEClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__init__cs��d|f���||�S)NrE)ry�__getattribute__re�rf�logr;r<rg5szMClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__getattribute__cs"��d||f���|||�dS)Nr
)ry�__setattr__�r6r9r�rhr;r<rj8szHClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__setattr__cs��d|f���||�dS)N�delattr)ry�__delattr__rerhr;r<rm;szHClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__delattr__N)r�r�r�r0rgrjrmr;rhr;r<�MM2srnr?r�)r
r�r��rEr�)rlr�c@seZdZdS)z@ClassPropertiesAndMethods.test_module_subclasses.<locals>.ModuleNr�r;r;r;r<�ModuleHsrpz?inheriting from ModuleType and str at the same time should fail)	rDr�r�rB�types�
ModuleType�strr�r�)r6rnr?r3rpr;rhr<�test_module_subclasses.s �z0ClassPropertiesAndMethods.test_module_subclassescsLGdd�dt����}|�|��d�|�d�|�|��d�G�fdd�dt��}|�}|�t|���g�d|d<|�t|���d	g�|�|dd�|�|��d�|�d�|�|��d�|�|j|t�tf�Gd
d�dt�}Gdd
�d
|t�}|�|��	�d�|�t
|��d�|�|��	�d�|�t
|��d�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z>ClassPropertiesAndMethods.test_multiple_inheritance.<locals>.CcSs
d|_dSr�r�rtr;r;r<r0SszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.__init__cSs|jSr�r�rtr;r;r<r�UszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.getstatecSs
||_dSr�r�r�r;r;r<r�WszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.setstateNr�r;r;r;r<r�Rsr�rr�cseZdZ�fdd�ZdS)z>ClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Dcsti��|���|�dSr�)rDr0rt�r�r;r<r0^szGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.D.__init__N�r�r�r�r0r;rur;r<r�]sr��world�hello)rxrwc@seZdZdd�Zdd�ZdS)zAClassPropertiesAndMethods.test_multiple_inheritance.<locals>.NodecSst|���Sr�)r)r�rtr;r;r<�__int__mszIClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Node.__int__cSsdS)NZ23r;rtr;r;r<r�oszEClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Node.fooN)r�r�r�ryr�r;r;r;r<�Nodelsrzc@seZdZdd�ZdS)zAClassPropertiesAndMethods.test_multiple_inheritance.<locals>.FragcSsdS)NZ42r;rtr;r;r<r�rszEClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Frag.fooNr�r;r;r;r<�Fragqsr{�r�)rrBr�r�r|r2rxr3�__mro__ryr))r6r?r�rJrzr{r;rur<�test_multiple_inheritancePs*

z3ClassPropertiesAndMethods.test_multiple_inheritancecCs�Gdd�dt�}|�|���d�Gdd�d|�}|�|���d�|�|���d�Gdd�d|�}|�|���d�|�|���d�Gdd�d||�}|�|���d�|�|���d�|�|j||||tf�Gd	d
�d
||�}|�|���d�|�|���d�|�|j||||tf�zGdd�d||�}Wntk
�rRYnX|�d
�zGdd�d||�}Wntk
�r�YnX|�d�dS)Nc@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.AcSsdSrr;rtr;r;r<r�|r�zBClassPropertiesAndMethods.test_diamond_inheritance.<locals>.A.spamNrr;r;r;r<r{src@seZdZdd�Zdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.BcSsdSrr;rtr;r;r<�boor�zAClassPropertiesAndMethods.test_diamond_inheritance.<locals>.B.boocSsdSrr;rtr;r;r<r��r�zBClassPropertiesAndMethods.test_diamond_inheritance.<locals>.B.spamN)r�r�r�rr�r;r;r;r<r~src@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.CcSsdSr"r;rtr;r;r<r�r�zAClassPropertiesAndMethods.test_diamond_inheritance.<locals>.C.booN)r�r�r�rr;r;r;r<r��sr�c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.DNr�r;r;r;r<r��sr�c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.ENr�r;r;r;r<r(�sr(c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.FNr�r;r;r;r<r_�sr_z#expected MRO order disagreement (F)c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.GNr�r;r;r;r<�G�sr�z#expected MRO order disagreement (G))rrBr�rr}r�r�)r6rrr�r�r(r_r�r;r;r<�test_diamond_inheritanceys4
z2ClassPropertiesAndMethods.test_diamond_inheritancec
Cs�Gdd�dt�}Gdd�dt�}Gdd�dt�}Gdd�d|�}Gd	d
�d
|�}Gdd�d||||�}|�|j||||||tf�dS)
Nc@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.ANr�r;r;r;r<r�src@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.BNr�r;r;r;r<r�src@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.CNr�r;r;r;r<r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.XNr�r;r;r;r<rS�srSc@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.YNr�r;r;r;r<rT�srTc@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.ZNr�r;r;r;r<rU�srU�rrBr})r6rrr�rSrTrUr;r;r<�test_ex5_from_c3_switch�sz1ClassPropertiesAndMethods.test_ex5_from_c3_switchc	Cs�Gdd�dt�}Gdd�d|�}Gdd�d|�}Gdd�d|�}Gd	d
�d
|�}Gdd�d||�}Gd
d�d|�}Gdd�d||�}|�|j|||||tf�|�|j||||tf�|�|j||||||||tf	�dS)Nc@seZdZdS)z9ClassPropertiesAndMethods.test_monotonicity.<locals>.BoatNr�r;r;r;r<�Boat�sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_monotonicity.<locals>.DayBoatNr�r;r;r;r<�DayBoat�sr�c@seZdZdS)z>ClassPropertiesAndMethods.test_monotonicity.<locals>.WheelBoatNr�r;r;r;r<�	WheelBoat�sr�c@seZdZdS)z?ClassPropertiesAndMethods.test_monotonicity.<locals>.EngineLessNr�r;r;r;r<�
EngineLess�sr�c@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.SmallMultihullNr�r;r;r;r<�SmallMultihull�sr�c@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.PedalWheelBoatNr�r;r;r;r<�PedalWheelBoat�sr�c@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.SmallCatamaranNr�r;r;r;r<�SmallCatamaran�sr�c@seZdZdS)z;ClassPropertiesAndMethods.test_monotonicity.<locals>.PedaloNr�r;r;r;r<�Pedalo�sr�r�)	r6r�r�r�r�r�r�r�r�r;r;r<�test_monotonicity�s.����z+ClassPropertiesAndMethods.test_monotonicityc
Cs�Gdd�dt�}Gdd�dt�}Gdd�dt�}Gdd�d||�}Gd	d
�d
||�}Gdd�d||�}|�|j||||||tf�dS)
Nc@seZdZdS)zAClassPropertiesAndMethods.test_consistency_with_epg.<locals>.PaneNr�r;r;r;r<�Pane�sr�c@seZdZdS)zKClassPropertiesAndMethods.test_consistency_with_epg.<locals>.ScrollingMixinNr�r;r;r;r<�ScrollingMixin�sr�c@seZdZdS)zIClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditingMixinNr�r;r;r;r<�EditingMixin�sr�c@seZdZdS)zKClassPropertiesAndMethods.test_consistency_with_epg.<locals>.ScrollablePaneNr�r;r;r;r<�ScrollablePane�sr�c@seZdZdS)zIClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditablePaneNr�r;r;r;r<�EditablePane�sr�c@seZdZdS)zSClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditableScrollablePaneNr�r;r;r;r<�EditableScrollablePane�sr�r�)r6r�r�r�r�r�r�r;r;r<�test_consistency_with_epg�s��z3ClassPropertiesAndMethods.test_consistency_with_epgcs�d}�fdd�}Gdd�dt�}Gdd�d|�}Gdd	�d	t�}|td
td||fi�|t|td||fi�|t|td|||fi�Gdd
�d
t�}Gdd�d|�}Gdd�d|�}Gdd�d||�}	Gdd�d||�}
|t|td|	|
fi�dS)NzCCannot create a consistent method resolution
order (MRO) for bases c
snz||�WnN|k
rZ}z0t��rJt|��|�sJ��dt|�|f�W5d}~XYnX��d|�dS)NzMessage %r, expected %rzExpected %s)r�check_impl_detailrsr	r�)�exc�expected�callabler7�msgrtr;r<�raises�s
�z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.raisesc@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.ANr�r;r;r;r<r�src@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.BNr�r;r;r;r<r�src@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.CNr�r;r;r;r<r��sr�zduplicate base class ArSc@seZdZdS)zCClassPropertiesAndMethods.test_mro_disagreement.<locals>.GridLayoutNr�r;r;r;r<�
GridLayout�sr�c@seZdZdS)zGClassPropertiesAndMethods.test_mro_disagreement.<locals>.HorizontalGridNr�r;r;r;r<�HorizontalGrid�sr�c@seZdZdS)zEClassPropertiesAndMethods.test_mro_disagreement.<locals>.VerticalGridNr�r;r;r;r<�VerticalGrid�sr�c@seZdZdS)z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.HVGridNr�r;r;r;r<�HVGrid�sr�c@seZdZdS)z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.VHGridNr�r;r;r;r<�VHGrid�sr�ZConfusedGrid)rr�rD)r6Zmro_err_msgr�rrr�r�r�r�r�r�r;rtr<�test_mro_disagreement�sD����z/ClassPropertiesAndMethods.test_mro_disagreementc	Cs�t�}|�|jt�|�t|�t�t�}|�||�|�|d�z
d|_Wnttfk
rdYnX|�	d�|�t�d�Gdd�dt�}|�}|�|j
i�d|_|�|jd�|�|j
ddi�dS)Nr�r�z1object() should not allow setting a foo attributerFc@seZdZdS)z:ClassPropertiesAndMethods.test_object_class.<locals>.CdictNr�r;r;r;r<�Cdictsr�re)rrBr�rD�assertNotEqualr�r��AttributeErrorr�r�rF)r6r?rRr�r3r;r;r<�test_object_class�s$

z+ClassPropertiesAndMethods.test_object_classc
	Cs�Gdd�dtj�}t�d�}|�|jtjk�|�t|d��||_|�|j|k�|�t|d��tj|_|�|jtjk�|�t|d��Gdd�dt�}|�t��|d_W5QRXGdd	�d	t	�}|�t��|d
_W5QRXGdd�dt
�}|�t��|d
_W5QRXGdd�dt�}|�t��|d_W5QRXGdd�dt�}|�t��|d_W5QRXGdd�dt
�}|�t��|d_W5QRXGdd�dt�}	|�t��|	t�_W5QRXdS)Nc@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.SubTypereN�r�r�r�r?r;r;r;r<�SubType
sr�rLr?c@seZdZdZdS)zhClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyIntr;N�r�r�r�r�r;r;r;r<�MyInt#sr�rec@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyFloatr;Nr�r;r;r;r<�MyFloat(sr���?c@seZdZdZdS)zlClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyComplexr;Nr�r;r;r;r<�	MyComplex-sr�y�?@c@seZdZdZdS)zhClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyStrr;Nr�r;r;r;r<�MyStr2sr�c@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyBytesr;Nr�r;r;r;r<�MyBytes7sr��ac@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyTupler;Nr�r;r;r;r<�MyTuple<sr�r;c@seZdZdZdS)znClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyFrozenSetr;Nr�r;r;r;r<�MyFrozenSetAsr�)rqrrr�r�r�r�r)rcr�r*r�rs�bytes�tuple�	frozenset)
r6r�rLr�r�r�r�r�r�r�r;r;r<�?test_object_class_assignment_between_heaptypes_and_nonheaptypes	s>
zYClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypesc	s�Gdd�dt�}|�}��|d���|d�Gdd�dt�}|�}��|d���|d�d|_��|jd�d|_��|jd�|`��|d�Gd	d
�d
t�}|�}��|d���|d���|d���|d�d|_d
|_d|_��|jd���|jd
���|jd�Gdd�dt�}|d�}��|d���|d���|��d�z
d|_Wntk
�rvYnX��	d�zGdd�dt�}Wnt
k
�r�YnX��	d�zGdd�dt�}Wnt
k
�r�YnX��	d�zGdd�dt�}Wnt
k
�rYnX��	d�zGdd�dt�}Wnt
k
�rNYnX��	d�zGdd�dt�}Wnt
k
�r�YnX��	d�Gd d�dt�}Gd!d�dt�}|�}d|_��|jd�Gd"d�dt�}|�}d|_��|jd�d#�G�fd$d�dt�}|�}d|_��|jd���
t�d%�t�zGd&d�dt�}Wnt
tfk
�rhYnX��	d'�G�fd(d)�d)t��Gd*d�dt�}|�}��|_��|_��|_���jd�~t�����jd%�Gd+d,�d,|�}|�}��|_��|_���jd
�~t�����jd%�Gd-d.�d.|�}	|	�}��|_��|_��|_���jd�~t�����jd%�Gd/d0�d0t�}
|
�}��|g|_���jd�d}t�����jd%�ttd1��r$Gd2d3�d3t�}|�}
tt���}td4�D]}|
|
k�q�tt���}��||�G�fd5d6�d6t�}t�d7��}|�}~W5QRX��|��d8�Gd9d:�d:t�}��t��|�`W5QRXdS);Nc@seZdZgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C0Nr�r;r;r;r<�C0Hsr�rFr�c@seZdZdgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C1r?Nr�r;r;r;r<�C1Nsr�r?rec@seZdZdddgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C3r?rRrWNr�r;r;r;r<�C3Zsr�rRrWrfrgc@s&eZdZdZdgZdd�Zdd�ZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C4zValidate name mangling�__acSs
||_dSr��Z_C4__a�r6r�r;r;r<r0ksz9ClassPropertiesAndMethods.test_slots.<locals>.C4.__init__cSs|jSr�r�rtr;r;r<r�msz4ClassPropertiesAndMethods.test_slots.<locals>.C4.getN)r�r�r��__doc__r�r0r�r;r;r;r<�C4hsr�rrr�rsz$Double underscored names not mangledc@seZdZdgZdS��/ClassPropertiesAndMethods.test_slots.<locals>.CNr�r;r;r;r<r�|sr�z[None] slots not caughtc@seZdZdgZdS)r�zfoo barNr�r;r;r;r<r��sz['foo bar'] slots not caughtc@seZdZdgZdS)r�zfoobarNr�r;r;r;r<r��sz['foo\0bar'] slots not caughtc@seZdZdgZdS)r��1Nr�r;r;r;r<r��sz['1'] slots not caughtc@seZdZdgZdS)r�r�Nr�r;r;r;r<r��sz[''] slots not caughtc@seZdZddddgZdS)r�r?Za_bZ_aZA0123456789ZNr�r;r;r;r<r��sc@seZdZdZdS�r��abcNr�r;r;r;r<r��sc@seZdZdZdSr�r�r;r;r;r<r��sr�cseZdZ�ZdSr�r�r;)�slotsr;r<r��src@seZdZed�gZdS)r��N)r�r�r��chrr�r;r;r;r<r��szhr(128)] slots not caughtcs(eZdZdZ�fdd�Z�fdd�ZdS)z5ClassPropertiesAndMethods.test_slots.<locals>.Countedrcs�jd7_dSr�r7rt��Countedr;r<r0�sz>ClassPropertiesAndMethods.test_slots.<locals>.Counted.__init__cs�jd8_dSr�r7rtr�r;r<�__del__�sz=ClassPropertiesAndMethods.test_slots.<locals>.Counted.__del__N)r�r�r�r8r0r�r;r�r;r<r��sr�c@seZdZdddgZdS)r�r?rRrWNr�r;r;r;r<r��sc@seZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.DNr�r;r;r;r<r��sr�c@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.E�eNr�r;r;r;r<r(�sr(c@seZdZddgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Fr?rRNr�r;r;r;r<r_�sr_�get_objectsc@seZdZdd�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.GcSsdS)NFr;r�r;r;r<�__eq__�sz6ClassPropertiesAndMethods.test_slots.<locals>.G.__eq__N�r�r�r�r�r;r;r;r<r��sr�r�cs(eZdZddgZdd�Z�fdd�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Hr?rRcSsd|_d|_dS�NrerfrQrtr;r;r<r0sz8ClassPropertiesAndMethods.test_slots.<locals>.H.__init__cs ��|jd���|jd�dSr�)rBr?rR)�self_rtr;r<r�sz7ClassPropertiesAndMethods.test_slots.<locals>.H.__del__N)r�r�r�r�r0r�r;rtr;r<�H�sr��stderrr�c@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Xr?Nr�r;r;r;r<rSsrS)rr�r?rBrRrWr�Z_ClassPropertiesAndMethods__ar�r�r�r�r�r�rDrs�UnicodeEncodeErrorr8r�
gc_collect�zr�r��gcr�r�r�Zcaptured_output�getvaluerc)r6r�r3r�r�r�r�rWr�r(r_�sr��gZorig_objectsr�Znew_objectsr��hrSr;)r�r6r�r<�
test_slotsFs







z$ClassPropertiesAndMethods.test_slotscCs2Gdd�dt�}|�}|�|d�|�|d�d|_|�|jddi�Gdd�dt�}|�}|�|d�|�|d�z
d|_Wntk
r�YnX|�d	�Gd
d�d||�}|�}|�|d�|�|d�d|_|�|jddi�Gdd
�d
||�}|�}|�|d�|�|d�d|_|�|jddi�dS)Nc@seZdZdgZdS)z7ClassPropertiesAndMethods.test_slots_special.<locals>.DrFNr�r;r;r;r<r�sr�rF�__weakref__r�r�c@seZdZdgZdS)z7ClassPropertiesAndMethods.test_slots_special.<locals>.Wr�Nr�r;r;r;r<�Wsr�z!shouldn't be allowed to set a.fooc@seZdZgZdS)z8ClassPropertiesAndMethods.test_slots_special.<locals>.C1Nr�r;r;r;r<r�&sr�c@seZdZgZdS)z8ClassPropertiesAndMethods.test_slots_special.<locals>.C2Nr�r;r;r;r<rN.srN)rr�r�r�rBrFr�r�)r6r�r?r�r�rNr;r;r<�test_slots_specials6

z,ClassPropertiesAndMethods.test_slots_specialc		s6G�fdd�dt�}Gdd�d�}Gdd�d||dd�}��|jdtj�|�}��|jd	���|d�d	|_��|jd	���	t
��Gd
d�d�}W5QRXGdd
�d
|dd�}��|j|jdd�d
���|jdtj�|�}��|d�d|_��|jd���	t
��Gdd�d�}W5QRXdS)NcseZdZ��fdd�Z�ZS)z;ClassPropertiesAndMethods.test_slots_special2.<locals>.Metacs��||�t��||||�Sr�)rarr�)r�r9r�	namespace�attr�r�r6r;r<r�9szCClassPropertiesAndMethods.test_slots_special2.<locals>.Meta.__new__rr;rtrr<�Meta8sr�c@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_slots_special2.<locals>.C1cSs
d|_dSr)rRrtr;r;r<r0>szBClassPropertiesAndMethods.test_slots_special2.<locals>.C1.__init__Nrvr;r;r;r<r�=sr�cs"eZdZdgZ�fdd�Z�ZS)z9ClassPropertiesAndMethods.test_slots_special2.<locals>.C2rcst���dSr��rr0rtrr;r<r0BszBClassPropertiesAndMethods.test_slots_special2.<locals>.C2.__init__)r�r�r�r�r0rr;r;rr<rN@srNr)r�r�r�c@seZdZdZdgZdS)z9ClassPropertiesAndMethods.test_slots_special2.<locals>.C3r�rN)r�r�r�rr�r;r;r;r<r�Lsr�c@seZdZdgZdS)z9ClassPropertiesAndMethods.test_slots_special2.<locals>.Q1r�Nr�r;r;r;r<�Q1Psr�r�����qc@seZdZe�ZdgZdS)z9ClassPropertiesAndMethods.test_slots_special2.<locals>.Q2r�N)r�r�r�rr�r;r;r;r<�Q2Zsr�)rDr�rFrq�MemberDescriptorTyperBrRr�rrcr�r�)	r6r�r�rNrWr�r�r�r�r;rtr<�test_slots_special26s0��z-ClassPropertiesAndMethods.test_slots_special2cCs`ddl}Gdd�d|jd�}Gdd�dt�}|�|�|�}|�||�|�t|jj|d�dS)Nrc@seZdZdZdS)z>ClassPropertiesAndMethods.test_slots_descriptor.<locals>.MyABCr?Nr�r;r;r;r<�MyABCbsr�r�c@seZdZdS)zBClassPropertiesAndMethods.test_slots_descriptor.<locals>.UnrelatedNr�r;r;r;r<�	Unrelatedesr�rg)	r��ABCMetar�registerr�rcr�r?�__set__)r6r�r�r��ur;r;r<�test_slots_descriptor^s
z/ClassPropertiesAndMethods.test_slots_descriptorcCsJGdd�dt�}Gdd�d|�}Gdd�d|�}d|_|�|jd�|�|jd�|�|jd�Gdd	�d	t�}|�}|�|d
�d|_|�|jd�dd
�|_|�|��d�dd
�|_|�t|�d�dd
�|_|�t	|�d�|�|jd�|�|d�dd�}||_
|�|jd�d|_|�|jd�dd�}||_
z
d|_Wntk
�r\YnX|�d�|�|jd�Gdd�d|�}|�}d|_|�|jd�Gdd�dt	�}	|�d|	d�d�|�|	d�dd�|�d|	d �d!�|�|	d �dd!�|�|	d �|	d�d!�Gd"d#�d#t�}
Gd$d%�d%|
d&�}|�|t�dS)'Nc@seZdZdS�z2ClassPropertiesAndMethods.test_dynamics.<locals>.DNr�r;r;r;r<r�qsr�c@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.ENr�r;r;r;r<r(ssr(c@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.FNr�r;r;r;r<r_usr_rec@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.CNr�r;r;r;r<r�}sr��foobarrfcSsdSrr;rtr;r;r<�<lambda>�r�z9ClassPropertiesAndMethods.test_dynamics.<locals>.<lambda>r�cSsdS)N�C()r;rtr;r;r<r��r�r�cSsdSr�r;rtr;r;r<r��r�r�r�cSs|dkrdSt�dS�Nr��r�rer;r;r<�	mygetattr�sz:ClassPropertiesAndMethods.test_dynamics.<locals>.mygetattrr�cSs|dkrt�t�|||�Sr�)r�rrjrkr;r;r<�	mysetattr�sz:ClassPropertiesAndMethods.test_dynamics.<locals>.mysetattrznot spamzexpected AttributeErrorc@seZdZdSr�r�r;r;r;r<r��sc@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.INr�r;r;r;r<�I�sr�r?Zaargrsc@seZdZdS)zAClassPropertiesAndMethods.test_dynamics.<locals>.dynamicmetaclassNr�r;r;r;r<�dynamicmetaclass�sr�c@seZdZdS)z:ClassPropertiesAndMethods.test_dynamics.<locals>.someclassNr�r;r;r;r<�	someclass�sr�r�)rr�rBr�r��methodr~r}ryr)�__getattr__r��newrjr�r�rDr�)r6r�r(r_r�r?r�r�rJr�r�r�r;r;r<�
test_dynamicsos\




z'ClassPropertiesAndMethods.test_dynamicscCs�zGdd�dtt�}Wntk
r*YnX|�d�zGdd�dtd�}Wntk
r`YnX|�d�Gdd�d�}zGdd�dtt��}Wntk
r�YnX|�d	�zGd
d�dt�}Wntk
r�YnX|�d�zGdd�dt�}Wntk
�rYnX|�d
�Gdd�dt�}Gdd�dt�}Gdd�dt|d�}Gdd�dt|d�}zGdd�d||�}Wntk
�r�YnX|�d�dS)Nc@seZdZdS��0ClassPropertiesAndMethods.test_errors.<locals>.CNr�r;r;r;r<r��sr�z5inheritance from both list and dict should be illegalc@seZdZdSr�r�r;r;r;r<r��sz+inheritance from non-type should be illegalc@seZdZdS)z6ClassPropertiesAndMethods.test_errors.<locals>.ClassicNr�r;r;r;r<�Classic�sr�c@seZdZdSr�r�r;r;r;r<r��sz,inheritance from CFunction should be illegalc@seZdZdZdS�r�reNr�r;r;r;r<r��sz__slots__ = 1 should be illegalc@seZdZdgZdSr�r�r;r;r;r<r��sz!__slots__ = [1] should be illegalc@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.M1Nr�r;r;r;r<r�src@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.M2Nr�r;r;r;r<r�src@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.A1Nr�r;r;r;r<�A1�srr�c@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.A2Nr�r;r;r;r<�A2�src@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.BNr�r;r;r;r<r�srz5finding the most derived metaclass should have failed)r2r|r�r�rrDr�)r6r�r�rrrrrr;r;r<�test_errors�sF




z%ClassPropertiesAndMethods.test_errorsc	s&Gdd�dt�}|�}|�|�d�|df�|�|�d�|df�|�|�d�|df�Gdd�d|�}|�}|�|�d�|df�|�|�d�|df�|�|�d�|df�|�|�|d�|df�dd�}t|�}|�|�dt�d	�td	f�|�|�d�d	�td	f�|�|jj|�|�|jj|�|�t||�jj|�|�t||�jj|�|�t||���|f�|�t||���|f�td��d�}|�	t
|�zt|dd
�Wnt
k
�r�YnX|�d�t|�}|�|ji�d	|_
|�|j
d	�|�|jdd	i�|`
|�|d�dS)
Nc@seZdZdd�Zee�ZdS)z6ClassPropertiesAndMethods.test_classmethods.<locals>.CcWs|Sr�r;�r?r;r;r<r��r�z:ClassPropertiesAndMethods.test_classmethods.<locals>.C.fooN�r�r�r�r�rH�goor;r;r;r<r��sr�rec@seZdZdS)z6ClassPropertiesAndMethods.test_classmethods.<locals>.DNr�r;r;r;r<r��sr�cSs||fSr�r;�r��argr;r;r<�fr�z6ClassPropertiesAndMethods.test_classmethods.<locals>.frr��r�z)classmethod shouldn't accept keyword argsr3)rrBrr�rHrr)�__self__rrcr�r�rFr3r�)	r6r�rWr�rJrZffrI�cmrr;r<�test_classmethods�sF
z+ClassPropertiesAndMethods.test_classmethodscCsLt�td�}td�}|�}td�D]}|�d�q"|j|�|ddd�dS�N�gettotalrefcountr�rr�)Zdelta)r�
get_attributer�rHr�r0�assertAlmostEqual)r6rr�refs_beforer�r;r;r<�%test_refleaks_in_classmethod___init__#sz?ClassPropertiesAndMethods.test_refleaks_in_classmethod___init__r�c	Cs�ddl}d}ddi}|jj||�\}}}|�||j�|�||�|�||�|��j||�\}}}|�||j�|�||�|�||�|jjd}||jf|�|�\}}	}
|�||j�|�|	|�|�|
|�Gdd�d|j�}||f|�|�\}}	}
|�||�|�|	|�|�|
|�|�t��}|�W5QRX|�t|j�d�|�t��}||���W5QRX|�t|j�d	�|�t��}|t	�W5QRXd
}
|�t|j�|
�|�t��}|�
dt	�W5QRX|�t|j�|
�dS)Nrrwr��{�	classmethc@seZdZdS)zAClassPropertiesAndMethods.test_classmethods_in_c.<locals>.SubSpamNr�r;r;r;r<�SubSpam?srzGdescriptor 'classmeth' of 'xxsubtype.spamlist' object needs an argumentzSdescriptor 'classmeth' requires a type but received a 'xxsubtype.spamlist' instancezUdescriptor 'classmeth' requires a subtype of 'xxsubtype.spamlist' but received 'list')r�r�rrBrFrcr�rs�	exceptionr2r)r6r�r?rJr3r��d1Zspam_cmZx2r��d2rr�expected_errmsgr;r;r<�test_classmethods_in_c,sR���z0ClassPropertiesAndMethods.test_classmethods_in_ccCsGdd�dt�}|�}|�|�d�d�|�|�d�d�|�|�d�|df�Gdd�d|�}|�}|�|�d�d�|�|�d�d�|�|�d�|df�|�|�|d�|df�td�}|�|ji�d|_|�|jd�|�|jddi�|`|�|d�dS)	Nc@seZdZdd�Zee�ZdS)z7ClassPropertiesAndMethods.test_staticmethods.<locals>.CcWs|Sr�r;rr;r;r<r�ar�z;ClassPropertiesAndMethods.test_staticmethods.<locals>.C.fooN)r�r�r�r�rrr;r;r;r<r�`sr�re�rec@seZdZdS)z7ClassPropertiesAndMethods.test_staticmethods.<locals>.DNr�r;r;r;r<r�gsr�r�r3)rrBrr�rrFr3r�)r6r�rWr�rJ�smr;r;r<�test_staticmethods^s$z,ClassPropertiesAndMethods.test_staticmethodscCsLt�td�}td�}|�}td�D]}|�d�q"|j|�|ddd�dSr
)rrr�rr�r0r)r6rrrr�r;r;r<�&test_refleaks_in_staticmethod___init__vsz@ClassPropertiesAndMethods.test_refleaks_in_staticmethod___init__cCs�ddl}d}ddi}|jj||�\}}}|�|d�|�||�|�||�|��j||�\}}}|�|d�|�||�|�||�dS)Nrrwr�r)r�r�Z
staticmethrB)r6r�r?rJr3r�rrr;r;r<�test_staticmethods_in_csz1ClassPropertiesAndMethods.test_staticmethods_in_ccsGdd�d����}|���d��df�|�|�d��df�|�|�d�|df�Gdd�d��}|�}|�|�d�|df�|�|�d�|df�|�|�d�|df�|�|�|d�|df�G�fdd�d�}|�|�jj�j�|�t�j������d��dS)	Nc@seZdZdd�Zee�ZdS)z1ClassPropertiesAndMethods.test_classic.<locals>.CcWs|Sr�r;rr;r;r<r��r�z5ClassPropertiesAndMethods.test_classic.<locals>.C.fooNrr;r;r;r<r��sr�rec@seZdZdS)z1ClassPropertiesAndMethods.test_classic.<locals>.DNr�r;r;r;r<r��sr�cseZdZ�jZdS)z1ClassPropertiesAndMethods.test_classic.<locals>.ENr�r;rur;r<r(�sr(�<bound method )rBrr��__func__r�r}rr	)r6rWr�rJr(r;rur<�test_classic�sz&ClassPropertiesAndMethods.test_classiccCshGdd�dt�}|�}|�|jd�|�|jd�d|_|�|jd�|�|jd�|`|�|d�dS)Nc@sHeZdZGdd�de�Zdd�Zdd�Zdd�Zd	d
�Zeeee�Z	dS)z2ClassPropertiesAndMethods.test_compattr.<locals>.Cc@s0eZdZd
dd�Zddd�Zdd�Zdd	�ZdS)zEClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attributeNcSs||_||_||_dSr�)�_computed_attribute__get�_computed_attribute__set�_computed_attribute__delete)r6r�r,�deleter;r;r<r0�szNClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__init__cSs
|�|�Sr�)r#)r6r�rDr;r;r<r�szMClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__get__cSs|�||�Sr�)r$�r6r�r�r;r;r<r��szMClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__set__cSs
|�|�Sr�)r%�r6r�r;r;r<�
__delete__�szPClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__delete__)NN)N)r�r�r�r0rr�r)r;r;r;r<�computed_attribute�s

r*cSs
d|_dSr���_C__xrtr;r;r<r0�sz;ClassPropertiesAndMethods.test_compattr.<locals>.C.__init__cSs|j}|d|_|Sr�r+r2r;r;r<Z__get_x�s
z:ClassPropertiesAndMethods.test_compattr.<locals>.C.__get_xcSs
||_dSr�r+r2r;r;r<Z__set_x�sz:ClassPropertiesAndMethods.test_compattr.<locals>.C.__set_xcSs|`dSr�r+rtr;r;r<Z
__delete_x�sz=ClassPropertiesAndMethods.test_compattr.<locals>.C.__delete_xN)
r�r�r�rr*r0Z	_C__get_xZ	_C__set_xZ_C__delete_xr3r;r;r;r<r��sr�rrer��r3)rrBr3r�r�r;r;r<�
test_compattr�sz'ClassPropertiesAndMethods.test_compattrcCshGdd�dt�}|�}|�|jd�|�|j|�Gdd�d|�}|�}|�|jd�|�|j|�dS)Nc@seZdZdd�Zdd�ZdS)z2ClassPropertiesAndMethods.test_newslots.<locals>.CcSst�|�}d|_|Sr�)r2r�r�)r�r6r;r;r<r��s
z:ClassPropertiesAndMethods.test_newslots.<locals>.C.__new__cSs|jd|_dS)Nrf�r�rtr;r;r<r0�sz;ClassPropertiesAndMethods.test_newslots.<locals>.C.__init__N�r�r�r�r�r0r;r;r;r<r��sr�rgc@seZdZdS)z2ClassPropertiesAndMethods.test_newslots.<locals>.DNr�r;r;r;r<r��sr�)r2rBr�r�)r6r�r?r�rRr;r;r<�
test_newslots�sz'ClassPropertiesAndMethods.test_newslotscCsz|�ttj�|�ttjd�|�ttjt�|�ttjt�Gdd�dt�}|�t|�Gdd�dt�}|�t|�dS)Nr�c@seZdZejZdS�z1ClassPropertiesAndMethods.test_bad_new.<locals>.CN)r�r�r�r2r�r;r;r;r<r��sr�c@seZdZejZdSr2)r�r�r�rr�r;r;r;r<r��s)rcr�rr�r2r�r;r;r<�test_bad_new�sz&ClassPropertiesAndMethods.test_bad_newcCs4Gdd�dt�}t�|�|�ttj|d�t�|��|�ttj|�d�Gdd�dt�}t�|�t�|d�t�|d��|�ttj|d�d�Gdd�dt�}t�|�|�ttj|d�t�|d��t�|d�d�Gdd�dt�}t�|�|�ttj|d�t�|d��|�ttj|d�d�dS)Nc@seZdZdS)�4ClassPropertiesAndMethods.test_object_new.<locals>.ANr�r;r;r;r<r�srrrc@seZdZdd�ZdS)r4cSs
||_dSr�r/�r6r�r;r;r<r0�s�=ClassPropertiesAndMethods.test_object_new.<locals>.A.__init__Nrvr;r;r;r<r�srgc@seZdZdd�ZdS)r4cSs
t�|�Sr��rr��r�r�r;r;r<r��s�<ClassPropertiesAndMethods.test_object_new.<locals>.A.__new__Nrr;r;r;r<r�sc@seZdZdd�Zdd�ZdS)r4cSs
t�|�Sr�r7r8r;r;r<r��sr9cSs
||_dSr�r/r5r;r;r<r0�sr6Nr0r;r;r;r<r�s)rr�rcr�r0�r6rr;r;r<�test_object_new�s(



z)ClassPropertiesAndMethods.test_object_newc	Cs�Gdd�dt�}|�t|�Gdd�d|�}t���t�dt�|d�}W5QRX|�|jd�|�|j	|�|`
|�t|�|`
t���t�dt�|d�}W5QRX|�|jd�|�|j	|�dS)Nc@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_restored_object_new.<locals>.Ac_st�dSr���AssertionError)r�r7r8r;r;r<r�	szEClassPropertiesAndMethods.test_restored_object_new.<locals>.A.__new__Nrr;r;r;r<rsrc@seZdZejZdd�ZdS)z=ClassPropertiesAndMethods.test_restored_object_new.<locals>.BcSs
||_dSr�r/r5r;r;r<r0szFClassPropertiesAndMethods.test_restored_object_new.<locals>.B.__init__N)r�r�r�rr�r0r;r;r;r<rsr�errorrg)rrcr=�warnings�catch_warnings�simplefilter�DeprecationWarningrBr�r�r�)r6rrrRr;r;r<�test_restored_object_news 

z2ClassPropertiesAndMethods.test_restored_object_newc		CsJGdd�dt�}Gdd�d|�}Gdd�d|�}Gdd�d||�}|�|��|tg�|�|j|tf�|�|��||tg�|�|j||tf�|�|��||tg�|�|j||tf�|�|��||||tg�|�|j||||tf�|�|���d�Gd	d
�d
t�}Gdd�d|||||d
�}|�|jt|||||f�|�|���d�z:Gdd�dt�}Gdd�dt|d
�}t�|�}d|d<Wntk
�r�YnX|�d�z(Gdd�dt�}Gdd�dt|d
�}Wntk
�r�YnX|�d�z(Gdd�dt�}Gdd�dt|d
�}Wntk
�r:YnX|�d�dS)Nc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.AcSsdSrr;rtr;r;r<r!r�z2ClassPropertiesAndMethods.test_altmro.<locals>.A.fN�r�r�r�rr;r;r;r<r src@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.BNr�r;r;r;r<r"src@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.CcSsdSr"r;rtr;r;r<r%r�z2ClassPropertiesAndMethods.test_altmro.<locals>.C.fNrDr;r;r;r<r�$sr�c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.DNr�r;r;r;r<r�&sr�c@seZdZdd�ZdS)z?ClassPropertiesAndMethods.test_altmro.<locals>.PerverseMetaTypecSst�|�}|��|Sr�)rD�mro�reverse)r��Lr;r;r<rE3s
zCClassPropertiesAndMethods.test_altmro.<locals>.PerverseMetaType.mroN�r�r�r�rEr;r;r;r<�PerverseMetaType2srIc@seZdZdS�z0ClassPropertiesAndMethods.test_altmro.<locals>.XNr�r;r;r;r<rS7srSr�c@seZdZdd�ZdS)�9ClassPropertiesAndMethods.test_altmro.<locals>._metaclasscSs
|ttgSr�)r|rrtr;r;r<rE>s�=ClassPropertiesAndMethods.test_altmro.<locals>._metaclass.mroNrHr;r;r;r<r�=sr�c@seZdZdSrJr�r;r;r;r<rS@srsrrzdevious mro() return not caughtc@seZdZdd�ZdS)rKcSsdgSr�r;rtr;r;r<rEQsrLNrHr;r;r;r<r�Psc@seZdZdSrJr�r;r;r;r<rSSsz!non-class mro() return not caughtc@seZdZdd�ZdS)rKcSsdSr�r;rtr;r;r<rE\srLNrHr;r;r;r<r�[sc@seZdZdSrJr�r;r;r;r<rS^sz$non-sequence mro() return not caught)	rrBrEr}rrDr�r�r�)	r6rrr�r�rIrSr�r3r;r;r<�test_altmrosJ


z%ClassPropertiesAndMethods.test_altmrocs�Gdd�dt��G�fdd�d��}|�}|�|jd�d|_|�|jd�|`|�|jd�|�|dd	�d
|d<|�|jd�|d=|�|jd�|�|dd
�dtdd
�f�d|dd
�<|�|jtdd
�df�|dd
�=|�|jtdd
��dS)Nc@seZdZdZdS)z5ClassPropertiesAndMethods.test_overloading.<locals>.Bz<Intermediate class because object doesn't have a __setattr__N�r�r�r�r�r;r;r;r<rhsrcsDeZdZdd�Z�fdd�Z�fdd�Zdd�Zd	d
�Zdd�Zd
S)z5ClassPropertiesAndMethods.test_overloading.<locals>.CcSs|dkrd|fSt�dS)Nr�rEr�rer;r;r<r�lszAClassPropertiesAndMethods.test_overloading.<locals>.C.__getattr__cs&|dkr||f|_n��|||�SdS�Nr�)r
rjrk�rr;r<rjqszAClassPropertiesAndMethods.test_overloading.<locals>.C.__setattr__cs |dkr||_n��||�SdSrO)rlrmrerPr;r<rmvszAClassPropertiesAndMethods.test_overloading.<locals>.C.__delattr__cSsd|fS)N�getitemr;r�r;r;r<rU|szAClassPropertiesAndMethods.test_overloading.<locals>.C.__getitem__cSs||f|_dSr�)�setitem)r6r�r�r;r;r<ra~szAClassPropertiesAndMethods.test_overloading.<locals>.C.__setitem__cSs
||_dSr�)�delitemr�r;r;r<�__delitem__�szAClassPropertiesAndMethods.test_overloading.<locals>.C.__delitem__N)	r�r�r�r�rjrmrUrarTr;rPr;r<r�ksr�ror�)r�r�r�)rQr��)r�rUrr�rQ)rrBr�r
rlrRrSrXr�r;rPr<�test_overloadinges$
z*ClassPropertiesAndMethods.test_overloadingcs�Gdd�dt���d��|����d�G��fdd�d��}|d�}|�|��d�|�|��d�|�|��d�G�fdd�dt�}|�|�jj�j�|�t�j��d����	d	��dS)
Nc@seZdZdd�Zdd�ZdS)z1ClassPropertiesAndMethods.test_methods.<locals>.CcSs
||_dSr��r3r2r;r;r<r0�sz:ClassPropertiesAndMethods.test_methods.<locals>.C.__init__cSs|jSr�rWrtr;r;r<r��sz5ClassPropertiesAndMethods.test_methods.<locals>.C.fooN)r�r�r�r0r�r;r;r;r<r��sr�recseZdZ�jZ�jZdS)z1ClassPropertiesAndMethods.test_methods.<locals>.DN)r�r�r�r�rrr;�r��c1r;r<r��sr�rfcseZdZ�jZdS)z1ClassPropertiesAndMethods.test_methods.<locals>.ENr�r;rur;r<r(�sr(r )
rrBr�rrr!r�r}rr	)r6r�rr(r;rXr<�test_methods�sz&ClassPropertiesAndMethods.test_methodsz)testing error message from implementationc	Cs�tj}d}|�t��}|�W5QRX|�|jjd|�d}|�t��}|d�W5QRX|�|jjd|�|�t��}|�d�W5QRX|�|jjd|�dS)Nz2descriptor 'add' of 'set' object needs an argumentrzBdescriptor 'add' for 'set' objects doesn't apply to a 'int' object)r,rrcr�rBrr7r)r6Zset_addrrr;r;r<�test_methods_in_c�sz+ClassPropertiesAndMethods.test_methods_in_ccs�dd�}dd�}dd�}dd�}d	d
�}dd�}d
d�}d=dd�}dd�}	dd�}
�fdd�}�fdd�}dd�}
dd�}dt|t�ifdt|t�ifdt|t�||d �fd!tj|t�ifd"|	|t�ifd#||td$�ifd%|
|td&�ifd'||t�d(|
ifd(||
t�d'|ifd)t|t�ifd*t|t�ifd+tj	|t�ifd,tj
|t�ifd,t|t�ifd-tj|t�ifd.t
|t�ifd/t|t�ifg}G��fd0d1�d1t�}G�fd2d3�d3t�}Gd4d5�d5t��G�fd6d7�d7t�}|D�]\}}}�}Gd8d9�d9|�}|��D]\}}t|||��qt|||�||��g�Gd:d9�d9|�}|��D]\}}t|||��qJt||||��||�����d;g|�Gd<d9�d9|�}|��D]\}}t|||��q�t|||�����||���q�dS)>Nc	Ss|�W5QRXdSr�r;)�managerr;r;r<�run_context�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.run_contextcSs|Sr�r;rtr;r;r<�iden�szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.idencSsdS)Nshellor;rtr;r;r<rx�szCClassPropertiesAndMethods.test_special_method_lookup.<locals>.hellocSsgSr�r;rtr;r;r<�	empty_seq�szGClassPropertiesAndMethods.test_special_method_lookup.<locals>.empty_seqcSsdSr�r;rtr;r;r<�zero�szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.zerocSsdS)N��?r;rtr;r;r<�complex_num�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.complex_numcSst�dSr�)�
StopIterationrtr;r;r<r��szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.stopcSsdS)NTr;)r6�thingr;r;r<�return_true�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.return_truecSs
tt|�Sr�)r�r)�r�r;r;r<�
do_isinstance�szKClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_isinstancecSs
tt|�Sr�)r�r)rfr;r;r<�
do_issubclass�szKClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_issubclasscs*Gdd�d|jt�}��|�dd�dS)Nc@seZdZdS)z^ClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_dict_missing.<locals>.DictSubNr�r;r;r;r<�DictSub�sri�hirj)r�r|rB)Zcheckerrirtr;r<�do_dict_missing�szMClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_dict_missingcs��|d�dS)Nrjrj)rB)r�r�rtr;r<�some_number�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.some_numbercWsdSr�r;�r7r;r;r<�swallow�r�zEClassPropertiesAndMethods.test_special_method_lookup.<locals>.swallowcSsdS�Nrxr;)r6�specr;r;r<�format_impl�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.format_impl�	__bytes__�__reversed__�__length_hint__)r{�__next__�
__sizeof__�__instancecheck__�__missing__r�__subclasscheck__�rG�	__enter__�__exit__�__complex__�
__format__�	__floor__�	__trunc__�__ceil__�__dir__�	__round__cs(eZdZ�fdd�Z�f�fdd�	ZdS)zEClassPropertiesAndMethods.test_special_method_lookup.<locals>.CheckercSs|�d�|��dS)Nz__getattr__ called with {0})r��format�r6r��testr;r;r<r�szQClassPropertiesAndMethods.test_special_method_lookup.<locals>.Checker.__getattr__cs$|�kr|�d�|��t�||�S)Nz __getattribute__ called with {0})r�r�rrgr�)�okr;r<rgszVClassPropertiesAndMethods.test_special_method_lookup.<locals>.Checker.__getattribute__N�r�r�r�r�rgr;)r�r6r;r<�Checkersr�cs eZdZdd�Z�fdd�ZdS)zJClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescrcSs
||_dSr�)�impl)r6r�r;r;r<r0szSClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescr.__init__cs��d�|j�||�Sr�)ryr�r�r6r��owner��recordr;r<r
s
zRClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescr.__get__N)r�r�r�r0rr;r�r;r<�SpecialDescrsr�c@seZdZdS)zIClassPropertiesAndMethods.test_special_method_lookup.<locals>.MyExceptionNr�r;r;r;r<�MyException
sr�cseZdZ�fdd�ZdS)zFClassPropertiesAndMethods.test_special_method_lookup.<locals>.ErrDescrcs��dSr�r;r��r�r;r<rszNClassPropertiesAndMethods.test_special_method_lookup.<locals>.ErrDescr.__get__N�r�r�r�rr;r�r;r<�ErrDescrsr�c@seZdZdS�z?ClassPropertiesAndMethods.test_special_method_lookup.<locals>.XNr�r;r;r;r<rSsrSc@seZdZdSr�r�r;r;r;r<rSsrec@seZdZdSr�r�r;r;r;r<rS$s)N)r�r,�reversedr2r��	getsizeofr�r��math�floor�truncr)�ceil�dir�roundr�	Exceptionr3r
rBrc)r6r]r^rxr_r`rbr�rergrhrkrlrnrqZspecialsr�r�r�r9ZrunnerZ	meth_impl�envrSr�r�r;)r�r�r�r6r<�test_special_method_lookup�s|

����

z4ClassPropertiesAndMethods.test_special_method_lookupc
Cs�Gdd�dt�}|�}|�}|�|�|�t|�t|��t|�t|�|�||�|�||k�|�||k�|�||k�|�t|��	d�d�|�t|�t
|��|�d|�td�D]}|�
||�q�|�d|�Gdd�dt�}|�}|�}|�|�|�t|�t|��t|�t|�|�||�|�||�|�||k�|�||k�|�t|��	d	�d�|�t|�t
|��|�d|�td�D]}|�
||��q�|�d|�Gd
d�dt�}|d�}	|d�}
|d�}|�|	�|�|
�|�t|	�td��|�|	|	�|�|	|
�|�|	|	k�|�|	|
�|�|	|
k�|�|	|
k�|�|
|	k�|�|
|	k�|�t|	�d
�|�t
|	�d�|td��}|�d|�td�D]}|�
||��q�|�d|�dS)Nc@seZdZdd�ZdS)z2ClassPropertiesAndMethods.test_specials.<locals>.CcSs$d|krdkrnn|St�dS�Nrr���
IndexErrorr�r;r;r<rU1sz>ClassPropertiesAndMethods.test_specials.<locals>.C.__getitem__Nr�r;r;r;r<r�0sr�zC object at rr�r�c@seZdZdd�ZdS)z2ClassPropertiesAndMethods.test_specials.<locals>.DcSs$d|krdkrnn|St�dSr�r�r�r;r;r<rUHsz>ClassPropertiesAndMethods.test_specials.<locals>.D.__getitem__Nr�r;r;r;r<r�Gsr�zD object at c@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)z6ClassPropertiesAndMethods.test_specials.<locals>.ProxycSs
||_dSr�rWr2r;r;r<r0_sz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__init__cSs
|jSr�rWrtr;r;r<r�asz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__bool__cSs
t|j�Sr�)�hashr3rtr;r;r<�__hash__csz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__hash__cSs
|j|kSr�rWr�r;r;r<r�esz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__eq__cSs
|j|kSr�rWr�r;r;r<�__ne__gsz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__ne__cSs
|j|kSr�rWr�r;r;r<�__ge__isz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__ge__cSs
|j|kSr�rWr�r;r;r<�__gt__ksz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__gt__cSs
|j|kSr�rWr�r;r;r<�__le__msz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__le__cSs
|j|kSr�rWr�r;r;r<�__lt__osz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__lt__cSs
d|jS)NzProxy:%srWrtr;r;r<r�qsz>ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__str__cSs
d|jS)Nz	Proxy(%r)rWrtr;r;r<r~ssz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__repr__cSs
||jkSr�rWr�r;r;r<riuszCClassPropertiesAndMethods.test_specials.<locals>.Proxy.__contains__N)r�r�r�r0r�r�r�r�r�r�r�r�r�r~rir;r;r;r<�Proxy^sr�rezProxy:0zProxy(0))rr�r��idr�rBr�ZassertGreaterEqualrs�findr}�assertNotInr�ra)
r6r�rY�c2r�r�rrr�Zp0Zp1Zp_1Zp10r;r;r<�
test_specials+sp
z'ClassPropertiesAndMethods.test_specialsc

Cs�ddl}Gdd�dt�}|�}|�|�}|�|�|�~t��|�|�d�~Gdd�dt�}|�}z|�|�Wn2tk
r�}z|�dt|��W5d}~XYnX|�	d�Gdd	�d	t�}|�}	|�|	�}|�|�|	�~	t��|�|�d�~dS)
Nrc@seZdZdS)z2ClassPropertiesAndMethods.test_weakrefs.<locals>.CNr�r;r;r;r<r��sr�c@seZdZdgZdS)z7ClassPropertiesAndMethods.test_weakrefs.<locals>.NoWeakr�Nr�r;r;r;r<�NoWeak�sr�zweak referencez!weakref.ref(no) should be illegalc@seZdZddgZdS)z5ClassPropertiesAndMethods.test_weakrefs.<locals>.Weakr�r�Nr�r;r;r;r<�Weak�sr�)
�weakrefr�refrBrr�r�rarsr�)
r6r�r�rW�rr��nor�r�Zyesr;r;r<�
test_weakrefs�s0
"

z'ClassPropertiesAndMethods.test_weakrefsc
CsGdd�dt�}|�}|�|d�d|_|�|jd�|�|jd�|`|�|d�|�|d�|j�|d�|�|j�|�d�|j�|�|�|d�|jd}|�	|t
�t|�}|�d|�|�d|�|�d	|�|�d
|�|�|j
d�|�|j|jd�|�|j|jd
�|�|j|jd�dD]t}zt||d�WnNtk
�r�}z.t|��d�dk�r�|�d|t|�f�W5d}~XYnX|�d|��q6d|_
|�|j
d�Gdd�dt�}|�}z|D]}	t|	��q�Wntk
�rYnX|�d�dS)Nc@s4eZdZdd�Zdd�Zdd�Zeeeedd�Zd	S)
z4ClassPropertiesAndMethods.test_properties.<locals>.CcSs|jSr�r+rtr;r;r<�getx�sz9ClassPropertiesAndMethods.test_properties.<locals>.C.getxcSs
||_dSr�r+r�r;r;r<�setx�sz9ClassPropertiesAndMethods.test_properties.<locals>.C.setxcSs|`dSr�r+rtr;r;r<�delx�sz9ClassPropertiesAndMethods.test_properties.<locals>.C.delx�I'm the x property.��docN)r�r�r�r�r�r�r)r3r;r;r;r<r��sr�r3r�r,r�r��fget�fset�fdelr�r�r�r�)r�r�r��readonlyrzQwhen setting readonly attr %r on a property, got unexpected AttributeError msg %rzIexpected AttributeError from trying to set readonly %r attr on a propertyc@seZdZedd��ZdS)z4ClassPropertiesAndMethods.test_properties.<locals>.DcSsddSr�r;)r�r;r;r<r��r�z=ClassPropertiesAndMethods.test_properties.<locals>.D.<lambda>N)r�r�r�r)rUr;r;r;r<r��sr�z,expected ZeroDivisionError from bad property)rr�r3rBr,r�rr)rFr�r)r�rar�r�r�r�r�r
r�rsr�r��ZeroDivisionError)
r6r�r?�raw�attrsr�r�r�rJr�r;r;r<�test_properties�sZ

��
z)ClassPropertiesAndMethods.test_propertiesrfz)Docstrings are omitted with -O2 and abovecsG�fdd�dt�}dS)NcsJeZdZdd�Zdd�Zee�Z��ejd�eed�Z	��e	jd�dS)z?ClassPropertiesAndMethods.test_properties_doc_attrib.<locals>.EcSsdS)�
getter methodrr;rtr;r;r<�getter�szFClassPropertiesAndMethods.test_properties_doc_attrib.<locals>.E.gettercSsdS)z
setter methodNr;)r�r�r;r;r<�setter�szFClassPropertiesAndMethods.test_properties_doc_attrib.<locals>.E.setterr�)r�N)
r�r�r�r�r�r)ZproprBr�Zprop2r;rtr;r<r(�s
r(�r)r6r(r;rtr<�test_properties_doc_attrib�sz4ClassPropertiesAndMethods.test_properties_doc_attribcs:zddl�Wntk
r YnXG�fdd�dt�}dS)NrcseZdZe�j�ZdS)z>ClassPropertiesAndMethods.test_testcapi_no_segfault.<locals>.XN)r�r�r�r)Ztest_with_docstring�pr;��	_testcapir;r<rS	srS)r��ImportErrorr�r6rSr;r�r<�test_testcapi_no_segfault�s
z3ClassPropertiesAndMethods.test_testcapi_no_segfaultcsGdd�dt����}|��jjd�|�|d�d|_|�|d�|�|jd�|�|jd�|`|�|d�|�|d�G�fdd	�d	��}|�}d
|_|�|jd
�|`|`Gdd�dt����}d|_|�|jd�|`G�fd
d�d��}|�}d|_|�|jd�|`dS)Nc@s@eZdZedd�Zejdd��Zejdd��Zejdd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.Crxr�cSs|jSr���_foortr;r;r<r�	sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.C.foocSst|�|_dSr��r'r�r�r;r;r<r�	scSs|`dSr�r�rtr;r;r<r�	sN)r�r�r�r)r�r�r��deleterr;r;r;r<r�	s


r�rxr�i���r�r�cseZdZ�jjdd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.DcSs"z|`Wntk
rYnXdSr�)r�r�rtr;r;r<r�	sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.D.fooN)r�r�r�r�r�r;rur;r<r�	sr�r�c@sDeZdZedd��Zejdd��Zejdd��Zejddd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.EcSs|jSr�r�rtr;r;r<r�*	sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.E.foocSst�dSr�)�RuntimeErrorr�r;r;r<r�-	scSst|�|_dSr�r�r�r;r;r<r�0	sNcSs|`dSr�r�r�r;r;r<r�3	s)N)r�r�r�r)r�r�r�r;r;r;r<r()	s


r(cs*eZdZ�jjdd��Zejdd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.FcSs|`dSr�r�rtr;r;r<r�=	sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.F.foocSstd|�|_dSr�)�maxr�r�r;r;r<r�@	sN)r�r�r�r�r�r�r;)r(r;r<r_<	s
r_���r)rrBr�r�r�r�r�)r6rWr�rJr�r_rr;)r�r(r<�test_properties_plus	s6z.ClassPropertiesAndMethods.test_properties_plusc	Cs�t�}|�|i�ti�}|�|i�tddd��}|�|ddd��|�|tt|�����|�|tt|�����tddd��}|�|tddd��|�|tf|��|�|tddidd��|�|tdgdd	��|�|td
dgf|��|�|tf|��ddd
ddgdfD]f}zt|�WnDtk
�r:Yn>tk
�rh|dk�rVn|�d|�YnX|�d|��qztii�Wntk
�r�YnX|�d�Gdd�d�}zt|��Wntk
�r�YnX|�d�dd�|_dd�|_	t|��}|�||j�Gdd�d�}t|dd�|dd�|dd�|dd�g�}|�|ddd��tt
td�tdd ���}|�|td!d"�td�D���d#gd$gfD]8}zt|�Wntk
�r�YnX|�d%|��q�dS)&NrfrR)rer?re)�one�twor�)r�)r�rf)r�)r�r�)r�r�ry�0�rzno TypeError from dict(%r)zno TypeError from dict({}, {})c@seZdZdddd�ZdS)zAClassPropertiesAndMethods.test_dict_constructors.<locals>.Mappingrfrjra)rergr?N)r�r�r�r|r;r;r;r<�Mappingq	sr�z*no TypeError from dict(incomplete mapping)cSst|j���Sr�)r2r|rxrtr;r;r<r�|	r�zBClassPropertiesAndMethods.test_dict_constructors.<locals>.<lambda>cSs
|j|Sr�)r|r�r;r;r<r�}	r�c@seZdZdd�Zdd�ZdS)zJClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntrycSs||_||_dSr�)�first�last)r6r�r�r;r;r<r0�	szSClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntry.__init__cSst|j|jg�Sr�)rzr�r�rtr;r;r<r{�	szSClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntry.__iter__N)r�r�r�r0r{r;r;r;r<�AddressBookEntry�	sr��TimZWarsaw�BarryZPeters)r�r�rjrrcSsg|]}||df�qSrr;��.0r�r;r;r<�
<listcomp>�	szDClassPropertiesAndMethods.test_dict_constructors.<locals>.<listcomp>)Ztooshort)Ztoo�longzby 1zno ValueError from dict(%r))r|rBr2r3rzr��
ValueErrorr�rxrU�zipr�)r6rJZbadargr�r�Zbadr;r;r<�test_dict_constructorsH	sn






�z0ClassPropertiesAndMethods.test_dict_constructorscs4d}|�t�ddg�~dddddgddd	ddit|jfD]}t|�q:d
d�}Gdd
�d
t�}ddg}|�|t|��|�|�}|�|t|��|�d|_dd�|_|�|t|��|ddg�Gdd�d|�}ddg|}|�|t|��|�|�}	|�|t|	��|�d|	_dd�|	_|�|t|	��|ddg�Gdd�dtt	��}
|
d�}d|_
d|_d d!d"d#d$g��fd%d&�t|�D�}|�|d'd(g�Gd)d*�d*|
�}
|
d+�}d|_
d|_|�|jd,�zt|�Wnt
k
�r�YnX|�tt�tt��G�fd-d.�d.t��G�fd/d
�d
t�}t|��dS)0Nr��junkr6rfy@g@�2�2�rfcSsdd�|D�S)NcSsg|]}|�d�s|�qS)r)r	)r�r�r;r;r<r��	s
zKClassPropertiesAndMethods.test_dir.<locals>.interesting.<locals>.<listcomp>r;)�stringsr;r;r<�interesting�	sz7ClassPropertiesAndMethods.test_dir.<locals>.interestingc@seZdZdZdd�ZdS)�-ClassPropertiesAndMethods.test_dir.<locals>.CrecSsdSr�r;rtr;r;r<�Cmethod�	r�z5ClassPropertiesAndMethods.test_dir.<locals>.C.CmethodN)r�r�r��Cdatar�r;r;r;r<r��	sr�r�r�cSsdSr�r;rtr;r;r<r��	r�z4ClassPropertiesAndMethods.test_dir.<locals>.<lambda>�cdata�cmethodc@seZdZdZdd�ZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.ArecSsdSr�r;rtr;r;r<�Amethod�	r�z5ClassPropertiesAndMethods.test_dir.<locals>.A.AmethodN)r�r�r��Adatar�r;r;r;r<r�	srr�r�r�cSsdS)Nrgr;rtr;r;r<r��	r��adata�amethodc@seZdZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.MNr�r;r;r;r<�M�	sr�rLrer�r��__package__�
__loader__�__spec__csg|]}|�kr|�qSr;r;�r�r3)�default_attributesr;r<r��	sz6ClassPropertiesAndMethods.test_dir.<locals>.<listcomp>r?rRc@seZdZdd�Zee�ZdS)z.ClassPropertiesAndMethods.test_dir.<locals>.M2cSsdS)N�Not a dict!r;rtr;r;r<�getdict�	sz6ClassPropertiesAndMethods.test_dir.<locals>.M2.getdictN)r�r�r�r�r)rFr;r;r;r<r�	srZm2r�cs<eZdZdd�Zdd�Z�fdd�Zdd�Z�fd	d
�ZdS)z3ClassPropertiesAndMethods.test_dir.<locals>.WrappercSs
||_dSr���
_Wrapper__objr(r;r;r<r0�	sz<ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__init__cSsdt|j�S)NzWrapper(%s))r}rrtr;r;r<r~�	sz<ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__repr__cs�|j|�Sr�rr���Wrapperr;r<rU�	sz?ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__getitem__cSs
t|j�Sr�)r�rrtr;r;r<r>�	sz;ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__len__cs�t|j|��Sr�)rErrerr;r<r��	sz?ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__getattr__N)r�r�r�r0r~rUr>r�r;rr;r<r�	s
rcs eZdZ�fdd�Zee�ZdS)r�cs�t|��Sr�)rDrtrr;r<Z
__getclass�	sz8ClassPropertiesAndMethods.test_dir.<locals>.C.__getclassN)r�r�r�Z_C__getclassr)r�r;rr;r<r��	s)rBr�rD�test_dirrr�r�r�r�r�rRr?rFr�r��Ellipsis)r6r�rr�r�ZcstuffrWrZastuffr?r�Z	minstance�namesrZ
m2instancer;)rr�r<r�	sZ&


�z"ClassPropertiesAndMethods.test_dirc	s�Gdd�dt�}|�|��d�d�G�fdd�d|��|����d�d�Gd	d
�d
|�}t|�|_|�|��d�d�G�fd
d�d|���|����d�d�G�fdd�dt��G��fdd�d���|����d�d�Gdd�d��}�|�|_|�|��d�d�zt�d�Wntk
�r4YnX|�d�zt�|��Wntk
�rfYnX|�d�zt���d�Wntk
�r�YnX|�d�zt���|��Wntk
�r�YnX|�d �Gd!d"�d"t�}Gd#d$�d$|�}|�}|�|j	d%�|�t||�j	d�Gd&d'�d't�}G�fd(d)�d)|��|���
�|j�|�t��t|dd*�W5QRXdS)+Nc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.AcSsd|S)NzA(%r)r;�r6r?r;r;r<rI�	sz5ClassPropertiesAndMethods.test_supers.<locals>.A.methNrr;r;r;r<r�	srrezA(1)cs&eZdZ��fdd�Zdd�Z�ZS)z0ClassPropertiesAndMethods.test_supers.<locals>.Bcst�|�|_dSr�)rr!rt)rr�r;r<r0
sz9ClassPropertiesAndMethods.test_supers.<locals>.B.__init__cSsd||j�|�S)NzB(%r)r rr;r;r<rI
sz5ClassPropertiesAndMethods.test_supers.<locals>.B.meth)r�r�r�r0rIrr;rPrr<r
srrfzB(2)A(2)c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.CcSsd||j�|�S)NzC(%r)r#rr;r;r<rI
sz5ClassPropertiesAndMethods.test_supers.<locals>.C.methNrr;r;r;r<r�

sr�rgzC(3)A(3)cseZdZ��fdd�Z�ZS)z0ClassPropertiesAndMethods.test_supers.<locals>.Dcsd|t�|��|�S)NzD(%r))rrIr)r�r�r;r<rI
sz5ClassPropertiesAndMethods.test_supers.<locals>.D.meth)r�r�r�rIrr;�r�rr<r�
sr�rjzD(4)C(4)B(4)A(4)cseZdZ��fdd�Z�ZS)z6ClassPropertiesAndMethods.test_supers.<locals>.mysupercst�|�j|�Sr�r�r9)r��mysuperr;r<r0
sz?ClassPropertiesAndMethods.test_supers.<locals>.mysuper.__init__)r�r�r�r0rr;)r	rr<r	
sr	cseZdZ��fdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.Ecsd|��|��|�S)NzE(%r))rIr�r(r	r;r<rI
sz5ClassPropertiesAndMethods.test_supers.<locals>.E.methNrr;r
r;r<r(
sr(rrzE(5)D(5)C(5)B(5)A(5)c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.FcSs |j}d||jjf|�|�S)Nz	F(%r)[%s])�	_F__superr�r�rI)r6r?r�r;r;r<rI$
sz5ClassPropertiesAndMethods.test_supers.<locals>.F.methNrr;r;r;r<r_#
sr_rsz!F(6)[mysuper]E(6)D(6)C(6)B(6)A(6)r�zshouldn't allow super(D, 42)zshouldn't allow super(D, C())r�z$shouldn't allow super(D).__get__(12)z%shouldn't allow super(D).__get__(C())c@seZdZdd�Zee�ZdS)z5ClassPropertiesAndMethods.test_supers.<locals>.DDbasecSsdSrr;rtr;r;r<r�M
r�z:ClassPropertiesAndMethods.test_supers.<locals>.DDbase.getxN�r�r�r�r�r)r3r;r;r;r<�DDbaseL
sr
c@seZdZdd�Zee�ZdS)z4ClassPropertiesAndMethods.test_supers.<locals>.DDsubcSsdSror;rtr;r;r<r�Q
r�z9ClassPropertiesAndMethods.test_supers.<locals>.DDsub.getxNrr;r;r;r<�DDsubP
srrxc@seZdZedd��ZdS)z3ClassPropertiesAndMethods.test_supers.<locals>.BasecSsdSrOr;rtr;r;r<r�\
r�z<ClassPropertiesAndMethods.test_supers.<locals>.Base.<lambda>N)r�r�r�r)�aPropr;r;r;r<�Base[
srcs"eZdZe��fdd��Z�ZS)z2ClassPropertiesAndMethods.test_supers.<locals>.Subcst�|�jSr�)rr)�klass)�Subr�r;r<r�_
sz7ClassPropertiesAndMethods.test_supers.<locals>.Sub.test)r�r�r�rHr�rr;)rrr<r^
srr	)
rrBrIrr$rr�r�rr3r�rrc)r6rr�r_r
r�ddrr)rr�r(rr	r<�test_supers�	sZ





z%ClassPropertiesAndMethods.test_superscsG�fdd�dt��|�t�d�d�d�|�t�d�d�d��d�}|�|d�|�t|�d�|�t|�jt�|�t|�td��|�|
jt�|�|d	?jt�|�|d	>jt�|��d	�d
>jt�|��d	�d
?jt�G�fdd�dt��|�t�d
�d�d�|�td�d��d��d�}|�|d�|�t|�d�|�t|�td��|�t|�jt�|�|
jt�|�|jt�|��d	�jt�|�|d	?jt�|�|d	>jt�|�|d	jt�|�|djt�|�|djt�|�|djt�|�d|jt�|�|d	Bjt�|�|d	Ajt�|�|d@jt�|��d	�d
>jt�|��d	�d
?jt�|�t�d	��jt�Gdd�dt�}|d�}|�|d	jt�|�d	|jt�|d�}|�|ji�|�t|�d�Gdd�dt	�}|�t|d��d�|d�}|�|d�|�t	|�d�|�t	|�jt	�|�t|�td��|�|
jt	�Gdd�dt
�}|dd�}|�t|�d�t
dd�}|�|jt
�|�||�|�t
|�|�|�t
|�jt
�||�}|�t|�d�|�||�|�t
|�|�|�t
|�jt
�|�t|�t|��|�|
jt
�|�|d	jt
�|�|d	|�|�|d	jt
�|�|d	|�|�|djt
�|�|d|�|�|djt
�|�|d|�Gd d!�d!t�}|d"�}|�|d"�|�|��|d#��|�|����|d"��t
d$�D].}|t
|��}|��}	|	��}
|�|
|��q@|d%�}|�t|�d%�|�t|�jt�|�t|�td%��|�|dd�jt�|�|djt�|�|d	jt�|�|d&jt�|d&�}|�t|�d&�|�t|�jt�|�||jt�|�|d	jt�|�|djt�|�|d'jt�|�|dd�jt�Gd(d)�d)t�}|d*�}|�|d*�|�|��|d+��|�|����|d*��t
d,�D]:}|d-�ttt
|����}|��}|��}	|�|	|��q�|d.�}|�t|�d.�|�t|�jt�d/}||�}|�||�|�t|�|�|�t|�jt�|�t|�t|��|�|di|d�|�|di|d�|�|d-jt�|�|d-|�|�d-|jt�|�d-||�|�|d	jt�|�|d	d-�|�|djt�|�|d|�|�|d'jt�|�|d'||�|�|dd�jt�|�|dd�|�|�|d	d	�jt�|�|d	d	�d-�|�|��jt�|�|��|�|�|��jt�|�|��|�|�|��jt�|�|��|�i}
|�|�|
�jt�|�|�|
�|�|�|�d0d0�jt�|�|�d0d0�|�|�|�t|��jt�|�|�t|��|�|�|�t|��jt�|�|�t|��|�|�|�t|��jt�|�|�t|��|�|�|��jt�|�|��|�Gd1d2�d2t�}|d3�}	|�|	d3�|�|	��|d4��|�|	����|d3��d.}||�}	|�t|	�|�|�t|	�jt�|�t|	�t|��|�|	di|d�|�|di|	d�|�|	��jt�|�|	��|�|�|	��jt�|�|	��|�|�|	��jt�|�|	��|�|�|	�d0d0�jt�|�|	�d0d0�|�|�|	�d5d5�jt�|�|	�d5d5�|�|�|	�t|	��jt�|�|	�t|	��|�|�|	�t|	��jt�|�|	�t|	��|�|�|	�t|	��jt�|�|	�t|	��|�|�|	��jt�|�|	��|�|�|	��jt�|�|	��|�|�|	��jt�|�|	��|�|�|	��jt�|�|	��|�|�|	d-jt�|�|	d-|�|�d-|	jt�|�d-|	|�|�|	d	jt�|�|	d	d-�|�|	djt�|�|	d|�|�|	d'jt�|�|	d'||�|�|	dd�jt�|�|	dd�|�|�|	d	d	�jt�|�|	d	d	�d-�Gd6d7�d7t�}|t
d��}|�|tt
d���|�d8�|�|tt
d��d8g�d|d<|�|tt
d9���|� t
d9d:��|�|tt
d:���g|d;d�<|�|tt
d<���|d=d<�=|�t|�d=�|�|tt
d=���|�t|�tt
d=���|�|d	d	�|�|dd�|�|d>d	�|�|dd�|�|dd�tt
d���dS)?Ncs eZdZdd�Z�fdd�ZdS)z@ClassPropertiesAndMethods.test_basic_inheritance.<locals>.hexintcSst|�Sr�)�hexrtr;r;r<r~m
szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.hexint.__repr__cs�t�||��Sr�)r)rPr���hexintr;r<rPo
szHClassPropertiesAndMethods.test_basic_inheritance.<locals>.hexint.__add__N)r�r�r�r~rPr;rr;r<rl
sr��	Z0x10i�Z0x3efi90rr�cs.eZdZgZdd�Z��fdd�ZeZ�ZS)zAClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlongcSst|�Sr�)�octrtr;r;r<r��
szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlong.__str__cs|�t�|��|��Sr�)r�rrPr�)r��octlongr;r<rP�
szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlong.__add__)r�r�r�r�r�rPr�rr;)rrr<r�
srrgrrZ0o10i�Z0o5675rer�c@seZdZdS)zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.longcloneNr�r;r;r;r<�	longclone�
src@s$eZdZdgZd	dd�Zdd�ZdS)
zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloatr�r�r�cSst|�|_dSr�)r)r�)r6r�r�r;r;r<r0�
szLClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloat.__init__cSsd|j|fS)Nr�r�rtr;r;r<r~�
szLClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloat.__repr__N)r�r�)r�r�r�r�r0r~r;r;r;r<�	precfloat�
s
rg�������?z1.1g��@c@seZdZdd�ZdS)zDClassPropertiesAndMethods.test_basic_inheritance.<locals>.madcomplexcSsd|j|jfS)Nz%.17gj%+.17g�r�r�rtr;r;r<r~�
szMClassPropertiesAndMethods.test_basic_inheritance.<locals>.madcomplex.__repr__N)r�r�r�r~r;r;r;r<�
madcomplex�
sr���rjz4j-3c@seZdZdZdd�ZdS)zBClassPropertiesAndMethods.test_basic_inheritance.<locals>.madtupleNcSs2|jdk	r|jSt|�}|��|�|�|_|jSr�)�_revr2rFr��r6rGr;r;r<�rev�
s
zFClassPropertiesAndMethods.test_basic_inheritance.<locals>.madtuple.rev�r�r�r�r!r#r;r;r;r<�madtuple�
sr%)
rerfrgrjrrrsr�rr)
rrr&rrsrrrjrgrfrei)rerfrgrjrrr;rfc@seZdZdZdd�ZdS)zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.madstringNcSs8|jdk	r|jSt|�}|��|�d�|��|_|jS�Nr��r!r2rFr��joinr"r;r;r<r#�
s
zGClassPropertiesAndMethods.test_basic_inheritance.<locals>.madstring.revr$r;r;r;r<�	madstring�
sr*�abcdefghijklmnopqrstuvwxyzZzyxwvutsrqponmlkjihgfedcba�r�Z12345zr3c@seZdZdZdd�ZdS)zDClassPropertiesAndMethods.test_basic_inheritance.<locals>.madunicodeNcSs8|jdk	r|jSt|�}|��|�d�|��|_|jSr'r(r"r;r;r<r#;s
zHClassPropertiesAndMethods.test_basic_inheritance.<locals>.madunicode.revr$r;r;r;r<�
madunicode9sr-ZABCDEFZFEDCBAZxyc@seZdZdS)zAClassPropertiesAndMethods.test_basic_inheritance.<locals>.sublistNr�r;r;r;r<�sublisttsr.rxrs�����r�r�)!r)rBr}r�r�r�rsr'rFr*r�r�r#r�r)�mapr��strip�lstrip�rstrip�	translate�replace�ljustr��rjust�center�lower�upper�
capitalize�titler2ryr�)r6r?rrr�baser%r�rKr�r�r*r�Zidentitytabr-r.r;)rrr<�test_basic_inheritancei
s�

			

z0ClassPropertiesAndMethods.test_basic_inheritancec	CsB|�td��tdd�W5QRX|�td��tdd�W5QRX|�td��tdd�W5QRX|�tddd�tdd��|�tdd	�d
�|�tddd
�d�|�td��tt	d�d�W5QRX|�td��t
dd�W5QRXtttttttt
fD]:}z|dd�Wntk
�r*YnX|�d|��qdS)Nzkeyword argumentrerWrfr�i�ri�r��500�abc�strict)r�errorsr�rg)Zsequence)rrerf)Zbogus_keyword_argz4expected TypeError from bogus keyword argument to %r)ZassertRaisesRegexr�r)r*�boolrBr�rsr�r�r2r�)r6�constructorr;r;r<�
test_keywords�s0��z'ClassPropertiesAndMethods.test_keywordscs�G�fdd�dt��|��d�d�|�d�d��|�t�d��d��d�d�d�d	�d
�di}|�|�d�d�|�|�d�d	�|�|�d
�d�|��d�|�|�|��d��d�dS)Ncs,eZdZdZdd�Z�fdd�Zdd�ZdS)	zFClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistrz�Subclass of str that computes __eq__ case-insensitively.

            Also computes a hash code of the string in canonical form.
            cSs|��|_t|j�|_dSr�)r;�	canonicalr��hashcoder�r;r;r<r0�s
zOClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__init__cst|��s�|�}|j|jkSr�)r�rHr���cistrr;r<r��s
zMClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__eq__cSs|jSr�)rIrtr;r;r<r��szOClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__hash__N)r�r�r�r�r0r�r�r;rJr;r<rK�srK�ABCr�ZaBcr�rer�rfZtHreergZtWoZTHrEEZONeZthrEE)rsrBrar�)r6rJr;rJr<�test_str_subclass_as_dict_key�sz7ClassPropertiesAndMethods.test_str_subclass_as_dict_keyc
s�Gdd�d�}|ttfD]�}G�fdd�d|���d�}�d�}�d�}|�|d�|||d�}dD]�}dD]�}d	D]v}	|�td
|	�td|	�d||f�|�td
|	�td|	�d||f�|�td|	�td|	�d||f�qtqlqdqdS)Nc@seZdZdS)zCClassPropertiesAndMethods.test_classic_comparisons.<locals>.classicNr�r;r;r;r<�classic�srNcs\eZdZdd�Z�fdd�Z�fdd�Z�fdd�Z�fd	d
�Z�fdd�Z�fd
d�Z	dS)z=ClassPropertiesAndMethods.test_classic_comparisons.<locals>.CcSst|�|_dSr��r)r�r�r;r;r<r0�szFClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__init__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr��r�r�r)r�r�rur;r<r��s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__eq__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r��s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__ne__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r�s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__lt__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r�s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__le__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r�s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__gt__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r�s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__ge__N)
r�r�r�r0r�r�r�r�r�r�r;rur;r<r��sr�rerfrgrw�rrrrrr�c[x] %s c[y]�x %s y�
x=%d, y=%d�	c[x] %s y�	x %s c[y])r)rrBrC)
r6rNr?rYr��c3rWr3�y�opr;rur<�test_classic_comparisons�s.(

�

�

�z2ClassPropertiesAndMethods.test_classic_comparisonscsZGdd�dt�}|d�}��|d���d|�Gdd�dt�}|d�}��|d���d|�Gdd	�d	�}|tttfD]�}G��fd
d�d|���d�}�d�}�d
�}	��|d�|||	d�}
dD]�}dD]�}dD]v}
��td|
�td|
�d||f���td|
�td|
�d||f���td|
�td|
�d||f�q�q�q�qzdS)Nc@seZdZdS)z:ClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZNr�r;r;r;r<rU2srUrey�?c@seZdZdd�ZdS)z;ClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZZcSs(zt||�dkWStYSXdS)Ng���ư>)r'r�r�r;r;r<r�8szBClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZZ.__eq__Nr�r;r;r;r<�ZZ7sr[g�ׇP�?c@seZdZdS)z@ClassPropertiesAndMethods.test_rich_comparisons.<locals>.classicNr�r;r;r;r<rNAsrNcsheZdZdd�Z�fdd�Z�fdd�Z�fdd�Z�fd	d
�Z�fdd�Z�fd
d�Z	�fdd�Z
dS)z:ClassPropertiesAndMethods.test_rich_comparisons.<locals>.CcSst|�|_dSr�rOr�r;r;r<r0EszCClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__init__cs��d�dS)Nzshouldn't call __cmp__)r�)r�r�rtr;r<�__cmp__GszBClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__cmp__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r�Is


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__eq__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r�Os


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__ne__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r�Us


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__lt__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r�[s


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__le__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r�as


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__gt__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStSr�rPr�rur;r<r�gs


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__ge__N)r�r�r�r0r\r�r�r�r�r�r�r;�r�r6r;r<r�Dsr�rfrgrwrQrRrSrTrUrV)r�rBr)rr2rC)r6rUr�r[�zzrNr?rYr�rWrWr3rXrYr;r]r<�test_rich_comparisons0s>)

�

�

�z/ClassPropertiesAndMethods.test_rich_comparisonscs4ddlm}�fdd�}||jd�|tjd�dS)Nr)�FileIOcs��|j|�dSr�)rBr�)�descrZwhatrtr;r<�check�sz6ClassPropertiesAndMethods.test_descrdoc.<locals>.checkzTrue if the file is closedz!the real part of a complex number)�_ior`�closedr�r�)r6r`rbr;rtr<�
test_descrdocsz'ClassPropertiesAndMethods.test_descrdoccsvGdd�dt��G�fdd�d�}G�fdd�dt�}|�|jd�|�|�jd�|�|jd	�|�|�jd
�dS)Nc@seZdZdd�ZdS)z?ClassPropertiesAndMethods.test_doc_descriptor.<locals>.DocDescrcSs&|r|jjd}|r|j}d||fS)Nz	 instancezobject=%s; type=%s)r�r�)r6rZotyper;r;r<r�s
zGClassPropertiesAndMethods.test_doc_descriptor.<locals>.DocDescr.__get__Nr�r;r;r;r<�DocDescr�srfcseZdZ��ZdS)z?ClassPropertiesAndMethods.test_doc_descriptor.<locals>.OldClassNrNr;�rfr;r<�OldClass�srhcseZdZ��ZdS)z?ClassPropertiesAndMethods.test_doc_descriptor.<locals>.NewClassNrNr;rgr;r<�NewClass�srizobject=None; type=OldClassz'object=OldClass instance; type=OldClasszobject=None; type=NewClassz'object=NewClass instance; type=NewClass)rrBr�)r6rhrir;rgr<�test_doc_descriptor�sz-ClassPropertiesAndMethods.test_doc_descriptorcsGdd�dt�}Gdd�dt�}Gdd�dt�}Gdd�d||�}||||fD]D}||||fD]2}|�}||_��|j|�||_��|j|�q^qN�fd	d
�}||�t�|t�|�||�d�||�t�|t�t�|t�t�Gdd
�d
t�}	|dt�|dt�t�}
||
td��||
td��~
Gdd�dt�}Gdd�dt�}Gdd�dt�}
Gdd�dt�}Gdd�dt�}Gdd�d|�}Gdd�d|
�}Gdd�d|�}Gd d!�d!|�}Gd"d#�d#|�}Gd$d%�d%|�}||f||
f|
|f||f||ffD]n\}}|�}d|_||_��|j|d&||f���|jd�||_��|j|d&||f���|jd��q||||||||t|	f
D]@}||||||||t|	f
D] }||k�r��q�||�|��q��q�Gd'd(�d(t��G�fd)d*�d*t���fd+d,�t	d-�D�}~dS).Nc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.CNr�r;r;r;r<r��sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.DNr�r;r;r;r<r��sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.ENr�r;r;r;r<r(�sr(c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.FNr�r;r;r;r<r_�sr_c	slz
||_Wntk
rYnX��d||f�zt|d�Wnttfk
rXYnX��d|�dS)Nz!shouldn't allow %r.__class__ = %rr�z shouldn't allow del %r.__class__)r�r�r�rlr�)r3r�rtr;r<�cant�s
z6ClassPropertiesAndMethods.test_set_class.<locals>.cantrec@seZdZgZdS)z5ClassPropertiesAndMethods.test_set_class.<locals>.IntNr�r;r;r;r<�Int�srlTrfc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Gr?rRNr�r;r;r;r<r��sr�c@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.HrRr?Nr�r;r;r;r<r��sr�c@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Ir?rRNr�r;r;r;r<r��sr�c@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.JrWrRNr�r;r;r;r<�J�srmc@seZdZdddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Kr?rRrJNr�r;r;r;r<�K�srnc@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Lr�Nr�r;r;r;r<rG�srGc@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Mr�Nr�r;r;r;r<r��sr�c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Nr�Nr�r;r;r;r<r��sr�c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.PrFNr�r;r;r;r<�P�sroc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.QNr�r;r;r;r<�Q�srpc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.RrFr�Nr�r;r;r;r<�R�srqz0assigning %r as __class__ for %r silently failedc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.ONr�r;r;r;r<�O�srrcseZdZ�fdd�ZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Acs
�|_dSr�rrt�rrr;r<r��sz;ClassPropertiesAndMethods.test_set_class.<locals>.A.__del__N�r�r�r�r�r;rsr;r<r�srcsg|]
}���qSr;r;r�)rr;r<r��sz<ClassPropertiesAndMethods.test_set_class.<locals>.<listcomp>r�)
rr�r�r2r)rErDr?rBr�)r6r�r�r(r_r�Zcls2r3rkrl�or�r�r�rmrnrGr�r�rorprqr�r;)rrrr6r<�test_set_class�st


*

�

�
z(ClassPropertiesAndMethods.test_set_classc	s�Gdd�dt�}|�}ddi|_��|jd��fdd���|d��|g��|d�|`Gdd�dt�����fd	d
�}Gdd�dt��}Gd
d�d�t�}Gdd�dt|d�}Gdd�dt|d�}|||fD]D}||�|j}	zd|	d<Wntk
�rYq�X��d|�q�Gdd�dtj��}
Gdd�d�tj�}|
|fD] }|d�}
||
�d|
jd<�qHdd�}Gdd�dt	��}Gdd �d �t	�}t	||fD]:}|�}d!di|_��|j
d���||�|t����q�dS)"Nc@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.CNr�r;r;r;r<r��sr�rRrec	s:z
||_Wnttfk
r"YnX��d||f�dS)Nz shouldn't allow %r.__dict__ = %r)rFr�r�r�)r3r|rtr;r<rk�s

z5ClassPropertiesAndMethods.test_set_dict.<locals>.cantc@seZdZdS)z5ClassPropertiesAndMethods.test_set_dict.<locals>.BaseNr�r;r;r;r<r
src	s��|i�z|`Wnttfk
r*YnX��d|��jd}z|�|i�Wnttfk
rlYnX��d|�dS)zR
            x has to be an instance of a class inheriting from Base.
            zshouldn't allow del %r.__dict__rFz&dict_descr allowed access to %r's dictN)rFr�r�r�r�)r3Z
dict_descr�rrkr6r;r<�verify_dict_readonly
s

zEClassPropertiesAndMethods.test_set_dict.<locals>.verify_dict_readonlyc@seZdZdS)z6ClassPropertiesAndMethods.test_set_dict.<locals>.Meta1Nr�r;r;r;r<�Meta1
sryc@seZdZdS)z6ClassPropertiesAndMethods.test_set_dict.<locals>.Meta2Nr�r;r;r;r<�Meta2
srzc@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.DNr�r;r;r;r<r�
sr�r�c@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.ENr�r;r;r;r<r(!
sr(Zeggsr�z%r's __dict__ can be modifiedc@seZdZdS)z8ClassPropertiesAndMethods.test_set_dict.<locals>.Module1Nr�r;r;r;r<�Module1.
sr{c@seZdZdS)z8ClassPropertiesAndMethods.test_set_dict.<locals>.Module2Nr�r;r;r;r<�Module20
sr|c	Ss,z|`Wnttfk
r"YdSXdSdS)NFT)rFr�r�)r�r;r;r<�can_delete_dict;
s
z@ClassPropertiesAndMethods.test_set_dict.<locals>.can_delete_dictc@seZdZdS)z;ClassPropertiesAndMethods.test_set_dict.<locals>.Exception1Nr�r;r;r;r<�
Exception1B
sr~c@seZdZdS)z;ClassPropertiesAndMethods.test_set_dict.<locals>.Exception2Nr�r;r;r;r<�
Exception2D
srr?)rrFrBrRrDr�r�rqrrr�r?r�)r6r�r?rxryrzr�r(r�Z
class_dictr{r|rrr�r}r~rZ
ExceptionTyper�r;rwr<�
test_set_dict�sJ




z'ClassPropertiesAndMethods.test_set_dictcs�G�fdd�dt��|�t�d��d��d�|�t�d�d�d�|�td�d��d�|�t�d��d��d�|�td�d��d�|�t�d�d�d�|�tt�d��d��d���d�Gd	d
�d
t�}dS)Ncs@eZdZdd�Z�fdd�ZeZd
�fdd�	Zd�fdd	�	ZdS)zBClassPropertiesAndMethods.test_binary_operator_override.<locals>.IcSsdt|�S)NzI(%r)�r)rtr;r;r<r~O
szKClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__repr__cs�t|�t|��Sr�r�r��r�r;r<rPQ
szJClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__add__Ncs>|dkr�tt|�t|���S�tt|�t|�t|���SdSr��rr)�r6r�r�r�r;r<�__pow__T
szJClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__pow__cs@|dkr �tt|�t|�|��S�tt|�t|�t|���SdSr�r�r�r�r;r<�__rpow__Y
szKClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__rpow__)N)N)r�r�r�r~rPr�r�r�r;r�r;r<r�N
s
r�rerfzI(3)rgzI(8)rrc@seZdZdd�ZdS)zBClassPropertiesAndMethods.test_binary_operator_override.<locals>.ScSs|��|��kSr�)r;r�r;r;r<r�g
szIClassPropertiesAndMethods.test_binary_operator_override.<locals>.S.__eq__Nr�r;r;r;r<�Sf
sr�)r)rBr}rrs)r6r�r;r�r<�test_binary_operator_overrideL
s$z7ClassPropertiesAndMethods.test_binary_operator_overridec	Cs|Gdd�dt�}Gdd�d|�}Gdd�d|�}Gdd�d||�}|�}t|�}d	d
�|_|�t|�d�dd
�|_|�t|�d
�dd
�|_|�t|�d�dd
�|_|�t|�d�d|_|�tt|�|`|�t|�d�d|_|�tt|�|`|�t|�d
�d|_|�tt|�|`|�t|�d�d|_|�tt|�|`|�t|�|�d|_d|_|�|jd�|�|jd�dd�}||_|�|jd�|�|jd�dd�}||_	|�|j
d�|�|jd�|�|jd�|`|�|jd�|`|�|jd�|�|jd�|`	z
|jWntk
�r8YnX|�d�Gdd�dt�}Gdd�d|�}~t
��dd
�|_dS)Nc@seZdZdS�z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.ANr�r;r;r;r<rl
src@seZdZdS�z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.BNr�r;r;r;r<rn
src@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.CNr�r;r;r;r<r�p
sr�c@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.DNr�r;r;r;r<r�r
sr�cSsdSrr;rtr;r;r<r�v
r�zEClassPropertiesAndMethods.test_subclass_propagation.<locals>.<lambda>r�cSsdS)N�:r;rtr;r;r<r�x
r�r�cSsdS)N�r;rtr;r;r<r�z
r�r�cSsdSr�r;rtr;r;r<r�|
r�r�cSs|dkrdSt�||�S)Nr�r�)rrgrer;r;r<rg�
szMClassPropertiesAndMethods.test_subclass_propagation.<locals>.__getattribute__r�cSs|dkrdSt|��dS)N)r�r�r�rxr�rer;r;r<r��
szHClassPropertiesAndMethods.test_subclass_propagation.<locals>.__getattr__rxzd.foo should be undefined nowc@seZdZdSr�r�r;r;r;r<r�
sc@seZdZdSr�r�r;r;r;r<r�
scWsdSr�r;rr;r;r<r��
r�)rr�r�rBrcr�r�r�rgr�r�r�r�rr�ra)	r6rrr�r�rJZ	orig_hashrgr�r;r;r<�test_subclass_propagationj
sv





z3ClassPropertiesAndMethods.test_subclass_propagationcCs�ddl}Gdd�dt�}d}||�}|�|�|�|�|��Gdd�dt�}|d�}z|�|�|�d�Wntk
r�YnXdS)	Nrc@seZdZdS)zBClassPropertiesAndMethods.test_buffer_inheritance.<locals>.MyBytesNr�r;r;r;r<r��
sr�rBc@seZdZdS)z@ClassPropertiesAndMethods.test_buffer_inheritance.<locals>.MyIntNr�r;r;r;r<r��
sr�r�z2subclass of int should not have a buffer interface)�binasciir�rB�b2a_hexr)r�r�)r6r�r�r?rLr�r;r;r<�test_buffer_inheritance�
s
z1ClassPropertiesAndMethods.test_buffer_inheritancecs�ddl�ddl}G�fdd�dt�}|d�}|�t|�|�|�tt|��t�|�tt|��t�|�t|�d�|�t|�d�|�t|�d�|�|��d�|�|��d�|�	�}t
||d�t
t|�|d�|�|��d	�|��dS)
Nrcs eZdZ�fdd�Zdd�ZdS)zGClassPropertiesAndMethods.test_str_of_str_subclass.<locals>.octetstringcs��|�d���d�S)N�ascii)r��encode�decodert�r�r;r<r��
szOClassPropertiesAndMethods.test_str_of_str_subclass.<locals>.octetstring.__str__cSs|dS)Nz reprr;rtr;r;r<r~�
szPClassPropertiesAndMethods.test_str_of_str_subclass.<locals>.octetstring.__repr__N)r�r�r�r�r~r;r�r;r<�octetstring�
sr�r�AZ41zA repr)�filez41
41
)
r��iorsrBrDr}�ordr�r~�StringIO�printr��close)r6r�r�ru�capturer;r�r<�test_str_of_str_subclass�
s"z2ClassPropertiesAndMethods.test_str_of_str_subclasscCsDdd�}|�|jdd�d�t�}tj|dddd�|�|d	�dS)
NcSs|Sr�r;rr;r;r<r�
r�z;ClassPropertiesAndMethods.test_keyword_arguments.<locals>.fr�ruabc½€�latin1r7)�encodingrDsabc�?)rBr�	bytearrayr0)r6rZbar;r;r<�test_keyword_arguments�
s�z0ClassPropertiesAndMethods.test_keyword_argumentscCsHGdd�dt�}|�|_z|��Wntk
r8YnX|�d�dS)Nc@seZdZdS)z8ClassPropertiesAndMethods.test_recursive_call.<locals>.ANr�r;r;r;r<r�
srz7Recursion limit should have been reached for __call__())rr�RecursionErrorr�r:r;r;r<�test_recursive_call�
sz-ClassPropertiesAndMethods.test_recursive_callcs�g�G�fdd�dt�}|�}|��g�~t��|��dg�Gdd�dt�}|�}z
|d=Wntk
rvYnX|�d�dS)NcseZdZ�fdd�ZdS)z5ClassPropertiesAndMethods.test_delete_hook.<locals>.Ccs��d�dSr�rYrt�rir;r<r�sz=ClassPropertiesAndMethods.test_delete_hook.<locals>.C.__del__Nrtr;r�r;r<r�sr�rec@seZdZdS)z5ClassPropertiesAndMethods.test_delete_hook.<locals>.DNr�r;r;r;r<r�sr�rz$invalid del() didn't raise TypeError)rrBrr�r�r�)r6r�rWr�rJr;r�r<�test_delete_hooks
z*ClassPropertiesAndMethods.test_delete_hookcCs�Gdd�dt�}|�}zt|�Wntk
r6YnX|�d�Gdd�dt�}|�}zt|�Wntk
rxYnX|�d�dS)Nc@seZdZdS)z?ClassPropertiesAndMethods.test_hash_inheritance.<locals>.mydictNr�r;r;r;r<�mydictsr�z#hash() of dict subclass should failc@seZdZdS)z?ClassPropertiesAndMethods.test_hash_inheritance.<locals>.mylistNr�r;r;r;r<�mylistsr�z#hash() of list subclass should fail)r|r�r�r�r2)r6r�rJr�r;r;r<�test_hash_inheritances
z/ClassPropertiesAndMethods.test_hash_inheritancecCszddWntk
r YnX|�d�zd�d�Wntk
rNYnX|�d�zd�dg�Wntk
r~YnX|�d�zd�d�Wntk
r�YnX|�d	�zd
dWntk
r�YnX|�d�zdiWntk
�rYnX|�d
�zddWntk
�r4YnX|�d�zddWntk
�rbYnX|�d�zddWntk
�r�YnX|�d�zddWntk
�r�YnX|�d�|�d��d�|�d��d�|�ddd�|�ddd�dS)Nr?rrz'' + 5 doesn't raise TypeErrorr�z%''.split('') doesn't raise ValueErrorrz$''.join([0]) doesn't raise TypeError�5z'''.rindex('5') doesn't raise ValueErrorz%(n)sz&'%(n)s' % None doesn't raise TypeErrorz%(nz&'%(n' % {} '' doesn't raise ValueErrorz%*sr�z''%*s' % ('abc') doesn't raise TypeErrorz%*.*s)r�rrz,'%*.*s' % ('abc', 5) doesn't raise TypeErrorz%s�rerfz%'%s' % (1, 2) doesn't raise TypeError�%z#'%' % None doesn't raise ValueErrorZ534253reZ534253xz%c�)r�r��splitr�r)�rindexrB�isdigitrtr;r;r<�test_str_operations)sl









z-ClassPropertiesAndMethods.test_str_operationscCs2Gdd�d�}|�}|�}||_||_t|�}dS)Nc@seZdZdS)z?ClassPropertiesAndMethods.test_deepcopy_recursive.<locals>.NodeNr�r;r;r;r<rzYsrz)rRr?r)r6rzr?rRr�r;r;r<�test_deepcopy_recursiveWsz1ClassPropertiesAndMethods.test_deepcopy_recursivecCsjddlm}|�|�}t|�|�|d�|�|d�|�|d�|�|j�d|_|�|jddi�dS)Nr)rrr��__file__r�re)	rqrrr�rsr�r�rFr�rB)r6r�rLr;r;r<�test_uninitialized_modulesas
z4ClassPropertiesAndMethods.test_uninitialized_modulescsRG�fdd�dt�}Gdd�d|��|�|d�dddg�|��d�dddg��d�}|�|jd�|d�}|�|��|�|jd��d�}|�|��|�|jd�Gd	d�dt�}|�|dd�|ddf�Gd
d�d|��|��dd��ddf�Gdd�dt�}|�|dd�||ddf�Gdd�d|��|��dd���ddf�dS)
NcseZdZ�fdd�ZdS)�3ClassPropertiesAndMethods.test_funny_new.<locals>.Ccs6t|t�rdddgSt|t�r(t���St�|�SdS)Nrerfrg)r�rsr)rr�rrr;r<r�ps




�;ClassPropertiesAndMethods.test_funny_new.<locals>.C.__new__Nrr;rr;r<r�osr�c@seZdZdd�ZdS)�3ClassPropertiesAndMethods.test_funny_new.<locals>.DcSs
||_dSr�r/�r6rr;r;r<r0usz<ClassPropertiesAndMethods.test_funny_new.<locals>.D.__init__Nrvr;r;r;r<r�tsr�r�rerfrgc@seZdZedd��ZdS)r�cWs|Sr�r;rmr;r;r<r��sr�N)r�r�r�rr�r;r;r;r<r��sc@seZdZdS�r�Nr�r;r;r;r<r��sc@seZdZedd��ZdS)r�cWs|Sr�r;rmr;r;r<r��sr�N)r�r�r�rHr�r;r;r;r<r��sc@seZdZdSr�r�r;r;r;r<r��s)rrBr�r�)r6r�rJr;rr<�test_funny_newms(z(ClassPropertiesAndMethods.test_funny_newcCs�Gdd�dt�}|�}|}|d9}|�||df�|}|d9}|�||df�|}|d9}|�||df�|}|d9}|�||df�|}|d9}|�||df�|}|d9}|�||df�dS)Nc@seZdZdd�ZdS)z2ClassPropertiesAndMethods.test_imul_bug.<locals>.CcSs||fSr�r;r�r;r;r<rm�sz;ClassPropertiesAndMethods.test_imul_bug.<locals>.C.__imul__N)r�r�r�rmr;r;r;r<r��sr�r�rfrglr��rrB)r6r�r3rXr;r;r<�
test_imul_bug�s(z'ClassPropertiesAndMethods.test_imul_bugcs�ddl}G�fdd�dt�}|d�}|�d���|jd���|��d�|�|�}��|jd���|��d�|�|�}��|jd���|��d�dS)Nrcs<eZdZddd�Zd
dd�Zdd�Zdd	�Z�fd
d�ZdS)z7ClassPropertiesAndMethods.test_copy_setstate.<locals>.CNcSs||_||_dSr�)r��_C__foor5r;r;r<r0�sz@ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__init__cSs
||_dSr�r/r5r;r;r<�setfoo�sz>ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.setfoocSs|jSr�)r�rtr;r;r<�getfoo�sz>ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.getfoocSs|jgSr�r/rtr;r;r<�__getstate__�szDClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__getstate__cs$��t|�d�|d|_|_dSr�)rBr�r�r�)r��lstrtr;r<�__setstate__�szDClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__setstate__)N)N)r�r�r�r0r�r�r�r�r;rtr;r<r��s


r�r�r�)r�rr�rBr�r�r)r6r�r�r?rRr;rtr<�test_copy_setstate�s



z,ClassPropertiesAndMethods.test_copy_setstatecCs�|�ddd�d�|�dtd�d�|�t�dtd��d�Gdd�dt�}|�|d�dd�d�|�|d�td�d�|�|d��td��d�|�ddd�d�|�dtd�d�|�t�dtd��d�Gd	d
�d
t�}|�|d�dd�d�|�|d�td�d�|�|d��td��d�|�dddgdd�ddg�|�dddgtd�ddg�|�t�dddgtd��ddg�Gd
d�dt�}|�|dddg�dd�ddg�|�|dddg�td�ddg�|�|dddg��td��ddg�|dddg�}ddg|tdd�<|�|dddg�ddg|tddd�<|�|dddg�|�tdd�ddg�|�|dddg�|�tddd�ddg�|�|dddg�dS)NrxrjZhellc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.ScSst�||�Sr�)rsrUr2r;r;r<rU�sz<ClassPropertiesAndMethods.test_slices.<locals>.S.__getitem__Nr�r;r;r;r<r��sr�rwrfr�c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.TcSst�||�Sr�)r�rUr2r;r;r<rU�sz<ClassPropertiesAndMethods.test_slices.<locals>.T.__getitem__Nr�r;r;r;r<r;�sr;rergc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.LcSst�||�Sr�)r2rUr2r;r;r<rU�sz<ClassPropertiesAndMethods.test_slices.<locals>.L.__getitem__Nr�r;r;r;r<rG�srGr)rBrXrsrUr�r2ra)r6r�r;rGr?r;r;r<�test_slices�s<"""$z%ClassPropertiesAndMethods.test_slicescsDG�fdd�dt����}d|_~t��|�t�j�d��`dS)NcseZdZgZ�fdd�ZdS)z>ClassPropertiesAndMethods.test_subtype_resurrection.<locals>.Ccs�j�|�dSr�)�	containerryrtrur;r<r��szFClassPropertiesAndMethods.test_subtype_resurrection.<locals>.C.__del__N)r�r�r�r�r�r;rur;r<r��sr�r�re)rr�rr�rBr�r�r�)r6rWr;rur<�test_subtype_resurrection�sz3ClassPropertiesAndMethods.test_subtype_resurrectioncCs0Gdd�dt�}d}td�D]}||�}q~dS)Nc@seZdZdgZdd�ZdS)z9ClassPropertiesAndMethods.test_slots_trash.<locals>.trashr3cSs
||_dSr�rWr2r;r;r<r0szBClassPropertiesAndMethods.test_slots_trash.<locals>.trash.__init__N)r�r�r�r�r0r;r;r;r<�trashsr�iP�)rr�)r6r�rur�r;r;r<�test_slots_trashs

z*ClassPropertiesAndMethods.test_slots_trashcCsnGdd�dt�}Gdd�dt�}Gdd�d||�}t��rJ|�|j|j�|�|d�|�|d�d	|�_dS)
Nc@seZdZdZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.Ar;Nr�r;r;r;r<rsrc@seZdZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.BNr�r;r;r;r<rsrc@seZdZdZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.Cr;Nr�r;r;r;r<r� sr�rFr�rf)rrr�rB�
__basicsize__r�r3)r6rrr�r;r;r<�test_slots_multiple_inheritancesz9ClassPropertiesAndMethods.test_slots_multiple_inheritancecCsZGdd�dt�}|�}|�|dd�|�|dd�|�d|d�|�d|d�dS)Nc@seZdZdd�Zdd�ZdS)z.ClassPropertiesAndMethods.test_rmul.<locals>.CcSsdS)Nrr;r�r;r;r<ro,sz6ClassPropertiesAndMethods.test_rmul.<locals>.C.__mul__cSsdS)N�rmulr;r�r;r;r<rq.sz7ClassPropertiesAndMethods.test_rmul.<locals>.C.__rmul__N)r�r�r�rorqr;r;r;r<r�+sr�rfrg������@r�r�r�r;r;r<�	test_rmul(sz#ClassPropertiesAndMethods.test_rmulcCs"Gdd�dt�}|�}|dC}dS)Nc@seZdZdd�ZdS)z.ClassPropertiesAndMethods.test_ipow.<locals>.CcSsdSr�r;r�r;r;r<�__ipow__:sz7ClassPropertiesAndMethods.test_ipow.<locals>.C.__ipow__N)r�r�r�r�r;r;r;r<r�9sr�rfr�r�r;r;r<�	test_ipow6sz#ClassPropertiesAndMethods.test_ipowc
s�Gdd�dt�}G�fdd�dt��Gdd�d|�}Gdd�d|�}|�}|�}|f|_�f|_|�|��d	�|�|��d	�|�|jd
�|�|jd
�|����|g�z|`Wnttfk
r�YnX|�d�z
d|_Wn<tk
�r }zt	|�d
k�r|�d�W5d}~XYnX|�d�z|f|_Wntk
�rNYnX|�d�z||f|_Wntk
�r~YnX|�d�z|f|_Wntk
�r�YnX|�d�dS)Nc@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.CNr�r;r;r;r<r�Csr�cs&eZdZ��fdd�Zdd�Z�ZS)z8ClassPropertiesAndMethods.test_mutable_bases.<locals>.C2cs |dkrdSt�|��|�SdS)Nr?rf)rrg�r6r�)rNr�r;r<rgFszIClassPropertiesAndMethods.test_mutable_bases.<locals>.C2.__getattribute__cSsdSr�r;rtr;r;r<rIKsz=ClassPropertiesAndMethods.test_mutable_bases.<locals>.C2.meth)r�r�r�rgrIrr;�rNrr<rNEsrNc@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.DNr�r;r;r;r<r�Msr�c@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.ENr�r;r;r;r<r(Osr(rerfz&shouldn't be able to delete .__bases__r;z/a new-style class can't have only classic basesz'wrong error message for .__bases__ = ()z)shouldn't be able to set .__bases__ to ()z.shouldn't be able to create inheritance cyclesz#didn't detect repeated base classes)
rrGrBrIr?�__subclasses__r�r�r�rs)r6r�r�r(rJr�r�r;r�r<�test_mutable_bases?sN




z,ClassPropertiesAndMethods.test_mutable_basescCs�dd�tj��D�}|D],}t�|d�|tk	r|�t|j�d|�qGdd�dt�}Gdd�dt�}Gd	d
�d
|�}zt	f|_Wnt
k
r�YnX|�d�zt	ft_Wnt
k
r�YnX|�d�z|tf|_Wnt
k
r�YnXdS)
NcSsg|]}t|t�r|�qSr;)r�rD)r��tpr;r;r<r��s
�z@ClassPropertiesAndMethods.test_builtin_bases.<locals>.<listcomp>rGrec@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.LNr�r;r;r;r<rG�srGc@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.CNr�r;r;r;r<r��sr�c@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.DNr�r;r;r;r<r��sr�z/shouldn't turn list subclass into dict subclassz-shouldn't be able to assign to list.__bases__)�builtinsrF�valuesrrgrBr�rGr2r|r�r�)r6Z
builtin_typesr�rGr�r�r;r;r<�test_builtin_bases�s.

z,ClassPropertiesAndMethods.test_builtin_basesc	Cs�|�t��Gdd�dtd��}W5QRX|�t��Gdd�dttd��}W5QRX|�t��Gdd�dtd�t�}W5QRXGdd�dt�}|�t��Gdd�d|td��}W5QRX|�t��Gdd�dtd�|�}W5QRXGd	d�dt�}|�t��td�f|_W5QRX|�t��ttd�f|_W5QRX|�t��td�tf|_W5QRX|�t��|td�f|_W5QRX|�t��td�|f|_W5QRXdS)
Nc@seZdZdS�z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XNr�r;r;r;r<rS�srSc@seZdZdSr�r�r;r;r;r<rS�sc@seZdZdSr�r�r;r;r;r<rS�sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.ONr�r;r;r;r<rr�srrc@seZdZdSr�r�r;r;r;r<rS�sc@seZdZdSr�r�r;r;r;r<rS�sc@seZdZdSr�r�r;r;r;r<rS�s)rcr�rDrrG)r6rSrrr;r;r<�test_unsubclassable_types�s,    z3ClassPropertiesAndMethods.test_unsubclassable_typesc
s�G�fdd�dt��Gdd�dt�}Gdd�dt�}Gdd�dt�}Gd	d
�d
|�}Gdd�d|�}Gd
d�d|�d�}Gdd�d||d�}|j}|j}	z|f|_Wn0tk
r�|�|j|�|�|j|	�YnX|�d�dS)Ncs&eZdZ��fdd�Zdd�Z�ZS)zOClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkOncecsd|_t�|���|||�Sr�)�flagrr�)r6r9rrB)�WorkOncer�r;r<r��szWClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkOnce.__new__cSs0|jdkrtd��n|jd7_t�|�SdS)NrZbozore)r�r�rDrErtr;r;r<rE�s

zSClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkOnce.mro)r�r�r�r�rErr;�r�rr<r��sr�c@seZdZdd�ZdS)zQClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkAlwayscSs
t�|�Sr�)rDrErtr;r;r<rE�szUClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkAlways.mroNrHr;r;r;r<�
WorkAlways�sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.CNr�r;r;r;r<r��sr�c@seZdZdS)zIClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.C2Nr�r;r;r;r<rN�srNc@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.DNr�r;r;r;r<r��sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.ENr�r;r;r;r<r(�sr(c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.FNr�r;r;r;r<r_�sr_r�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.GNr�r;r;r;r<r��sr�zexception not propagated)rDrr}rGr�rBr�)
r6r�r�rNr�r(r_r�ZE_mro_beforeZD_mro_beforer;r�r<�#test_mutable_bases_with_failing_mro�s z=ClassPropertiesAndMethods.test_mutable_bases_with_failing_mrocCs�Gdd�dt�}Gdd�dt�}Gdd�d||�}Gdd�d||�}Gd	d
�d
||�}z||f|_Wntk
rxYnX|�d�dS)Nc@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.ANr�r;r;r;r<rsrc@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.BNr�r;r;r;r<rsrc@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.CNr�r;r;r;r<r�sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.DNr�r;r;r;r<r�	sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.ENr�r;r;r;r<r(sr(zdidn't catch MRO conflict)rrGr�r�)r6rrr�r�r(r;r;r<�%test_mutable_bases_catch_mro_conflict�sz?ClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflictcCsVGdd�dt�}|j}d|_|�|j|jf|df�d|_|�|j|jf|df�dS)Nc@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_names.<locals>.CNr�r;r;r;r<r�sr�r�zD.E)rr�r�rB)r6r�r�r;r;r<�test_mutable_namessz,ClassPropertiesAndMethods.test_mutable_namescs6G�fdd�dt�}Gdd�d��|d��_d�_dS)NcseZdZ�fdd�ZdS)z<ClassPropertiesAndMethods.test_evil_type_name.<locals>.Nastycs
d�_dS)Nr�)r�rtrur;r<r�)szDClassPropertiesAndMethods.test_evil_type_name.<locals>.Nasty.__del__Nrtr;rur;r<�Nasty(sr�c@seZdZdS)z8ClassPropertiesAndMethods.test_evil_type_name.<locals>.CNr�r;r;r;r<r�,sr�r�Znormal)rsr�)r6r�r;rur<�test_evil_type_name$s
z-ClassPropertiesAndMethods.test_evil_type_namecCsGdd�dt�}|�|d�dd�|�d|d�d�Gdd�dt�}|�|�dd�|�d|�d	�Gd
d�d|�}|�|�|�d�|�|�|�d
�Gdd�d|�}|�|j|j�|�|�dd�|�d|�d	�|�|�|�d�|�|�|�d�dS)Nc@seZdZdd�Zdd�ZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.BcSsdS)N�B.__floordiv__r;r�r;r;r<�__floordiv__;szHClassPropertiesAndMethods.test_subclass_right_op.<locals>.B.__floordiv__cSsdS)N�B.__rfloordiv__r;r�r;r;r<�
__rfloordiv__=szIClassPropertiesAndMethods.test_subclass_right_op.<locals>.B.__rfloordiv__N�r�r�r�r�r�r;r;r;r<r:srrer�r�c@seZdZdd�Zdd�ZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.CcSsdS)N�C.__floordiv__r;r�r;r;r<r�FszHClassPropertiesAndMethods.test_subclass_right_op.<locals>.C.__floordiv__cSsdS)N�C.__rfloordiv__r;r�r;r;r<r�HszIClassPropertiesAndMethods.test_subclass_right_op.<locals>.C.__rfloordiv__Nr�r;r;r;r<r�Esr�r�r�c@seZdZdd�Zdd�ZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.DcSsdS)N�D.__floordiv__r;r�r;r;r<r�QszHClassPropertiesAndMethods.test_subclass_right_op.<locals>.D.__floordiv__cSsdS)N�D.__rfloordiv__r;r�r;r;r<r�SszIClassPropertiesAndMethods.test_subclass_right_op.<locals>.D.__rfloordiv__Nr�r;r;r;r<r�Psr�r�r�c@seZdZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.ENr�r;r;r;r<r([sr()r)rBrr�)r6rr�r�r(r;r;r<�test_subclass_right_op2sz0ClassPropertiesAndMethods.test_subclass_right_opz)testing an internal kind of method objectcCs6dddg}dddd�}|�t�|�|�|�i�|�|�tjd}|�|�dt�|�|�|�|�i�|�|�z|�dd�Wntk
r�YnX|�d�z|�d�Wntk
r�YnX|�d�z|�dd�Wntk
r�YnX|�d	�z|�dt�Wntk
�r&YnX|�d
�dS)Nrerfrgrw�fromkeysz0shouldn't have allowed descr.__get__(None, None)r�z(shouldn't have allowed descr.__get__(42)z.shouldn't have allowed descr.__get__(None, 42)z/shouldn't have allowed descr.__get__(None, int))rBr|r�rFrr�r�r))r6rrHrar;r;r<�test_meth_class_getes6




z-ClassPropertiesAndMethods.test_meth_class_getcCs�Gdd�dt�}Gdd�d�}|�}||�}|�||�|�||�Gdd�d|�}|�}||�}|�||�|�||�Gdd�dt�}|�}||�}|�||�|�||�Gdd�d|�}|�}||�}|�||�|�||�dS)	Nc@seZdZdd�Zdd�ZdS)z<ClassPropertiesAndMethods.test_isinst_isclass.<locals>.ProxycSs
||_dSr���_Proxy__objr(r;r;r<r0�szEClassPropertiesAndMethods.test_isinst_isclass.<locals>.Proxy.__init__cSs&|�d�rt�||�St|j|�SdS�NZ_Proxy__�r	rrgrEr�rer;r;r<rg�s
zMClassPropertiesAndMethods.test_isinst_isclass.<locals>.Proxy.__getattribute__N�r�r�r�r0rgr;r;r;r<r��sr�c@seZdZdS�z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.CNr�r;r;r;r<r��sr�c@seZdZdS�z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.DNr�r;r;r;r<r��sr�c@seZdZdSr�r�r;r;r;r<r��sc@seZdZdSr�r�r;r;r;r<r��s)rr�)r6r�r�r?�par�r;r;r<�test_isinst_isclass�s*	z-ClassPropertiesAndMethods.test_isinst_isclasscs\Gdd�dt�}Gdd�dt�}G�fdd�d|����}||�}|��jd|�d�dS)	Nc@seZdZdd�Zdd�ZdS)z9ClassPropertiesAndMethods.test_proxy_super.<locals>.ProxycSs
||_dSr�r�r(r;r;r<r0�szBClassPropertiesAndMethods.test_proxy_super.<locals>.Proxy.__init__cSs&|�d�rt�||�St|j|�SdSr�r�rer;r;r<rg�s
zJClassPropertiesAndMethods.test_proxy_super.<locals>.Proxy.__getattribute__Nr�r;r;r;r<r��sr�c@seZdZdd�ZdS)z5ClassPropertiesAndMethods.test_proxy_super.<locals>.BcSsdS)NzB.fr;rtr;r;r<r�sz7ClassPropertiesAndMethods.test_proxy_super.<locals>.B.fNrDr;r;r;r<r�srcseZdZ��fdd�Z�ZS)z5ClassPropertiesAndMethods.test_proxy_super.<locals>.Ccst�|���dS)Nz->C.f)rrrt)r�r�r;r<r�sz7ClassPropertiesAndMethods.test_proxy_super.<locals>.C.f)r�r�r�rrr;rurr<r��sr�rzB.f->C.f)rrBrF)r6r�rr�r�r;rur<�test_proxy_super�s	z*ClassPropertiesAndMethods.test_proxy_supercCsfzt�tdd�Wntk
r&YnX|�d�zt�td�Wntk
rVYnX|�d�dS)Nr�r�z"Carlo Verre __setattr__ succeeded!r;z"Carlo Verre __delattr__ succeeded!)rrjrsr�r�rmrtr;r;r<�test_carloverre�s
z)ClassPropertiesAndMethods.test_carloverrecCslGdd�dt�}Gdd�d�}Gdd�d||�}|dtfi�}z
d|_Wntk
rf|�d	�YnXdS)
Nc@seZdZdd�ZdS)zHClassPropertiesAndMethods.test_carloverre_multi_inherit_valid.<locals>.AcSst�|||�dSr�)rDrj�r�r�r�r;r;r<rj�szTClassPropertiesAndMethods.test_carloverre_multi_inherit_valid.<locals>.A.__setattr__N�r�r�r�rjr;r;r;r<r�src@seZdZdS)zHClassPropertiesAndMethods.test_carloverre_multi_inherit_valid.<locals>.BNr�r;r;r;r<r�src@seZdZdS)zHClassPropertiesAndMethods.test_carloverre_multi_inherit_valid.<locals>.CNr�r;r;r;r<r��sr�r�Tz1setattr through direct base types should be legal�rDrr�r�r��r6rrr�r�r;r;r<�#test_carloverre_multi_inherit_valid�s
z=ClassPropertiesAndMethods.test_carloverre_multi_inherit_validcCslGdd�dt�}Gdd�d�}Gdd�d||�}|dtfi�}z
d|_Wntk
r\YnX|�d	�dS)
Nc@seZdZdd�ZdS)zJClassPropertiesAndMethods.test_carloverre_multi_inherit_invalid.<locals>.AcSst�|||�dSr�)rrjr�r;r;r<rj�szVClassPropertiesAndMethods.test_carloverre_multi_inherit_invalid.<locals>.A.__setattr__Nr�r;r;r;r<r�src@seZdZdS)zJClassPropertiesAndMethods.test_carloverre_multi_inherit_invalid.<locals>.BNr�r;r;r;r<r�src@seZdZdS)zJClassPropertiesAndMethods.test_carloverre_multi_inherit_invalid.<locals>.CNr�r;r;r;r<r��sr�r�Tz6setattr through indirect base types should be rejectedr�r�r;r;r<�%test_carloverre_multi_inherit_invalid�s
z?ClassPropertiesAndMethods.test_carloverre_multi_inherit_invalidcs@ddl�G�fdd�d�}Gdd�dt�}|�}||�|_~dS)Nrcs eZdZ�fdd�Zdd�ZdS)zAClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provokercs��|�|_dSr��r�)r6Z	referrent�r�r;r<r0szJClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provoker.__init__cSs|��}dSr�r�r2r;r;r<r�szIClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provoker.__del__N)r�r�r�r0r�r;rr;r<�Provokersrc@seZdZdS)z=ClassPropertiesAndMethods.test_weakref_segfault.<locals>.OopsNr�r;r;r;r<�Oopssr)r�rZwhatever)r6rrrur;rr<�test_weakref_segfaults
z/ClassPropertiesAndMethods.test_weakref_segfaultcCs$dd�}td�D]
}|j}qd}dS)NcSsdSr�r;r;r;r;r<r�r�zAClassPropertiesAndMethods.test_wrapper_segfault.<locals>.<lambda>i@B)r�r)r6rr�r;r;r<�test_wrapper_segfaultsz/ClassPropertiesAndMethods.test_wrapper_segfaultcCsPtj}Gdd�d�}|�t_z&ztd�Wntk
r>YnXW5|t_XdS)Nc@seZdZdd�ZdS)z>ClassPropertiesAndMethods.test_file_fault.<locals>.StdoutGuardcSstjt_td|��dS)Nz!Premature access to sys.stdout.%s)r��
__stdout__�stdoutr�r�r;r;r<r� szJClassPropertiesAndMethods.test_file_fault.<locals>.StdoutGuard.__getattr__N�r�r�r�r�r;r;r;r<�StdoutGuardsrzOops!)r�rr�r�)r6Ztest_stdoutrr;r;r<�test_file_faults
z)ClassPropertiesAndMethods.test_file_faultcspG�fdd�dt�}Gdd�dt��G�fdd�dt����}d|j|�<|�|jd�t��|�|d	�dS)
Ncs eZdZdd�Z�fdd�ZdS)zHClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.EvilcSstd�S)Nr��r�rtr;r;r<r�3szQClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Evil.__hash__cs"z�`Wntk
rYnXdSr�)r�r�r�rur;r<r�5s
zOClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Evil.__eq__N�r�r�r�r�r�r;rur;r<�Evil2src@seZdZddd�ZdS)zIClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.DescrNcSsdSr�r;)r6�obrDr;r;r<r>szQClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Descr.__get__)Nr�r;r;r;r<�Descr=srcseZdZ��ZdS)zEClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.CN)r�r�r�r�r;�rr;r<r�Asr�rrer�)rrFrBr�rr�r�)r6rrWr;)r�rr<� test_vicious_descriptor_nonsense+sz:ClassPropertiesAndMethods.test_vicious_descriptor_nonsensecCs>Gdd�dt�}z
|�Wntk
r.YnX|�d�dS)Nc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_init.<locals>.FoocSsdS)Nr�r;rtr;r;r<r0Osz9ClassPropertiesAndMethods.test_init.<locals>.Foo.__init__Nrvr;r;r;r<�FooNsrz'did not test __init__() for None return)rr�r�)r6rr;r;r<�	test_initLs
z#ClassPropertiesAndMethods.test_initc	Cs||�t��||kW5QRX|�t��||kW5QRX|�t��||kW5QRX|�t��||kW5QRXdSr��rcr��r6r?rRr;r;r<�assertNotOrderableXsz,ClassPropertiesAndMethods.assertNotOrderablecCs�g}|�|j|jk�|�|j|jk�|�|jgjk�|�|jgjk�|�|j|jk�|�|j|jk�|�|j|j�|�|jjd�|�|jj|�|�|jj	t
�|�|jjt
jj�t|j�dS)NrP)
r�rPr�rorrBr�r�r
�__objclass__r2r�r��r6r�r;r;r<�test_method_wrapperbsz-ClassPropertiesAndMethods.test_method_wrappercCs�g}|�|j|jk�|�|j|jk�|�|jgjk�|�|jgjk�|�|j|jk�|�|j|jk�|�|j|j�|�|jjd�|�|jj|�|�|jj	t
jj	�t|j�dS)Nry)r�ryr��poprrBr�r�r
r�r2r�rr;r;r<�test_builtin_function_or_methodtsz9ClassPropertiesAndMethods.test_builtin_function_or_methodcCs�|�tjtjk�|�tjtjk�|�tjtjk�|�tjtjk�|�tjtj�|�tjjd�|�tjj	t�|�tj
tj
k�|�tj
tj
k�|�tj
tjk�|�tj
tjk�|�tj
tj
�|�tj
jd�|�tj
j	t�dS)NrPry)r�r2rPr�rorrBr�r�rryrrtr;r;r<�!test_special_unbound_method_types�sz;ClassPropertiesAndMethods.test_special_unbound_method_typescs�ddl�dd�}��fdd�}tjd}tj}dD]�\}}}d|d	d�}td
d||i�}	|	�}
|||
|
�|||
|�|||
|�|r2|||
|
�|||
|�|||
|�d|d	d�}td
d||i�}|�}
|||
|
�|||
|�|||
|�q2dS)NrcSstSr�r�r�r;r;r<�
specialmethod�szEClassPropertiesAndMethods.test_not_implemented.<locals>.specialmethodcs@zt|||�d��Wntk
r*YnX��d|f�dS)N)r3rX�operatorzno TypeError from %r)r]r�r�)r:r3rX�rr6r;r<rb�s
z=ClassPropertiesAndMethods.test_not_implemented.<locals>.checkre))rPzx + yzx += y)�__sub__zx - yzx -= y)rozx * yzx *= y)�
__matmul__zx @ yzx @= y)�__truediv__zx / yzx /= y)r�zx // yzx //= y)�__mod__zx % yzx %= y)�
__divmod__zdivmod(x, y)N)r�zx ** yzx **= y)�
__lshift__zx << yzx <<= y)�
__rshift__zx >> yzx >>= y)�__and__zx & yzx &= y)�__or__zx | yzx |= y)�__xor__zx ^ yzx ^= yZ__rrfrr;Z__ir�)rr�r�rD)r6rrbZN1ZN2r9r:ZiexprZrnamerr?Zinamer�rWr;rr<�test_not_implemented�s,
z.ClassPropertiesAndMethods.test_not_implementedcCs4Gdd�dt�}|�}d|dd�<|�|jd�dS)Nc@seZdZdd�ZdS)z6ClassPropertiesAndMethods.test_assign_slice.<locals>.CcSs
||_dSr��r�)r6�idxr�r;r;r<ra�szBClassPropertiesAndMethods.test_assign_slice.<locals>.C.__setitem__N)r�r�r�rar;r;r;r<r��sr�rgrerf)rrBr�)r6r�rWr;r;r<�test_assign_slice�sz+ClassPropertiesAndMethods.test_assign_slicecs�Gdd�dt�}|d��G�fdd�dt�}|�}|�|j��d|_|�|jd�Gdd�dt�}Gd	d�d|d
�}d|_|d�|_|�|jd�dS)Nc@seZdZdd�Zdd�ZdS)z<ClassPropertiesAndMethods.test_set_and_no_get.<locals>.DescrcSs
||_dSr��r9rer;r;r<r0�szEClassPropertiesAndMethods.test_set_and_no_get.<locals>.Descr.__init__cSs||j|j<dSr�)rFr9r'r;r;r<r��szDClassPropertiesAndMethods.test_set_and_no_get.<locals>.Descr.__set__N)r�r�r�r0r�r;r;r;r<r�srr?cseZdZ�ZdS�z8ClassPropertiesAndMethods.test_set_and_no_get.<locals>.XNr�r;�rar;r<rS�srSr�c@seZdZdS)z;ClassPropertiesAndMethods.test_set_and_no_get.<locals>.MetaNr�r;r;r;r<r��sr�c@seZdZdSr.r�r;r;r;r<rS�sr�)rr�r?rBrD)r6rrSr3r�r;r/r<�test_set_and_no_get�s
z-ClassPropertiesAndMethods.test_set_and_no_getcs�Gdd�dt�}|��G�fdd�dt�}G�fdd�dt�}G�fdd�dt�}|�tt|�d	�|��jd
�|�tt|�d	�|��jd�|�tt|�d	�|��jd�G�fd
d�dt��|�tt��d	�dS)Nc@seZdZdZddd�ZdS)z@ClassPropertiesAndMethods.test_getattr_hooks.<locals>.DescriptorrNcs�fdd�}|S)Ncs�jd7_t|��dSr�)r8r�r-rtr;r<r��szXClassPropertiesAndMethods.test_getattr_hooks.<locals>.Descriptor.__get__.<locals>.getterr;)r6r�Zobjtyper�r;rtr<r�szHClassPropertiesAndMethods.test_getattr_hooks.<locals>.Descriptor.__get__)N)r�r�r�r8rr;r;r;r<�
Descriptor�sr1cseZdZ�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.AN)r�r�r�rgr;r/r;r<rsrcseZdZ�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.BNrr;r/r;r<rsrcseZdZ�Z�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.CN)r�r�r�rgr�r;r/r;r<r�sr�r�rerfrjcs eZdZdd�Z�fdd�ZdS)zFClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattributecSst|��dSr�r�rer;r;r<r�szRClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattribute.__getattr__cs&�`td�D]}t��qt|��dS�Nrr)r�r�r�Zcollectr�)r6r9r���EvilGetattributer;r<rgs
zWClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattribute.__getattribute__Nr�r;r3r;r<r4sr4)rrcr�rErBr8)r6r1rrr�r;)r4rar<�test_getattr_hooks�s
z,ClassPropertiesAndMethods.test_getattr_hookscCs|�ttjtt�dSr�)rcr�rDrgr2rtr;r;r<�test_type___getattribute__sz4ClassPropertiesAndMethods.test_type___getattribute__c	Cs^|�tttd�Gdd�dt�}|�tt|d�Gdd�dt�}|�t��
|`W5QRXdS)N�__abstractmethods__c@seZdZdS)z<ClassPropertiesAndMethods.test_abstractmethods.<locals>.metaNr�r;r;r;r<�meta%sr8c@seZdZdS)z9ClassPropertiesAndMethods.test_abstractmethods.<locals>.XNr�r;r;r;r<rS(srS)rcr�rErDrr7)r6r8rSr;r;r<�test_abstractmethods"sz.ClassPropertiesAndMethods.test_abstractmethodsc	CsfGdd�d�}|�}|�|t�|�t��t�|�W5QRX|�t��t�|d�W5QRXdS)Nc@seZdZeZdS)z:ClassPropertiesAndMethods.test_proxy_call.<locals>.FakeStrN)r�r�r�rsr�r;r;r;r<�FakeStr.sr:r�)r�rsrcr�r�rP)r6r:Zfake_strr;r;r<�test_proxy_call-sz)ClassPropertiesAndMethods.test_proxy_callcCs<Gdd�d�}|j|_|�}|�tt|�|�tt|�dS)Nc@seZdZdS)z7ClassPropertiesAndMethods.test_repr_as_str.<locals>.FooNr�r;r;r;r<r@sr)r�r~rcr�rsr})r6rr�r;r;r<�test_repr_as_str=s
z*ClassPropertiesAndMethods.test_repr_as_strcCs>Gdd�dt�}|�}d|_|�|dd�|�||�dS)Nc@seZdZejZejZdS)z>ClassPropertiesAndMethods.test_mixing_slot_wrappers.<locals>.XN)r�r�r�r|rarjr��__neg__r;r;r;r<rSHsrSr�rX)r|rXrB)r6rSr3r;r;r<�test_mixing_slot_wrappersGs
z3ClassPropertiesAndMethods.test_mixing_slot_wrappersc	CsVGdd�dt�}|�}|�t��||kW5QRX|�t��||W5QRXdS)Nc@seZdZejZejZdS)zBClassPropertiesAndMethods.test_wrong_class_slot_wrapper.<locals>.AN)r�r�r�rsr�rPr;r;r;r<rSsr)r)rcr�)r6rr?r;r;r<�test_wrong_class_slot_wrapperPsz7ClassPropertiesAndMethods.test_wrong_class_slot_wrapperc	Cs>|�t��}Gdd�d�}W5QRXt|j�}|�d|�dS)Nc@seZdZdgZdZdS)zEClassPropertiesAndMethods.test_slot_shadows_class_variable.<locals>.Xr�N)r�r�r�r�r�r;r;r;r<rS^srSz0'foo' in __slots__ conflicts with class variable)rcr�rsrrB)r6rrSrLr;r;r<� test_slot_shadows_class_variable\s
z:ClassPropertiesAndMethods.test_slot_shadows_class_variablec	Cs�Gdd�d�}d|_|�|jd�|�t��}tt�jd�td�W5QRX|�dt	|j
��|�t��}t|�jd�|�W5QRX|�dt	|j
��|�|jd�dS)Nc@seZdZdZdS)z1ClassPropertiesAndMethods.test_set_doc.<locals>.XZelephantNrNr;r;r;r<rSesrSZbananar�Zblahzcan't set list.__doc__zcan't delete X.__doc__)r�rBrcr�rDr2rFr�rarsrr))r6rSrr;r;r<�test_set_docds z&ClassPropertiesAndMethods.test_set_docc	Cs$tjtjtjtjg}ddddg}t||�D]\}}|�t	|�j
|d�q*|D]$}|jjd|j
}|�|j|�qN|�tjjd�|�tjjd�|�tjjd	�|�tjjd
�Gdd�d�}|�
t��
|`W5QRX|�
tt	jd
jtd�Gdd�d�a|�tjd�|�tjjd�dS)Nr��memberZgetset�wrapperZ_descriptor�.z	str.lowerzcomplex.realz
float.realzint.__add__c@seZdZdS)z2ClassPropertiesAndMethods.test_qualname.<locals>.XNr�r;r;r;r<rS�srSr�ZOinkc@seZdZGdd�d�ZdS)rTc@seZdZdS)�Y.InsideNr�r;r;r;r<�Inside�srFN)r�r�r�rFr;r;r;r<rT�srTrE)rsr;r�r�r*r)rPr�rBrDr�rr�rcr�rFr�rTrF)r6ZdescriptorsrqrJ�n�qualnamerSr;r;r<�
test_qualnameqs*�z'ClassPropertiesAndMethods.test_qualnamecCs^ddi}tdd|�}|�|jd�|�d|j�|�|ddi�ddi}|�ttdd|�dS)Nr�z	some.namerr;re)rDrBr�r�rFrcr�)r6rBr�r;r;r<�test_qualname_dict�sz,ClassPropertiesAndMethods.test_qualname_dictcCs^Gdd�dt�}|�}d|_t�|�}~t��|�|��t��D]}|�	t
|�|�qDdS)Nc@seZdZdd�ZdS)z<ClassPropertiesAndMethods.test_cycle_through_dict.<locals>.XcSst�|�||_dSr�)r|r0rFrtr;r;r<r0�s
zEClassPropertiesAndMethods.test_cycle_through_dict.<locals>.X.__init__Nrvr;r;r;r<rS�srSr�)r|r�r�r�rr��assertIsNoner�r��assertIsNotrD)r6rSr3�wrrur;r;r<�test_cycle_through_dict�s
z1ClassPropertiesAndMethods.test_cycle_through_dictcCs�Gdd�d�}|�t|d�|jt|dd�Gdd�d�}Gdd�d�}Gd	d
�d
||�}|||fD]>}|d�|ddd�|�t|ddd�|jt|dddd
�qddS)Nc@seZdZdS)z[ClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNeitherNr�r;r;r;r<�OverrideNeither�srOrer	c@seZdZddd�ZdS)zWClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNewrc_stj|f|�|�Sr�r7)r�r�r�r7r�r;r;r<r��sz_ClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNew.__new__N)rrr;r;r;r<�OverrideNew�srPc@seZdZddd�ZdS)zXClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideInitrc_stj|f|�|�Sr�)rr0)r6r�r�r7r8r;r;r<r0�szaClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideInit.__init__N)rrvr;r;r;r<�OverrideInit�srQc@seZdZdS)zXClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideBothNr�r;r;r;r<�OverrideBoth�srRrfrgr/r)r6rOrPrQrRZcaser;r;r<�(test_object_new_and_init_with_parameters�szBClassPropertiesAndMethods.test_object_new_and_init_with_parameterscCs>Gdd�d�}Gdd�d|�}|�d|j�|�d|j�dS)Nc@seZdZdS)z\ClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptors.<locals>.BaseNr�r;r;r;r<r�src@seZdZdS)z[ClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptors.<locals>.SubNr�r;r;r;r<r�srrF)rarFr�)r6rrr;r;r<�4test_subclassing_does_not_duplicate_dict_descriptors�szNClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptorscsRGdd�d�}|�t|�j�d�Gdd�d�}Gdd�d|�}Gdd	�d	|�}|�}|�}|�}t||�}|�t|j�d
�|�t|j�d�|�t|j�d�|�t|j�d
�Gdd�d�}|�}	|�t|	j�d�|�t|j�d�Gdd�d�}
|
�}t�}t�||�}
|�t|
�d�d|_|�t|
�d�d|_|�t|
�d�dS)Nc@seZdZdd�ZdS)�=ClassPropertiesAndMethods.test_bound_method_repr.<locals>.FoocSsdSr�r;rtr;r;r<r��s�DClassPropertiesAndMethods.test_bound_method_repr.<locals>.Foo.methodN�r�r�r�r�r;r;r;r<r�srz4<bound method .*Foo\.method of <.*Foo object at .*>>c@seZdZdd�ZdS)z>ClassPropertiesAndMethods.test_bound_method_repr.<locals>.BasecSsdSr�r;rtr;r;r<r��szEClassPropertiesAndMethods.test_bound_method_repr.<locals>.Base.methodNrWr;r;r;r<r�src@seZdZdS)zBClassPropertiesAndMethods.test_bound_method_repr.<locals>.Derived1Nr�r;r;r;r<�Derived1�srXc@seZdZdd�ZdS)zBClassPropertiesAndMethods.test_bound_method_repr.<locals>.Derived2cSsdSr�r;rtr;r;r<r��szIClassPropertiesAndMethods.test_bound_method_repr.<locals>.Derived2.methodNrWr;r;r;r<�Derived2�srYz6<bound method .*Base\.method of <.*Base object at .*>>z:<bound method .*Base\.method of <.*Derived1 object at .*>>z><bound method .*Derived2\.method of <.*Derived2 object at .*>>z:<bound method .*Base\.method of <.*Derived2 object at .*>>c@seZdZedd��ZdS)rUcSsdSr�r;r�r;r;r<r��srVN)r�r�r�rHr�r;r;r;r<r�sz/<bound method .*Foo\.method of <class '.*Foo'>>c@seZdZdd�ZdS)zDClassPropertiesAndMethods.test_bound_method_repr.<locals>.MyCallablecSsdSr�r;r�r;r;r<r�szMClassPropertiesAndMethods.test_bound_method_repr.<locals>.MyCallable.__call__N)r�r�r�rr;r;r;r<�
MyCallable�srZz*<bound method \? of <object object at .*>>r9z,<bound method name of <object object at .*>>rHz0<bound method qualname of <object object at .*>>)	ZassertRegexr}r�rrrq�
MethodTyper�r�)r6rrrXrYr?Zderived1Zderived2Zsuper_d2r�rZrQ�instancer�rr;r<�test_bound_method_repr�s\�
������
�
�
�z0ClassPropertiesAndMethods.test_bound_method_reprNzneed the _testcapi modulecs*Gdd�d��G�fdd�d�}|jdS)Nc@seZdZejZdS)z6ClassPropertiesAndMethods.test_bpo25750.<locals>.DescrN)r�r�r�r�Zbad_getrr;r;r;r<rsrcseZdZ��Zdd�ZdS)z2ClassPropertiesAndMethods.test_bpo25750.<locals>.XcSsd|_dd�td�D�|_dS)NcSsg|]}d|�qSr�r;r�r;r;r<r�
szNClassPropertiesAndMethods.test_bpo25750.<locals>.X.__new__.<locals>.<listcomp>i')rar�r�r�r;r;r<r�sz:ClassPropertiesAndMethods.test_bpo25750.<locals>.X.__new__N)r�r�r�rar�r;rr;r<rSsrSr/r�r;rr<�
test_bpo25750�sz'ClassPropertiesAndMethods.test_bpo25750)�r�r�r�r�r�r�r�rdrtr~r�r�r�r�r�r�r�r�r�r�r�r�rrrZ
refcount_testrr�rrrrr"r.r1r.ZexpectedFailurer3r;rCrMrVrZr[r�r�r�r��skipIfr��flags�optimizer��cpython_onlyr�r�r�rrr@rGrMrZr_rerjrvr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr	rrrrrrr)r,r0r5r6r9r;r<r>r?r@rArIrJrNrSrTr]r�r^rr;r;rr<r��s4X")%
%=K&(F<2

1

"
"
G1
ib?�



CS^pN @OYYM	
.
',	A( 63
+'!
4
'
	
 
7r�c@s�eZdZdd�Ze�eed�o$e��d�dd��Z	e�eed�oFe��d�dd��Z
e�eed�ohe��d�d	d
��Zdd�Zd
d�Z
dS)�DictProxyTestscCsGdd�dt�}||_dS)Nc@seZdZdd�ZdS)zDictProxyTests.setUp.<locals>.CcSsdSr�r;rtr;r;r<rIsz$DictProxyTests.setUp.<locals>.C.methNrr;r;r;r<r�sr�)rr�r�r;r;r<�setUpszDictProxyTests.setUp�gettracez#trace function introduces __local__cCsB|jj��}|�|t�t|�}|��|�|dddddg�dS)NrFr�r�r�rI)r�rFrx�assertNotIsInstancer2�sortrB�r6rrxr;r;r<�test_iter_keyss�zDictProxyTests.test_iter_keyscCs4|jj��}|�|t�t|�}|�t|�d�dSr2)r�rFr�rfr2rBr�)r6rr�r;r;r<�test_iter_values szDictProxyTests.test_iter_valuescCsH|jj��}|�|t�dd�|D�}|��|�|dddddg�dS)NcSsg|]}|d�qSr�r;)r��itemr;r;r<r�/sz2DictProxyTests.test_iter_items.<locals>.<listcomp>rFr�r�r�rI)r�rFr3rfr2rgrBrhr;r;r<�test_iter_items)s�zDictProxyTests.test_iter_itemscCsNGdd�dt�}Gdd�dt�}Gdd�d|d�}|�t|j�t|j��dS)Nc@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.BNr�r;r;r;r<r6src@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.MNr�r;r;r;r<r�8sr�c@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.CNr�r;r;r;r<r�:sr�r�)rrDrBrF)r6rr�r�r;r;r<�test_dict_type_with_metaclass4sz,DictProxyTests.test_dict_type_with_metaclasscCs^t|jj�}|�|�d�|�|�|�d�|�|jj��D]\}}|�d�||�|�q<dS)Nz
mappingproxy(�)z
{!r}: {!r})	r}r�rFr�r	�endswithr3rar�)r6r�r�r�r;r;r<�	test_repr?s
zDictProxyTests.test_reprN)r�r�r�rdr.r_r�r�rerirjrlrmrpr;r;r;r<rcs�
	�
�
	rcc@seZdZdd�ZdS)�PTypesLongInitTestcCs>Gdd�dt�}ztd|�d�WnYnXt�t�dS)Nc@seZdZdd�ZdS)z;PTypesLongInitTest.test_pytype_long_ready.<locals>.UserLongcWsdSr�r;r9r;r;r<r�TszCPTypesLongInitTest.test_pytype_long_ready.<locals>.UserLong.__pow__N)r�r�r�r�r;r;r;r<�UserLongSsrrr)rrrDrEr�)r6rrr;r;r<�test_pytype_long_readyLsz)PTypesLongInitTest.test_pytype_long_readyN)r�r�r�rsr;r;r;r<rqJsrqc@seZdZdd�ZdS)�	MiscTestscsjG��fdd�dt�}Gdd�dt�}Gdd�dt��td|f|�di��|��jd	�|��jd
�dS)Ncs"eZdZdd�Z��fdd�ZdS)z7MiscTests.test_type_lookup_mro_reference.<locals>.MyKeycSstd�S)N�mykeyr
rtr;r;r<r�fsz@MiscTests.test_type_lookup_mro_reference.<locals>.MyKey.__hash__cs�f�_dSr�rzr���Base2rSr;r<r�isz>MiscTests.test_type_lookup_mro_reference.<locals>.MyKey.__eq__Nrr;rvr;r<�MyKeyesrxc@seZdZdZdZdS)z6MiscTests.test_type_lookup_mro_reference.<locals>.Base�	from BaseN�r�r�r�ru�mykey2r;r;r;r<rlsrc@seZdZdZdZdS)z7MiscTests.test_type_lookup_mro_reference.<locals>.Base2�
from Base2Nrzr;r;r;r<rwpsrwrSrrryr|)rrDrBrur{)r6rxrr;rvr<�test_type_lookup_mro_referenceasz(MiscTests.test_type_lookup_mro_referenceN)r�r�r�r}r;r;r;r<rt`srtc@sfeZdZdidddfdd�Zdd�Zdd�Zdd	d
�Zedd��Zd
d�Z	dd�Z
dd�Zdd�ZdS)�
PicklingTestsr;Nc
CsB|dkr�|�|�}|rD|�|dtj�|�|dt|�||f�n,|�|dtj�|�|dt|�f|�|�|d|�|dk	r�|�t|d�|�n|�|d�|dk	r�|�	t
|d�|�n|�|d�ndt|�j}	tjt|�|	|	t
kr�dn|	|�ff}|dk	�r||f7}|�|�|�|�|�|��|�dS)Nrfrrergrj)�
__reduce_ex__rB�copyreg�
__newobj_ex__rD�
__newobj__�assertListEqualr2rK�assertDictEqualr|�__base__�_reconstructorr�
__reduce__)
r6�protor�r7r8r��	listitems�	dictitemsZreduce_valueZ	base_typer;r;r<�
_check_reduce}s2

��

zPicklingTests._check_reducecs�ttjd�}d�ddd��ddi�G�fdd	�d	�}|�}|D]}|�||��q@���D]\}}t|||�q\|D]}|j||��d
�qvGdd�d�}|�}|D],}|d
kr�|�t��|�|�W5QRXq�G��fdd�d�}|�}|D]}|d
kr�|�||���q�G�fdd�d�}	G�fdd�d�}
Gdd�d�}Gdd�d�}|D]N}|	|
||fD]:}
|
�}|d
k�rd|�tt	f��|�|�W5QRX�qd�qTG�fdd�d�}|�}|D]}|�||���q�Gdd�d�}|�}|D]0}|d
k�r�|�t
��|�|�W5QRX�q�G�fdd�d�}|�}|D]}|j||�d
��q<Gdd�d�}|�}|D]}|j||d d
��qlGd!d"�d"�}|�}|D]N}|�t
��|�|�W5QRX|d
k�r�|�t
��|��W5QRX�q�G�fd#d$�d$�}|�}|D]d}|d
k�r,|j||d�fd
�n>|�t��|�|�W5QRX|�t��|��W5QRX�qGd%d&�d&t�}|d'd(i�}|D]}|j||t|�d)��q�Gd*d+�d+t
�}|d,g�}|D]}|j||t
|�d-��q�dS).Nre)i����r�i7���i���)ZbaconZfish�cheeseio���cseZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C1cs�Sr�r;rtrmr;r<�__getnewargs__�sz4PicklingTests.test_reduce.<locals>.C1.__getnewargs__N�r�r�r�r�r;rmr;r<r��sr�r�c@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C2cSsdS�Nzbad argsr;rtr;r;r<r��sz4PicklingTests.test_reduce.<locals>.C2.__getnewargs__Nr�r;r;r;r<rN�srNrfcseZdZ��fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C3cs��fSr�r;rtr<r;r<�__getnewargs_ex__�sz7PicklingTests.test_reduce.<locals>.C3.__getnewargs_ex__N�r�r�r�r�r;r<r;r<r��sr�cseZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C4cs�dfS)Nzbad dictr;rtrmr;r<r��sz7PicklingTests.test_reduce.<locals>.C4.__getnewargs_ex__Nr�r;rmr;r<r��sr�cseZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C5csd�fS)Nz	bad tupler;rt�r8r;r<r��sz7PicklingTests.test_reduce.<locals>.C5.__getnewargs_ex__Nr�r;r�r;r<�C5�sr�c@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C6cSsdS)Nr;r;rtr;r;r<r��sz7PicklingTests.test_reduce.<locals>.C6.__getnewargs_ex__Nr�r;r;r;r<�C6�sr�c@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C7cSsdSr�r;rtr;r;r<r��sz7PicklingTests.test_reduce.<locals>.C7.__getnewargs_ex__Nr�r;r;r;r<�C7�sr�cseZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C9cs�ifSr�r;rtrmr;r<r��sz7PicklingTests.test_reduce.<locals>.C9.__getnewargs_ex__Nr�r;rmr;r<�C9�sr�c@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C10cSst�dSr�r�rtr;r;r<r��sz8PicklingTests.test_reduce.<locals>.C10.__getnewargs_ex__Nr�r;r;r;r<�C10�sr�cseZdZ�fdd�ZdS)z&PicklingTests.test_reduce.<locals>.C11cs�Sr�r;rtr�r;r<r��sz3PicklingTests.test_reduce.<locals>.C11.__getstate__N�r�r�r�r�r;r�r;r<�C11�sr�c@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C12cSsdS)N�not dictr;rtr;r;r<r��sz3PicklingTests.test_reduce.<locals>.C12.__getstate__Nr�r;r;r;r<�C12�sr�r�c@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C13cSst�dSr�r�rtr;r;r<r��sz3PicklingTests.test_reduce.<locals>.C13.__getstate__Nr�r;r;r;r<�C13�sr�cs eZdZe��Z�fdd�ZdS)z&PicklingTests.test_reduce.<locals>.C14cs"���D]\}}t|||�qdSr��r3r
rkr�r;r<r0�sz/PicklingTests.test_reduce.<locals>.C14.__init__N)r�r�r�r�r�r0r;r�r;r<�C14�sr�c@seZdZdS)z&PicklingTests.test_reduce.<locals>.C15Nr�r;r;r;r<�C15
sr�Zquebeci����)r�c@seZdZdS)z&PicklingTests.test_reduce.<locals>.C16Nr�r;r;r;r<�C16sr�Zyukon)r�)r��pickle�HIGHEST_PROTOCOLr�r3r
rcr�rr�r�r�r|r2)r6�	protocolsr�r�r�r9r�rNr�r�r�r�r�r�r�r�r�r�r�r�r�r�r;)r7r8r�r<�test_reduce�s�





zPicklingTests.test_reducecCsLttjd�}Gdd�d�}|D]&}|dkr0ind}|j||�|d�q dS)Nrec@seZdZdd�Zdd�ZdS)z7PicklingTests.test_special_method_lookup.<locals>.PickycSsiSr�r;rtr;r;r<r�szDPicklingTests.test_special_method_lookup.<locals>.Picky.__getstate__cSs|dkrt|��dS)N)r�r�r<r�r;r;r<r�szCPicklingTests.test_special_method_lookup.<locals>.Picky.__getattr__N)r�r�r�r�r�r;r;r;r<�Pickysr�rfr�)r�r�r�r�)r6r�r��protocolr�r;r;r<r�s
z(PicklingTests.test_special_method_lookupcCs|dkrd�||�}t|�jtjkr,td��|j|||d�|jt|�t|�|d�t|d�r�|j|j	|j	|d�|j|j	|j	|d�t|d�r�|j
|j|j|d�|jD]@}|jt||�t||�|d�|jt
||d�t
||d�|d�q�|jt|�t|�|d�dS)zKUtility method to verify if two objects are copies of each others.
        Nz{!r} is not a copy of {!r}zCobject passed to _assert_is_copy must override the __repr__ method.)r�rFr�)r�rDr~rr�rLr�r�r�rFr�r�rBrEr})r6r��objcopyr��slotr;r;r<�_assert_is_copy$s,


�
�zPicklingTests._assert_is_copycsDGdd�d���fdd�t�ttjd�tjtjhtjtjh�D�S)zLUtility method to generate the many possible pickle configurations.
        c@s(eZdZdZdd�Zdd�Zdd�ZdS)	z<PicklingTests._generate_pickle_copiers.<locals>.PickleCopierz&This class copies object using pickle.cSs||_||_||_dSr�)r��dumps�loads)r6r�r�r�r;r;r<r0DszEPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.__init__cSs|�|�||j��Sr�)r�r�r�r(r;r;r<r�HszAPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.copycSs$d�|j|jj|jj|jj|jj�S)Nz0PickleCopier(proto={}, dumps={}.{}, loads={}.{}))r�r�r�r�r�r�rtr;r;r<r~Js�zEPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.__repr__N)r�r�r�r�r0r�r~r;r;r;r<�PickleCopierBsr�c3s|]}�|�VqdSr�r;)r�r7�r�r;r<�	<genexpr>Rsz9PicklingTests._generate_pickle_copiers.<locals>.<genexpr>re)	�	itertools�productr�r�r�r��_dumpsr��_loadsr;r;r�r<�_generate_pickle_copiers>s


��z&PicklingTests._generate_pickle_copiersc
CsFGdd�d�a|�t��t�t�d�W5QRXGdd�dt�a|�t��t�t�d�W5QRXGdd�d�aGdd�dt�aGdd	�d	t�a|��D]�}|j|d
���t�}|�	|�}|�
||�d|_|�	|�}|�
||�t�}d|_d|_|�	|�}|�
||�t�}d|_d
|_|�	|�}|�
||�W5QRXq�dS)Nc@seZdZdgZdS)r�r?Nr�r;r;r;r<r�]sr�rc@seZdZdS)r�Nr�r;r;r;r<r�csr�c@s.eZdZdZdgZdd�Zdd�Zdd�Zd	S)
r�z7A class with __getstate__ and __setstate__ implemented.r?c
Ss`t|di���}t|�jD]@}|j�dd�D],}zt||�||<Wq,tk
rVYq,Xq,q|S)NrFr�r;)rEr�rDr}rFr�r�)r6r�r�r�r;r;r<r�ks
zC.__getstate__cSs"|��D]\}}t|||�qdSr�r�)r6r�r�r�r;r;r<r�tszC.__setstate__cSsdt|�j|��fS)Nz%s()<%r>)rDr�r�rtr;r;r<r~wsz
C.__repr__N)r�r�r�r�r�r�r�r~r;r;r;r<r�hs
	c@seZdZdZdS)r�z!A subclass of a class with slots.NrNr;r;r;r<r�zsc@seZdZdZdgZdS)r(zA subclass with an extra slot.rRN)r�r�r�r�r�r;r;r;r<r(sr()�
pickle_copierr�r�r�)
r�rcr�r�r�r�r(r��subTestr�r�r?rR)r6r�r3rXr;r;r<�test_pickle_slotsWs6



zPicklingTests.test_pickle_slotsc

CsnGdd�d�aGdd�dt�aGdd�dt�aGdd�dt�aGd	d
�d
t�atttttf}|��}t�	||�D]�\}}|j
||d��ht|di�}||j|�}|j
}|�|�}|�||�|d
kr�|js�|j��|�|�}	|�||	�W5QRXqp|D]n}|j
|d��Xt|di�}||j|�}t|�}|�||�|j�s^|j��t|�}	|�||	�W5QRXq�dS)Ncs0eZdZdZdZdZ�fdd�Zdd�Z�ZS)r�z:The state of this class is copyable via its instance dict.r�Tcst���||_||_dSr�)rr0r?rRrrr;r<r0�s
zC1.__init__cSsd|j|jfS)Nz
C1(%r, %r)rQrtr;r;r<r~�szC1.__repr__)	r�r�r�r��ARGS�NEED_DICT_COPYINGr0r~rr;r;rr<r��s
r�csHeZdZdZdZdZ�fdd�Z�fdd�Zedd	��Z	d
d�Z
�ZS)rNz,A list subclass copyable via __getnewargs__.r�Fcst��|�}||_||_|Sr��rr�r?rR)r�r?rRr6rr;r<r��sz
C2.__new__cst���|�d�dS�Nr�)rr0ryr9rr;r<r0�s
zC2.__init__cSs|jSr��r�r�r;r;r<r��szC2.__getnewargs__cSsd|j|jt|�fS)NzC2(%r, %r)<%r>�r?rRr2rtr;r;r<r~�szC2.__repr__)r�r�r�r�r�r�r�r0rHr�r~rr;r;rr<rN�s
rNc@s<eZdZdZdZdZdd�Zedd��Zdd	�Z	d
d�Z
dS)
r�z*A list subclass copyable via __getstate__.r�FcSs||_||_|�d�dSr�)r?rRryrr;r;r<r0�szC3.__init__cSs|jSr�r�r�r;r;r<r��szC3.__getstate__cSs|\}}||_||_dSr�rQ)r6r�r?rRr;r;r<r��szC3.__setstate__cSsd|j|jt|�fS)NzC3(%r, %r)<%r>r�rtr;r;r<r~�szC3.__repr__N)r�r�r�r�r�r�r0rHr�r�r~r;r;r;r<r��s
r�cs<eZdZdZdZdZ�fdd�Zedd��Zdd	�Z	�Z
S)
r�z,An int subclass copyable via __getnewargs__.)rxrwreFcst��||�}||_||_|Sr�r��r�r?rRr�r6rr;r<r��sz
C4.__new__cSs|jSr�r�r�r;r;r<r��szC4.__getnewargs__cSsd|j|jt|�fS)NzC4(%r, %r)<%r>�r?rRr)rtr;r;r<r~�szC4.__repr__)r�r�r�r�r�r�r�rHr�r~rr;r;rr<r��s
r�csJeZdZdZdZddiZdZdd��fdd	�
Zed
d��Z	dd
�Z
�ZS)r�z/An int subclass copyable via __getnewargs_ex__.r�r�rgFrr*cst��||�}||_||_|Sr�r�r�rr;r<r��sz
C5.__new__cSs|j|jfSr�)r��KWARGSr�r;r;r<r��szC5.__getnewargs_ex__cSsd|j|jt|�fS)NzC5(%r, %r)<%r>r�rtr;r;r<r~�szC5.__repr__)r�r�r�r�r�r�r�r�rHr�r~rr;r;rr<r��s
r�)r�r�r�rfr�)r�r2rNr�r)r�r�r�r�r�r�rEr�r�r�r�r�rFrbr)
r6Ztest_classesZpickle_copiersr�r�r8r�r�r�Zobjcopy2r;r;r<�test_reduce_copying�s8



z!PicklingTests.test_reduce_copyingcs^Gdd�dt��G��fdd�d��ddl}|j�fdddifddf}|����d�|�dS)	Nc@seZdZdS)z(PicklingTests.test_issue24097.<locals>.SNr�r;r;r;r<r�sr�cs$eZdZ�d�gZ��fdd�ZdS)z(PicklingTests.test_issue24097.<locals>.Ar�cs(|dkr �d�g�jdd�<dSt�dS)Nr�r�)�
__slotnames__r�r��rr�r;r<r�sz4PicklingTests.test_issue24097.<locals>.A.__getattr__N)r�r�r�r�r�r;r�r;r<rs
rrr�r�rf)rsr�r�rBr)r6r�r�r;r�r<�test_issue24097s
	zPicklingTests.test_issue24097c	Cs~t���|�t��t��d�W5QRXt��d�|�t��t���W5QRX|�t��t��d�W5QRXdSr�)rr�rcr�rrtr;r;r<�test_object_reduce's
z PicklingTests.test_object_reduce)N)
r�r�r�r�r�r�r�rr�r�r�r�r�r;r;r;r<r~{s�
{

C|r~c@seZdZejdd��ZdS)�SharedKeyTestscCs6Gdd�d�}Gdd�d|�}|�|�}}|�t�t|��t�t|���|�t�t|��t�ddi��td�\|_|_|_|_	|_
|_|�t�t|��t�t|���|�}|�t�t|��t�t|���|�t�t|��t�ddi��td�\|_|_
|_	|_
|_|_|�t�t|��t�ddi��dS)Nc@seZdZdS)z)SharedKeyTests.test_subclasses.<locals>.ANr�r;r;r;r<r:src@seZdZdS)z)SharedKeyTests.test_subclasses.<locals>.BNr�r;r;r;r<r<srr?rers)rBr�r��varsZ
assertLessr�r3rXr��wr�r�r�rKr�r�)r6rrr?rRr�r;r;r<�test_subclasses7s       zSharedKeyTests.test_subclassesN)r�r�r�rrbr�r;r;r;r<r�5sr�c@s eZdZdZdd�Zdd�ZdS)�DebugHelperMetaz<
    Sets default __doc__ and simplifies repr() output.
    cCs&|�d�dkr||d<t�||||�S)Nr�)r�rDr�)rAr9rr�r;r;r<r�QszDebugHelperMeta.__new__cCs
t|j�Sr�)r}r�r�r;r;r<r~UszDebugHelperMeta.__repr__N)r�r�r�r�r�r~r;r;r;r<r�Msr�c@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�MroTestz�
    Regressions for some bugs revealed through
    mcsl.mro() customization (typeobject.c: mro_internal()) and
    cls.__bases__ assignment (typeobject.c: type_set_bases()).
    cCsd|_d|_dS)NrF)�step�readyrtr;r;r<rd`sz
MroTest.setUpcCs |j|k}|r|jd7_|Sr�)r�)r6�limit�retr;r;r<�
step_untilds
zMroTest.step_untilcs*G�fdd�dt�}Gdd�d|d�}dS)zM
        type_set_bases must be aware that type->tp_mro can be NULL.
        cseZdZ�fdd�ZdS)z4MroTest.test_incomplete_set_bases_on_self.<locals>.Mcs"��d�r|jd7_t�|�S)Nrer;)r�rGrDrEr�rtr;r<rEos
z8MroTest.test_incomplete_set_bases_on_self.<locals>.M.mroNrHr;rtr;r<r�nsr�c@seZdZdS)z4MroTest.test_incomplete_set_bases_on_self.<locals>.ANr�r;r;r;r<rvsrr�N�r��r6r�rr;rtr<�!test_incomplete_set_bases_on_selfjsz)MroTest.test_incomplete_set_bases_on_selfcsJG��fdd�dt�}Gdd�d|d��Gdd�d��}|jd7_d	S)
z?
        Deep reentrancy must not over-decref old_mro.
        cseZdZ��fdd�ZdS)z/MroTest.test_reent_set_bases_on_base.<locals>.Mcs6|jdk	r,|jdkr,��d�r,�jd7_t�|�S)Nrr�r;)r}r�r�rGrDrEr��rr6r;r<rE~s
z3MroTest.test_reent_set_bases_on_base.<locals>.M.mroNrHr;r�r;r<r�}sr�c@seZdZdS)z/MroTest.test_reent_set_bases_on_base.<locals>.ANr�r;r;r;r<r�srr�c@seZdZdS)z/MroTest.test_reent_set_bases_on_base.<locals>.BNr�r;r;r;r<r�srr;N)r�rG)r6r�rr;r�r<�test_reent_set_bases_on_baseys	z$MroTest.test_reent_set_bases_on_basecsJG�fdd�dt�}Gdd�d|d�}Gdd�d|�}Gdd	�d	|�}d
S)zU
        Similar to test_reent_set_bases_on_base, but may crash differently.
        cseZdZ�fdd�ZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.Mcs4|jd}|tk	r*��d�r*|jd7_t�|�S)Nrrrr;)rGrr�rDrE)r�r?rtr;r<rE�s


z:MroTest.test_reent_set_bases_on_direct_base.<locals>.M.mroNrHr;rtr;r<r��sr�c@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.ANr�r;r;r;r<r�srr�c@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.BNr�r;r;r;r<r�src@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.CNr�r;r;r;r<r��sr�Nr�)r6r�rrr�r;rtr<�#test_reent_set_bases_on_direct_base�s	z+MroTest.test_reent_set_bases_on_direct_basec	sxG���fdd�dt�}Gdd�d|d�}Gdd�d|��Gdd	�d	|��d
�_��t���jd7_W5QRXdS)
aM
        type_set_bases must check for an inheritance cycle not only through
        MRO of the type, which may be not yet updated in case of reentrance,
        but also through tp_base chain, which is assigned before diving into
        inner calls to mro().

        Otherwise, the following snippet can loop forever:
            do {
                // ...
                type = type->tp_base;
            } while (type != NULL);

        Functions that rely on tp_base (like solid_base and PyType_IsSubtype)
        would not be happy in that case, causing a stack overflow.
        cseZdZ���fdd�ZdS)z5MroTest.test_reent_set_bases_tp_base_cycle.<locals>.Mcs4�jr*|jdkr�f�_|jdkr*�f�_t�|�S)N�B1�B2�r�r�rGrDrEr��r�r�r6r;r<rE�s

z9MroTest.test_reent_set_bases_tp_base_cycle.<locals>.M.mroNrHr;r�r;r<r��sr�c@seZdZdS)z5MroTest.test_reent_set_bases_tp_base_cycle.<locals>.ANr�r;r;r;r<r�srr�c@seZdZdS)z6MroTest.test_reent_set_bases_tp_base_cycle.<locals>.B1Nr�r;r;r;r<r��sr�c@seZdZdS)z6MroTest.test_reent_set_bases_tp_base_cycle.<locals>.B2Nr�r;r;r;r<r��sr�Tr;N)r�r�rcr�rGr�r;r�r<�"test_reent_set_bases_tp_base_cycle�s	z*MroTest.test_reent_set_bases_tp_base_cyclecs�G���fdd�dt�}Gdd�d|d�}Gdd�d|�}Gdd	�d	|��Gd
d�d|��d�_|f�_�f|_���j�f�������g���|��g���|j�f������|g�d
S)a�
        type_set_bases must check for reentrancy upon finishing its job
        by updating tp_subclasses of old/new bases of the type.
        Otherwise, an implicit inheritance cycle through tp_subclasses
        can break functions that recurse on elements of that field
        (like recurse_down_subclasses and mro_hierarchy) eventually
        leading to a stack overflow.
        cseZdZ���fdd�ZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.Mcs(�jr|jdkrd�_�f�_t�|�S�Nr�Fr�r��r�r�r6r;r<rE�sz?MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.M.mroNrHr;r�r;r<r��sr�c@seZdZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.ANr�r;r;r;r<r�srr�c@seZdZdS)z<MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.B1Nr�r;r;r;r<r��sr�c@seZdZdS)z<MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.B2Nr�r;r;r;r<r��sr�c@seZdZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.CNr�r;r;r;r<r��sr�TN)r�r�rGrBr��r6r�rr�r;r�r<�(test_tp_subclasses_cycle_in_update_slots�s	z0MroTest.test_tp_subclasses_cycle_in_update_slotsc	s�Gdd�dt��G����fdd�dt�}Gdd�d|d�}Gdd	�d	|�}Gd
d�d|��Gdd
�d
|��d�_�����|f�_W5QRX�f|_���j�f����jtt�	����dS)z�
        The same as test_tp_subclasses_cycle_in_update_slots, but tests
        a code path executed on error (goto bail).
        c@seZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.ENr�r;r;r;r<r(�sr(cseZdZ����fdd�ZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.Mcs:�jr0|jdkr0�j�fkr$d�_n�f�_��t�|�Sr�r�r��r�r�r(r6r;r<rE�szAMroTest.test_tp_subclasses_cycle_error_return_path.<locals>.M.mroNrHr;r�r;r<r��sr�c@seZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.ANr�r;r;r;r<r�srr�c@seZdZdS)z>MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.B1Nr�r;r;r;r<r��sr�c@seZdZdS)z>MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.B2Nr�r;r;r;r<r��sr�c@seZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.CNr�r;r;r;r<r��sr�TN)
r�r�r�rcrGrBr}r�rDrEr�r;r�r<�*test_tp_subclasses_cycle_error_return_path�s
z2MroTest.test_tp_subclasses_cycle_error_return_pathcs*G�fdd�dt�}Gdd�d|d�}dS)z�
        Extending an unitialized type with type->tp_mro == NULL must
        throw a reasonable TypeError exception, instead of failing
        with PyErr_BadInternalCall.
        cseZdZ�fdd�ZdS)z)MroTest.test_incomplete_extend.<locals>.Mc	sD|jdkr:|jdkr:��t��Gdd�d|�}W5QRXt�|�S)NrSc@seZdZdS)z8MroTest.test_incomplete_extend.<locals>.M.mro.<locals>.XNr�r;r;r;r<rSs)r}r�rcr�rDrE)r�rSrtr;r<rEsz-MroTest.test_incomplete_extend.<locals>.M.mroNrHr;rtr;r<r�sr�c@seZdZdS)z)MroTest.test_incomplete_extend.<locals>.ANr�r;r;r;r<rsrr�Nr�r�r;rtr<�test_incomplete_extend
s	zMroTest.test_incomplete_extendcs*G�fdd�dt�}Gdd�d|d�}dS)z�
        Attrubute lookup on a super object must be aware that
        its target type can be uninitialized (type->tp_mro == NULL).
        cseZdZ��fdd�Z�ZS)z(MroTest.test_incomplete_super.<locals>.Mc	s6|jdkr,��t��t||�jW5QRXt�|�Sr�)r}rcr�rZxxxrDrEr�r�r;r<rE"s
z,MroTest.test_incomplete_super.<locals>.M.mro)r�r�r�rErr;rtrr<r�!sr�c@seZdZdS)z(MroTest.test_incomplete_super.<locals>.ANr�r;r;r;r<r)srr�Nr�r�r;rtr<�test_incomplete_superszMroTest.test_incomplete_superN)r�r�r�r�rdr�r�r�r�r�r�r�r�r�r;r;r;r<r�Ys$$"r�c
Cst�tttttttt	�dSr�)
rZrun_unittestrqrr�rcrtr~r�r�r;r;r;r<�	test_main-s�r��__main__)r�r�r�r�r�r�r�rqr.r?r�r�rr�rr�r�r/rr�rcrqrtr~r�rDr�r�r�r�r;r;r;r<�<module>s�
x%<=U


F1le Man4ger