HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_descr.cpython-37.pyc
B

��g���@s,ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZGdd�dej�ZGdd�dej�ZGdd	�d	ej�ZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�dej�Zdd�Zedk�r(e�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�|_x>t|j���D],\}}|��rn|d}nd|}||j|<qTWddddddd�|_x>t|j���D],\}}|��r�|d}nd|}||j|<q�WdS)N�+�-�*�@�/z//�divmodz**z<<z>>�&�^�|�cmp�<z<=z==z!=�>z>=)�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�r7�+/usr/local/lib/python3.7/test/test_descr.pyr,sJ



zOperatorsTest.__init__�len(a)�__len__c	Cs�d|i}|�t||�|�t|�}t||�}x||jkrD|jd}q.W|�t|d|�|j|�|�||�|�t||�}|�|�|�dS)N�ar�im_func)�assertEqual�eval�type�getattr�__dict__�	__bases__)	r2r;�resr6�meth�d�t�m�bmr7r7r8�	unop_testCs

zOperatorsTest.unop_test�a+b�__add__c
Cs�||d�}|�t||�|�t|�}t||�}x||jkrF|jd}q0W|�t|d|�|j|�|�|||�|�t||�}	|�|	|�|�dS)N)r;�brr<)r=r>r?r@rArB)
r2r;rLrCr6rDrErFrGrHr7r7r8�
binop_testSs


zOperatorsTest.binop_test�a[b:c]�__getitem__cCs�|||d�}|�t||�|�t|�}t||�}	x||jkrH|jd}q2W|�t|	d|	�|j|�|�|	|t||��|�t||�}
|�|
t||��|�dS)N)r;rL�crr<)r=r>r?r@rArB�slice)r2r;rLrPrCr6rDrErFrGrHr7r7r8�sliceop_testbs

zOperatorsTest.sliceop_test�a+=b�__iadd__c
Cs�t|�|d�}t||�|�|d|�t|�}t||�}x||jkrR|jd}q<W|�t|d|�|j|�t|�|d<||d|�|�|d|�t|�|d<t|d|�}	|	|�|�|d|�dS)N)r;rLr;rr<)r�execr=r?r@rArB)
r2r;rLrC�stmtrDrErFrGrHr7r7r8�
setop_testps

zOperatorsTest.setop_test�a[b]=c�__setitem__cCs�t|�||d�}t||�|�|d|�t|�}t||�}	x||jkrT|jd}q>W|�t|	d|	�|j|�t|�|d<|	|d||�|�|d|�t|�|d<t|d|�}
|
||�|�|d|�dS)N)r;rLrPr;rr<)rrUr=r?r@rArB)r2r;rLrPrCrVrDrErFrGrHr7r7r8�set2op_test�s


zOperatorsTest.set2op_test�a[b:c]=dcCs�t|�|||d�}t||�|�|d|�t|�}	x||	jkrL|	jd}	q6Wt|	|�}
|�t|
d|
�|	j|�t|�|d<|
|dt||�|�|�|d|�t|�|d<t|d|�}|t||�|�|�|d|�dS)N)r;rLrPrEr;rr<)rrUr=r?rArBr@rQ)r2r;rLrPrErCrVrDZ
dictionaryrFrGrHr7r7r8�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��za+brK�zb in a�__contains__�rza[b]rOza[b:c]za+=brTza*=b�__imul__zlen(a)r:za*b�__mul__zb*a�__rmul__za[b]=crY��za[b:c]=d)rMrRrWrIrZr\)r2r7r7r8�
test_lists�s"""$zOperatorsTest.test_listsc	Csh|�ddd�dddd�|�ddd�dddd�|�ddd�dddd	�ddd�}g}xt|���D]}|�|�qdWg}xt|�D]}|�|�q�W|�||�g}x|��D]}|�|�q�W|�||�g}xt�|�D]}|�|�q�W|�||�ddd�}|�|dd
d�|�t	t
|�i�|�|�t	|��i�|�|�ddd�dddddd
�dd�dS)Nr^ra)r]r_r]zb in ar`rza[b]rOzlen(a)r:r_)r]r^r_za[b]=crY)
rMr.�keys�append�iterr=�__iter__�dictrIr>�repr�__repr__rZ)r2rE�l1�i�lr7r7r8�
test_dicts�s2

zOperatorsTest.test_dictscCs�||d�}xL|j��D]>\}}||krd|}t||�rt||�}|�|||||�qWxNt|j���D]<\}}||krhd|}t||�rht||�}|�||||�qhWdS)N)r;rLz__%s__)r-r/�hasattrr>rMr.r1rI)r2r;rL�skiprlr5r6rCr7r7r8�number_operators�s




zOperatorsTest.number_operatorscCs~|�dd�|�d��d�|�d��d�Gdd�dt�}|�|d�d�y|�dWntk
rnYnX|�d	�dS)
N�dr_r]rc@seZdZdd�ZdS)z"OperatorsTest.test_ints.<locals>.CcSstS)N)�NotImplemented)r2�otherr7r7r8rK�sz*OperatorsTest.test_ints.<locals>.C.__add__N)�__name__�
__module__�__qualname__rKr7r7r7r8�C�sr|re�z+NotImplemented should have caused TypeError)rur=�__bool__r%�	TypeError�fail)r2r|r7r7r8�	test_ints�szOperatorsTest.test_intscCs|�dd�dS)NgY@g@)ru)r2r7r7r8�test_floats�szOperatorsTest.test_floatscCs�|jddddddddd	d
dg	d�Gd
d�dt�}|ddd�}|�t|�d�|�|jd�||dd�}|�t|�d�|�|jd�|d�}|�t|�d�|�|jd�dS)NyY@y@rrr!r"r%r&rr
�mod)rtc@s&eZdZdgZdd�Zdd�ZeZdS)z,OperatorsTest.test_complexes.<locals>.Number�precc_s"tj|f|��}|�dd�|_|S)Nr��)�complex�__new__�getr�)�clsr3�kwds�resultr7r7r8r�sz4OperatorsTest.test_complexes.<locals>.Number.__new__cSsJ|j}|jdkrd||jfS|jdkr6d||jfSd||j||jfS)Ngz%.*gz%.*gjz(%.*g+%.*gj))r��imag�real)r2r�r7r7r8rns

z5OperatorsTest.test_complexes.<locals>.Number.__repr__N)ryrzr{�	__slots__r�rn�__str__r7r7r7r8�Numbersr�g��Q�	@rf)r�z3.14r^z3.1gPm@z234.5r�)rur�r=rmr�)r2r�r;r7r7r8�test_complexes�szOperatorsTest.test_complexescCs2|�t�dd�tdd��|�t�dd�d�dS)Ny@g@g@r]g�)r=r��__radd__r&�__rsub__)r2r7r7r8�test_explicit_reverse_methods sz+OperatorsTest.test_explicit_reverse_methodsz"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)rq�memo�spamr7r7r8r�*sz/OperatorsTest.test_spam_lists.<locals>.spamlistr]r^za+brKr_zb in ar`raza[b]rOza[b:c]za+=brTza*=brbzlen(a)r:za*brczb*ardza[b]=crYrerfza[b:c]=dc@seZdZdd�ZdS)z(OperatorsTest.test_spam_lists.<locals>.CcSsdS)Nr]r7)r2r7r7r8�fooG�z,OperatorsTest.test_spam_lists.<locals>.C.fooN)ryrzr{r�r7r7r7r8r|Fsr|rv�*)N)�copyr��_deepcopy_dispatchr�rMrRrWrIrZr\r=r�ri�getstate�setstate)r2r�r�r�r|r;r7r7r8�test_spam_lists%s@
   $$$ 

zOperatorsTest.test_spam_listsc
Cs$ddl}ddl}ddd�}||j|j<|�|ddd��dddd	�|�|ddd��dddd	�|�|ddd��ddd
d�|ddd��}g}xt|���D]}|�|�q�Wg}xt|�D]}|�|�q�W|�	||�g}x|�
�D]}|�|�q�W|�	||�g}x&t|i���
|�D]}|�|��qW|�	||�ddd�}||�}	|�|	ddd
�|�|	t
|�dd�|�|ddd��dd|dddd��dd�Gdd�d|j�}
|
�}|�	t|���g�|�	|��d�d|d<|�	t|���dg�|�	|��d�|�d�|�	|��d�dS)NrcSs6ddl}|��}x t|���D]\}}|||<qW|S)Nr)r��spamdictr.r/)rEr�r��sd�k�vr7r7r8r�Us
z/OperatorsTest.test_spam_dicts.<locals>.spamdictr^ra)r]r_r]zb in ar`za[b]rOzlen(a)r:zrepr(a)rnr_)r]r^r_za[b]=crYc@seZdZdd�ZdS)z(OperatorsTest.test_spam_dicts.<locals>.CcSsdS)Nr]r7)r2r7r7r8r�yr�z,OperatorsTest.test_spam_dicts.<locals>.C.fooN)ryrzr{r�r7r7r7r8r|xsr|�barr�)r�r�rv)N)r�r�r�r�rMr.rhrirjr=rkr?rIrmrZr/r�r�r�)r2r�r�r�rErorprqZ	straightdZspamdr|r;r7r7r8�test_spam_dictsQsJ

"
zOperatorsTest.test_spam_dictscCs|�ttj���tj�dS)N)r=�range�sys�maxsizer:)r2r7r7r8�test_wrap_lenfunc_bad_cast�sz(OperatorsTest.test_wrap_lenfunc_bad_castN)r9r:)rJrK)rNrO)rSrT)rXrY)r[rY)ryrzr{r,rIrMrRrWrZr\rgrrrur�r�r�r�r�impl_detailr�r�r�r7r7r7r8rs"0





!,2rcs�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*dHdI�Z+dJdK�Z,dLdM�Z-dNdO�Z.e#�/e0j1j2dPkdQ�dRdS��Z3ej4dTdU��Z5dVdW�Z6dXdY�Z7dZd[�Z8�fd\d]�Z9d^d_�Z:d`da�Z;dbdc�Z<ddde�Z=dfdg�Z>dhdi�Z?djdk�Z@dldm�ZAdndo�ZBdpdq�ZCdrds�ZDdtdu�ZEdvdw�ZFdxdy�ZGdzd{�ZHd|d}�ZId~d�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^e�d��d�d���Z_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�dƄZmd�dȄZnd�dʄZod�d̄Zpd�d΄Zqd�dЄZrd�d҄Zsd�dԄZtd�dքZud�d؄Zvd�dڄZwd�d܄Zx�fd�dބZy�ZzS)��ClassPropertiesAndMethodscCs|�t||�d||f�dS)Nz%r has no attribute %r)�
assertTruers)r2�objr5r7r7r8�
assertHasAttr�sz'ClassPropertiesAndMethods.assertHasAttrcCs|�t||�d||f�dS)Nz%r has unexpected attribute %r)�assertFalsers)r2r�r5r7r7r8�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}x@t
|�D]4}|�||<x"t
|�D]}|||||<�qlW�qTWx>t
|�D]2}x*t
|�D]}��|||||��q�W�q�WdS)Ncs@eZdZdZ�fdd�Zdd�Z�fdd�Zdd	�Zd
d�ZdS)
z6ClassPropertiesAndMethods.test_python_dicts.<locals>.C���csH|r��t|�d�|d|_|rDx t|���D]\}}|||<q0WdS)Nr]r)r=�len�stater.r/)�
self_localr;�kwr�r�)r2r7r8r,�s
z?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.__init__cSs|�|d�S)Nr)r�)r2�keyr7r7r8rO�szBClassPropertiesAndMethods.test_python_dicts.<locals>.C.__getitem__cs"��|td��t�|||�dS)Nr)�assertIsInstancer?rlrY)r�r��value)r2r7r8rY�szBClassPropertiesAndMethods.test_python_dicts.<locals>.C.__setitem__cSs
||_dS)N)r�)r2r�r7r7r8r��sz?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.setstatecSs|jS)N)r�)r2r7r7r8r��sz?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.getstateN)	ryrzr{r�r,rOrYr�r�r7)r2r7r8r|�sr|r�r]r^)r�r�r�r�r�r�
r���2)r��
issubclassrlr�r=�assertIs�	__class__r�r�r�r�)	r2rEr|�a1�a2r;�Nrp�jr7)r2r8�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)Nrv)�
isinstancerQ�start�stopr.rO)r2rpr7r7r8rO�s
zBClassPropertiesAndMethods.test_python_lists.<locals>.C.__getitem__N)ryrzr{rOr7r7r7r8r|�sr|rr]r^rv�e�f��)rvr�)r.�extendr=)r2r|r;r7r7r8�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�}|�}y
|�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�}WdQRXGdTd �d ||d�}|�|t|��|�dNdLg�����|�dNdLg�����GdUdV�dVt�|�}|�|t|��|�dNdLg�����|�dNdLg�����GdWdX�dX|t��}|�|t|��|�dNdLg�����|�dNdLg�����|�t��GdYdF�dF|t��}WdQRX|�t��GdZdF�dFt�|�}WdQRXdS)[Nc@s$eZdZdd�Zdd�Zdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSs
d|_dS)Nr)�	_C__state)r2r7r7r8r,�sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.__init__cSs|jS)N)r�)r2r7r7r8r��sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.getstatecSs
||_dS)N)r�)r2r�r7r7r8r��sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.setstateN)ryrzr{r,r�r�r7r7r7r8r|�sr|)�	metaclassrr�c@seZdZdd�ZdS)z<ClassPropertiesAndMethods.test_metaclass.<locals>._metaclasscSs|S)Nr7)r�r7r7r8�myself�r�zCClassPropertiesAndMethods.test_metaclass.<locals>._metaclass.myselfN)ryrzr{r�r7r7r7r8�
_metaclass�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)ryrzr{r7r7r7r8�D�sr�c@seZdZdd�ZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.M1cSsd|d<t�||||�S)Nr]�__spam__)r?r�)r�r5�basesrlr7r7r8r��sz<ClassPropertiesAndMethods.test_metaclass.<locals>.M1.__new__N)ryrzr{r�r7r7r7r8�M1�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)ryrzr{r7r7r7r8r|�sr]c@seZdZdS)z;ClassPropertiesAndMethods.test_metaclass.<locals>._instanceN)ryrzr{r7r7r7r8�	_instance�sr�cs$eZdZedd��Z�fdd�ZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.M2cSs t�|�}||_||_||_|S)N)�objectr�r5r�rl)r�r5r�rlr2r7r7r8r��s

z<ClassPropertiesAndMethods.test_metaclass.<locals>.M2.__new__cs@��}x4|jD]*}|�d�rqt|||j|�||��qW|S)N�__)rl�
startswith�setattr�__get__)r2�itr�)r�r7r8�__call__�s
z=ClassPropertiesAndMethods.test_metaclass.<locals>.M2.__call__N)ryrzr{�staticmethodr�r�r7)r�r7r8�M2�sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSsdS)Nr�r7)r2r7r7r8r�sz8ClassPropertiesAndMethods.test_metaclass.<locals>.C.spamN)ryrzr{r�r7r7r7r8r|sr7r�r�cseZdZ��fdd�Z�ZS)z;ClassPropertiesAndMethods.test_metaclass.<locals>.autosupercs^t�|��||||�}x |dd�dkr6|dd�}qW|rFd|}nd}t||t|��|S)Nr]�_z
_%s__superZ__super)�superr�r�)r�r5r�rlr�)r��	autosuperr7r8r�s

zCClassPropertiesAndMethods.test_metaclass.<locals>.autosuper.__new__)ryrzr{r��
__classcell__r7)r�)r�r8r�sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AcSsdS)N�Ar7)r2r7r7r8rDsz8ClassPropertiesAndMethods.test_metaclass.<locals>.A.methN)ryrzr{rDr7r7r7r8r�sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BcSsd|j��S)N�B)�	_B__superrD)r2r7r7r8rD!sz8ClassPropertiesAndMethods.test_metaclass.<locals>.B.methN)ryrzr{rDr7r7r7r8r� sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSsd|j��S)Nr|)�	_C__superrD)r2r7r7r8rD$sz8ClassPropertiesAndMethods.test_metaclass.<locals>.C.methN)ryrzr{rDr7r7r7r8r|#sc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DcSsd|j��S)Nr�)�	_D__superrD)r2r7r7r8rD'sz8ClassPropertiesAndMethods.test_metaclass.<locals>.D.methN)ryrzr{rDr7r7r7r8r�&sZDCBAc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.EcSsd|j��S)N�E)Z	_E__superrD)r2r7r7r8rD+sz8ClassPropertiesAndMethods.test_metaclass.<locals>.E.methN)ryrzr{rDr7r7r7r8r�*sr�ZEBCAcseZdZ��fdd�Z�ZS)z>ClassPropertiesAndMethods.test_metaclass.<locals>.autopropertyc	s�i}x�|��D]v\}}|�d�rN|dd�}|�|d�\}}|}||f||<q|�d�r|dd�}|�|d�\}}|}||f||<qWx&|��D]\}\}}t||�||<q�Wt�|��||||�S)NZ_get_re)NNZ_set_)r/r�r��propertyr�r�)	r�r5r�rl�hitsr��valr��set)r��autopropertyr7r8r�2s 

zFClassPropertiesAndMethods.test_metaclass.<locals>.autoproperty.__new__)ryrzr{r�r�r7)r�)r�r8r�/sr�c@seZdZdd�Zdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AcSs|jS)N)�_A__x)r2r7r7r8�_get_xDsz:ClassPropertiesAndMethods.test_metaclass.<locals>.A._get_xcSs||_dS)N)r�)r2�xr7r7r8�_set_xFsz:ClassPropertiesAndMethods.test_metaclass.<locals>.A._set_xN)ryrzr{r�r�r7r7r7r8r�Csr�r�i�c@seZdZdS)z@ClassPropertiesAndMethods.test_metaclass.<locals>.multimetaclassN)ryrzr{r7r7r7r8�multimetaclassNsr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AcSsdS)Nr�r7)r2r7r7r8r�Rsz:ClassPropertiesAndMethods.test_metaclass.<locals>.A._get_xN)ryrzr{r�r7r7r7r8r�Qsc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BcSsd|j��S)Nr�)r�r�)r2r7r7r8r�Usz:ClassPropertiesAndMethods.test_metaclass.<locals>.B._get_xN)ryrzr{r�r7r7r7r8r�Tsc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSsd|j��S)Nr|)r�r�)r2r7r7r8r�Xsz:ClassPropertiesAndMethods.test_metaclass.<locals>.C._get_xN)ryrzr{r�r7r7r7r8r|Wsc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DcSsd|j��S)Nr�)r�r�)r2r7r7r8r�[sz:ClassPropertiesAndMethods.test_metaclass.<locals>.D._get_xN)ryrzr{r�r7r7r7r8r�ZscseZdZdZ�fdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.Trcs�jd7_dS)Nr])�counter)r2r3)�Tr7r8r,bsz<ClassPropertiesAndMethods.test_metaclass.<locals>.T.__init__N)ryrzr{r�r,r7)r�r7r8r�`sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)ryrzr{r7r7r7r8r|dsc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)ryrzr{r7r7r7r8r|ksz5calling object w/o call method should raise TypeErrorc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.Ac_stj||�S)N)r?r�)r3r4r7r7r8r�tsz;ClassPropertiesAndMethods.test_metaclass.<locals>.A.__new__N)ryrzr{r�r7r7r7r8r�ssc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BN)ryrzr{r7r7r7r8r�wsc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)ryrzr{r7r7r7r8r|zsc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)ryrzr{r7r7r7r8r�~scs.eZdZe��fdd��Zedd��Z�ZS)z7ClassPropertiesAndMethods.test_metaclass.<locals>.AMetacs��d�t��||||�S)N�AMeta)rir�r�)�mclsr5r��ns)r��	new_callsr7r8r��s
z?ClassPropertiesAndMethods.test_metaclass.<locals>.AMeta.__new__cSsiS)Nr7)r�r5r�r7r7r8�__prepare__�szCClassPropertiesAndMethods.test_metaclass.<locals>.AMeta.__prepare__)ryrzr{r�r��classmethodr�r�r7)r�)r�r8r��sr�cs2eZdZe��fdd��Ze�fdd��Z�ZS)z7ClassPropertiesAndMethods.test_metaclass.<locals>.BMetacs��d�t��||||�S)N�BMeta)rir�r�)r�r5r�r�)r�r�r7r8r��s
z?ClassPropertiesAndMethods.test_metaclass.<locals>.BMeta.__new__cst��||�}d|d<|S)NT�BMeta_was_here)r�r�)r�r5r�r�)r�r7r8r��szCClassPropertiesAndMethods.test_metaclass.<locals>.BMeta.__prepare__)ryrzr{r�r�r�r�r�r7)r�)r�r8r��sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AN)ryrzr{r7r7r7r8r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BN)ryrzr{r7r7r7r8r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)ryrzr{r7r7r7r8r|�sr�c@seZdZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.C2N)ryrzr{r7r7r7r8�C2�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)ryrzr{r7r7r7r8r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.EN)ryrzr{r7r7r7r8r��scs�S)Nr7)r3r4)�markerr7r8�func�sz6ClassPropertiesAndMethods.test_metaclass.<locals>.funcc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.XN)ryrzr{r7r7r7r8�X�src@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.YN)ryrzr{r7r7r7r8�Y�src@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.ZN)ryrzr{r7r7r7r8�Z�srcs.eZdZ��fdd�Ze�fdd��Z�ZS)z:ClassPropertiesAndMethods.test_metaclass.<locals>.ANotMetacs��d�t��|�S)N�ANotMeta)rir�r�)r�r3r4)r�r�r7r8r��s
zBClassPropertiesAndMethods.test_metaclass.<locals>.ANotMeta.__new__cs��d�iS)Nr)ri)r�r5r�)�
prepare_callsr7r8r��s
zFClassPropertiesAndMethods.test_metaclass.<locals>.ANotMeta.__prepare__)ryrzr{r�r�r�r�r7)r�r)r�r8r�srcs0eZdZ��fdd�Ze��fdd��Z�ZS)z:ClassPropertiesAndMethods.test_metaclass.<locals>.BNotMetacs��d�t��|�S)N�BNotMeta)rir�r�)r�r3r4)r�r�r7r8r��s
zBClassPropertiesAndMethods.test_metaclass.<locals>.BNotMeta.__new__cs��d�t��||�S)Nr)rir�r�)r�r5r�)r�rr7r8r��s
zFClassPropertiesAndMethods.test_metaclass.<locals>.BNotMeta.__prepare__)ryrzr{r�r�r�r�r7)r�r)r�r8r�src@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AN)ryrzr{r7r7r7r8r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BN)ryrzr{r7r7r7r8r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)ryrzr{r7r7r7r8r|�sc@seZdZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.C2N)ryrzr{r7r7r7r8r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)ryrzr{r7r7r7r8r�sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.EN)ryrzr{r7r7r7r8r�sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.FN)ryrzr{r7r7r7r8�Fsrc@seZdZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.F2N)ryrzr{r7r7r7r8�F2src@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.XN)ryrzr{r7r7r7r8r#sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.XN)ryrzr{r7r7r7r8r&s)r?r=r�r�r�r�r�r�r5r��assertInrlr�rDr�r�r�r�rr�r��clearrA�assertRaisesr%)r2r|r;r�r�rEr�rPr�r�r�r�r�r�r�r�r�rrrrrrrr7)r�r�r�r�r�r�rr8�test_metaclass�s$


		z(ClassPropertiesAndMethods.test_metaclasscs�g�tt��G��fdd�d��}|d�}d|_|j}|`|��dddg�yGdd	�d	tjt�}Wntk
rxYnX|�d
�dS)NcsBeZdZ�fdd�Z��fdd�Z��fdd�Z��fdd�Zd	S)
z<ClassPropertiesAndMethods.test_module_subclasses.<locals>.MMcs��||�dS)N)r,)r2r5)�MTr7r8r,.szEClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__init__cs��d|f���||�S)Nr@)ri�__getattribute__)r2r5)r�logr7r8r
0szMClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__getattribute__cs"��d||f���|||�dS)Nr�)ri�__setattr__)r2r5r�)rrr7r8r3szHClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__setattr__cs��d|f���||�dS)N�delattr)ri�__delattr__)r2r5)rrr7r8r6szHClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__delattr__N)ryrzr{r,r
rrr7)rrr7r8�MM-srr;r�)r�r�r�)r@r�)rr�c@seZdZdS)z@ClassPropertiesAndMethods.test_module_subclasses.<locals>.ModuleN)ryrzr{r7r7r7r8�ModuleCsrz?inheriting from ModuleType and str at the same time should fail)	r?r�r�r=�types�
ModuleType�strrr�)r2rr;r�rr7)rrr8�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|_dS)Nr)r�)r2r7r7r8r,NszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.__init__cSs|jS)N)r�)r2r7r7r8r�PszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.getstatecSs
||_dS)N)r�)r2r�r7r7r8r�RszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.setstateN)ryrzr{r,r�r�r7r7r7r8r|Msr|rr�cseZdZ�fdd�ZdS)z>ClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Dcsti��|���|�dS)N)r?r,)r2)r|r7r8r,YszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.D.__init__N)ryrzr{r,r7)r|r7r8r�Xsr��world�hello)rrc@seZdZdd�Zdd�ZdS)zAClassPropertiesAndMethods.test_multiple_inheritance.<locals>.NodecSst|���S)N)r%r�)r2r7r7r8�__int__hszIClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Node.__int__cSsdS)NZ23r7)r2r7r7r8r�jszEClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Node.fooN)ryrzr{rr�r7r7r7r8�Nodegsrc@seZdZdd�ZdS)zAClassPropertiesAndMethods.test_multiple_inheritance.<locals>.FragcSsdS)NZ42r7)r2r7r7r8r�mszEClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Frag.fooN)ryrzr{r�r7r7r7r8�Fraglsr�r�)r�r=r�r�rlr.rhr/�__mro__rr%)r2r;r�rErrr7)r|r8�test_multiple_inheritanceKs*

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�yGdd�d||�}Wntk
�rRYnX|�d
�yGdd�d||�}Wntk
�r�YnX|�d�dS)Nc@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.AcSsdS)Nr�r7)r2r7r7r8r�wr�zBClassPropertiesAndMethods.test_diamond_inheritance.<locals>.A.spamN)ryrzr{r�r7r7r7r8r�vsr�c@seZdZdd�Zdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.BcSsdS)Nr�r7)r2r7r7r8�boozr�zAClassPropertiesAndMethods.test_diamond_inheritance.<locals>.B.boocSsdS)Nr�r7)r2r7r7r8r�{r�zBClassPropertiesAndMethods.test_diamond_inheritance.<locals>.B.spamN)ryrzr{r r�r7r7r7r8r�ysr�c@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.CcSsdS)Nr|r7)r2r7r7r8r r�zAClassPropertiesAndMethods.test_diamond_inheritance.<locals>.C.booN)ryrzr{r r7r7r7r8r|~sr|c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.DN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.EN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.FN)ryrzr{r7r7r7r8r�srz#expected MRO order disagreement (F)c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.GN)ryrzr{r7r7r7r8�G�sr!z#expected MRO order disagreement (G))r�r=r�r rrr�)r2r�r�r|r�r�rr!r7r7r8�test_diamond_inheritancets4
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>.AN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.BN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.CN)ryrzr{r7r7r7r8r|�sr|c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.XN)ryrzr{r7r7r7r8r�src@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.YN)ryrzr{r7r7r7r8r�src@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.ZN)ryrzr{r7r7r7r8r�sr)r�r=r)r2r�r�r|rrrr7r7r8�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>.BoatN)ryrzr{r7r7r7r8�Boat�sr$c@seZdZdS)z<ClassPropertiesAndMethods.test_monotonicity.<locals>.DayBoatN)ryrzr{r7r7r7r8�DayBoat�sr%c@seZdZdS)z>ClassPropertiesAndMethods.test_monotonicity.<locals>.WheelBoatN)ryrzr{r7r7r7r8�	WheelBoat�sr&c@seZdZdS)z?ClassPropertiesAndMethods.test_monotonicity.<locals>.EngineLessN)ryrzr{r7r7r7r8�
EngineLess�sr'c@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.SmallMultihullN)ryrzr{r7r7r7r8�SmallMultihull�sr(c@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.PedalWheelBoatN)ryrzr{r7r7r7r8�PedalWheelBoat�sr)c@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.SmallCatamaranN)ryrzr{r7r7r7r8�SmallCatamaran�sr*c@seZdZdS)z;ClassPropertiesAndMethods.test_monotonicity.<locals>.PedaloN)ryrzr{r7r7r7r8�Pedalo�sr+)r�r=r)	r2r$r%r&r'r(r)r*r+r7r7r8�test_monotonicity�sz+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>.PaneN)ryrzr{r7r7r7r8�Pane�sr-c@seZdZdS)zKClassPropertiesAndMethods.test_consistency_with_epg.<locals>.ScrollingMixinN)ryrzr{r7r7r7r8�ScrollingMixin�sr.c@seZdZdS)zIClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditingMixinN)ryrzr{r7r7r7r8�EditingMixin�sr/c@seZdZdS)zKClassPropertiesAndMethods.test_consistency_with_epg.<locals>.ScrollablePaneN)ryrzr{r7r7r7r8�ScrollablePane�sr0c@seZdZdS)zIClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditablePaneN)ryrzr{r7r7r7r8�EditablePane�sr1c@seZdZdS)zSClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditableScrollablePaneN)ryrzr{r7r7r7r8�EditableScrollablePane�sr2)r�r=r)r2r-r.r/r0r1r2r7r7r8�test_consistency_with_epg�sz3ClassPropertiesAndMethods.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
sny||�WnN|k
rZ}z0t��rJt|��|�sJ��dt|�|f�Wdd}~XYnX��d|�dS)NzMessage %r, expected %rzExpected %s)r�check_impl_detailrr�r�)�exc�expected�callabler3�msg)r2r7r8�raises�s"z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.raisesc@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.AN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.BN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.CN)ryrzr{r7r7r7r8r|�sr|zduplicate base class Arc@seZdZdS)zCClassPropertiesAndMethods.test_mro_disagreement.<locals>.GridLayoutN)ryrzr{r7r7r7r8�
GridLayout�sr:c@seZdZdS)zGClassPropertiesAndMethods.test_mro_disagreement.<locals>.HorizontalGridN)ryrzr{r7r7r7r8�HorizontalGrid�sr;c@seZdZdS)zEClassPropertiesAndMethods.test_mro_disagreement.<locals>.VerticalGridN)ryrzr{r7r7r7r8�VerticalGrid�sr<c@seZdZdS)z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.HVGridN)ryrzr{r7r7r7r8�HVGrid�sr=c@seZdZdS)z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.VHGridN)ryrzr{r7r7r7r8�VHGrid�sr>ZConfusedGrid)r�rr?)r2Zmro_err_msgr9r�r�r|r:r;r<r=r>r7)r2r8�test_mro_disagreement�s$z/ClassPropertiesAndMethods.test_mro_disagreementc	Cs�t�}|�|jt�|�t|�t�t�}|�||�|�|d�y
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 attributerAc@seZdZdS)z:ClassPropertiesAndMethods.test_object_class.<locals>.CdictN)ryrzr{r7r7r7r8�Cdict�sr@r])r�r=r�r?�assertNotEqualr�r��AttributeErrorrr�rA)r2r;rLr@r�r7r7r8�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_WdQRXGdd	�d	t	�}|�t��|d
_WdQRXGdd�dt
�}|�t��|d
_WdQRXGdd�dt�}|�t��|d_WdQRXGdd�dt�}|�t��|d_WdQRXGdd�dt
�}|�t��|d_WdQRXGdd�dt�}	|�t��|	t�_WdQRXdS)Nc@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.SubTyper]N)ryrzr{r;r7r7r7r8�SubTypesrDrGr;c@seZdZdZdS)zhClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyIntr7N)ryrzr{r�r7r7r7r8�MyIntsrEr]c@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyFloatr7N)ryrzr{r�r7r7r7r8�MyFloat#srFg�?c@seZdZdZdS)zlClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyComplexr7N)ryrzr{r�r7r7r7r8�	MyComplex(srGy�?@c@seZdZdZdS)zhClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyStrr7N)ryrzr{r�r7r7r7r8�MyStr-srHc@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyBytesr7N)ryrzr{r�r7r7r7r8�MyBytes2srI�ac@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyTupler7N)ryrzr{r�r7r7r7r8�MyTuple7srKr7c@seZdZdZdS)znClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyFrozenSetr7N)ryrzr{r�r7r7r7r8�MyFrozenSet<srL)rrr�r�r�rsr%r
rr&r�r�bytes�tuple�	frozenset)
r2rDrGrErFrGrHrIrKrLr7r7r8�?test_object_class_assignment_between_heaptypes_and_nonheaptypess>
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�y
d|_Wntk
�rvYnX��	d�yGdd�dt�}Wnt
k
�r�YnX��	d�yGdd�dt�}Wnt
k
�r�YnX��	d�yGdd�dt�}Wnt
k
�rYnX��	d�yGdd�dt�}Wnt
k
�rNYnX��	d�yGdd�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�yGd&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���}xtd4�D]}|
|
k�q�Wtt���}��||�G�fd5d6�d6t�}t�d7��}|�}~WdQRX��|��d8�Gd9d:�d:t�}��t��|�`WdQRXdS);Nc@seZdZgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C0N)ryrzr{r�r7r7r7r8�C0CsrQrAr�c@seZdZdgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C1r;N)ryrzr{r�r7r7r7r8�C1IsrRr;r]c@seZdZdddgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C3r;rLrPN)ryrzr{r�r7r7r7r8�C3UsrSrLrPr^r_c@s&eZdZdZdgZdd�Zdd�ZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C4zValidate name mangling�__acSs
||_dS)N)�_C4__a)r2r�r7r7r8r,fsz9ClassPropertiesAndMethods.test_slots.<locals>.C4.__init__cSs|jS)N)rU)r2r7r7r8r�hsz4ClassPropertiesAndMethods.test_slots.<locals>.C4.getN)ryrzr{�__doc__r�r,r�r7r7r7r8�C4csrWrerTrfz$Double underscored names not mangledc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CN)ryrzr{r�r7r7r7r8r|wsr|z[None] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Czfoo barN)ryrzr{r�r7r7r7r8r|~sz['foo bar'] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CzfoobarN)ryrzr{r�r7r7r7r8r|�sz['foo\0bar'] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.C�1N)ryrzr{r�r7r7r7r8r|�sz['1'] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Cr}N)ryrzr{r�r7r7r7r8r|�sz[''] slots not caughtc@seZdZddddgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Cr;Za_bZ_aZA0123456789ZN)ryrzr{r�r7r7r7r8r|�sc@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.C�abcN)ryrzr{r�r7r7r7r8r|�sc@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CrYN)ryrzr{r�r7r7r7r8r|�s)r�r�cseZdZ�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CN)ryrzr{r�r7)�slotsr7r8r|�src@seZdZed�gZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.C�N)ryrzr{�chrr�r7r7r7r8r|�szhr(128)] slots not caughtcs(eZdZdZ�fdd�Z�fdd�ZdS)z5ClassPropertiesAndMethods.test_slots.<locals>.Countedrcs�jd7_dS)Nr])r�)r2)�Countedr7r8r,�sz>ClassPropertiesAndMethods.test_slots.<locals>.Counted.__init__cs�jd8_dS)Nr])r�)r2)r]r7r8�__del__�sz=ClassPropertiesAndMethods.test_slots.<locals>.Counted.__del__N)ryrzr{r�r,r^r7)r]r7r8r]�sr]c@seZdZdddgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Cr;rLrPN)ryrzr{r�r7r7r7r8r|�sc@seZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.DN)ryrzr{r7r7r7r8r��sr�c@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.E�eN)ryrzr{r�r7r7r7r8r��sr�c@seZdZddgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Fr;rLN)ryrzr{r�r7r7r7r8r�sr�get_objectsc@seZdZdd�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.GcSsdS)NFr7)r2rxr7r7r8�__eq__�sz6ClassPropertiesAndMethods.test_slots.<locals>.G.__eq__N)ryrzr{rar7r7r7r8r!�sr!r�cs(eZdZddgZdd�Z�fdd�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Hr;rLcSsd|_d|_dS)Nr]r^)r;rL)r2r7r7r8r,�sz8ClassPropertiesAndMethods.test_slots.<locals>.H.__init__cs ��|jd���|jd�dS)Nr]r^)r=r;rL)�self_)r2r7r8r^�sz7ClassPropertiesAndMethods.test_slots.<locals>.H.__del__N)ryrzr{r�r,r^r7)r2r7r8�H�src�stderrr}c@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Xr;N)ryrzr{r�r7r7r7r8rsr)r�r�r;r=rLrPr�Z_ClassPropertiesAndMethods__arBr�rrYr�r�r?r�UnicodeEncodeErrorr�r�
gc_collect�zr_rs�gcr�r`r�Zcaptured_output�getvaluer
)r2rQr�rRrSrWr|rPr�r�r�sr!�gZorig_objectsrpZnew_objectsrc�hrr7)r]r2rZr8�
test_slotsAs







z$ClassPropertiesAndMethods.test_slotscCs2Gdd�dt�}|�}|�|d�|�|d�d|_|�|jddi�Gdd�dt�}|�}|�|d�|�|d�y
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>.DrAN)ryrzr{r�r7r7r7r8r�
sr�rA�__weakref__r�r�c@seZdZdgZdS)z7ClassPropertiesAndMethods.test_slots_special.<locals>.WrnN)ryrzr{r�r7r7r7r8�Wsroz!shouldn't be allowed to set a.fooc@seZdZgZdS)z8ClassPropertiesAndMethods.test_slots_special.<locals>.C1N)ryrzr{r�r7r7r7r8rR!srRc@seZdZgZdS)z8ClassPropertiesAndMethods.test_slots_special.<locals>.C2N)ryrzr{r�r7r7r7r8r�)sr�)r�r�r�r�r=rArBr�)r2r�r;rorRr�r7r7r8�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�}WdQRXGdd
�d
|dd�}��|j|jdd�d
���|jdtj�|�}��|d�d|_��|jd���	t
��Gdd�d�}WdQRXdS)NcseZdZ��fdd�Z�ZS)z;ClassPropertiesAndMethods.test_slots_special2.<locals>.Metacs��||�t��||||�S)N)rr�r�)r�r5r��	namespace�attr)r�r2r7r8r�4szCClassPropertiesAndMethods.test_slots_special2.<locals>.Meta.__new__)ryrzr{r�r�r7)r2)r�r8�Meta3srsc@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_slots_special2.<locals>.C1cSs
d|_dS)Nr�)rL)r2r7r7r8r,9szBClassPropertiesAndMethods.test_slots_special2.<locals>.C1.__init__N)ryrzr{r,r7r7r7r8rR8srRcs"eZdZdgZ�fdd�Z�ZS)z9ClassPropertiesAndMethods.test_slots_special2.<locals>.C2r�cst���dS)N)r�r,)r2)r�r7r8r,=szBClassPropertiesAndMethods.test_slots_special2.<locals>.C2.__init__)ryrzr{r�r,r�r7r7)r�r8r�;sr�r�)r�rrr�c@seZdZdZdgZdS)z9ClassPropertiesAndMethods.test_slots_special2.<locals>.C3r�r�N)ryrzr{r�r�r7r7r7r8rSGsrSc@seZdZdgZdS)z9ClassPropertiesAndMethods.test_slots_special2.<locals>.Q1r{N)ryrzr{r�r7r7r7r8�Q1Ksrtr{����qc@seZdZe�ZdgZdS)z9ClassPropertiesAndMethods.test_slots_special2.<locals>.Q2r{N)ryrzr{r�r�r7r7r7r8�Q2Usrw)r?r�rAr�MemberDescriptorTyper=rLr�r�r
rr{)	r2rsrRr�rPrSrtrvrwr7)r2r8�test_slots_special21s,z-ClassPropertiesAndMethods.test_slots_special2cCs`ddl}Gdd�d|jd�}Gdd�dt�}|�|�|�}|�||�|�t|jj|d�dS)Nrc@seZdZdZdS)z>ClassPropertiesAndMethods.test_slots_descriptor.<locals>.MyABCr;N)ryrzr{r�r7r7r7r8�MyABC]srz)r�c@seZdZdS)zBClassPropertiesAndMethods.test_slots_descriptor.<locals>.UnrelatedN)ryrzr{r7r7r7r8�	Unrelated`sr{r_)	rY�ABCMetar��registerr�r
rr;�__set__)r2rYrzr{�ur7r7r8�test_slots_descriptorYs
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�}||_
y
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>.DN)ryrzr{r7r7r7r8r�lsr�c@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.EN)ryrzr{r7r7r7r8r�nsr�c@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.FN)ryrzr{r7r7r7r8rpsrr]c@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.CN)ryrzr{r7r7r7r8r|xsr|�foobarr^cSsdS)Nr�r7)r2r7r7r8�<lambda>~r�z9ClassPropertiesAndMethods.test_dynamics.<locals>.<lambda>r�cSsdS)NzC()r7)r2r7r7r8r��r�zC()cSsdS)Nrvr7)r2r7r7r8r��r�rvr�cSs|dkrdSt�dS)Nr�)rB)r2r5r7r7r8�	mygetattr�sz:ClassPropertiesAndMethods.test_dynamics.<locals>.mygetattrr�cSs|dkrt�t�|||�S)Nr�)rBr�r)r2r5r�r7r7r8�	mysetattr�sz:ClassPropertiesAndMethods.test_dynamics.<locals>.mysetattrznot spamzexpected AttributeErrorc@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.DN)ryrzr{r7r7r7r8r��sc@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.IN)ryrzr{r7r7r7r8�I�sr�r;Zaar_rfc@seZdZdS)zAClassPropertiesAndMethods.test_dynamics.<locals>.dynamicmetaclassN)ryrzr{r7r7r7r8�dynamicmetaclass�sr�c@seZdZdS)z:ClassPropertiesAndMethods.test_dynamics.<locals>.someclassN)ryrzr{r7r7r7r8�	someclass�sr�)r�)r�r�r=r�r��methodrnrmrr%�__getattr__r��newrrBr�r?rA)r2r�r�rr|r;r�r�rEr�r�r�r7r7r8�
test_dynamicsjs\




z'ClassPropertiesAndMethods.test_dynamicscCs�yGdd�dtt�}Wntk
r*YnX|�d�yGdd�dtd�}Wntk
r`YnX|�d�Gdd�d�}yGdd�dtt��}Wntk
r�YnX|�d	�yGd
d�dt�}Wntk
r�YnX|�d�yGdd�dt�}Wntk
�rYnX|�d
�Gdd�dt�}Gdd�dt�}Gdd�dt|d�}Gdd�dt|d�}yGdd�d||�}Wntk
�r�YnX|�d�dS)Nc@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CN)ryrzr{r7r7r7r8r|�sr|z5inheritance from both list and dict should be illegalc@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CN)ryrzr{r7r7r7r8r|�sz+inheritance from non-type should be illegalc@seZdZdS)z6ClassPropertiesAndMethods.test_errors.<locals>.ClassicN)ryrzr{r7r7r7r8�Classic�sr�c@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CN)ryrzr{r7r7r7r8r|�sz,inheritance from CFunction should be illegalc@seZdZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.Cr]N)ryrzr{r�r7r7r7r8r|�sz__slots__ = 1 should be illegalc@seZdZdgZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.Cr]N)ryrzr{r�r7r7r7r8r|�sz!__slots__ = [1] should be illegalc@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.M1N)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.M2N)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.A1N)ryrzr{r7r7r7r8�A1�sr�)r�c@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.A2N)ryrzr{r7r7r7r8�A2�sr�c@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.BN)ryrzr{r7r7r7r8r��sr�z5finding the most derived metaclass should have failed)r.rlrr�r�r?r�)r2r|r�r�r�r�r�r�r7r7r8�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
|�yt|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|S)Nr7)r;r7r7r8r��r�z:ClassPropertiesAndMethods.test_classmethods.<locals>.C.fooN)ryrzr{r�r��goor7r7r7r8r|�sr|r]c@seZdZdS)z6ClassPropertiesAndMethods.test_classmethods.<locals>.DN)ryrzr{r7r7r7r8r��sr�cSs||fS)Nr7)r��argr7r7r8�f�r�z6ClassPropertiesAndMethods.test_classmethods.<locals>.frr�)r�z)classmethod shouldn't accept keyword argsr�)r�r=r�r�r�r�r%�__self__r�r
rr�rAr�r�)	r2r|rPr�rEr�ZffrD�cm)r�r7r8�test_classmethods�sF
z+ClassPropertiesAndMethods.test_classmethodscCsPt�td�}td�}|�}xtd�D]}|�d�q$W|j|�|ddd�dS)N�gettotalrefcountrvrr�)�delta)r�
get_attributer�r�r�r,�assertAlmostEqual)r2r�r��refs_beforerpr7r7r8�%test_refleaks_in_classmethod___init__sz?ClassPropertiesAndMethods.test_refleaks_in_classmethod___init__z"the module 'xxsubtype' is internalc
	Cs�ddl}d}ddi}|jj||�\}}}|�||j�|�||�|�||�|��j||�\}}}|�||j�|�||�|�||�|jjd}||jf|�|�\}}	}
|�||j�|�|	|�|�|
|�Gdd�d|j�}||f|�|�\}}	}
|�||�|�|	|�|�|
|�|�t��}|�WdQRX|�t|j�d�|�t��}||���WdQRX|�t|j�d	�|�t��}|t	�WdQRX|�t|j�d
�dS)Nr)r]r^r_rY�{�	classmethc@seZdZdS)zAClassPropertiesAndMethods.test_classmethods_in_c.<locals>.SubSpamN)ryrzr{r7r7r7r8�SubSpam:sr�zGdescriptor '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�r�r=rAr
rr�	exceptionr.)
r2r�r;rEr�r��d1Zspam_cmZx2r��d2r�r�r7r7r8�test_classmethods_in_c'sH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|S)Nr7)r;r7r7r8r�Xr�z;ClassPropertiesAndMethods.test_staticmethods.<locals>.C.fooN)ryrzr{r�r�r�r7r7r7r8r|Wsr|r])r]c@seZdZdS)z7ClassPropertiesAndMethods.test_staticmethods.<locals>.DN)ryrzr{r7r7r7r8r�^sr�r�r�)r�r=r�r�r�rAr�r�)r2r|rPr�rE�smr7r7r8�test_staticmethodsUs$z,ClassPropertiesAndMethods.test_staticmethodscCsPt�td�}td�}|�}xtd�D]}|�d�q$W|j|�|ddd�dS)Nr�rvrr�)r�)rr�r�r�r�r,r�)r2r�r�r�rpr7r7r8�&test_refleaks_in_staticmethod___init__msz@ClassPropertiesAndMethods.test_refleaks_in_staticmethod___init__cCs�ddl}d}ddi}|jj||�\}}}|�|d�|�||�|�||�|��j||�\}}}|�|d�|�||�|�||�dS)Nr)r]r^r_rYr�)r�r�Z
staticmethr=)r2r�r;rEr�r�r�r�r7r7r8�test_staticmethods_in_cvs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|S)Nr7)r;r7r7r8r��r�z5ClassPropertiesAndMethods.test_classic.<locals>.C.fooN)ryrzr{r�r�r�r7r7r7r8r|�sr|r]c@seZdZdS)z1ClassPropertiesAndMethods.test_classic.<locals>.DN)ryrzr{r7r7r7r8r��sr�cseZdZ�jZdS)z1ClassPropertiesAndMethods.test_classic.<locals>.EN)ryrzr{r�r7)r|r7r8r��sr�z<bound method )r=r�r��__func__r�rmr�r�)r2rPr�rEr�r7)r|r8�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||_||_||_dS)N)�_computed_attribute__get�_computed_attribute__set�_computed_attribute__delete)r2r�r��deleter7r7r8r,�szNClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__init__cSs
|�|�S)N)r�)r2r�r?r7r7r8r��szMClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__get__cSs|�||�S)N)r�)r2r�r�r7r7r8r~�szMClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__set__cSs
|�|�S)N)r�)r2r�r7r7r8�
__delete__�szPClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__delete__)NN)N)ryrzr{r,r�r~r�r7r7r7r8�computed_attribute�s

r�cSs
d|_dS)Nr)�_C__x)r2r7r7r8r,�sz;ClassPropertiesAndMethods.test_compattr.<locals>.C.__init__cSs|j}|d|_|S)Nr])r�)r2r�r7r7r8Z__get_x�s
z:ClassPropertiesAndMethods.test_compattr.<locals>.C.__get_xcSs
||_dS)N)r�)r2r�r7r7r8Z__set_x�sz:ClassPropertiesAndMethods.test_compattr.<locals>.C.__set_xcSs|`dS)N)r�)r2r7r7r8Z
__delete_x�sz=ClassPropertiesAndMethods.test_compattr.<locals>.C.__delete_xN)
ryrzr{r�r�r,Z	_C__get_xZ	_C__set_xZ_C__delete_xr�r7r7r7r8r|�sr|rr]r��r�)r�r=r�r�)r2r|r;r7r7r8�
test_compattr�sz'ClassPropertiesAndMethods.test_compattrcCshGdd�dt�}|�}|�|jd�|�|j|�Gdd�d|�}|�}|�|jd�|�|j|�dS)Nc@seZdZdd�Zdd�ZdS)z2ClassPropertiesAndMethods.test_newslots.<locals>.CcSst�|�}d|_|S)Nr])r.r�r�)r�r2r7r7r8r��s
z:ClassPropertiesAndMethods.test_newslots.<locals>.C.__new__cSs|jd|_dS)Nr^)r�)r2r7r7r8r,�sz;ClassPropertiesAndMethods.test_newslots.<locals>.C.__init__N)ryrzr{r�r,r7r7r7r8r|�sr|r_c@seZdZdS)z2ClassPropertiesAndMethods.test_newslots.<locals>.DN)ryrzr{r7r7r7r8r��sr�)r.r=r�r�)r2r|r;r�rLr7r7r8�
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)ryrzr{r.r�r7r7r7r8r|�sr|c@seZdZejZdS)z1ClassPropertiesAndMethods.test_bad_new.<locals>.CN)ryrzr{r�r�r7r7r7r8r|�s)r
rr�r�r.)r2r|r7r7r8�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)z4ClassPropertiesAndMethods.test_object_new.<locals>.AN)ryrzr{r7r7r7r8r��sr�rec@seZdZdd�ZdS)z4ClassPropertiesAndMethods.test_object_new.<locals>.AcSs
||_dS)N)r�)r2r�r7r7r8r,�sz=ClassPropertiesAndMethods.test_object_new.<locals>.A.__init__N)ryrzr{r,r7r7r7r8r��sr_c@seZdZdd�ZdS)z4ClassPropertiesAndMethods.test_object_new.<locals>.AcSs
t�|�S)N)r�r�)r�r�r7r7r8r��sz<ClassPropertiesAndMethods.test_object_new.<locals>.A.__new__N)ryrzr{r�r7r7r7r8r��sc@seZdZdd�Zdd�ZdS)z4ClassPropertiesAndMethods.test_object_new.<locals>.AcSs
t�|�S)N)r�r�)r�r�r7r7r8r��sz<ClassPropertiesAndMethods.test_object_new.<locals>.A.__new__cSs
||_dS)N)r�)r2r�r7r7r8r,�sz=ClassPropertiesAndMethods.test_object_new.<locals>.A.__init__N)ryrzr{r�r,r7r7r7r8r��s)r�r�r
rr,)r2r�r7r7r8�test_object_new�s(



z)ClassPropertiesAndMethods.test_object_newc	Cs�Gdd�dt�}|�t|�Gdd�d|�}t���t�dt�|d�}WdQRX|�|jd�|�|j	|�|`
|�t|�|`
t���t�dt�|d�}WdQRX|�|jd�|�|j	|�dS)Nc@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_restored_object_new.<locals>.Ac_st�dS)N)�AssertionError)r�r3r4r7r7r8r�szEClassPropertiesAndMethods.test_restored_object_new.<locals>.A.__new__N)ryrzr{r�r7r7r7r8r��sr�c@seZdZejZdd�ZdS)z=ClassPropertiesAndMethods.test_restored_object_new.<locals>.BcSs
||_dS)N)r�)r2r�r7r7r8r,szFClassPropertiesAndMethods.test_restored_object_new.<locals>.B.__init__N)ryrzr{r�r�r,r7r7r7r8r�sr��errorr_)r�r
r��warnings�catch_warnings�simplefilter�DeprecationWarningr=r�r�r�)r2r�r�rLr7r7r8�test_restored_object_new�s 

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�y:Gdd�dt�}Gdd�dt|d
�}t�|�}d|d<Wntk
�r�YnX|�d�y(Gdd�dt�}Gdd�dt|d
�}Wntk
�r�YnX|�d�y(Gdd�dt�}Gdd�dt|d
�}Wntk
�r:YnX|�d�dS)Nc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.AcSsdS)Nr�r7)r2r7r7r8r�r�z2ClassPropertiesAndMethods.test_altmro.<locals>.A.fN)ryrzr{r�r7r7r7r8r�sr�c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.BN)ryrzr{r7r7r7r8r�sr�c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.CcSsdS)Nr|r7)r2r7r7r8r�r�z2ClassPropertiesAndMethods.test_altmro.<locals>.C.fN)ryrzr{r�r7r7r7r8r|sr|c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.DN)ryrzr{r7r7r7r8r�sr�c@seZdZdd�ZdS)z?ClassPropertiesAndMethods.test_altmro.<locals>.PerverseMetaTypecSst�|�}|��|S)N)r?�mro�reverse)r��Lr7r7r8r�*s
zCClassPropertiesAndMethods.test_altmro.<locals>.PerverseMetaType.mroN)ryrzr{r�r7r7r7r8�PerverseMetaType)sr�c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)ryrzr{r7r7r7r8r.sr)r�c@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_altmro.<locals>._metaclasscSs
|ttgS)N)rlr�)r2r7r7r8r�5sz=ClassPropertiesAndMethods.test_altmro.<locals>._metaclass.mroN)ryrzr{r�r7r7r7r8r�4sr�c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)ryrzr{r7r7r7r8r7srfrezdevious mro() return not caughtc@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_altmro.<locals>._metaclasscSsdgS)Nr]r7)r2r7r7r8r�Hsz=ClassPropertiesAndMethods.test_altmro.<locals>._metaclass.mroN)ryrzr{r�r7r7r7r8r�Gsc@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)ryrzr{r7r7r7r8rJsz!non-class mro() return not caughtc@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_altmro.<locals>._metaclasscSsdS)Nr]r7)r2r7r7r8r�Ssz=ClassPropertiesAndMethods.test_altmro.<locals>._metaclass.mroN)ryrzr{r�r7r7r7r8r�Rsc@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)ryrzr{r7r7r7r8rUsz$non-sequence mro() return not caught)	r�r=r�rr�r?r�rr�)	r2r�r�r|r�r�rr�r�r7r7r8�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)ryrzr{rVr7r7r7r8r�_sr�csDeZdZdd�Z�fdd�Z�fdd�Zdd�Zd	d
�Zdd�Zd
S)z5ClassPropertiesAndMethods.test_overloading.<locals>.CcSs|dkrd|fSt�dS)Nr�r@)rB)r2r5r7r7r8r�cszAClassPropertiesAndMethods.test_overloading.<locals>.C.__getattr__cs&|dkr||f|_n��|||�SdS)Nr�)r�r)r2r5r�)r�r7r8rhszAClassPropertiesAndMethods.test_overloading.<locals>.C.__setattr__cs |dkr||_n��||�SdS)Nr�)rr)r2r5)r�r7r8rmszAClassPropertiesAndMethods.test_overloading.<locals>.C.__delattr__cSsd|fS)N�getitemr7)r2r�r7r7r8rOsszAClassPropertiesAndMethods.test_overloading.<locals>.C.__getitem__cSs||f|_dS)N)�setitem)r2r�r�r7r7r8rYuszAClassPropertiesAndMethods.test_overloading.<locals>.C.__setitem__cSs
||_dS)N)�delitem)r2r�r7r7r8�__delitem__wszAClassPropertiesAndMethods.test_overloading.<locals>.C.__delitem__N)	ryrzr{r�rrrOrYr�r7)r�r7r8r|bsr|)r@r�r�)r�r�r�)r�r��)r�r�rr�r�)r�r=r�r�rr�r�rQ)r2r|r;r7)r�r8�test_overloading\s$
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
||_dS)N)r�)r2r�r7r7r8r,�sz:ClassPropertiesAndMethods.test_methods.<locals>.C.__init__cSs|jS)N)r�)r2r7r7r8r��sz5ClassPropertiesAndMethods.test_methods.<locals>.C.fooN)ryrzr{r,r�r7r7r7r8r|�sr|r]cseZdZ�jZ�jZdS)z1ClassPropertiesAndMethods.test_methods.<locals>.DN)ryrzr{r�r r�r7)r|�c1r7r8r��sr�r^cseZdZ�jZdS)z1ClassPropertiesAndMethods.test_methods.<locals>.EN)ryrzr{r�r7)r|r7r8r��sr�z<bound method )
r�r=r�r r�r�r�rmr�r�)r2r�r�r�r7)r|r�r8�test_methods�sz&ClassPropertiesAndMethods.test_methodscs�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�}�x|D�]\}}}�}Gd8d9�d9|�}x"|��D]\}}t|||��qWt|||�||��g�Gd:d9�d9|�}x"|��D]\}}t|||��qTWt||||��||�����d;g|�Gd<d9�d9|�}x"|��D]\}}t|||��q�Wt|||�����||���q�WdS)>Nc	Ss|�WdQRXdS)Nr7)Zmanagerr7r7r8�run_context�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.run_contextcSs|S)Nr7)r2r7r7r8�iden�szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.idencSsdS)Nshellor7)r2r7r7r8r�szCClassPropertiesAndMethods.test_special_method_lookup.<locals>.hellocSsgS)Nr7)r2r7r7r8�	empty_seq�szGClassPropertiesAndMethods.test_special_method_lookup.<locals>.empty_seqcSsdS)Nrr7)r2r7r7r8�zero�szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.zerocSsdS)Ny�?r7)r2r7r7r8�complex_num�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.complex_numcSst�dS)N)�
StopIteration)r2r7r7r8r��szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.stopcSsdS)NTr7)r2�thingr7r7r8�return_true�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.return_truecSs
tt|�S)N)r�r%)r�r7r7r8�
do_isinstance�szKClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_isinstancecSs
tt|�S)N)r�r%)r�r7r7r8�
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>.DictSubN)ryrzr{r7r7r7r8�DictSub�sr��hira)r�rlr=)Zcheckerr�)r2r7r8�do_dict_missing�szMClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_dict_missingcs��|d�dS)Nr�ra)r=)rbr�)r2r7r8�some_number�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.some_numbercWsdS)Nr7)r3r7r7r8�swallow�r�zEClassPropertiesAndMethods.test_special_method_lookup.<locals>.swallowcSsdS)Nrr7)r2�specr7r7r8�format_impl�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.format_impl�	__bytes__�__reversed__�__length_hint__)rk�__next__�
__sizeof__�__instancecheck__�__missing__)r��__subclasscheck__)rB�	__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)r2rr�testr7r7r8r��szQClassPropertiesAndMethods.test_special_method_lookup.<locals>.Checker.__getattr__cs$|�kr|�d�|��t�||�S)Nz __getattribute__ called with {0})r�r�r�r
)r2rrr�)�okr7r8r
�szVClassPropertiesAndMethods.test_special_method_lookup.<locals>.Checker.__getattribute__N)ryrzr{r�r
r7)r�r2r7r8�Checker�sr�cs eZdZdd�Z�fdd�ZdS)zJClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescrcSs
||_dS)N)�impl)r2r�r7r7r8r,�szSClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescr.__init__cs��d�|j�||�S)Nr])rir�r�)r2r��owner)�recordr7r8r��s
zRClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescr.__get__N)ryrzr{r,r�r7)r�r7r8�SpecialDescr�sr�c@seZdZdS)zIClassPropertiesAndMethods.test_special_method_lookup.<locals>.MyExceptionN)ryrzr{r7r7r7r8�MyException�sr�cseZdZ�fdd�ZdS)zFClassPropertiesAndMethods.test_special_method_lookup.<locals>.ErrDescrcs��dS)Nr7)r2r�r�)r�r7r8r��szNClassPropertiesAndMethods.test_special_method_lookup.<locals>.ErrDescr.__get__N)ryrzr{r�r7)r�r7r8�ErrDescr�sr�c@seZdZdS)z?ClassPropertiesAndMethods.test_special_method_lookup.<locals>.XN)ryrzr{r7r7r7r8r�src@seZdZdS)z?ClassPropertiesAndMethods.test_special_method_lookup.<locals>.XN)ryrzr{r7r7r7r8r�sr]c@seZdZdS)z?ClassPropertiesAndMethods.test_special_method_lookup.<locals>.XN)ryrzr{r7r7r7r8rs)N)rMr��reversedr.r��	getsizeofr�r��mathZfloorZtruncr%Zceil�dir�roundr��	Exceptionr/r�r=r
)r2r�r�rr�r�r�r�r�r�r�r�r�r�r�Zspecialsr�r�r�r5ZrunnerZ	meth_impl�envrrrr�r7)r�r�r�r2r8�test_special_method_lookup�sp






z4ClassPropertiesAndMethods.test_special_method_lookupc
Cs�Gdd�dt�}|�}|�}|�|�|�t|�t|��t|�t|�|�||�|�||k�|�||k�|�||k�|�t|��	d�d�|�t|�t
|��|�d|�xtd�D]}|�
||�q�W|�d|�Gdd�dt�}|�}|�}|�|�|�t|�t|��t|�t|�|�||�|�||�|�||k�|�||k�|�t|��	d	�d�|�t|�t
|��|�d|�xtd�D]}|�
||��q�W|�d|�Gd
d�dt�}|d�}	|d�}
|d�}|�|	�|�|
�|�t|	�td��|�|	|	�|�|	|
�|�|	|	k�|�|	|
�|�|	|
k�|�|	|
k�|�|
|	k�|�|
|	k�|�t|	�d
�|�t
|	�d�|td��}|�d|�xtd�D]}|�
||��q�W|�d|�dS)Nc@seZdZdd�ZdS)z2ClassPropertiesAndMethods.test_specials.<locals>.CcSs$d|krdkrnn|St�dS)Nrr�)�
IndexError)r2rpr7r7r8rOsz>ClassPropertiesAndMethods.test_specials.<locals>.C.__getitem__N)ryrzr{rOr7r7r7r8r|sr|zC object at rr�r�c@seZdZdd�ZdS)z2ClassPropertiesAndMethods.test_specials.<locals>.DcSs$d|krdkrnn|St�dS)Nrr�)r�)r2rpr7r7r8rO(sz>ClassPropertiesAndMethods.test_specials.<locals>.D.__getitem__N)ryrzr{rOr7r7r7r8r�'sr�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
||_dS)N)r�)r2r�r7r7r8r,?sz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__init__cSs
|jS)N)r�)r2r7r7r8r~Asz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__bool__cSs
t|j�S)N)�hashr�)r2r7r7r8�__hash__Csz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__hash__cSs
|j|kS)N)r�)r2rxr7r7r8raEsz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__eq__cSs
|j|kS)N)r�)r2rxr7r7r8�__ne__Gsz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__ne__cSs
|j|kS)N)r�)r2rxr7r7r8�__ge__Isz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__ge__cSs
|j|kS)N)r�)r2rxr7r7r8�__gt__Ksz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__gt__cSs
|j|kS)N)r�)r2rxr7r7r8�__le__Msz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__le__cSs
|j|kS)N)r�)r2rxr7r7r8�__lt__Osz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__lt__cSs
d|jS)NzProxy:%s)r�)r2r7r7r8r�Qsz>ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__str__cSs
d|jS)Nz	Proxy(%r))r�)r2r7r7r8rnSsz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__repr__cSs
||jkS)N)r�)r2r�r7r7r8r`UszCClassPropertiesAndMethods.test_specials.<locals>.Proxy.__contains__N)ryrzr{r,r~r�rarrrrrr�rnr`r7r7r7r8�Proxy>srr]zProxy:0zProxy(0))r�r�rA�idr�r=r�ZassertGreaterEqualr�findrm�assertNotInr�r)
r2r|r��c2rpr�r�r�rZp0Zp1Zp_1Zp10r7r7r8�
test_specialssp
z'ClassPropertiesAndMethods.test_specialsc

Cs�ddl}Gdd�dt�}|�}|�|�}|�|�|�~t��|�|�d�~Gdd�dt�}|�}y|�|�Wn2tk
r�}z|�dt|��Wdd}~XYnX|�	d�Gdd	�d	t�}|�}	|�|	�}|�|�|	�~	t��|�|�d�~dS)
Nrc@seZdZdS)z2ClassPropertiesAndMethods.test_weakrefs.<locals>.CN)ryrzr{r7r7r7r8r|psr|c@seZdZdgZdS)z7ClassPropertiesAndMethods.test_weakrefs.<locals>.NoWeakr�N)ryrzr{r�r7r7r7r8�NoWeakysrzweak referencez!weakref.ref(no) should be illegalc@seZdZddgZdS)z5ClassPropertiesAndMethods.test_weakrefs.<locals>.Weakr�rnN)ryrzr{r�r7r7r7r8�Weak�sr)
�weakrefr��refr=rrfrrrr�)
r2r
r|rP�rr�nor8rZyesr7r7r8�
test_weakrefsms0
"

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�x|dD]t}yt||d�WnNtk
�r�}z.t|��d�dk�r�|�d|t|�f�Wdd}~XYnX|�d|��q8Wd|_
|�|j
d�Gdd�dt�}|�}yx|D]}	t|	��q�WWntk
�rYnX|�d�dS)Nc@s4eZdZdd�Zdd�Zdd�Zeeeedd�Zd	S)
z4ClassPropertiesAndMethods.test_properties.<locals>.CcSs|jS)N)r�)r2r7r7r8�getx�sz9ClassPropertiesAndMethods.test_properties.<locals>.C.getxcSs
||_dS)N)r�)r2r�r7r7r8�setx�sz9ClassPropertiesAndMethods.test_properties.<locals>.C.setxcSs|`dS)N)r�)r2r7r7r8�delx�sz9ClassPropertiesAndMethods.test_properties.<locals>.C.delxzI'm the x property.)�docN)ryrzr{rrrr�r�r7r7r7r8r|�sr|r�r�r�rvrV�fget�fset�fdelzI'm the x property.rrr)rrr�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>.DcSsddS)Nr]rr7)rjr7r7r8r��r�z=ClassPropertiesAndMethods.test_properties.<locals>.D.<lambda>N)ryrzr{r�rOr7r7r7r8r��sr�z,expected ZeroDivisionError from bad property)r�r�r�r=r�r~r�r�rAr�r�r�rrVr�rrrr�rBrrr��ZeroDivisionError)
r2r|r;�raw�attrsrrr8r�rErpr7r7r8�test_properties�sV

"
z)ClassPropertiesAndMethods.test_propertiesr^z)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)z
getter methodrr7)r2r7r7r8�getter�szFClassPropertiesAndMethods.test_properties_doc_attrib.<locals>.E.gettercSsdS)z
setter methodNr7)rbr�r7r7r8�setter�szFClassPropertiesAndMethods.test_properties_doc_attrib.<locals>.E.setterz
getter method)rN)
ryrzr{rrr�Zpropr=rVZprop2r7)r2r7r8r��s
r�)r�)r2r�r7)r2r8�test_properties_doc_attrib�sz4ClassPropertiesAndMethods.test_properties_doc_attribcs:yddl�Wntk
r YnXG�fdd�dt�}dS)NrcseZdZe�j�ZdS)z>ClassPropertiesAndMethods.test_testcapi_no_segfault.<locals>.XN)ryrzr{r�Ztest_with_docstring�pr7)�	_testcapir7r8r�sr)r"�ImportErrorr�)r2rr7)r"r8�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>.Cr)rcSs|jS)N)�_foo)r2r7r7r8r��sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.C.foocSst|�|_dS)N)r#r%)r2r�r7r7r8r��scSs|`dS)N)r%)r2r7r7r8r��sN)ryrzr{r�r�rr�deleterr7r7r7r8r|�s
r|rr�i���r%r�cseZdZ�jjdd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.DcSs"y|`Wntk
rYnXdS)N)r%rB)r2r7r7r8r��sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.D.fooN)ryrzr{r�r&r7)r|r7r8r��sr�r�c@sDeZdZedd��Zejdd��Zejdd��Zejddd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.EcSs|jS)N)r%)r2r7r7r8r�
	sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.E.foocSst�dS)N)�RuntimeError)r2r�r7r7r8r�
	scSst|�|_dS)N)r#r%)r2r�r7r7r8r�	sNcSs|`dS)N)r%)r2r�r7r7r8r�	s)N)ryrzr{r�r�rr&r7r7r7r8r�		s
r�cs*eZdZ�jjdd��Zejdd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.FcSs|`dS)N)r%)r2r7r7r8r�	sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.F.foocSstd|�|_dS)Nr)�maxr%)r2r�r7r7r8r� 	sN)ryrzr{r�r&rr7)r�r7r8r	sri����r)r�r=r�rVr�r�r%)r2rPr�rEr_rr�r7)r|r�r8�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|��x|ddd
ddgdfD]f}yt|�WnDtk
�r<Yn>tk
�rj|dk�rXn|�d|�YnX|�d|��qWytii�Wntk
�r�YnX|�d�Gdd�d�}yt|��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���xHd#gd$gfD]8}yt|�Wntk
�r�YnX|�d%|��q�WdS)&Nr^rL)r]r;r])�one�twor*)r+)r+r^)r*)r*rv)r+r�ry�0)rzno TypeError from dict(%r)zno TypeError from dict({}, {})c@seZdZdddd�ZdS)zAClassPropertiesAndMethods.test_dict_constructors.<locals>.Mappingr^ray�?)r]r_r;N)ryrzr{rlr7r7r7r8�MappingQ	sr-z*no TypeError from dict(incomplete mapping)cSst|j���S)N)r.rlrh)r2r7r7r8r�\	r�zBClassPropertiesAndMethods.test_dict_constructors.<locals>.<lambda>cSs
|j|S)N)rl)r2rpr7r7r8r�]	r�c@seZdZdd�Zdd�ZdS)zJClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntrycSs||_||_dS)N)�first�last)r2r.r/r7r7r8r,c	szSClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntry.__init__cSst|j|jg�S)N)rjr.r/)r2r7r7r8rkf	szSClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntry.__iter__N)ryrzr{r,rkr7r7r7r8�AddressBookEntryb	sr0�TimZWarsaw�BarryZPeters)r2r1rarecSsg|]}||df�qS)r]r7)�.0rpr7r7r8�
<listcomp>p	szDClassPropertiesAndMethods.test_dict_constructors.<locals>.<listcomp>)Ztooshort)ZtooZlongzby 1zno ValueError from dict(%r))rlr=r.r/rjr�
ValueErrorr�rhrO�zipr�)r2rEZbadargr-r0Zbadr7r7r8�test_dict_constructors(	sl






z0ClassPropertiesAndMethods.test_dict_constructorscs8d}|�t�ddg�~x2dddddgddd	ddit|jfD]}t|�q<Wd
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,�yt|�Wnt
k
�r�YnX|�tt�tt��G�fd-d.�d.t��G�fd/d
�d
t�}t|��dS)0Nr��junkr2r^y@g@�2�2)r^cSsdd�|D�S)NcSsg|]}|�d�s|�qS)r�)r�)r3rjr7r7r8r4�	szKClassPropertiesAndMethods.test_dir.<locals>.interesting.<locals>.<listcomp>r7)�stringsr7r7r8�interesting�	sz7ClassPropertiesAndMethods.test_dir.<locals>.interestingc@seZdZdZdd�ZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.Cr]cSsdS)Nr7)r2r7r7r8�Cmethod�	r�z5ClassPropertiesAndMethods.test_dir.<locals>.C.CmethodN)ryrzr{�Cdatar=r7r7r7r8r|�	sr|r>r=cSsdS)Nrr7)r2r7r7r8r��	r�z4ClassPropertiesAndMethods.test_dir.<locals>.<lambda>�cdata�cmethodc@seZdZdZdd�ZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.Ar]cSsdS)Nr7)r2r7r7r8�Amethod�	r�z5ClassPropertiesAndMethods.test_dir.<locals>.A.AmethodN)ryrzr{�AdatarAr7r7r7r8r��	sr�rBrAr�cSsdS)Nr_r7)r2r7r7r8r��	r��adata�amethodc@seZdZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.MN)ryrzr{r7r7r7r8�M�	srErGr]ryrV�__package__�
__loader__�__spec__csg|]}|�kr|�qSr7r7)r3r�)�default_attributesr7r8r4�	sz6ClassPropertiesAndMethods.test_dir.<locals>.<listcomp>r;rLc@seZdZdd�Zee�ZdS)z.ClassPropertiesAndMethods.test_dir.<locals>.M2cSsdS)NzNot a dict!r7)r2r7r7r8�getdict�	sz6ClassPropertiesAndMethods.test_dir.<locals>.M2.getdictN)ryrzr{rJr�rAr7r7r7r8r��	sr�Zm2zNot a dict!cs<eZdZdd�Zdd�Z�fdd�Zdd�Z�fd	d
�ZdS)z3ClassPropertiesAndMethods.test_dir.<locals>.WrappercSs
||_dS)N)�
_Wrapper__obj)r2r�r7r7r8r,�	sz<ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__init__cSsdt|j�S)NzWrapper(%s))rmrK)r2r7r7r8rn�	sz<ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__repr__cs�|j|�S)N)rK)r2r�)�Wrapperr7r8rO�	sz?ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__getitem__cSs
t|j�S)N)r�rK)r2r7r7r8r:�	sz;ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__len__cs�t|j|��S)N)r@rK)r2r5)rLr7r8r��	sz?ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__getattr__N)ryrzr{r,rnrOr:r�r7)rLr7r8rL�	s
rLcs eZdZ�fdd�Zee�ZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.Ccs�t|��S)N)r?)r2)rLr7r8Z
__getclass�	sz8ClassPropertiesAndMethods.test_dir.<locals>.C.__getclassN)ryrzr{Z_C__getclassr�r�r7)rLr7r8r|�	s)r=r�r?�test_dirr�r?r@rCrDr�rLr;rArrw�Ellipsis)r2r8r�r<r|ZcstuffrPr�Zastuffr;rEZ	minstance�namesr�Z
m2instancer7)rLrIr8rM{	sV(

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�yt�d�Wntk
�r4YnX|�d�yt�|��Wntk
�rfYnX|�d�yt���d�Wntk
�r�YnX|�d�yt���|��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*�WdQRXdS)+Nc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.AcSsd|S)NzA(%r)r7)r2r;r7r7r8rD�	sz5ClassPropertiesAndMethods.test_supers.<locals>.A.methN)ryrzr{rDr7r7r7r8r��	sr�r]zA(1)cs&eZdZ��fdd�Zdd�Z�ZS)z0ClassPropertiesAndMethods.test_supers.<locals>.Bcst�|�|_dS)N)r�r�)r2)r�r�r7r8r,�	sz9ClassPropertiesAndMethods.test_supers.<locals>.B.__init__cSsd||j�|�S)NzB(%r))r�rD)r2r;r7r7r8rD�	sz5ClassPropertiesAndMethods.test_supers.<locals>.B.meth)ryrzr{r,rDr�r7)r�)r�r8r��	sr�r^zB(2)A(2)c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.CcSsd||j�|�S)NzC(%r))r�rD)r2r;r7r7r8rD�	sz5ClassPropertiesAndMethods.test_supers.<locals>.C.methN)ryrzr{rDr7r7r7r8r|�	sr|r_zC(3)A(3)cseZdZ��fdd�Z�ZS)z0ClassPropertiesAndMethods.test_supers.<locals>.Dcsd|t�|��|�S)NzD(%r))r�rD)r2r;)r�r�r7r8rD�	sz5ClassPropertiesAndMethods.test_supers.<locals>.D.meth)ryrzr{rDr�r7)r�)r�r8r��	sr�razD(4)C(4)B(4)A(4)cseZdZ��fdd�Z�ZS)z6ClassPropertiesAndMethods.test_supers.<locals>.mysupercst�|�j|�S)N)r�r,)r2r3)r��mysuperr7r8r,�	sz?ClassPropertiesAndMethods.test_supers.<locals>.mysuper.__init__)ryrzr{r,r�r7)rP)r�r8rP�	srPcseZdZ��fdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.Ecsd|��|��|�S)NzE(%r))rD)r2r;)r�rPr7r8rD�	sz5ClassPropertiesAndMethods.test_supers.<locals>.E.methN)ryrzr{rDr7)r�rPr7r8r��	sr�rezE(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�ryrD)r2r;rjr7r7r8rD
sz5ClassPropertiesAndMethods.test_supers.<locals>.F.methN)ryrzr{rDr7r7r7r8r
srrfz!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>.DDbasecSsdS)Nr�r7)r2r7r7r8r-
r�z:ClassPropertiesAndMethods.test_supers.<locals>.DDbase.getxN)ryrzr{rr�r�r7r7r7r8�DDbase,
srRc@seZdZdd�Zee�ZdS)z4ClassPropertiesAndMethods.test_supers.<locals>.DDsubcSsdS)Nrr7)r2r7r7r8r1
r�z9ClassPropertiesAndMethods.test_supers.<locals>.DDsub.getxN)ryrzr{rr�r�r7r7r7r8�DDsub0
srSrc@seZdZedd��ZdS)z3ClassPropertiesAndMethods.test_supers.<locals>.BasecSsdS)Nr�r7)r2r7r7r8r�<
r�z<ClassPropertiesAndMethods.test_supers.<locals>.Base.<lambda>N)ryrzr{r��aPropr7r7r7r8�Base;
srUcs"eZdZe��fdd��Z�ZS)z2ClassPropertiesAndMethods.test_supers.<locals>.Subcst�|�jS)N)r�rT)�klass)�Subr�r7r8r�?
sz7ClassPropertiesAndMethods.test_supers.<locals>.Sub.test)ryrzr{r�r�r�r7)rW)r�r8rW>
srW)r�)
r�r=rDr�r�rQrr�r�r�r�rTr
)r2r�r|rrRrS�ddrU)r�)r�r�r�rWrPr8�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"��x:t
d$�D].}|t
|��}|��}	|	��}
|�|
|��qBW|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*��xFt
d,�D]:}|d-�ttt
|����}|��}|��}	|�|	|��q�W|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|�S)N)�hex)r2r7r7r8rnM
szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.hexint.__repr__cs�t�||��S)N)r%rK)r2rx)�hexintr7r8rKO
szHClassPropertiesAndMethods.test_basic_inheritance.<locals>.hexint.__add__N)ryrzr{rnrKr7)r[r7r8r[L
sr[��	Z0x10i�Z0x3efi90rr�cs.eZdZgZdd�Z��fdd�ZeZ�ZS)zAClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlongcSst|�S)N)�oct)r2r7r7r8r�b
szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlong.__str__cs|�t�|��|��S)N)r�r�rK)r2rx)r��octlongr7r8rKd
szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlong.__add__)ryrzr{r�r�rKr�r�r7)r_)r�r8r_`
sr_r_reZ0o10i�Z0o5675r]r�c@seZdZdS)zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.longcloneN)ryrzr{r7r7r7r8�	longclone�
sr`c@s$eZdZdgZd	dd�Zdd�ZdS)
zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloatr��r�cSst|�|_dS)N)r%r�)r2r�r�r7r7r8r,�
szLClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloat.__init__cSsd|j|fS)Nz%.*g)r�)r2r7r7r8rn�
szLClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloat.__repr__N)rar�)ryrzr{r�r,rnr7r7r7r8�	precfloat�
s
rbg�������?z1.1g��@c@seZdZdd�ZdS)zDClassPropertiesAndMethods.test_basic_inheritance.<locals>.madcomplexcSsd|j|jfS)Nz%.17gj%+.17g)r�r�)r2r7r7r8rn�
szMClassPropertiesAndMethods.test_basic_inheritance.<locals>.madcomplex.__repr__N)ryrzr{rnr7r7r7r8�
madcomplex�
src���raz4j-3c@seZdZdZdd�ZdS)zBClassPropertiesAndMethods.test_basic_inheritance.<locals>.madtupleNcSs2|jdk	r|jSt|�}|��|�|�|_|jS)N)�_revr.r�r�)r2r�r7r7r8�rev�
s
zFClassPropertiesAndMethods.test_basic_inheritance.<locals>.madtuple.rev)ryrzr{rerfr7r7r7r8�madtuple�
srg)
r]r^r_rarerfr\�r]r)
rr]rhr\rfrerar_r^r]i)r]r^r_rarer7r^c@seZdZdZdd�ZdS)zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.madstringNcSs8|jdk	r|jSt|�}|��|�d�|��|_|jS)Nr})rer.r�r��join)r2r�r7r7r8rf�
s
zGClassPropertiesAndMethods.test_basic_inheritance.<locals>.madstring.rev)ryrzr{rerfr7r7r7r8�	madstring�
srjZabcdefghijklmnopqrstuvwxyzZzyxwvutsrqponmlkjihgfedcba�r}Z12345zr�c@seZdZdZdd�ZdS)zDClassPropertiesAndMethods.test_basic_inheritance.<locals>.madunicodeNcSs8|jdk	r|jSt|�}|��|�d�|��|_|jS)Nr})rer.r�r�ri)r2r�r7r7r8rfs
zHClassPropertiesAndMethods.test_basic_inheritance.<locals>.madunicode.rev)ryrzr{rerfr7r7r7r8�
madunicodesrlZABCDEFZFEDCBAZxyc@seZdZdS)zAClassPropertiesAndMethods.test_basic_inheritance.<locals>.sublistN)ryrzr{r7r7r7r8�sublistTsrmrrf�����r�i����)!r%r=rmr�r�r�rr#rAr&r�rNrfr�ri�mapr\�strip�lstrip�rstrip�	translate�replace�ljustr��rjust�center�lower�upper�
capitalize�titler.rir�)r2r;r`rbrc�basergrprFrr�rjrjZidentitytabrlrmr7)r[r_r8�test_basic_inheritanceI
s�

			

z0ClassPropertiesAndMethods.test_basic_inheritancec	CsF|�td��tdd�WdQRX|�td��tdd�WdQRX|�td��tdd�WdQRX|�tddd�tdd��|�tdd	�d
�|�tddd
�d�|�td��tt	d�d�WdQRX|�td��t
dd�WdQRXxRtttttttt
fD]:}y|dd�Wntk
�r,YnX|�d|��qWdS)Nzkeyword argumentr])r�r^r�i�)r�r�i�)r��500sabc�strict)r��errorsrYr_)Zsequence)rr]r^)Zbogus_keyword_argz4expected TypeError from bogus keyword argument to %r)ZassertRaisesRegexrr%r&�boolr=r�rrNr�r.r�)r2�constructorr7r7r8�
test_keywords�s*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�Sublcass of str that computes __eq__ case-insensitively.

            Also computes a hash code of the string in canonical form.
            cSs|��|_t|j�|_dS)N)rz�	canonicalr��hashcode)r2r�r7r7r8r,�s
zOClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__init__cst|��s�|�}|j|jkS)N)r�r�)r2rx)�cistrr7r8ra�s
zMClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__eq__cSs|jS)N)r�)r2r7r7r8r��szOClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__hash__N)ryrzr{rVr,rar�r7)r�r7r8r��sr��ABCrYZaBcr*r]r+r^ZtHreer_ZtWoZTHrEEZONeZthrEE)rr=rr�)r2rEr7)r�r8�test_str_subclass_as_dict_key�sz7ClassPropertiesAndMethods.test_str_subclass_as_dict_keyc
sGdd�d�}x�|ttfD]�}G�fdd�d|���d�}�d�}�d�}|�|d�|||d�}x�dD]�}x�dD]�}x~d	D]v}	|�td
|	�td|	�d||f�|�td
|	�td|	�d||f�|�td|	�td|	�d||f�q|WqrWqhWqWdS)Nc@seZdZdS)zCClassPropertiesAndMethods.test_classic_comparisons.<locals>.classicN)ryrzr{r7r7r7r8�classic�sr�cs\eZdZdd�Z�fdd�Z�fdd�Z�fdd�Z�fd	d
�Z�fdd�Z�fd
d�Z	dS)z=ClassPropertiesAndMethods.test_classic_comparisons.<locals>.CcSst|�|_dS)N)r%r�)r2r�r7r7r8r,�szFClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__init__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8ra�s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__eq__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8r�s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__ne__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8r�s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__lt__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8r�s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__le__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8r�s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__gt__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8r�s


zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__ge__N)
ryrzr{r,rarrrrrr7)r|r7r8r|�sr|r]r^r_)r]r^r_)rz<=z==z!=rz>=zc[x] %s c[y]zx %s yz
x=%d, y=%dz	c[x] %s yz	x %s c[y])r%r�r=r>)
r2r�r~r�r	�c3rPr��y�opr7)r|r8�test_classic_comparisons�s((





z2ClassPropertiesAndMethods.test_classic_comparisonscsjGdd�dt�}|d�}��|d���d|�Gdd�dt�}|d�}��|d���d|�Gdd	�d	�}x�|tttfD]�}G��fd
d�d|���d�}�d�}�d
�}	��|d�|||	d�}
x�dD]�}x�dD]�}x~dD]v}
��td|
�td|
�d||f���td|
�td|
�d||f���td|
�td|
�d||f�q�Wq�Wq�Wq|WdS)Nc@seZdZdS)z:ClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZN)ryrzr{r7r7r7r8rsrr]y�?c@seZdZdd�ZdS)z;ClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZZcSs yt||�dkStSdS)Ng���ư>)r#rw)r2rxr7r7r8raszBClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZZ.__eq__N)ryrzr{rar7r7r7r8�ZZsr�g�ׇP�?c@seZdZdS)z@ClassPropertiesAndMethods.test_rich_comparisons.<locals>.classicN)ryrzr{r7r7r7r8r�!sr�csheZdZdd�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|�|_dS)N)r%r�)r2r�r7r7r8r,%szCClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__init__cs��d�dS)Nzshouldn't call __cmp__)r�)rbrx)r2r7r8�__cmp__'szBClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__cmp__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8ra)s


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__eq__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8r/s


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__ne__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8r5s


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__lt__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8r;s


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__le__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8rAs


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__gt__cs8t|��r|j|jkSt|t�s*t|t�r4|j|kStS)N)r�r�r%rw)r2rx)r|r7r8rGs


zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__ge__N)ryrzr{r,r�rarrrrrr7)r|r2r7r8r|$sr|r^r_)r]r^r_)rz<=z==z!=rz>=zc[x] %s c[y]zx %s yz
x=%d, y=%dz	c[x] %s yz	x %s c[y])r�r=r%r�r.r>)r2rrgr�Zzzr�r~r�r	r�rPr�r�r�r7)r|r2r8�test_rich_comparisonss8)





z/ClassPropertiesAndMethods.test_rich_comparisonscs4ddlm}�fdd�}||jd�|tjd�dS)Nr)�FileIOcs��|j|�dS)N)r=rV)�descrZwhat)r2r7r8�checkbsz6ClassPropertiesAndMethods.test_descrdoc.<locals>.checkzTrue if the file is closedz!the real part of a complex number)�_ior��closedr�r�)r2r�r�r7)r2r8�
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�ry)r2r�Zotyper7r7r8r�ks
zGClassPropertiesAndMethods.test_doc_descriptor.<locals>.DocDescr.__get__N)ryrzr{r�r7r7r7r8�DocDescrjsr�cseZdZ��ZdS)z?ClassPropertiesAndMethods.test_doc_descriptor.<locals>.OldClassN)ryrzr{rVr7)r�r7r8�OldClassqsr�cseZdZ��ZdS)z?ClassPropertiesAndMethods.test_doc_descriptor.<locals>.NewClassN)ryrzr{rVr7)r�r7r8�NewClassssr�zobject=None; type=OldClassz'object=OldClass instance; type=OldClasszobject=None; type=NewClassz'object=NewClass instance; type=NewClass)r�r=rV)r2r�r�r7)r�r8�test_doc_descriptorgsz-ClassPropertiesAndMethods.test_doc_descriptorcs Gdd�dt�}Gdd�dt�}Gdd�dt�}Gdd�d||�}xX||||fD]H}xB||||fD]2}|�}||_��|j|�||_��|j|�qbWqPW�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%|�}x�||f||
f|
|f||f||ffD]n\}}|�}d|_||_��|j|d&||f���|jd�||_��|j|d&||f���|jd��qWx`||||||||t|	f
D]D}x<||||||||t|	f
D] }||k�rȐq�||�|��q�W�q�WGd'd(�d(t��G�fd)d*�d*t���fd+d,�t	d-�D�}~dS).Nc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.CN)ryrzr{r7r7r7r8r||sr|c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.DN)ryrzr{r7r7r7r8r�}sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.EN)ryrzr{r7r7r7r8r�~sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.FN)ryrzr{r7r7r7r8rsrc	sly
||_Wntk
rYnX��d||f�yt|d�Wnttfk
rXYnX��d|�dS)Nz!shouldn't allow %r.__class__ = %rr�z shouldn't allow del %r.__class__)r�rr�rrB)r�r|)r2r7r8�cant�s
z6ClassPropertiesAndMethods.test_set_class.<locals>.cantr]c@seZdZgZdS)z5ClassPropertiesAndMethods.test_set_class.<locals>.IntN)ryrzr{r�r7r7r7r8�Int�sr�Tr^c@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Gr;rLN)ryrzr{r�r7r7r7r8r!�sr!c@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.HrLr;N)ryrzr{r�r7r7r7r8rc�srcc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Ir;rLN)ryrzr{r�r7r7r7r8r��sr�c@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.JrPrLN)ryrzr{r�r7r7r7r8�J�sr�c@seZdZdddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Kr;rLrEN)ryrzr{r�r7r7r7r8�K�sr�c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Lr_N)ryrzr{r�r7r7r7r8r��sr�c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Mr_N)ryrzr{r�r7r7r7r8rE�srEc@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.NrnN)ryrzr{r�r7r7r7r8r��sr�c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.PrAN)ryrzr{r�r7r7r7r8�P�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.QN)ryrzr{r7r7r7r8�Q�sr�c@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.RrArnN)ryrzr{r�r7r7r7r8�R�sr�z0assigning %r as __class__ for %r silently failedc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.ON)ryrzr{r7r7r7r8�O�sr�cseZdZ�fdd�ZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Acs
�|_dS)N)r�)r2)r�r7r8r^�sz;ClassPropertiesAndMethods.test_set_class.<locals>.A.__del__N)ryrzr{r^r7)r�r7r8r��sr�csg|]
}���qSr7r7)r3r�)r�r7r8r4�sz<ClassPropertiesAndMethods.test_set_class.<locals>.<listcomp>rv)
r�r�r�r.r%r�r?r;r=r�)r2r|r�r�rr�Zcls2r�r�r��or!rcr�r�r�r�rEr�r�r�r�rqr7)r�r�r2r8�test_set_classzsp


,


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�}xR|||fD]D}||�|j}	yd|	d<Wntk
�rYq�X��d|�q�WGdd�dtj��}
Gdd�d�tj�}x,|
|fD] }|d�}
||
�d|
jd<�qNWdd�}Gdd�dt	��}Gdd �d �t	�}xHt	||fD]:}|�}d!di|_��|j
d���||�|t����q�WdS)"Nc@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.CN)ryrzr{r7r7r7r8r|�sr|rLr]c	s:y
||_Wnttfk
r"YnX��d||f�dS)Nz shouldn't allow %r.__dict__ = %r)rArBrr�)r�rl)r2r7r8r��s

z5ClassPropertiesAndMethods.test_set_dict.<locals>.cantc@seZdZdS)z5ClassPropertiesAndMethods.test_set_dict.<locals>.BaseN)ryrzr{r7r7r7r8rU�srUc	s��|i�y|`Wnttfk
r*YnX��d|��jd}y|�|i�Wnttfk
rlYnX��d|�dS)zR
            x has to be an instance of a class inheriting from Base.
            zshouldn't allow del %r.__dict__rAz&dict_descr allowed access to %r's dictN)rArBrr�r~)r�Z
dict_descr)rUr�r2r7r8�verify_dict_readonly�s

zEClassPropertiesAndMethods.test_set_dict.<locals>.verify_dict_readonlyc@seZdZdS)z6ClassPropertiesAndMethods.test_set_dict.<locals>.Meta1N)ryrzr{r7r7r7r8�Meta1�sr�c@seZdZdS)z6ClassPropertiesAndMethods.test_set_dict.<locals>.Meta2N)ryrzr{r7r7r7r8�Meta2�sr�c@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.DN)ryrzr{r7r7r7r8r��sr�)r�c@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.EN)ryrzr{r7r7r7r8r�
sr�Zeggsr�z%r's __dict__ can be modifiedc@seZdZdS)z8ClassPropertiesAndMethods.test_set_dict.<locals>.Module1N)ryrzr{r7r7r7r8�Module1
sr�c@seZdZdS)z8ClassPropertiesAndMethods.test_set_dict.<locals>.Module2N)ryrzr{r7r7r7r8�Module2
sr�c	Ss*y|`Wnttfk
r dSXdSdS)NFT)rArrB)r_r7r7r8�can_delete_dict
s
z@ClassPropertiesAndMethods.test_set_dict.<locals>.can_delete_dictc@seZdZdS)z;ClassPropertiesAndMethods.test_set_dict.<locals>.Exception1N)ryrzr{r7r7r7r8�
Exception1"
sr�c@seZdZdS)z;ClassPropertiesAndMethods.test_set_dict.<locals>.Exception2N)ryrzr{r7r7r7r8�
Exception2$
sr�r;)r�rAr=rLr?rr�rrr�r;r5)r2r|r;r�r�r�r�r�r�Z
class_dictr�r�rr�r�r�r�Z
ExceptionTyper_r7)rUr�r2r8�
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%)r2r7r7r8rn/
szKClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__repr__cs�t|�t|��S)N)r%)r2rx)r�r7r8rK1
szJClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__add__Ncs>|dkr�tt|�t|���S�tt|�t|�t|���SdS)N)rr%)r2rxr�)r�r7r8�__pow__4
szJClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__pow__cs@|dkr �tt|�t|�|��S�tt|�t|�t|���SdS)N)rr%)r2rxr�)r�r7r8�__rpow__9
szKClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__rpow__)N)N)ryrzr{rnrKr�r�r�r7)r�r7r8r�.
s
r�r]r^zI(3)r_zI(8)rec@seZdZdd�ZdS)zBClassPropertiesAndMethods.test_binary_operator_override.<locals>.ScSs|��|��kS)N)rz)r2rxr7r7r8raG
szIClassPropertiesAndMethods.test_binary_operator_override.<locals>.S.__eq__N)ryrzr{rar7r7r7r8�SF
sr�)r%r=rmrr)r2r�r7)r�r8�test_binary_operator_override,
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�|`	y
|jWntk
�r8YnX|�d�Gdd�dt�}Gdd�d|�}~t
��dd
�|_dS)Nc@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.AN)ryrzr{r7r7r7r8r�L
sr�c@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.BN)ryrzr{r7r7r7r8r�N
sr�c@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.CN)ryrzr{r7r7r7r8r|P
sr|c@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.DN)ryrzr{r7r7r7r8r�R
sr�cSsdS)Nr�r7)r2r7r7r8r�V
r�zEClassPropertiesAndMethods.test_subclass_propagation.<locals>.<lambda>r�cSsdS)Ni:r7)r2r7r7r8r�X
r�i:cSsdS)N�r7)r2r7r7r8r�Z
r�r�cSsdS)Nrvr7)r2r7r7r8r�\
r�rvcSs|dkrdSt�||�S)Nr�r�)r�r
)r2r5r7r7r8r
r
szMClassPropertiesAndMethods.test_subclass_propagation.<locals>.__getattribute__r�cSs|dkrdSt|��dS)N)r�r�r�r)rB)r2r5r7r7r8r�y
szHClassPropertiesAndMethods.test_subclass_propagation.<locals>.__getattr__rzd.foo should be undefined nowc@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.AN)ryrzr{r7r7r7r8r��
sc@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.BN)ryrzr{r7r7r7r8r��
scWsdS)Nr7)r;r7r7r8r��
r�)r�r�r�r=r
rr�r�r
r�r�rBr�rrfrY)	r2r�r�r|r�rEZ	orig_hashr
r�r7r7r8�test_subclass_propagationJ
sv





z3ClassPropertiesAndMethods.test_subclass_propagationcCs�ddl}Gdd�dt�}d}||�}|�|�|�|�|��Gdd�dt�}|d�}y|�|�|�d�Wntk
r�YnXdS)	Nrc@seZdZdS)zBClassPropertiesAndMethods.test_buffer_inheritance.<locals>.MyBytesN)ryrzr{r7r7r7r8rI�
srIsabcc@seZdZdS)z@ClassPropertiesAndMethods.test_buffer_inheritance.<locals>.MyIntN)ryrzr{r7r7r7r8rE�
srEr�z2subclass of int should not have a buffer interface)�binasciirMr=�b2a_hexr%r�r)r2r�rIr~rGrEr7r7r8�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�decode)r2)r�r7r8r��
szOClassPropertiesAndMethods.test_str_of_str_subclass.<locals>.octetstring.__str__cSs|dS)Nz reprr7)r2r7r7r8rn�
szPClassPropertiesAndMethods.test_str_of_str_subclass.<locals>.octetstring.__repr__N)ryrzr{r�rnr7)r�r7r8�octetstring�
sr�r��AZ41zA repr)�filez41
41
)
r��iorr=r?rm�ordr�rn�StringIO�printri�close)r2r�r�r�Zcapturer7)r�r8�test_str_of_str_subclass�
s"z2ClassPropertiesAndMethods.test_str_of_str_subclasscCsDdd�}|�|jdd�d�t�}tj|dddd�|�|d	�dS)
NcSs|S)Nr7)r;r7r7r8r��
r�z;ClassPropertiesAndMethods.test_keyword_arguments.<locals>.fr�)r;uabc½€�latin1rv)�encodingr�sabc�?)r=r��	bytearrayr,)r2r�Zbar7r7r8�test_keyword_arguments�
s
z0ClassPropertiesAndMethods.test_keyword_argumentscCsHGdd�dt�}|�|_y|��Wntk
r8YnX|�d�dS)Nc@seZdZdS)z8ClassPropertiesAndMethods.test_recursive_call.<locals>.AN)ryrzr{r7r7r7r8r��
sr�z7Recursion limit should have been reached for __call__())r�r��RecursionErrorr�)r2r�r7r7r8�test_recursive_call�
sz-ClassPropertiesAndMethods.test_recursive_callcs�g�G�fdd�dt�}|�}|��g�~t��|��dg�Gdd�dt�}|�}y
|d=Wntk
rvYnX|�d�dS)NcseZdZ�fdd�ZdS)z5ClassPropertiesAndMethods.test_delete_hook.<locals>.Ccs��d�dS)Nr])ri)r2)rr7r8r^�
sz=ClassPropertiesAndMethods.test_delete_hook.<locals>.C.__del__N)ryrzr{r^r7)rr7r8r|�
sr|r]c@seZdZdS)z5ClassPropertiesAndMethods.test_delete_hook.<locals>.DN)ryrzr{r7r7r7r8r��
sr�rz$invalid del() didn't raise TypeError)r�r=rrfrr�)r2r|rPr�rEr7)rr8�test_delete_hook�
s
z*ClassPropertiesAndMethods.test_delete_hookcCs�Gdd�dt�}|�}yt|�Wntk
r6YnX|�d�Gdd�dt�}|�}yt|�Wntk
rxYnX|�d�dS)Nc@seZdZdS)z?ClassPropertiesAndMethods.test_hash_inheritance.<locals>.mydictN)ryrzr{r7r7r7r8�mydict�
sr�z#hash() of dict subclass should failc@seZdZdS)z?ClassPropertiesAndMethods.test_hash_inheritance.<locals>.mylistN)ryrzr{r7r7r7r8�mylist�
sr�z#hash() of list subclass should fail)rlr�rr�r.)r2r�rEr�r7r7r8�test_hash_inheritance�
s
z/ClassPropertiesAndMethods.test_hash_inheritancecCsyddWntk
r YnX|�d�yd�d�Wntk
rNYnX|�d�yd�dg�Wntk
r~YnX|�d�yd�d�Wntk
r�YnX|�d	�yd
dWntk
r�YnX|�d�ydiWntk
�rYnX|�d
�yddWntk
�r4YnX|�d�yddWntk
�rbYnX|�d�yddWntk
�r�YnX|�d�yddWntk
�r�YnX|�d�|�d��d�|�d��d�|�ddd�|�ddd�dS)Nr;rez'' + 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%*srYz''%*s' % ('abc') doesn't raise TypeErrorz%*.*s)rYrez,'%*.*s' % ('abc', 5) doesn't raise TypeErrorz%s)r]r^z%'%s' % (1, 2) doesn't raise TypeError�%z#'%' % None doesn't raise ValueErrorZ534253r]Z534253xz%c�)rr��splitr5ri�rindexr=�isdigit)r2r7r7r8�test_str_operations	sl









z-ClassPropertiesAndMethods.test_str_operationscCs2Gdd�d�}|�}|�}||_||_t|�}dS)Nc@seZdZdS)z?ClassPropertiesAndMethods.test_deepcopy_recursive.<locals>.NodeN)ryrzr{r7r7r7r8r9sr)rLr;r)r2rr;rLrgr7r7r8�test_deepcopy_recursive7sz1ClassPropertiesAndMethods.test_deepcopy_recursivecCsjddlm}|�|�}t|�|�|d�|�|d�|�|d�|�|j�d|_|�|jddi�dS)Nr)rry�__file__r�r])	rrr�rr�r�rAr�r=)r2rErGr7r7r8�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)z3ClassPropertiesAndMethods.test_funny_new.<locals>.Ccs6t|t�rdddgSt|t�r(t���St�|�SdS)Nr]r^r_)r�rr%r�r�)r�r�)r�r7r8r�Ps




z;ClassPropertiesAndMethods.test_funny_new.<locals>.C.__new__N)ryrzr{r�r7)r�r7r8r|Osr|c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.DcSs
||_dS)N)r�)r2r�r7r7r8r,Usz<ClassPropertiesAndMethods.test_funny_new.<locals>.D.__init__N)ryrzr{r,r7r7r7r8r�Tsr�rXr]r^r_c@seZdZedd��ZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.CcWs|S)Nr7)r3r7r7r8r�csz;ClassPropertiesAndMethods.test_funny_new.<locals>.C.__new__N)ryrzr{r�r�r7r7r7r8r|bsc@seZdZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.DN)ryrzr{r7r7r7r8r�gsc@seZdZedd��ZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.CcWs|S)Nr7)r3r7r7r8r�lsz;ClassPropertiesAndMethods.test_funny_new.<locals>.C.__new__N)ryrzr{r�r�r7r7r7r8r|ksc@seZdZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.DN)ryrzr{r7r7r7r8r�ps)r�r=r�r�)r2r|rEr7)r�r8�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||fS)Nr7)r2rxr7r7r8rbxsz;ClassPropertiesAndMethods.test_imul_bug.<locals>.C.__imul__N)ryrzr{rbr7r7r7r8r|wsr|g�?r^r_lr�)r�r=)r2r|r�r�r7r7r8�
test_imul_bugts(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||_||_dS)N)r��_C__foo)r2r�r7r7r8r,�sz@ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__init__cSs
||_dS)N)r�)r2r�r7r7r8�setfoo�sz>ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.setfoocSs|jS)N)r�)r2r7r7r8�getfoo�sz>ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.getfoocSs|jgS)N)r�)r2r7r7r8�__getstate__�szDClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__getstate__cs$��t|�d�|d|_|_dS)Nr]r)r=r�r�r�)rbZlst)r2r7r8�__setstate__�szDClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__setstate__)N)N)ryrzr{r,r�r�r�r�r7)r2r7r8r|�s


r|r�r�)r�r�r�r=r�r�r)r2r�r|r;rLr7)r2r8�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)NrraZhellc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.ScSst�||�S)N)rrO)r2r�r7r7r8rO�sz<ClassPropertiesAndMethods.test_slices.<locals>.S.__getitem__N)ryrzr{rOr7r7r7r8r��sr�)r]r^r_r^)r]r^c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.TcSst�||�S)N)rNrO)r2r�r7r7r8rO�sz<ClassPropertiesAndMethods.test_slices.<locals>.T.__getitem__N)ryrzr{rOr7r7r7r8r��sr�r]r_c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.LcSst�||�S)N)r.rO)r2r�r7r7r8rO�sz<ClassPropertiesAndMethods.test_slices.<locals>.L.__getitem__N)ryrzr{rOr7r7r7r8r��sr�r)r=rQrrOrNr.rY)r2r�r�r�r;r7r7r8�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�|�dS)N)�	containerri)r2)r|r7r8r^�szFClassPropertiesAndMethods.test_subtype_resurrection.<locals>.C.__del__N)ryrzr{r�r^r7)r|r7r8r|�sr|r�r])r�rrrrfr=r�r�r^)r2rPr7)r|r8�test_subtype_resurrection�sz3ClassPropertiesAndMethods.test_subtype_resurrectioncCs4Gdd�dt�}d}xtd�D]}||�}qW~dS)Nc@seZdZdgZdd�ZdS)z9ClassPropertiesAndMethods.test_slots_trash.<locals>.trashr�cSs
||_dS)N)r�)r2r�r7r7r8r,�szBClassPropertiesAndMethods.test_slots_trash.<locals>.trash.__init__N)ryrzr{r�r,r7r7r7r8�trash�sr�iP�)r�r�)r2r�r�rpr7r7r8�test_slots_trash�s
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>.Ar7N)ryrzr{r�r7r7r7r8r��sr�c@seZdZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.BN)ryrzr{r7r7r7r8r��sr�c@seZdZdZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.Cr7N)ryrzr{r�r7r7r7r8r|sr|rArnr^)r�rr4r=�
__basicsize__r�r�)r2r�r�r|r7r7r8�test_slots_multiple_inheritance�sz9ClassPropertiesAndMethods.test_slots_multiple_inheritancecCsZGdd�dt�}|�}|�|dd�|�|dd�|�d|d�|�d|d�dS)Nc@seZdZdd�Zdd�ZdS)z.ClassPropertiesAndMethods.test_rmul.<locals>.CcSsdS)Nrr7)r2rxr7r7r8rcsz6ClassPropertiesAndMethods.test_rmul.<locals>.C.__mul__cSsdS)N�rmulr7)r2rxr7r7r8rdsz7ClassPropertiesAndMethods.test_rmul.<locals>.C.__rmul__N)ryrzr{rcrdr7r7r7r8r|sr|r^rg������@r�)r�r=)r2r|r;r7r7r8�	test_rmulsz#ClassPropertiesAndMethods.test_rmulcCs"Gdd�dt�}|�}|dC}dS)Nc@seZdZdd�ZdS)z.ClassPropertiesAndMethods.test_ipow.<locals>.CcSsdS)Nr7)r2rxr7r7r8�__ipow__sz7ClassPropertiesAndMethods.test_ipow.<locals>.C.__ipow__N)ryrzr{r�r7r7r7r8r|sr|r^)r�)r2r|r;r7r7r8�	test_ipowsz#ClassPropertiesAndMethods.test_ipowc
s�Gdd�dt�}G�fdd�dt��Gdd�d|�}Gdd�d|�}|�}|�}|f|_�f|_|�|��d	�|�|��d	�|�|jd
�|�|jd
�|����|g�y|`Wnttfk
r�YnX|�d�y
d|_Wn<tk
�r }zt	|�d
k�r|�d�Wdd}~XYnX|�d�y|f|_Wntk
�rNYnX|�d�y||f|_Wntk
�r~YnX|�d�y|f|_Wntk
�r�YnX|�d�dS)Nc@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.CN)ryrzr{r7r7r7r8r|#sr|cs&eZdZ��fdd�Zdd�Z�ZS)z8ClassPropertiesAndMethods.test_mutable_bases.<locals>.C2cs |dkrdSt�|��|�SdS)Nr;r^)r�r
)r2rr)r�r�r7r8r
&szIClassPropertiesAndMethods.test_mutable_bases.<locals>.C2.__getattribute__cSsdS)Nr]r7)r2r7r7r8rD+sz=ClassPropertiesAndMethods.test_mutable_bases.<locals>.C2.meth)ryrzr{r
rDr�r7)r�)r�r8r�%sr�c@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.DN)ryrzr{r7r7r7r8r�-sr�c@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.EN)ryrzr{r7r7r7r8r�/sr�r]r^z&shouldn't be able to delete .__bases__r7z/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)
r�rBr=rDr;�__subclasses__rrBr�r)r2r|r�r�rEr_r8r7)r�r8�test_mutable_basessN




z,ClassPropertiesAndMethods.test_mutable_basescCsdd�tj��D�}x4|D],}t�|d�|tk	r|�t|j�d|�qWGdd�dt�}Gdd�dt�}Gd	d
�d
|�}yt	f|_Wnt
k
r�YnX|�d�yt	ft_Wnt
k
r�YnX|�d�y|tf|_Wnt
k
r�YnXd
�std��dS)NcSsg|]}t|t�r|�qSr7)r�r?)r3�tpr7r7r8r4csz@ClassPropertiesAndMethods.test_builtin_bases.<locals>.<listcomp>rBr]c@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.LN)ryrzr{r7r7r7r8r�jsr�c@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.CN)ryrzr{r7r7r7r8r|msr|c@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.DN)ryrzr{r7r7r7r8r�psr�z/shouldn't turn list subclass into dict subclassz-shouldn't be able to assign to list.__bases__rz#best_base calculation found wanting)
�builtinsrA�valuesr�r
r=r�rBr.rlrr�r�)r2Z
builtin_typesr�r�r|r�r7r7r8�test_builtin_bases`s.


z,ClassPropertiesAndMethods.test_builtin_basesc	Cs�|�t��Gdd�dtd��}WdQRX|�t��Gdd�dttd��}WdQRX|�t��Gdd�dtd�t�}WdQRXGdd�dt�}|�t��Gdd�d|td��}WdQRX|�t��Gdd�dtd�|�}WdQRXGd	d�dt�}|�t��td�f|_WdQRX|�t��ttd�f|_WdQRX|�t��td�tf|_WdQRX|�t��|td�f|_WdQRX|�t��td�|f|_WdQRXdS)
Nc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)ryrzr{r7r7r7r8r�src@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)ryrzr{r7r7r7r8r�sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)ryrzr{r7r7r7r8r�sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.ON)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)ryrzr{r7r7r7r8r�sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)ryrzr{r7r7r7r8r�sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)ryrzr{r7r7r7r8r�s)r
rr?r�rB)r2rr�r7r7r8�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}	y|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�|���|||�S)Nr)�flagr�r�)r2r5r�r�)�WorkOncer�r7r8r��szWClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkOnce.__new__cSs0|jdkrtd��n|jd7_t�|�SdS)NrZbozor])r�r'r?r�)r2r7r7r8r��s

zSClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkOnce.mro)ryrzr{r�r�r�r7)r�)r�r8r��sr�c@seZdZdd�ZdS)zQClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkAlwayscSs
t�|�S)N)r?r�)r2r7r7r8r��szUClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkAlways.mroN)ryrzr{r�r7r7r7r8�
WorkAlways�sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.CN)ryrzr{r7r7r7r8r|�sr|c@seZdZdS)zIClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.C2N)ryrzr{r7r7r7r8r��sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.DN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.EN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.FN)ryrzr{r7r7r7r8r�sr)r�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.GN)ryrzr{r7r7r7r8r!�sr!zexception not propagated)r?r�rrBr'r=r�)
r2r�r|r�r�r�rr!ZE_mro_beforeZD_mro_beforer7)r�r8�#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
||�}y||f|_Wntk
rxYnX|�d�dS)Nc@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.AN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.BN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.CN)ryrzr{r7r7r7r8r|�sr|c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.DN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.EN)ryrzr{r7r7r7r8r��sr�zdidn't catch MRO conflict)r�rBrr�)r2r�r�r|r�r�r7r7r8�%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>.CN)ryrzr{r7r7r7r8r|�sr|r�zD.E)r�rzryr=)r2r|r�r7r7r8�test_mutable_names�s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)Nrx)ry)r2)r|r7r8r^	szDClassPropertiesAndMethods.test_evil_type_name.<locals>.Nasty.__del__N)ryrzr{r^r7)r|r7r8�Nastysr�c@seZdZdS)z8ClassPropertiesAndMethods.test_evil_type_name.<locals>.CN)ryrzr{r7r7r7r8r|sr|rYZnormal)rry)r2r�r7)r|r8�test_evil_type_names
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)NzB.__floordiv__r7)r2rxr7r7r8�__floordiv__szHClassPropertiesAndMethods.test_subclass_right_op.<locals>.B.__floordiv__cSsdS)NzB.__rfloordiv__r7)r2rxr7r7r8�
__rfloordiv__szIClassPropertiesAndMethods.test_subclass_right_op.<locals>.B.__rfloordiv__N)ryrzr{r�r�r7r7r7r8r�sr�r]zB.__floordiv__zB.__rfloordiv__c@seZdZdd�Zdd�ZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.CcSsdS)NzC.__floordiv__r7)r2rxr7r7r8r�&szHClassPropertiesAndMethods.test_subclass_right_op.<locals>.C.__floordiv__cSsdS)NzC.__rfloordiv__r7)r2rxr7r7r8r�(szIClassPropertiesAndMethods.test_subclass_right_op.<locals>.C.__rfloordiv__N)ryrzr{r�r�r7r7r7r8r|%sr|zC.__floordiv__zC.__rfloordiv__c@seZdZdd�Zdd�ZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.DcSsdS)NzD.__floordiv__r7)r2rxr7r7r8r�1szHClassPropertiesAndMethods.test_subclass_right_op.<locals>.D.__floordiv__cSsdS)NzD.__rfloordiv__r7)r2rxr7r7r8r�3szIClassPropertiesAndMethods.test_subclass_right_op.<locals>.D.__rfloordiv__N)ryrzr{r�r�r7r7r7r8r�0sr�zD.__floordiv__zD.__rfloordiv__c@seZdZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.EN)ryrzr{r7r7r7r8r�;sr�)r%r=r�r�)r2r�r|r�r�r7r7r8�test_subclass_right_opsz0ClassPropertiesAndMethods.test_subclass_right_opz)testing an internal kind of method objectcCs6dddg}dddd�}|�t�|�|�|�i�|�|�tjd}|�|�dt�|�|�|�|�i�|�|�y|�dd�Wntk
r�YnX|�d�y|�d�Wntk
r�YnX|�d�y|�dd�Wntk
r�YnX|�d	�y|�dt�Wntk
�r&YnX|�d
�dS)Nr]r^r_)r]r^r_�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))r=rlr�rAr�rr�r%)r2r�rCr�r7r7r8�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
||_dS)N)�_Proxy__obj)r2r�r7r7r8r,tszEClassPropertiesAndMethods.test_isinst_isclass.<locals>.Proxy.__init__cSs&|�d�rt�||�St|j|�SdS)N�_Proxy__)r�r�r
r@r)r2r5r7r7r8r
vs
zMClassPropertiesAndMethods.test_isinst_isclass.<locals>.Proxy.__getattribute__N)ryrzr{r,r
r7r7r7r8rssrc@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.CN)ryrzr{r7r7r7r8r||sr|c@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.DN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.CN)ryrzr{r7r7r7r8r|�sc@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.DN)ryrzr{r7r7r7r8r��s)r�r�)r2rr|r;�par�r7r7r8�test_isinst_isclassqs*	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
||_dS)N)r)r2r�r7r7r8r,�szBClassPropertiesAndMethods.test_proxy_super.<locals>.Proxy.__init__cSs&|�d�rt�||�St|j|�SdS)Nr)r�r�r
r@r)r2r5r7r7r8r
�s
zJClassPropertiesAndMethods.test_proxy_super.<locals>.Proxy.__getattribute__N)ryrzr{r,r
r7r7r7r8r�src@seZdZdd�ZdS)z5ClassPropertiesAndMethods.test_proxy_super.<locals>.BcSsdS)NzB.fr7)r2r7r7r8r��sz7ClassPropertiesAndMethods.test_proxy_super.<locals>.B.fN)ryrzr{r�r7r7r7r8r��sr�cseZdZ��fdd�Z�ZS)z5ClassPropertiesAndMethods.test_proxy_super.<locals>.Ccst�|���dS)Nz->C.f)r�r�)r2)r|r�r7r8r��sz7ClassPropertiesAndMethods.test_proxy_super.<locals>.C.f)ryrzr{r�r�r7)r|)r�r8r|�sr|r�zB.f->C.f)r�r=rA)r2rr�r�r!r7)r|r8�test_proxy_super�s	z*ClassPropertiesAndMethods.test_proxy_supercCsfyt�tdd�Wntk
r&YnX|�d�yt�td�Wntk
rVYnX|�d�dS)Nr�r�z"Carlo Verre __setattr__ succeeded!rzz"Carlo Verre __delattr__ succeeded!)r�rrrr�r)r2r7r7r8�test_carloverre�s
z)ClassPropertiesAndMethods.test_carloverrecs@ddl�G�fdd�d�}Gdd�dt�}|�}||�|_~dS)Nrcs eZdZ�fdd�Zdd�ZdS)zAClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provokercs��|�|_dS)N)r)r2Z	referrent)r
r7r8r,�szJClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provoker.__init__cSs|��}dS)N)r)r2r�r7r7r8r^�szIClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provoker.__del__N)ryrzr{r,r^r7)r
r7r8�Provoker�src@seZdZdS)z=ClassPropertiesAndMethods.test_weakref_segfault.<locals>.OopsN)ryrzr{r7r7r7r8�Oops�sr)r
r�Zwhatever)r2rrr�r7)r
r8�test_weakref_segfault�s
z/ClassPropertiesAndMethods.test_weakref_segfaultcCs(dd�}xtd�D]
}|j}qWd}dS)NcSsdS)Nr7r7r7r7r8r��r�zAClassPropertiesAndMethods.test_wrapper_segfault.<locals>.<lambda>i@B)r�r�)r2r�rpr7r7r8�test_wrapper_segfault�s
z/ClassPropertiesAndMethods.test_wrapper_segfaultcCsPtj}Gdd�d�}|�t_z&ytd�Wntk
r>YnXWd|t_XdS)Nc@seZdZdd�ZdS)z>ClassPropertiesAndMethods.test_file_fault.<locals>.StdoutGuardcSstjt_td|��dS)Nz!Premature access to sys.stdout.%s)r��
__stdout__�stdoutr')r2rrr7r7r8r��szJClassPropertiesAndMethods.test_file_fault.<locals>.StdoutGuard.__getattr__N)ryrzr{r�r7r7r7r8�StdoutGuard�srzOops!)r�rr�r')r2Ztest_stdoutrr7r7r8�test_file_fault�s
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)Nrr)r�)r2r7r7r8r��szQClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Evil.__hash__cs�`dS)Nr)rr)r2rx)r|r7r8ra�szOClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Evil.__eq__N)ryrzr{r�rar7)r|r7r8�Evil�src@seZdZddd�ZdS)zIClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.DescrNcSsdS)Nr]r7)r2Zobr?r7r7r8r��szQClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Descr.__get__)N)ryrzr{r�r7r7r7r8�Descr�srcseZdZ��ZdS)zEClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.CN)ryrzr{rrr7)rr7r8r|�sr|rr]rr)r�rAr=rrrrfr�)r2rrPr7)r|rr8� test_vicious_descriptor_nonsense�sz:ClassPropertiesAndMethods.test_vicious_descriptor_nonsensecCs>Gdd�dt�}y
|�Wntk
r.YnX|�d�dS)Nc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_init.<locals>.FoocSsdS)Nr�r7)r2r7r7r8r,sz9ClassPropertiesAndMethods.test_init.<locals>.Foo.__init__N)ryrzr{r,r7r7r7r8�Foosrz'did not test __init__() for None return)r�rr�)r2rr7r7r8�	test_inits
z#ClassPropertiesAndMethods.test_initcCsg}|�|j|j�|�|jgj�|�|jdgj�|�|j|j�|�|jjd�t|jd�r�|�|jj|�|�|jjt	�n |�|jj
|�|�|jjt	�|�|jjt	jj�yt
|j�Wntk
r�YnX|�d�d}|d7}|�|jdj�|�t
|j�t
dj��dS)NrerKr�z"no TypeError from hash([].__add__)r7)r\)r=rKrArcryrsr�r��__objclass__r.Zim_selfZim_classrVr�rr�)r2rqrFr7r7r8�test_method_wrappers*
z-ClassPropertiesAndMethods.test_method_wrappercsddl�dd�}��fdd�}tjd}tj}x�dD]�\}}}d|d	d�}td
d||i�}	|	�}
|||
|
�|||
|�|||
|�|r4|||
|
�|||
|�|||
|�d|d	d�}td
d||i�}|�}
|||
|
�|||
|�|||
|�q4WdS)NrcSstS)N)rw)r2rxr7r7r8�
specialmethod6szEClassPropertiesAndMethods.test_not_implemented.<locals>.specialmethodcs@yt|||�d��Wntk
r*YnX��d|f�dS)N)r�r��operatorzno TypeError from %r)rUrr�)r6r�r�)rr2r7r8r�9s
z=ClassPropertiesAndMethods.test_not_implemented.<locals>.checkr]))rKzx + yzx += y)�__sub__zx - yzx -= y)rczx * 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__rr^r�r7Z__ir|)rr�r�r?)r2rr�ZN1ZN2r5r6ZiexprZrnamer�r;Zinamer|rPr7)rr2r8�test_not_implemented1s,
z.ClassPropertiesAndMethods.test_not_implementedcCs4Gdd�dt�}|�}d|dd�<|�|jd�dS)Nc@seZdZdd�ZdS)z6ClassPropertiesAndMethods.test_assign_slice.<locals>.CcSs
||_dS)N)r�)r2�idxr�r7r7r8rYkszBClassPropertiesAndMethods.test_assign_slice.<locals>.C.__setitem__N)ryrzr{rYr7r7r7r8r|jsr|r_r]r^)r�r=r�)r2r|rPr7r7r8�test_assign_slicees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
||_dS)N)r5)r2r5r7r7r8r,wszEClassPropertiesAndMethods.test_set_and_no_get.<locals>.Descr.__init__cSs||j|j<dS)N)rAr5)r2r�r�r7r7r8r~zszDClassPropertiesAndMethods.test_set_and_no_get.<locals>.Descr.__set__N)ryrzr{r,r~r7r7r7r8rusrr;cseZdZ�ZdS)z8ClassPropertiesAndMethods.test_set_and_no_get.<locals>.XN)ryrzr{r;r7)r�r7r8r~srr�c@seZdZdS)z;ClassPropertiesAndMethods.test_set_and_no_get.<locals>.MetaN)ryrzr{r7r7r7r8rs�srsc@seZdZdS)z8ClassPropertiesAndMethods.test_set_and_no_get.<locals>.XN)ryrzr{r7r7r7r8r�s)r�)r�r�r;r=r?)r2rrr�rsr7)r�r8�test_set_and_no_getrs
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|��dS)Nr])r�rB)r5)r2r7r8r�szXClassPropertiesAndMethods.test_getattr_hooks.<locals>.Descriptor.__get__.<locals>.getterr7)r2r�Zobjtyperr7)r2r8r��szHClassPropertiesAndMethods.test_getattr_hooks.<locals>.Descriptor.__get__)N)ryrzr{r�r�r7r7r7r8�
Descriptor�sr%cseZdZ�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.AN)ryrzr{r
r7)r�r7r8r��sr�cseZdZ�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.BN)ryrzr{r�r7)r�r7r8r��sr�cseZdZ�Z�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.CN)ryrzr{r
r�r7)r�r7r8r|�sr|rrr]r^racs eZdZdd�Z�fdd�ZdS)zFClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattributecSst|��dS)N)rB)r2r5r7r7r8r��szRClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattribute.__getattr__cs*�`xtd�D]}t��qWt|��dS)Nre)r�r�rhZcollectrB)r2r5rp)�EvilGetattributer7r8r
�szWClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattribute.__getattribute__N)ryrzr{r�r
r7)r&r7r8r&�sr&)r�r
rBr@r=r�)r2r%r�r�r|r7)r&r�r8�test_getattr_hooks�s
z,ClassPropertiesAndMethods.test_getattr_hookscCs|�ttjtt�dS)N)r
rr?r
r.)r2r7r7r8�test_type___getattribute__�sz4ClassPropertiesAndMethods.test_type___getattribute__c	Cs^|�tttd�Gdd�dt�}|�tt|d�Gdd�dt�}|�t��
|`WdQRXdS)N�__abstractmethods__c@seZdZdS)z<ClassPropertiesAndMethods.test_abstractmethods.<locals>.metaN)ryrzr{r7r7r7r8�meta�sr*c@seZdZdS)z9ClassPropertiesAndMethods.test_abstractmethods.<locals>.XN)ryrzr{r7r7r7r8r�sr)r
rBr@r?r�r))r2r*rr7r7r8�test_abstractmethods�sz.ClassPropertiesAndMethods.test_abstractmethodsc	CsfGdd�d�}|�}|�|t�|�t��t�|�WdQRX|�t��t�|d�WdQRXdS)Nc@seZdZeZdS)z:ClassPropertiesAndMethods.test_proxy_call.<locals>.FakeStrN)ryrzr{rr�r7r7r7r8�FakeStr�sr,rY)r�rr
rr�rK)r2r,Zfake_strr7r7r8�test_proxy_call�sz)ClassPropertiesAndMethods.test_proxy_callcCs<Gdd�d�}|j|_|�}|�tt|�|�tt|�dS)Nc@seZdZdS)z7ClassPropertiesAndMethods.test_repr_as_str.<locals>.FooN)ryrzr{r7r7r7r8r�sr)r�rnr
r�rrm)r2rr�r7r7r8�test_repr_as_str�s
z*ClassPropertiesAndMethods.test_repr_as_strcCs0Gdd�dt�}|�}d|_|�|dd�dS)Nc@seZdZejZdS)z>ClassPropertiesAndMethods.test_mixing_slot_wrappers.<locals>.XN)ryrzr{rlrYrr7r7r7r8r�srr�r�)rlr�r=)r2rr�r7r7r8�test_mixing_slot_wrappers�sz3ClassPropertiesAndMethods.test_mixing_slot_wrappersc	Cs>|�t��}Gdd�d�}WdQRXt|j�}|�d|�dS)Nc@seZdZdgZdZdS)zEClassPropertiesAndMethods.test_slot_shadows_class_variable.<locals>.Xr�N)ryrzr{r�r�r7r7r7r8r�srz0'foo' in __slots__ conflicts with class variable)r
r5rr�r=)r2r�rrGr7r7r8� test_slot_shadows_class_variable�s
z:ClassPropertiesAndMethods.test_slot_shadows_class_variablec	Cs�Gdd�d�}d|_|�|jd�|�t��}tt�jd�td�WdQRX|�dt	|j
��|�t��}t|�jd�|�WdQRX|�dt	|j
��|�|jd�dS)Nc@seZdZdZdS)z1ClassPropertiesAndMethods.test_set_doc.<locals>.XZelephantN)ryrzr{rVr7r7r7r8r�srZbananarVZblahzcan't set list.__doc__zcan't delete X.__doc__)rVr=r
rr?r.rAr~rrr�r�)r2rr�r7r7r8�test_set_doc�s z&ClassPropertiesAndMethods.test_set_docc	Cs,tjtjtjtjg}ddddg}x,t||�D]\}}|�t	|�j
|d�q,Wx,|D]$}|jjd|j
}|�|j|�qTW|�tjjd�|�tjjd�|�tjjd	�|�tjjd
�Gdd�d�}|�
t��
|`WdQRX|�
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>.XN)ryrzr{r7r7r7r8rsrr{ZOinkc@seZdZGdd�d�ZdS)rc@seZdZdS)zY.InsideN)ryrzr{r7r7r7r8�Insidesr5N)ryrzr{r5r7r7r7r8rsrzY.Inside)rrzr�r�r&r%rKr6r=r?ryrr{r
rrAr~rr5)r2ZdescriptorsrrE�n�qualnamerr7r7r8�
test_qualname�s&
z'ClassPropertiesAndMethods.test_qualnamecCs^ddi}tdd|�}|�|jd�|�d|j�|�|ddi�ddi}|�ttdd|�dS)Nr{z	some.namerr7r])r?r=r{rrAr
r)r2r�r�r7r7r8�test_qualname_dictsz,ClassPropertiesAndMethods.test_qualname_dictcCsbGdd�dt�}|�}d|_t�|�}~t��|�|��x t��D]}|�	t
|�|�qFWdS)Nc@seZdZdd�ZdS)z<ClassPropertiesAndMethods.test_cycle_through_dict.<locals>.XcSst�|�||_dS)N)rlr,rA)r2r7r7r8r,'s
zEClassPropertiesAndMethods.test_cycle_through_dict.<locals>.X.__init__N)ryrzr{r,r7r7r7r8r&srr�)rlrrr
rrrf�assertIsNonerhr`�assertIsNotr?)r2rr�Zwrr�r7r7r8�test_cycle_through_dict$s
z1ClassPropertiesAndMethods.test_cycle_through_dictcCs�Gdd�d�}|�t|d�|jt|dd�Gdd�d�}Gdd�d�}Gd	d
�d
||�}xL|||fD]>}|d�|ddd�|�t|ddd�|jt|dddd
�qfWdS)Nc@seZdZdS)z[ClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNeitherN)ryrzr{r7r7r7r8�OverrideNeither5sr=r])r�c@seZdZddd�ZdS)zWClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNewrc_stj|f|�|�S)N)r�r�)r�r�r�r3r�r7r7r8r�:sz_ClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNew.__new__N)r)ryrzr{r�r7r7r7r8�OverrideNew9sr>c@seZdZddd�ZdS)zXClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideInitrc_stj|f|�|�S)N)r�r,)r2r�r�r3r4r7r7r8r,=szaClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideInit.__init__N)r)ryrzr{r,r7r7r7r8�OverrideInit<sr?c@seZdZdS)zXClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideBothN)ryrzr{r7r7r7r8�OverrideBoth?sr@r^r_)r�)r
r)r2r=r>r?r@Zcaser7r7r8�(test_object_new_and_init_with_parameters3s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>.BaseN)ryrzr{r7r7r7r8rUHsrUc@seZdZdS)z[ClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptors.<locals>.SubN)ryrzr{r7r7r7r8rWJsrWrA)rrAr)r2rUrWr7r7r8�4test_subclassing_does_not_duplicate_dict_descriptorsGszNClassPropertiesAndMethods.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)z=ClassPropertiesAndMethods.test_bound_method_repr.<locals>.FoocSsdS)Nr7)r2r7r7r8r�QszDClassPropertiesAndMethods.test_bound_method_repr.<locals>.Foo.methodN)ryrzr{r�r7r7r7r8rPsrz4<bound method .*Foo\.method of <.*Foo object at .*>>c@seZdZdd�ZdS)z>ClassPropertiesAndMethods.test_bound_method_repr.<locals>.BasecSsdS)Nr7)r2r7r7r8r�XszEClassPropertiesAndMethods.test_bound_method_repr.<locals>.Base.methodN)ryrzr{r�r7r7r7r8rUWsrUc@seZdZdS)zBClassPropertiesAndMethods.test_bound_method_repr.<locals>.Derived1N)ryrzr{r7r7r7r8�Derived1ZsrCc@seZdZdd�ZdS)zBClassPropertiesAndMethods.test_bound_method_repr.<locals>.Derived2cSsdS)Nr7)r2r7r7r8r�]szIClassPropertiesAndMethods.test_bound_method_repr.<locals>.Derived2.methodN)ryrzr{r�r7r7r7r8�Derived2\srDz6<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)z=ClassPropertiesAndMethods.test_bound_method_repr.<locals>.FoocSsdS)Nr7)r�r7r7r8r�mszDClassPropertiesAndMethods.test_bound_method_repr.<locals>.Foo.methodN)ryrzr{r�r�r7r7r7r8rlsz/<bound method .*Foo\.method of <class '.*Foo'>>c@seZdZdd�ZdS)zDClassPropertiesAndMethods.test_bound_method_repr.<locals>.MyCallablecSsdS)Nr7)r2r�r7r7r8r�xszMClassPropertiesAndMethods.test_bound_method_repr.<locals>.MyCallable.__call__N)ryrzr{r�r7r7r7r8�
MyCallablewsrEz*<bound method \? of <object object at .*>>r5z,<bound method name of <object object at .*>>r7z0<bound method qualname of <object object at .*>>)	ZassertRegexrmr�r�r�r�
MethodTyperyr{)r2rrUrCrDr~Zderived1Zderived2Zsuper_d2r�rEr��instancer�)r�r7r8�test_bound_method_reprOsH



z0ClassPropertiesAndMethods.test_bound_method_repr){ryrzr{r�r�r�r�rrrr"r#r,r3r?rCrPrmrpryr�r�r�r�rZ
refcount_testr�r�r�r�r�r�r�r�r�r*ZexpectedFailurer�r�r�r�r�r�r�r
rr�skipIfr��flags�optimizer �cpython_onlyr$r)r7rMrYrr�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�r�r�rrrrr	r
rrrr!r#r$r'r(r+r-r.r/r0r1r8r9r<rArBrHr�r7r7)r�r8r��s�4X")%
%=K&(F<2	.	"
"G1ib?CS^pN @OYYM	
.
',	A( 63,'!4
'

 
r�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>.CcSsdS)Nr7)r2r7r7r8rD�sz$DictProxyTests.setUp.<locals>.C.methN)ryrzr{rDr7r7r7r8r|�sr|)r�r|)r2r|r7r7r8�setUp�szDictProxyTests.setUp�gettracez#trace function introduces __local__cCsB|jj��}|�|t�t|�}|��|�|dddddg�dS)NrArVrzrnrD)r|rArh�assertNotIsInstancer.�sortr=)r2r�rhr7r7r8�test_iter_keys�szDictProxyTests.test_iter_keyscCs4|jj��}|�|t�t|�}|�t|�d�dS)Nre)r|rAr�rPr.r=r�)r2r�r�r7r7r8�test_iter_values�szDictProxyTests.test_iter_valuescCsH|jj��}|�|t�dd�|D�}|��|�|dddddg�dS)NcSsg|]}|d�qS)rr7)r3�itemr7r7r8r4�sz2DictProxyTests.test_iter_items.<locals>.<listcomp>rArVrzrnrD)r|rAr/rPr.rQr=)r2r�rhr7r7r8�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>.BN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.MN)ryrzr{r7r7r7r8rE�srEc@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.CN)ryrzr{r7r7r7r8r|�sr|)r�)r�r?r=rA)r2r�rEr|r7r7r8�test_dict_type_with_metaclass�sz,DictProxyTests.test_dict_type_with_metaclasscCsbt|jj�}|�|�d�|�|�|�d�|�x,|jj��D]\}}|�d�||�|�q>WdS)Nz
mappingproxy(�)z
{!r}: {!r})	rmr|rAr�r��endswithr/rr�)r2rr�r�r7r7r8�	test_repr�s
zDictProxyTests.test_reprN)ryrzr{rNr*rIrsr�rOrRrSrUrVrYr7r7r7r8rM�s

rMc@seZdZdd�ZdS)�PTypesLongInitTestcCs>Gdd�dt�}ytd|�d�WnYnXt�t�dS)Nc@seZdZdd�ZdS)z;PTypesLongInitTest.test_pytype_long_ready.<locals>.UserLongcWsdS)Nr7)r2r3r7r7r8r��szCPTypesLongInitTest.test_pytype_long_ready.<locals>.UserLong.__pow__N)ryrzr{r�r7r7r7r8�UserLong�sr[r)r�rr?r�rN)r2r[r7r7r8�test_pytype_long_ready�sz)PTypesLongInitTest.test_pytype_long_readyN)ryrzr{r\r7r7r7r8rZ�srZc@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�mykey)r�)r2r7r7r8r��sz@MiscTests.test_type_lookup_mro_reference.<locals>.MyKey.__hash__cs�f�_dS)N)rB)r2rx)�Base2rr7r8ra�sz>MiscTests.test_type_lookup_mro_reference.<locals>.MyKey.__eq__N)ryrzr{r�rar7)r_rr7r8�MyKey�sr`c@seZdZdZdZdS)z6MiscTests.test_type_lookup_mro_reference.<locals>.Basez	from BaseN)ryrzr{r^�mykey2r7r7r7r8rU�srUc@seZdZdZdZdS)z7MiscTests.test_type_lookup_mro_reference.<locals>.Base2z
from Base2N)ryrzr{r^rar7r7r7r8r_�sr_rrez	from Basez
from Base2)r�r?r=r^ra)r2r`rUr7)r_rr8�test_type_lookup_mro_reference�sz(MiscTests.test_type_lookup_mro_referenceN)ryrzr{rbr7r7r7r8r]�sr]c@sfeZdZdidddfdd�Zdd�Zdd�Zdd	d
�Zedd��Zd
d�Z	dd�Z
dd�Zdd�ZdS)�
PicklingTestsr7Nc
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)Nr^rr]r_ra)�
__reduce_ex__r=�copyreg�
__newobj_ex__r?�
__newobj__�assertListEqualr.r:�assertDictEqualrl�__base__�_reconstructorr��
__reduce__)
r2�protor�r3r4r��	listitems�	dictitemsZreduce_valueZ	base_typer7r7r8�
_check_reduce�s.



zPicklingTests._check_reducecs(ttjd�}d�ddd��ddi�G�fdd	�d	�}|�}x|D]}|�||��qBWx ���D]\}}t|||�qbWx|D]}|j||��d
�q�WGdd�d�}|�}x4|D],}|d
kr�|�t��|�|�WdQRXq�WG��fdd�d�}|�}x(|D] }|d
k�r|�||����qWG�fdd�d�}	G�fdd�d�}
Gdd�d�}Gdd�d�}xZ|D]R}xJ|	|
||fD]:}
|
�}|d
k�r�|�tt	f��|�|�WdQRX�q�W�qnWG�fdd�d�}|�}x|D]}|�||���q�WGdd�d�}|�}x8|D]0}|d
k�r|�t
��|�|�WdQRX�qWG�fdd�d�}|�}x|D]}|j||�d
��qfWGdd�d�}|�}x|D]}|j||d d
��q�WGd!d"�d"�}|�}xV|D]N}|�t
��|�|�WdQRX|d
k�r�|�t
��|��WdQRX�q�WG�fd#d$�d$�}|�}xl|D]d}|d
k�rb|j||d�fd
�n>|�t��|�|�WdQRX|�t��|��WdQRX�q>WGd%d&�d&t�}|d'd(i�}x"|D]}|j||t|�d)��q�WGd*d+�d+t
�}|d,g�}x"|D]}|j||t
|�d-��qWdS).Nr])i����r�i7���i���)ZbaconZfish�cheeseio���cseZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C1cs�S)Nr7)r2)r3r7r8�__getnewargs__sz4PicklingTests.test_reduce.<locals>.C1.__getnewargs__N)ryrzr{rrr7)r3r7r8rRsrR)r�c@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C2cSsdS)Nzbad argsr7)r2r7r7r8rr'sz4PicklingTests.test_reduce.<locals>.C2.__getnewargs__N)ryrzr{rrr7r7r7r8r�&sr�r^cseZdZ��fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C3cs��fS)Nr7)r2)r3r4r7r8�__getnewargs_ex__0sz7PicklingTests.test_reduce.<locals>.C3.__getnewargs_ex__N)ryrzr{rsr7)r3r4r7r8rS/srScseZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C4cs�dfS)Nzbad dictr7)r2)r3r7r8rs8sz7PicklingTests.test_reduce.<locals>.C4.__getnewargs_ex__N)ryrzr{rsr7)r3r7r8rW7srWcseZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C5csd�fS)Nz	bad tupler7)r2)r4r7r8rs;sz7PicklingTests.test_reduce.<locals>.C5.__getnewargs_ex__N)ryrzr{rsr7)r4r7r8�C5:srtc@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C6cSsdS)Nr7r7)r2r7r7r8rs>sz7PicklingTests.test_reduce.<locals>.C6.__getnewargs_ex__N)ryrzr{rsr7r7r7r8�C6=sruc@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C7cSsdS)Nzbad argsr7)r2r7r7r8rsAsz7PicklingTests.test_reduce.<locals>.C7.__getnewargs_ex__N)ryrzr{rsr7r7r7r8�C7@srvcseZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C9cs�ifS)Nr7)r2)r3r7r8rsKsz7PicklingTests.test_reduce.<locals>.C9.__getnewargs_ex__N)ryrzr{rsr7)r3r7r8�C9Jsrwc@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C10cSst�dS)N)r�)r2r7r7r8rsRsz8PicklingTests.test_reduce.<locals>.C10.__getnewargs_ex__N)ryrzr{rsr7r7r7r8�C10QsrxcseZdZ�fdd�ZdS)z&PicklingTests.test_reduce.<locals>.C11cs�S)Nr7)r2)r�r7r8r�[sz3PicklingTests.test_reduce.<locals>.C11.__getstate__N)ryrzr{r�r7)r�r7r8�C11Zsryc@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C12cSsdS)Nznot dictr7)r2r7r7r8r�bsz3PicklingTests.test_reduce.<locals>.C12.__getstate__N)ryrzr{r�r7r7r7r8�C12asrzznot dictc@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C13cSst�dS)N)r�)r2r7r7r8r�isz3PicklingTests.test_reduce.<locals>.C13.__getstate__N)ryrzr{r�r7r7r7r8�C13hsr{cs eZdZe��Z�fdd�ZdS)z&PicklingTests.test_reduce.<locals>.C14cs&x ���D]\}}t|||�q
WdS)N)r/r�)r2r5r�)r�r7r8r,usz/PicklingTests.test_reduce.<locals>.C14.__init__N)ryrzr{rNr�r,r7)r�r7r8�C14ssr|c@seZdZdS)z&PicklingTests.test_reduce.<locals>.C15N)ryrzr{r7r7r7r8�C15�sr}Zquebeci����)roc@seZdZdS)z&PicklingTests.test_reduce.<locals>.C16N)ryrzr{r7r7r7r8�C16�sr~Zyukon)rn)r��pickle�HIGHEST_PROTOCOLrpr/r�r
rrdr5r�rlrlr.)r2�	protocolsrRr�rmr5r�r�rSrWrtrurvr�rwrxryrzr{r|r}r~r7)r3r4r�r8�test_reduces�







 











zPicklingTests.test_reducecCsPttjd�}Gdd�d�}x.|D]&}|dkr2ind}|j||�|d�q"WdS)Nr]c@seZdZdd�Zdd�ZdS)z7PicklingTests.test_special_method_lookup.<locals>.PickycSsiS)Nr7)r2r7r7r8r��szDPicklingTests.test_special_method_lookup.<locals>.Picky.__getstate__cSs|dkrt|��dS)N)rrrs)r�)r2rrr7r7r8r��szCPicklingTests.test_special_method_lookup.<locals>.Picky.__getattr__N)ryrzr{r�r�r7r7r7r8�Picky�sr�r^)r�)r�rr�rp)r2r�r�Zprotocolr�r7r7r8r��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�xJ|jD]@}|jt||�t||�|d�|jt
||d�t
||d�|d�q�W|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.)r8rAr�)r�r?rnr�r5r;r�rsrirArhr�r=r@rm)r2r��objcopyr8�slotr7r7r8�_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||_||_||_dS)N)rm�dumps�loads)r2rmr�r�r7r7r8r,�szEPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.__init__cSs|�|�||j��S)N)r�r�rm)r2r�r7r7r8r��szAPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.copycSs$d�|j|jj|jj|jj|jj�S)Nz0PickleCopier(proto={}, dumps={}.{}, loads={}.{}))r�rmr�rzr{r�)r2r7r7r8rn�szEPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.__repr__N)ryrzr{rVr,r�rnr7r7r7r8�PickleCopier�sr�c3s|]}�|�VqdS)Nr7)r3r3)r�r7r8�	<genexpr>�sz9PicklingTests._generate_pickle_copiers.<locals>.<genexpr>r])	�	itertools�productr�rr�r�Z_dumpsr�Z_loadsr7r7)r�r8�_generate_pickle_copiers�s


z&PicklingTests._generate_pickle_copiersc
CsJGdd�d�a|�t��t�t�d�WdQRXGdd�dt�a|�t��t�t�d�WdQRXGdd�d�aGdd�dt�aGdd	�d	t�ax�|��D]�}|j|d
���t�}|�	|�}|�
||�d|_|�	|�}|�
||�t�}d|_d|_|�	|�}|�
||�t�}d|_d
|_|�	|�}|�
||�WdQRXq�WdS)Nc@seZdZdgZdS)r|r;N)ryrzr{r�r7r7r7r8r|�sr|rc@seZdZdS)r�N)ryrzr{r7r7r7r8r��sr�c@s.eZdZdZdgZdd�Zdd�Zdd�Zd	S)
r|z7A class with __getstate__ and __setstate__ implemented.r;c
Ssht|di���}xRt|�jD]D}x>|j�dd�D],}yt||�||<Wq0tk
rZYq0Xq0WqW|S)NrAr�r7)r@r�r?rrAr�rB)r2r�r�r�r7r7r8r��szC.__getstate__cSs&x |��D]\}}t|||�q
WdS)N)r/r�)r2r�r�r�r7r7r8r��szC.__setstate__cSsdt|�j|��fS)Nz%s()<%r>)r?ryr�)r2r7r7r8rn�sz
C.__repr__N)ryrzr{rVr�r�r�rnr7r7r7r8r|�s
	c@seZdZdZdS)r�z!A subclass of a class with slots.N)ryrzr{rVr7r7r7r8r��sc@seZdZdZdgZdS)r�zA subclass with an extra slot.rLN)ryrzr{rVr�r7r7r7r8r��sr�)�
pickle_copierr�rvr�)
r|r
rrr�r�r�r��subTestr�r�r;rL)r2r�r�r�r7r7r8�test_pickle_slots�s6



zPicklingTests.test_pickle_slotsc

CsxGdd�d�aGdd�dt�aGdd�dt�aGdd�dt�aGd	d
�d
t�atttttf}|��}x�t�	||�D]�\}}|j
||d��ht|di�}||j|�}|j
}|�|�}|�||�|d
kr�|js�|j��|�|�}	|�||	�WdQRXqrWxx|D]p}|j
|d��Xt|di�}||j|�}t|�}|�||�|j�sd|j��t|�}	|�||	�WdQRX�qWdS)Ncs0eZdZdZdZdZ�fdd�Zdd�Z�ZS)rRz:The state of this class is copyable via its instance dict.)r]r^Tcst���||_||_dS)N)r�r,r;rL)r2r;rL)r�r7r8r,s
zC1.__init__cSsd|j|jfS)Nz
C1(%r, %r))r;rL)r2r7r7r8rnszC1.__repr__)	ryrzr{rV�ARGS�NEED_DICT_COPYINGr,rnr�r7r7)r�r8rRs
rRcsHeZdZdZdZdZ�fdd�Z�fdd�Zedd	��Z	d
d�Z
�ZS)r�z,A list subclass copyable via __getnewargs__.)r]r^Fcst��|�}||_||_|S)N)r�r�r;rL)r�r;rLr2)r�r7r8r�&sz
C2.__new__cst���|�d�dS)Nrq)r�r,ri)r2r3)r�r7r8r,+s
zC2.__init__cSs|jS)N)r�)r�r7r7r8rr0szC2.__getnewargs__cSsd|j|jt|�fS)NzC2(%r, %r)<%r>)r;rLr.)r2r7r7r8rn3szC2.__repr__)ryrzr{rVr�r�r�r,r�rrrnr�r7r7)r�r8r�"sr�c@s<eZdZdZdZdZdd�Zedd��Zdd	�Z	d
d�Z
dS)
rSz*A list subclass copyable via __getstate__.)r]r^FcSs||_||_|�d�dS)Nrq)r;rLri)r2r;rLr7r7r8r,;szC3.__init__cSs|jS)N)r�)r�r7r7r8r�AszC3.__getstate__cSs|\}}||_||_dS)N)r;rL)r2r�r;rLr7r7r8r�DszC3.__setstate__cSsd|j|jt|�fS)NzC3(%r, %r)<%r>)r;rLr.)r2r7r7r8rnHszC3.__repr__N)ryrzr{rVr�r�r,r�r�r�rnr7r7r7r8rS7srScs<eZdZdZdZdZ�fdd�Zedd��Zdd	�Z	�Z
S)
rWz,An int subclass copyable via __getnewargs__.)rrr]Fcst��||�}||_||_|S)N)r�r�r;rL)r�r;rLr�r2)r�r7r8r�Psz
C4.__new__cSs|jS)N)r�)r�r7r7r8rrUszC4.__getnewargs__cSsd|j|jt|�fS)NzC4(%r, %r)<%r>)r;rLr%)r2r7r7r8rnXszC4.__repr__)ryrzr{rVr�r�r�r�rrrnr�r7r7)r�r8rWLsrWcsJeZdZdZdZddiZdZdd��fdd	�
Zed
d��Z	dd
�Z
�ZS)rtz/An int subclass copyable via __getnewargs_ex__.)r]r^r�r_Fr)r�cst��||�}||_||_|S)N)r�r�r;rL)r�r;rLr�r2)r�r7r8r�asz
C5.__new__cSs|j|jfS)N)r��KWARGS)r�r7r7r8rsfszC5.__getnewargs_ex__cSsd|j|jt|�fS)NzC5(%r, %r)<%r>)r;rLr%)r2r7r7r8rniszC5.__repr__)ryrzr{rVr�r�r�r�r�rsrnr�r7r7)r�r8rt\srt)r�r�r�r^)r�)rRr.r�rSr%rWrtr�r�r�r�r@r�rmr�r�r�rAr	r)
r2Ztest_classesZpickle_copiersr�r�r4r�rmr�Zobjcopy2r7r7r8�test_reduce_copyings8




z!PicklingTests.test_reduce_copyingcs^Gdd�dt��G��fdd�d��ddl}|j�fdddifddf}|����d�|�dS)	Nc@seZdZdS)z(PicklingTests.test_issue24097.<locals>.SN)ryrzr{r7r7r7r8r��sr�cs$eZdZ�d�gZ��fdd�ZdS)z(PicklingTests.test_issue24097.<locals>.Ar�cs(|dkr �d�g�jdd�<dSt�dS)Nr�r�)�
__slotnames__rB)r2rr)r�r�r7r8r��sz4PicklingTests.test_issue24097.<locals>.A.__getattr__N)ryrzr{r�r�r7)r�r�r7r8r��s
r�rr�r�r^)rrergr=rd)r2rer6r7)r�r�r8�test_issue24097�s
	zPicklingTests.test_issue24097c	Cs~t���|�t��t��d�WdQRXt��d�|�t��t���WdQRX|�t��t��d�WdQRXdS)Nr)r�rlr
rrd)r2r7r7r8�test_object_reduce�s
z PicklingTests.test_object_reduce)N)
ryrzr{rpr�r�r�r�r�r�r�r�r�r7r7r7r8rc�s{
C|rcc@seZdZejdd��ZdS)�SharedKeyTestscCs*Gdd�d�}Gdd�d|�}|�|�}}|�t�t|��t�t|���|�t�t|��t�i��td�\|_|_|_|_	|_
|_|�t�t|��t�t|���|�}|�t�t|��t�t|���|�t�t|��t�i��td�\|_|_
|_	|_
|_|_|�t�t|��t�i��dS)Nc@seZdZdS)z)SharedKeyTests.test_subclasses.<locals>.AN)ryrzr{r7r7r7r8r��sr�c@seZdZdS)z)SharedKeyTests.test_subclasses.<locals>.BN)ryrzr{r7r7r7r8r��sr�rf)r=r�r��varsZ
assertLessr�r�r�rg�wr�rrArFrjr)r2r�r�r;rLr�r7r7r8�test_subclasses�s     zSharedKeyTests.test_subclassesN)ryrzr{rrLr�r7r7r7r8r��sr�c@s eZdZdZdd�Zdd�ZdS)�DebugHelperMetaz<
    Sets default __doc__ and simplifies repr() output.
    cCs&|�d�dkr||d<t�||||�S)NrV)r�r?r�)r�r5r�rr7r7r8r��szDebugHelperMeta.__new__cCs
t|j�S)N)rmry)r�r7r7r8rn�szDebugHelperMeta.__repr__N)ryrzr{rVr�rnr7r7r7r8r��sr�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�ready)r2r7r7r8rN�sz
MroTest.setUpcCs |j|k}|r|jd7_|S)Nr])r�)r2�limit�retr7r7r8�
step_until�s
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>.Mcs0��d�r&|jdkst�|jd7_t�|�S)Nr]r7)r�rr�rBr?r�)r�)r2r7r8r��s
z8MroTest.test_incomplete_set_bases_on_self.<locals>.M.mroN)ryrzr{r�r7)r2r7r8rE�srEc@seZdZdS)z4MroTest.test_incomplete_set_bases_on_self.<locals>.AN)ryrzr{r7r7r7r8r��sr�)r�N)r�)r2rEr�r7)r2r8�!test_incomplete_set_bases_on_self�sz)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)Nr�r�r7)rryr�rBr?r�)r�)r�r2r7r8r��s
z3MroTest.test_reent_set_bases_on_base.<locals>.M.mroN)ryrzr{r�r7)r�r2r7r8rE�srEc@seZdZdS)z/MroTest.test_reent_set_bases_on_base.<locals>.AN)ryrzr{r7r7r7r8r��sr�)r�c@seZdZdS)z/MroTest.test_reent_set_bases_on_base.<locals>.BN)ryrzr{r7r7r7r8r�sr�r7N)r�rB)r2rEr�r7)r�r2r8�test_reent_set_bases_on_base�s	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)Nrrer7)rBr�r�r?r�)r�r~)r2r7r8r�
s


z:MroTest.test_reent_set_bases_on_direct_base.<locals>.M.mroN)ryrzr{r�r7)r2r7r8rE	srEc@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.AN)ryrzr{r7r7r7r8r�sr�)r�c@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.BN)ryrzr{r7r7r7r8r�sr�c@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.CN)ryrzr{r7r7r7r8r|sr|N)r�)r2rEr�r�r|r7)r2r8�#test_reent_set_bases_on_direct_bases	z+MroTest.test_reent_set_bases_on_direct_basec	sxG���fdd�dt�}Gdd�d|d�}Gdd�d|��Gdd	�d	|��d
�_��t���jd7_WdQRXd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�ryrBr?r�)r�)r�r�r2r7r8r�*s

z9MroTest.test_reent_set_bases_tp_base_cycle.<locals>.M.mroN)ryrzr{r�r7)r�r�r2r7r8rE)srEc@seZdZdS)z5MroTest.test_reent_set_bases_tp_base_cycle.<locals>.AN)ryrzr{r7r7r7r8r�2sr�)r�c@seZdZdS)z6MroTest.test_reent_set_bases_tp_base_cycle.<locals>.B1N)ryrzr{r7r7r7r8r�4sr�c@seZdZdS)z6MroTest.test_reent_set_bases_tp_base_cycle.<locals>.B2N)ryrzr{r7r7r7r8r�6sr�Tr7N)r�r�r
rrB)r2rEr�r7)r�r�r2r8�"test_reent_set_bases_tp_base_cycles	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|F)r�ryrBr?r�)r�)r�r|r2r7r8r�Gsz?MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.M.mroN)ryrzr{r�r7)r�r|r2r7r8rEFsrEc@seZdZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.AN)ryrzr{r7r7r7r8r�Msr�)r�c@seZdZdS)z<MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.B1N)ryrzr{r7r7r7r8r�Osr�c@seZdZdS)z<MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.B2N)ryrzr{r7r7r7r8r�Qsr�c@seZdZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.CN)ryrzr{r7r7r7r8r|Ssr|TN)r�r�rBr=r�)r2rEr�r�r7)r�r|r2r8�(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�_WdQRX�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>.EN)ryrzr{r7r7r7r8r�fsr�cseZdZ����fdd�ZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.Mcs:�jr0|jdkr0�j�fkr$d�_n�f�_��t�|�S)Nr|F)r�ryrBr?r�)r�)r�r|r�r2r7r8r�iszAMroTest.test_tp_subclasses_cycle_error_return_path.<locals>.M.mroN)ryrzr{r�r7)r�r|r�r2r7r8rEhsrEc@seZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.AN)ryrzr{r7r7r7r8r�rsr�)r�c@seZdZdS)z>MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.B1N)ryrzr{r7r7r7r8r�tsr�c@seZdZdS)z>MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.B2N)ryrzr{r7r7r7r8r�vsr�c@seZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.CN)ryrzr{r7r7r7r8r|xsr|TN)
r�r�r�r
rBr=rrNr?r�)r2rEr�r�r7)r�r|r�r2r8�*test_tp_subclasses_cycle_error_return_pathas
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|�}WdQRXt�|�S)Nrc@seZdZdS)z8MroTest.test_incomplete_extend.<locals>.M.mro.<locals>.XN)ryrzr{r7r7r7r8r�s)rryr
rr?r�)r�r)r2r7r8r��sz-MroTest.test_incomplete_extend.<locals>.M.mroN)ryrzr{r�r7)r2r7r8rE�srEc@seZdZdS)z)MroTest.test_incomplete_extend.<locals>.AN)ryrzr{r7r7r7r8r��sr�)r�N)r�)r2rEr�r7)r2r8�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||�jWdQRXt�|�S)N)rr
rBr�Zxxxr?r�)r�)r�r2r7r8r��s
z,MroTest.test_incomplete_super.<locals>.M.mro)ryrzr{r�r�r7)r2)r�r8rE�srEc@seZdZdS)z(MroTest.test_incomplete_super.<locals>.AN)ryrzr{r7r7r7r8r��sr�)r�N)r�)r2rEr�r7)r2r8�test_incomplete_super�szMroTest.test_incomplete_superN)ryrzr{rVrNr�r�r�r�r�r�r�r�r�r7r7r7r8r��s$$"r�c
Cst�tttttttt	�dS)N)
rZrun_unittestrZrr�rMr]rcr�r�r7r7r7r8�	test_main�sr��__main__)r�rerhr�r�rr�rr*r�r
r�rr�rr+rr�rMrZr]rcr�r?r�r�r�ryr7r7r7r8�<module>s�x"<=U