Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_descr.cpython-35.opt-1.pyc



��YfV��@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�Zedkr�e�dS)�N)�deepcopy)�supportc@seZdZdd�Zdddd�Zddd	d
�Zddd
d�Zdddd�Zdddd�Zdddd�Z	dd�Z
dd�Zgdd�Zd d!�Z
d"d#�Zd$d%�Zd&d'�Zejd(�d)d*��Zejd(�d+d,��Zd-S).�
OperatorsTestc(Osttjj|||�ddddddddd	d
ddd
d
dddddddddddddddddddd d!d"d#d$d%d&i|_xSt|jj��D]<\}}|j�r�|d'}n
d(|}||j|<q�Wd)dd*dd+d+d,d-d.d.d/d/i|_xSt|jj��D]<\}}|j�rU|d0}n
d1|}||j|<q0WdS)2N�add�+�sub�-�mul�*�matmul�@�truediv�/�floordivz//�divmod�powz**�lshiftz<<�rshiftz>>�and�&�xor�^�or�|Zcmp�lt�<�lez<=�eqz==�nez!=�gt�>�gez>=z(a, b)za %s b�pos�neg�abs�invert�~�int�floatz(a)z%s a)�unittest�TestCase�__init__�binops�list�items�islower�unops)�self�args�kwargs�name�expr�r6�4/opt/alt/python35/lib64/python3.5/test/test_descr.pyr+sJ"

"

zOperatorsTest.__init__zlen(a)�__len__c	Cs�d|i}|jt||�|�t|�}t||�}x ||jkrb|jd}qCW|jt|d|�|j|�|j||�|�t||�}|j|�|�dS)N�ar�im_func)�assertEqual�eval�type�getattr�__dict__�	__bases__)	r1r9�resr5�meth�d�t�m�bmr6r6r7�	unop_testCs#zOperatorsTest.unop_testza+b�__add__c
Cs�d|d|i}|jt||�|�t|�}t||�}x ||jkrh|jd}qIW|jt|d|�|j|�|j|||�|�t||�}	|j|	|�|�dS)Nr9�brr:)r;r<r=r>r?r@)
r1r9rIrAr5rBrCrDrErFr6r6r7�
binop_testSs#zOperatorsTest.binop_testza[b:c]�__getitem__cCs�d|d|d|i}|jt||�|�t|�}t||�}	x ||jkrn|jd}qOW|jt|	d|	�|j|�|j|	|t||��|�t||�}
|j|
t||��|�dS)Nr9rI�crr:)r;r<r=r>r?r@�slice)r1r9rIrLrAr5rBrCrDrErFr6r6r7�sliceop_testbs#"zOperatorsTest.sliceop_testza+=b�__iadd__c
Csdt|�d|i}t||�|j|d|�t|�}t||�}x ||jkrv|jd}qWW|jt|d|�|j|�t|�|d<||d|�|j|d|�t|�|d<t|d|�}	|	|�|j|d|�dS)Nr9rIrr:)r�execr;r=r>r?r@)
r1r9rIrA�stmtrBrCrDrErFr6r6r7�
setop_testps
#
zOperatorsTest.setop_testza[b]=c�__setitem__cCs dt|�d|d|i}t||�|j|d|�t|�}t||�}	x ||jkr||jd}q]W|jt|	d|	�|j|�t|�|d<|	|d||�|j|d|�t|�|d<t|d|�}
|
||�|j|d|�dS)Nr9rIrLrr:)rrPr;r=r>r?r@)r1r9rIrLrArQrBrCrDrErFr6r6r7�set2op_test�s
#
zOperatorsTest.set2op_testza[b:c]=dcCs8dt|�d|d|d|i}t||�|j|d|�t|�}	x ||	jkrs|	jd}	qTWt|	|�}
|jt|
d|
�|	j|�t|�|d<|
|dt||�|�|j|d|�t|�|d<t|d|�}|t||�|�|j|d|�dS)Nr9rIrLrCrr:)rrPr;r=r?r@r>rM)r1r9rIrLrCrArQrBZ
dictionaryrDrErFr6r6r7�setsliceop_test�s$
#zOperatorsTest.setsliceop_testc	Cs�|jdgdgddgdd�|jdddgdddd�|jdddgdd	dd�|jdddgddd
d�|jdddgd	dddgdd�|jdgdgddgd
d�|jddgdddddddgdd�|jdddgddd�|jddgdddddddgdd�|jddgdddddddgdd�|jddgddddgdd�|jddddgddddgddddgdd�dS)N��za+brH�zb in a�__contains__�rza[b]rKza[b:c]za+=brOza*=b�__imul__zlen(a)r8za*b�__mul__zb*a�__rmul__za[b]=crS��za[b:c]=d)rJrNrRrGrTrU)r1r6r6r7�
test_lists�s%"""+%111(6zOperatorsTest.test_listsc
Cs|jddddidddd�|jddddidddd�|jddddidddd	�ddddi}g}x't|j��D]}|j|�q�Wg}x!t|�D]}|j|�q�W|j||�g}x!|j�D]}|j|�q�W|j||�g}x$tj|�D]}|j|�q;W|j||�ddddi}|j|dd
d�|jt	t
|�i�|�|jt	|j�i�|�|jddddiddddddddidd
�dS)NrVrWrXrZzb in arYrza[b]rKzlen(a)r8za[b]=crS)
rJr-�keys�append�iterr;�__iter__�dictrGr<�repr�__repr__rT)r1rC�l1�i�lr6r6r7�
test_dicts�s2%%%3zOperatorsTest.test_dictscCs�d|d|i}xj|jj�D]Y\}}||kr"d|}t||�r"t||�}|j|||||�q"Wxmt|jj��D]V\}}||kr�d|}t||�r�t||�}|j||||�q�WdS)Nr9rIz__%s__)r,r.�hasattrr<rJr-r0rG)r1r9rI�skiprer4r5rAr6r6r7�number_operators�s
"
zOperatorsTest.number_operatorscCs�|jdd�|jdj�d�|jdj�d�Gdd�dt�}|j|d�d�y|�dWntk
r�YnX|jd	�dS)
N�drXrVrc@seZdZdd�ZdS)z"OperatorsTest.test_ints.<locals>.CcSstS)N)�NotImplemented)r1�otherr6r6r7rH�sz*OperatorsTest.test_ints.<locals>.C.__add__N)�__name__�
__module__�__qualname__rHr6r6r6r7�C�srur^�z+NotImplemented should have caused TypeError)rnr;�__bool__r'�	TypeError�fail)r1rur6r6r7�	test_ints�s
zOperatorsTest.test_intscCs|jdd�dS)NgY@g@)rn)r1r6r6r7�test_floats�szOperatorsTest.test_floatsc
Cs�|jddddddddd	d
ddg	�Gd
d�dt�}|ddd�}|jt|�d�|j|jd�||dd�}|jt|�d�|j|jd�|d�}|jt|�d�|j|jd�dS)NyY@y@rmrrrr!r'r(rr�modc@s7eZdZdgZdd�Zdd�ZeZdS)z,OperatorsTest.test_complexes.<locals>.Number�precc_s+tj||�}|jdd�|_|S)Nr}�)�complex�__new__�getr})�clsr2�kwds�resultr6r6r7r�sz4OperatorsTest.test_complexes.<locals>.Number.__new__cSsc|j}|jdkr)d||jfS|jdkrId||jfSd||j||jfS)Ngz%.*gz%.*gjz(%.*g+%.*gj))r}�imag�real)r1r}r6r6r7rgs	z5OperatorsTest.test_complexes.<locals>.Number.__repr__N)rrrsrt�	__slots__r�rg�__str__r6r6r6r7�Numbers	r�g��Q�	@r}r_z3.14rWz3.1gPm@z234.5r~)rnrr;rfr})r1r�r9r6r6r7�test_complexes�szOperatorsTest.test_complexescCsE|jtjdd�tdd��|jtjdd�d�dS)Ny@g@g@rVg@g�)r;r�__radd__r(�__rsub__)r1r6r6r7�test_explicit_reverse_methods s%z+OperatorsTest.test_explicit_reverse_methodsz"the module 'xxsubtype' is internalc
CsXddl}ddl}ddd�}||j|j<|j|dg�|dg�|ddg�dd�|j|dddg�ddd	d
�|j|dddg�ddd	d
�|j|dddg�dddd
�|j|dddg�dd|ddg�dd
�|j|dg�|dg�|ddg�dd�|j|ddg�d|ddddddg�dd�|j|dddg�ddd�|j|ddg�d|ddddddg�dd�|j|ddg�d|ddddddg�dd�|j|ddg�dd|ddg�dd�|j	|ddddg�dd|ddg�|ddddg�dd�Gdd�d|j�}|�}|j
|g�|j
|j�d�|jd �|j
|d g�|j
|j
�d�|jd!�|j
|j
�d!�dS)"NrcSsddl}|j|�S)Nr)�	xxsubtype�spamlist)rj�memo�spamr6r6r7r�*sz/OperatorsTest.test_spam_lists.<locals>.spamlistrVrWza+brHrXzb in arYrZza[b]rKza[b:c]za+=brOza*=br[zlen(a)r8za*br\zb*ar]za[b]=crSr^r_za[b:c]=dc@seZdZdd�ZdS)z(OperatorsTest.test_spam_lists.<locals>.CcSsdS)NrVr6)r1r6r6r7�fooGsz,OperatorsTest.test_spam_lists.<locals>.C.fooN)rrrsrtr�r6r6r6r7ruFsruro�*)�copyr��_deepcopy_dispatchr�rJrNrRrGrTrUr;r�rb�getstate�setstate)r1r�r�r�rur9r6r6r7�test_spam_lists%s@0(((006%66-0	

zOperatorsTest.test_spam_listscCs
ddl}ddl}ddd�}||j|j<|j|ddddi�dddd	�|j|ddddi�dddd	�|j|ddddi�ddd
d�|ddddi�}g}x't|j��D]}|j|�q�Wg}x!t|�D]}|j|�qW|j	||�g}x!|j
�D]}|j|�qMW|j	||�g}x0t|i��j
|�D]}|j|�q�W|j	||�ddddi}||�}	|j|	ddd
�|j|	t
|�dd�|j|ddddi�dd|ddddddi�dd�Gdd�d|j�}
|
�}|j	t|j��g�|j	|j�d�d|d<|j	t|j��dg�|j	|j�d�|jd�|j	|j�d�dS)NrcSsIddl}|j�}x*t|j��D]\}}|||<q+W|S)Nr)r��spamdictr-r.)rCr�r�Zsd�k�vr6r6r7r�Us
z/OperatorsTest.test_spam_dicts.<locals>.spamdictrVrWrXrZzb in arYza[b]rKzlen(a)r8zrepr(a)rgza[b]=crSc@seZdZdd�ZdS)z(OperatorsTest.test_spam_dicts.<locals>.CcSsdS)NrVr6)r1r6r6r7r�ysz,OperatorsTest.test_spam_dicts.<locals>.C.fooN)rrrsrtr�r6r6r6r7ruxsru�barr�ro)r�r�)r�r�r�r�rJr-rarbrcr;rdr=rGrfrTr.r�r�r�)r1r�r�r�rCrhrirjZ	straightdZspamdrur9r6r6r7�test_spam_dictsQsJ+++"<
	

zOperatorsTest.test_spam_dictsN)rrrsrtr+rGrJrNrRrTrUr`rkrnrzr{r�r�r�impl_detailr�r�r6r6r6r7rs 0!,rcs�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&�Z�fd'd(�Zejd)�d*d+��Zd,d-�Zejd)�d.d/��Zd0d1�Zd2d3�Zd4d5�Zej d6d7��Z!d8d9�Z"ej d:d;��Z#d<d=�Z$d>d?�Z%d@dA�Z&dBdC�Z'dDdE�Z(dFdG�Z)dHdI�Z*ej+e,j-j.dJkdK�dLdM��Z/ej0dNdO��Z1dPdQ�Z2dRdS�Z3dTdU�Z4�fdVdW�Z5dXdY�Z6dZd[�Z7d\d]�Z8d^d_�Z9d`da�Z:dbdc�Z;ddde�Z<dfdg�Z=dhdi�Z>djdk�Z?dldm�Z@dndo�ZAdpdq�ZBdrds�ZCdtdu�ZDdvdw�ZEdxdy�ZFdzd{�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��ZXd�d��ZYd�d��ZZejd��d�d���Z[d�d��Z\d�d��Z]d�d��Z^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��Zt�fd�d��Zu�S)��ClassPropertiesAndMethodscCs'|jt||�d||f�dS)Nz%r has no attribute %r)�
assertTruerl)r1�objr4r6r6r7�
assertHasAttr�sz'ClassPropertiesAndMethods.assertHasAttrcCs'|jt||�d||f�dS)Nz%r has unexpected attribute %r)�assertFalserl)r1r�r4r6r6r7�assertNotHasAttr�sz*ClassPropertiesAndMethods.assertNotHasAttrc	s]�jttt���jit�t�}�j|i��j|jt��j|t�G�fdd�dt�}�jt|t��|d�}�j|jd�|dddd�}�j|ddko�|dd�|�}�j|jd
��j|j�d�|j	d��j|jd��j|j�d�|j	d	��j|jd	��j|j�d	��j|d
d�d|d
<�j|d
d�d}xJt
|�D]<}|�||<x&t
|�D]}|||||<q�Wq�WxGt
|�D]9}x0t
|�D]"}�j|||||�q/WqWdS)Ncs^eZdZd
Z�fdd�Zdd�Z�fdd�Zdd	�Zd
d�ZdS)z6ClassPropertiesAndMethods.test_python_dicts.<locals>.CrVcs`|r)�jt|�d�|d|_|r\x*t|j��D]\}}|||<qBWdS)NrVr)r;�len�stater-r.)�
self_localr9�kwr�r�)r1r6r7r+�s
z?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.__init__cSs|j|d�S)Nr)r�)r1�keyr6r6r7rK�szBClassPropertiesAndMethods.test_python_dicts.<locals>.C.__getitem__cs-�j|td��tj|||�dS)Nr)�assertIsInstancer=rerS)r�r��value)r1r6r7rS�szBClassPropertiesAndMethods.test_python_dicts.<locals>.C.__setitem__cSs
||_dS)N)r�)r1r�r6r6r7r��sz?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.setstatecSs|jS)N)r�)r1r6r6r7r��sz?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.getstateN���)	rrrsrtr�r+rKrSr�r�r6)r1r6r7ru�srur~r�rVr�rWr�
r���2r�r�)r��
issubclassrer�r;�assertIs�	__class__r�r�r��range)	r1rCru�a1�a2r9�Nri�jr6)r1r7�test_python_dicts�s@	$	



z+ClassPropertiesAndMethods.test_python_dictscCs�Gdd�dt�}|�}|jdddg�|j|dd�|j|dd�|j|dd�|j|dd	�d
�dS)Nc@seZdZdd�ZdS)z6ClassPropertiesAndMethods.test_python_lists.<locals>.CcSs3t|t�r|j|jfStj||�dS)Nro)�
isinstancerM�start�stopr-rK)r1rir6r6r7rK�szBClassPropertiesAndMethods.test_python_lists.<locals>.C.__getitem__N)rrrsrtrKr6r6r6r7ru�srurrVrWro�e�f��)ror�)r-�extendr;)r1rur9r6r6r7�test_python_lists�s	z+ClassPropertiesAndMethods.test_python_listsc"s2Gdd�ddt�}|�}|j|j�d�|jd�|j|j�d�Gdd�dt�}Gdd	�d	d|�}|j|j�|�|�}|j|j|�Gd
d�dt�}Gdd�dd|�}|j|jd
�|�}|j|jd
�Gdd�dt��G�fdd�dt�}Gdd�dd|�}|j|jd�|j|j	f�|j
d|j�|�}|j|j�d�G�fdd�dt��Gdd�dd��}	Gdd�d|	�}
Gdd�d|	�}Gdd	�d	||
�}|j|�j
�d�Gdd�d|
|�}|j|�j
�d �G�fd!d"�d"t��Gd#d�dd��}	|	�}|j|d$�d%|_|j|jd%�|j|jdY�Gd&d'�d'���}Gd(d�dd|�}	Gd)d�d|	�}
Gd*d�d|	�}Gd+d	�d	||
�}|j|�jd�G�fd,d-�d-t��Gd.d�dd��}|j�jd
�|�}|jt|�|�|j�jd
�Gd/d�dt�}|�}y|�Wntk
rDYnX|jd0�Gd1d�dt�}	Gd2d�dt�}
Gd3d�dtd|	�}Gd4d	�d	|
|�}|j|	t|��g�G�fd5d6�d6t�}
G�fd7d8�d8|
�}Gd9d�dd|
�}	|jd6g���j�Gd:d�dd|�}
|jd8d6g���j�Gd;d�d|	|
�}|jd8d6g���j�|j
d<|j�Gd=d>�d>|
|	�}|jd8d6g���j�|j
d<|j�Gd?d	�d	|dt�}|jd8d6g���j�|j
d<|j�Gd@d�d|d|
�}|jd8d6g���j�|j
d<|j�t���fdAdB�}GdCdD�dDd|�}GdEdF�dFtd|�}GdGdH�dH|d|�}|j�|�|j�|�|j�|�g�G��fdIdJ�dJ�}G��fdKdL�dL|�}GdMd�dd|�}	|j|t|	��|jdJg���j�|jdJg���j�GdNd�dd|�}
|j|t|
��|jdLdJg���j�|jdLdJg���j�GdOd�d|	|
�}|j|t|��|jdLdJg���j�|jdLdJg���j�GdPd>�d>|
|	�}|j|t|��|jdLdJg���j�|jdLdJg���j�|jt��!GdQd	�d	|dt�}WdQRXGdRd�d|d|�}|j|t|��|jdLdJg���j�|jdLdJg���j�GdSdT�dTt�|�}|j|t|��|jdLdJg���j�|jdLdJg���j�GdUdV�dV|t��}|j|t|��|jdLdJg���j�|jdLdJg���j�|jt��!GdWdD�dD|t��}WdQRX|jt��!GdXdD�dDt�|�}WdQRXdS)ZNc@s4eZdZdd�Zdd�Zdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSs
d|_dS)Nr)�	_C__state)r1r6r6r7r+�sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.__init__cSs|jS)N)r�)r1r6r6r7r��sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.getstatecSs
||_dS)N)r�)r1r�r6r6r7r��sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.setstateN)rrrsrtr+r�r�r6r6r6r7ru�sru�	metaclassrr�c@seZdZdd�ZdS)z<ClassPropertiesAndMethods.test_metaclass.<locals>._metaclasscSs|S)Nr6)r�r6r6r7�myself�szCClassPropertiesAndMethods.test_metaclass.<locals>._metaclass.myselfN)rrrsrtr�r6r6r6r7�
_metaclass�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)rrrsrtr6r6r6r7�D�sr�c@seZdZdd�ZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.M1cSs d|d<tj||||�S)NrV�__spam__)r=r�)r�r4�basesrer6r6r7r��s
z<ClassPropertiesAndMethods.test_metaclass.<locals>.M1.__new__N)rrrsrtr�r6r6r6r7�M1�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rrrsrtr6r6r6r7ru�srVc@seZdZdS)z;ClassPropertiesAndMethods.test_metaclass.<locals>._instanceN)rrrsrtr6r6r6r7�	_instance�sr�cs4eZdZedd��Z�fdd�ZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.M2cSs.tj|�}||_||_||_|S)N)�objectr�r4r�re)r�r4r�rer1r6r6r7r��s
			z<ClassPropertiesAndMethods.test_metaclass.<locals>.M2.__new__csV��}xF|jD];}|jd�r+qt|||j|j||��qW|S)N�__)re�
startswith�setattr�__get__)r1�itr�)r�r6r7�__call__�s	'z=ClassPropertiesAndMethods.test_metaclass.<locals>.M2.__call__N)rrrsrt�staticmethodr�r�r6)r�r6r7�M2�sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSsdS)Nr�r6)r1r6r6r7r�sz8ClassPropertiesAndMethods.test_metaclass.<locals>.C.spamN)rrrsrtr�r6r6r6r7ru�sr�r�cs%eZdZ��fdd�Z�S)z;ClassPropertiesAndMethods.test_metaclass.<locals>.autosupercs�t�|�j||||�}x*|dd�dkrM|dd�}q$W|rad|}nd}t||t|��|S)NrV�_z
_%s__superZ__super)�superr�r�)r�r4r�rer�)r��	autosuperr6r7r�
s
zCClassPropertiesAndMethods.test_metaclass.<locals>.autosuper.__new__)rrrsrtr�r6)r�)r�r7r�
sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AcSsdS)N�Ar6)r1r6r6r7rBsz8ClassPropertiesAndMethods.test_metaclass.<locals>.A.methN)rrrsrtrBr6r6r6r7r�sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BcSsd|jj�S)N�B)�	_B__superrB)r1r6r6r7rBsz8ClassPropertiesAndMethods.test_metaclass.<locals>.B.methN)rrrsrtrBr6r6r6r7r�sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSsd|jj�S)Nru)�	_C__superrB)r1r6r6r7rB sz8ClassPropertiesAndMethods.test_metaclass.<locals>.C.methN)rrrsrtrBr6r6r6r7rusc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DcSsd|jj�S)Nr�)�	_D__superrB)r1r6r6r7rB#sz8ClassPropertiesAndMethods.test_metaclass.<locals>.D.methN)rrrsrtrBr6r6r6r7r�"sZDCBAc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.EcSsd|jj�S)N�E)Z	_E__superrB)r1r6r6r7rB'sz8ClassPropertiesAndMethods.test_metaclass.<locals>.E.methN)rrrsrtrBr6r6r6r7r�&sr�ZEBCAcs%eZdZ��fdd�Z�S)z>ClassPropertiesAndMethods.test_metaclass.<locals>.autopropertyc	si}x�|j�D]�\}}|jd�ro|dd�}|j|d�\}}|}||f||<q|jd�r|dd�}|j|d�\}}|}||f||<qWx3|j�D]%\}\}}t||�||<q�Wt�|�j||||�S)NZ_get_r^Z_set_)NN)NN)r.r�r��propertyr�r�)	r�r4r�re�hitsr��valr��set)r��autopropertyr6r7r�.s zFClassPropertiesAndMethods.test_metaclass.<locals>.autoproperty.__new__)rrrsrtr�r6)r�)r�r7r�+sr�c@s(eZdZdd�Zdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AcSs|jS)N)�_A__x)r1r6r6r7�_get_x@sz:ClassPropertiesAndMethods.test_metaclass.<locals>.A._get_xcSs||_dS)N)r�)r1�xr6r6r7�_set_xBsz:ClassPropertiesAndMethods.test_metaclass.<locals>.A._set_xN)rrrsrtr�r�r6r6r6r7r�?sr�r~c@seZdZdS)z@ClassPropertiesAndMethods.test_metaclass.<locals>.multimetaclassN)rrrsrtr6r6r6r7�multimetaclassJsr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AcSsdS)Nr�r6)r1r6r6r7r�Nsz:ClassPropertiesAndMethods.test_metaclass.<locals>.A._get_xN)rrrsrtr�r6r6r6r7r�Msc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BcSsd|jj�S)Nr�)r�r�)r1r6r6r7r�Qsz:ClassPropertiesAndMethods.test_metaclass.<locals>.B._get_xN)rrrsrtr�r6r6r6r7r�Psc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSsd|jj�S)Nru)r�r�)r1r6r6r7r�Tsz:ClassPropertiesAndMethods.test_metaclass.<locals>.C._get_xN)rrrsrtr�r6r6r6r7ruSsc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DcSsd|jj�S)Nr�)r�r�)r1r6r6r7r�Wsz:ClassPropertiesAndMethods.test_metaclass.<locals>.D._get_xN)rrrsrtr�r6r6r6r7r�Vscs(eZdZdZ�fdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.Trcs�jd7_dS)NrV)�counter)r1r2)�Tr6r7r+^sz<ClassPropertiesAndMethods.test_metaclass.<locals>.T.__init__N)rrrsrtr�r+r6)r�r6r7r�\sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rrrsrtr6r6r6r7ru`sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rrrsrtr6r6r6r7rugsz5calling object w/o call method should raise TypeErrorc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.Ac_stj||�S)N)r=r�)r2r3r6r6r7r�psz;ClassPropertiesAndMethods.test_metaclass.<locals>.A.__new__N)rrrsrtr�r6r6r6r7r�osc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BN)rrrsrtr6r6r6r7r�ssc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rrrsrtr6r6r6r7ruvsc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)rrrsrtr6r6r6r7r�zscs=eZdZe��fdd��Zedd��Z�S)z7ClassPropertiesAndMethods.test_metaclass.<locals>.AMetacs&�jd�t�j||||�S)N�AMeta)rbr�r�)�mclsr4r��ns)r��	new_callsr6r7r��s
z?ClassPropertiesAndMethods.test_metaclass.<locals>.AMeta.__new__cSsiS)Nr6)r�r4r�r6r6r7�__prepare__�szCClassPropertiesAndMethods.test_metaclass.<locals>.AMeta.__prepare__)rrrsrtr�r��classmethodr�r6)r�)r�r7r��sr�csCeZdZe��fdd��Ze�fdd��Z�S)z7ClassPropertiesAndMethods.test_metaclass.<locals>.BMetacs&�jd�t�j||||�S)N�BMeta)rbr�r�)r�r4r�r�)r�r�r6r7r��s
z?ClassPropertiesAndMethods.test_metaclass.<locals>.BMeta.__new__cs#t�j||�}d|d<|S)NT�BMeta_was_here)r�r�)r�r4r�r�)r�r6r7r��s
zCClassPropertiesAndMethods.test_metaclass.<locals>.BMeta.__prepare__)rrrsrtr�r�r�r�r6)r�)r�r7r��sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AN)rrrsrtr6r6r6r7r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BN)rrrsrtr6r6r6r7r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rrrsrtr6r6r6r7ru�sr�c@seZdZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.C2N)rrrsrtr6r6r6r7�C2�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)rrrsrtr6r6r6r7r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.EN)rrrsrtr6r6r6r7r��scs�S)Nr6)r2r3)�markerr6r7�func�sz6ClassPropertiesAndMethods.test_metaclass.<locals>.funcc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.XN)rrrsrtr6r6r6r7�X�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.YN)rrrsrtr6r6r6r7�Y�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.ZN)rrrsrtr6r6r6r7�Z�sr�cs=eZdZ��fdd�Ze�fdd��Z�S)z:ClassPropertiesAndMethods.test_metaclass.<locals>.ANotMetacs�jd�t�j|�S)N�ANotMeta)rbr�r�)r�r2r3)r�r�r6r7r��s
zBClassPropertiesAndMethods.test_metaclass.<locals>.ANotMeta.__new__cs�jd�iS)Nr�)rb)r�r4r�)�
prepare_callsr6r7r��s
zFClassPropertiesAndMethods.test_metaclass.<locals>.ANotMeta.__prepare__)rrrsrtr�r�r�r6)r�r�)r�r7r��sr�cs@eZdZ��fdd�Ze��fdd��Z�S)z:ClassPropertiesAndMethods.test_metaclass.<locals>.BNotMetacs�jd�t�j|�S)N�BNotMeta)rbr�r�)r�r2r3)r�r�r6r7r��s
zBClassPropertiesAndMethods.test_metaclass.<locals>.BNotMeta.__new__cs �jd�t�j||�S)Nr�)rbr�r�)r�r4r�)r�r�r6r7r��s
zFClassPropertiesAndMethods.test_metaclass.<locals>.BNotMeta.__prepare__)rrrsrtr�r�r�r6)r�r�)r�r7r��sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AN)rrrsrtr6r6r6r7r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BN)rrrsrtr6r6r6r7r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rrrsrtr6r6r6r7ru�sc@seZdZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.C2N)rrrsrtr6r6r6r7r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)rrrsrtr6r6r6r7r�sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.EN)rrrsrtr6r6r6r7r�sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.FN)rrrsrtr6r6r6r7�Fsr�c@seZdZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.F2N)rrrsrtr6r6r6r7�F2sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.XN)rrrsrtr6r6r6r7r�sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.XN)rrrsrtr6r6r6r7r�"si�)r=r;r�r�r�r�r�r�r4r��assertInrer�rBr�r�r�r�rxryr��clearr?�assertRaisesr')r1rur9r�r�rCr�rLr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r6)r�r�r�r�r�r�r�r7�test_metaclass�s$	
							

	





		







#





#z(ClassPropertiesAndMethods.test_metaclasscs�g�tt��G��fdd�d��}|d�}d|_|j}|`|j�dd
dg�y Gd	d
�d
tjt�}Wntk
r�YnX|jd�dS)NcsaeZdZ�fdd�Z��fdd�Z��fdd�Z��fdd�Zd	S)
z<ClassPropertiesAndMethods.test_module_subclasses.<locals>.MMcs�j||�dS)N)r+)r1r4)�MTr6r7r+*szEClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__init__cs#�jd|f��j||�S)Nr>)rb�__getattribute__)r1r4)r��logr6r7r,szMClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__getattribute__cs-�jd||f��j|||�dS)Nr�)rb�__setattr__)r1r4r�)r�rr6r7r/szHClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__setattr__cs'�jd|f��j||�dS)N�delattr)rb�__delattr__)r1r4)r�rr6r7r2szHClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__delattr__N)rrrsrtr+rrrr6)r�rr6r7�MM)srr9r~r�r�r>rc@seZdZdS)z@ClassPropertiesAndMethods.test_module_subclasses.<locals>.ModuleN)rrrsrtr6r6r6r7�Module?srz?inheriting from ModuleType and str at the same time should fail)r�r�r~)r>r�)rr�)	r=�sysr�r;�types�
ModuleType�strrxry)r1rr9r�rr6)r�rr7�test_module_subclasses%s		
 
z0ClassPropertiesAndMethods.test_module_subclassescs�Gdd�dt����}|j|j�d�|jd�|j|j�d�G�fdd�dt��}|�}|jt|j��g�d|d<|jt|j��dg�|j|dd�|j|j�d�|jd�|j|j�d�|j|j|t�tf�Gd	d
�d
t�}Gdd�d|t�}|j|�j	�d
�|jt
|��d
�|j|�j	�d�|jt
|��d�dS)Nc@s4eZdZdd�Zdd�Zdd�ZdS)z>ClassPropertiesAndMethods.test_multiple_inheritance.<locals>.CcSs
d|_dS)Nr)r�)r1r6r6r7r+JszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.__init__cSs|jS)N)r�)r1r6r6r7r�LszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.getstatecSs
||_dS)N)r�)r1r�r6r6r7r�NszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.setstateN)rrrsrtr+r�r�r6r6r6r7ruIsrurr�cs"eZdZ�fdd�ZdS)z>ClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Dcs$ti�j|��j|�dS)N)r=r+)r1)rur6r7r+UszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.D.__init__N)rrrsrtr+r6)rur6r7r�Tsr��world�helloc@s(eZdZdd�Zdd�ZdS)zAClassPropertiesAndMethods.test_multiple_inheritance.<locals>.NodecSst|j��S)N)r'r�)r1r6r6r7�__int__dszIClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Node.__int__cSsdS)NZ23r6)r1r6r6r7r�fszEClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Node.fooN)rrrsrtrr�r6r6r6r7�Nodecsrc@seZdZdd�ZdS)zAClassPropertiesAndMethods.test_multiple_inheritance.<locals>.FragcSsdS)NZ42r6)r1r6r6r7r�iszEClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Frag.fooN)rrrsrtr�r6r6r6r7�Fraghsr�r�)r
r)r�r;r�r�rer-rar.�__mro__rr')r1r9r�rCrrr6)rur7�test_multiple_inheritanceGs*	
	

z3ClassPropertiesAndMethods.test_multiple_inheritancecCsGdd�dt�}|j|�j�d�Gdd�d|�}|j|�j�d�|j|�j�d�Gdd�d|�}|j|�j�d�|j|�j�d�Gdd�d||�}|j|�j�d�|j|�j�d�|j|j||||tf�Gd	d
�d
||�}|j|�j�d�|j|�j�d�|j|j||||tf�yGdd�d||�}Wntk
r�YnX|jd
�yGdd�d||�}Wntk
r	YnX|jd�dS)Nc@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.AcSsdS)Nr�r6)r1r6r6r7r�sszBClassPropertiesAndMethods.test_diamond_inheritance.<locals>.A.spamN)rrrsrtr�r6r6r6r7r�rsr�c@s(eZdZdd�Zdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.BcSsdS)Nr�r6)r1r6r6r7�boovszAClassPropertiesAndMethods.test_diamond_inheritance.<locals>.B.boocSsdS)Nr�r6)r1r6r6r7r�wszBClassPropertiesAndMethods.test_diamond_inheritance.<locals>.B.spamN)rrrsrtrr�r6r6r6r7r�usr�c@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.CcSsdS)Nrur6)r1r6r6r7r{szAClassPropertiesAndMethods.test_diamond_inheritance.<locals>.C.booN)rrrsrtrr6r6r6r7ruzsruc@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.DN)rrrsrtr6r6r6r7r�~sr�c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.EN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.FN)rrrsrtr6r6r6r7r��sr�z#expected MRO order disagreement (F)c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance.<locals>.GN)rrrsrtr6r6r6r7�G�srz#expected MRO order disagreement (G))r�r;r�rrrxry)r1r�r�rur�r�r�rr6r6r7�test_diamond_inheritanceps4""


z2ClassPropertiesAndMethods.test_diamond_inheritancec	Cs�Gdd�dt�}Gdd�dt�}Gdd�dt�}Gdd�d|�}Gd	d
�d
|�}Gdd�d||||�}|j|j||||||tf�dS)
Nc@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.AN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.BN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.CN)rrrsrtr6r6r6r7ru�sruc@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.XN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.YN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.ZN)rrrsrtr6r6r6r7r��sr�)r�r;r)r1r�r�rur�r�r�r6r6r7�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|j|||||tf�|j|j||||tf�|j|j||||||||tf	�dS)Nc@seZdZdS)z9ClassPropertiesAndMethods.test_monotonicity.<locals>.BoatN)rrrsrtr6r6r6r7�Boat�src@seZdZdS)z<ClassPropertiesAndMethods.test_monotonicity.<locals>.DayBoatN)rrrsrtr6r6r6r7�DayBoat�src@seZdZdS)z>ClassPropertiesAndMethods.test_monotonicity.<locals>.WheelBoatN)rrrsrtr6r6r6r7�	WheelBoat�src@seZdZdS)z?ClassPropertiesAndMethods.test_monotonicity.<locals>.EngineLessN)rrrsrtr6r6r6r7�
EngineLess�src@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.SmallMultihullN)rrrsrtr6r6r6r7�SmallMultihull�src@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.PedalWheelBoatN)rrrsrtr6r6r6r7�PedalWheelBoat�src@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.SmallCatamaranN)rrrsrtr6r6r6r7�SmallCatamaran�src@seZdZdS)z;ClassPropertiesAndMethods.test_monotonicity.<locals>.PedaloN)rrrsrtr6r6r6r7�Pedalo�sr)r�r;r)	r1rrrrrrrrr6r6r7�test_monotonicity�sz+ClassPropertiesAndMethods.test_monotonicityc	Cs�Gdd�dt�}Gdd�dt�}Gdd�dt�}Gdd�d||�}Gd	d
�d
||�}Gdd�d||�}|j|j||||||tf�dS)
Nc@seZdZdS)zAClassPropertiesAndMethods.test_consistency_with_epg.<locals>.PaneN)rrrsrtr6r6r6r7�Pane�sr!c@seZdZdS)zKClassPropertiesAndMethods.test_consistency_with_epg.<locals>.ScrollingMixinN)rrrsrtr6r6r6r7�ScrollingMixin�sr"c@seZdZdS)zIClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditingMixinN)rrrsrtr6r6r6r7�EditingMixin�sr#c@seZdZdS)zKClassPropertiesAndMethods.test_consistency_with_epg.<locals>.ScrollablePaneN)rrrsrtr6r6r6r7�ScrollablePane�sr$c@seZdZdS)zIClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditablePaneN)rrrsrtr6r6r6r7�EditablePane�sr%c@seZdZdS)zSClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditableScrollablePaneN)rrrsrtr6r6r6r7�EditableScrollablePane�sr&)r�r;r)r1r!r"r#r$r%r&r6r6r7�test_consistency_with_epg�sz3ClassPropertiesAndMethods.test_consistency_with_epgcsQd}�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 cs�y||�Wnc|k
rs}zCtj�rat|�j|�sa�jdt|�|f�WYdd}~XnX�jd|�dS)NzMessage %r, expected %rzExpected %s)r�check_impl_detailr
r�ry)�exc�expected�callabler2�msg)r1r6r7�raises�s	'z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.raisesc@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.AN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.BN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.CN)rrrsrtr6r6r6r7ru�sruzduplicate base class Ar�c@seZdZdS)zCClassPropertiesAndMethods.test_mro_disagreement.<locals>.GridLayoutN)rrrsrtr6r6r6r7�
GridLayout�sr.c@seZdZdS)zGClassPropertiesAndMethods.test_mro_disagreement.<locals>.HorizontalGridN)rrrsrtr6r6r6r7�HorizontalGrid�sr/c@seZdZdS)zEClassPropertiesAndMethods.test_mro_disagreement.<locals>.VerticalGridN)rrrsrtr6r6r6r7�VerticalGrid�sr0c@seZdZdS)z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.HVGridN)rrrsrtr6r6r6r7�HVGrid�sr1c@seZdZdS)z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.VHGridN)rrrsrtr6r6r6r7�VHGrid�sr2ZConfusedGrid)r�rxr=)r1Zmro_err_msgr-r�r�rur.r/r0r1r2r6)r1r7�test_mro_disagreement�s$				z/ClassPropertiesAndMethods.test_mro_disagreementcCst�}|j|jt�|jt|�t�t�}|j||�|j|d�y
d|_Wnttfk
r�YnX|j	d�|jt�d�Gdd�dt�}|�}|j|j
i�d|_|j|jd�|j|j
ddi�dS)Nr�r~z1object() should not allow setting a foo attributer?c@seZdZdS)z:ClassPropertiesAndMethods.test_object_class.<locals>.CdictN)rrrsrtr6r6r6r7�Cdict�sr4rV)r�r;r�r=�assertNotEqualr�r��AttributeErrorrxryr?)r1r9rIr4r�r6r6r7�test_object_class�s$		

		z+ClassPropertiesAndMethods.test_object_classc
3CsHGdd�dtj�}tjd�}|j|jtjk�|jt|d��||_|j|j|k�|jt|d��tj|_|j|jtjk�|jt|d��Gdd�dt�}|jt��|d_WdQRXGdd	�d	t	�}|jt��|d
_WdQRXGdd�dt
�}|jt��|d_WdQRXGdd�dt�}|jt��|d_WdQRXGdd�dt�}|jt��|d_WdQRXGdd�dt
�}|jt��|f_WdQRXGdd�dt�}	|jt��|	t�_WdQRXdS)Nc@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.SubTyperVN)rrrsrtr9r6r6r6r7�SubTypesr8rEr9c@seZdZfZdS)zhClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyIntN)rrrsrtr�r6r6r6r7�MyIntsr9rVc@seZdZfZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyFloatN)rrrsrtr�r6r6r6r7�MyFloatsr:g�?c@seZdZfZdS)zlClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyComplexN)rrrsrtr�r6r6r6r7�	MyComplex$sr;y@c@seZdZfZdS)zhClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyStrN)rrrsrtr�r6r6r6r7�MyStr)sr<c@seZdZfZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyBytesN)rrrsrtr�r6r6r6r7�MyBytes.sr=�ac@seZdZfZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyTupleN)rrrsrtr�r6r6r6r7�MyTuple3sr?c@seZdZfZdS)znClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes.<locals>.MyFrozenSetN)rrrsrtr�r6r6r6r7�MyFrozenSet8sr@y�?@)rr	r�r�r�rlr'r�rxr(rr
�bytes�tuple�	frozenset)
r1r8rEr9r:r;r<r=r?r@r6r6r7�?test_object_class_assignment_between_heaptypes_and_nonheaptypess>	zYClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypescHsNGdd�dt�}|�}�j|d��j|d�Gdd�dt�}|�}�j|d��j|d�d|_�j|jd�d|_�j|jd�|`�j|d�Gd	d
�d
t�}|�}�j|d��j|d��j|d��j|d�d|_d
|_d|_�j|jd��j|jd
��j|jd�Gdd�dt�}|d�}�j|d��j|d��j|j�d�y
d|_Wntk
r�YnX�j	d�yGdd�dt�}Wnt
k
r4YnX�j	d�yGdd�dt�}Wnt
k
rpYnX�j	d�yGdd�dt�}Wnt
k
r�YnX�j	d�yGdd�dt�}Wnt
k
r�YnX�j	d�yGdd�dt�}Wnt
k
r$YnX�j	d�Gd d�dt�}Gd!d�dt�}|�}d|_�j|jd�Gd"d�dt�}|�}d|_�j|jd�d;�G�fd$d�dt�}|�}d|_�j|jd��j
t�d%�t�yGd&d�dt�}Wnt
tfk
rSYnX�j	d'�G�fd(d)�d)t��Gd*d�dt�}|�}��|_��|_��|_�j�jd�~tj��j�jd%�Gd+d,�d,|�}|�}��|_��|_�j�jd
�~tj��j�jd%�Gd-d.�d.|�}	|	�}��|_��|_��|_�j�jd�~tj��j�jd%�Gd/d0�d0t�}
|
�}��|g|_�j�jd�d}tj��j�jd%�ttd1�r�Gd2d3�d3t�}|�}
ttj��}xtd4�D]}|
|
kq�Wttj��}�j||�G�fd5d6�d6t�}tjd7��}|�}~WdQRX�j|j�d8�Gd9d:�d:t�}�jt��|�`WdQRXdS)<Nc@seZdZgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C0N)rrrsrtr�r6r6r6r7�C0?srEr?r�c@seZdZdgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C1r9N)rrrsrtr�r6r6r6r7�C1EsrFr9rVc@seZdZdddgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C3r9rIrLN)rrrsrtr�r6r6r6r7�C3QsrGrIrLrWrXc@s7eZdZdZdgZdd�Zdd�ZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C4zValidate name mangling�__acSs
||_dS)N)�_C4__a)r1r�r6r6r7r+bsz9ClassPropertiesAndMethods.test_slots.<locals>.C4.__init__cSs|jS)N)rI)r1r6r6r7r�dsz4ClassPropertiesAndMethods.test_slots.<locals>.C4.getN)rrrsrt�__doc__r�r+r�r6r6r6r7�C4_s	rKr^rHr_z$Double underscored names not mangledc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CN)rrrsrtr�r6r6r6r7russruz[None] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Czfoo barN)rrrsrtr�r6r6r6r7ruzsz['foo bar'] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CzfoobarN)rrrsrtr�r6r6r6r7ru�sz['foo\0bar'] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.C�1N)rrrsrtr�r6r6r6r7ru�sz['1'] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CrvN)rrrsrtr�r6r6r6r7ru�sz[''] slots not caughtc@s"eZdZddddgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Cr9Za_bZ_aZA0123456789ZN)rrrsrtr�r6r6r6r7ru�sc@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.C�abcN)rrrsrtr�r6r6r6r7ru�sc@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CrMN)rrrsrtr�r6r6r6r7ru�sr�cseZdZ�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CN)rrrsrtr�r6)�slotsr6r7ru�src@seZdZed�gZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.C�N)rrrsrt�chrr�r6r6r6r7ru�szhr(128)] slots not caughtcs:eZdZdZ�fdd�Z�fdd�ZdS)z5ClassPropertiesAndMethods.test_slots.<locals>.Countedrcs�jd7_dS)NrV)r�)r1)�Countedr6r7r+�sz>ClassPropertiesAndMethods.test_slots.<locals>.Counted.__init__cs�jd8_dS)NrV)r�)r1)rQr6r7�__del__�sz=ClassPropertiesAndMethods.test_slots.<locals>.Counted.__del__N)rrrsrtr�r+rRr6)rQr6r7rQ�srQc@seZdZdddgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Cr9rIrLN)rrrsrtr�r6r6r6r7ru�sc@seZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.DN)rrrsrtr6r6r6r7r��sr�c@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.E�eN)rrrsrtr�r6r6r6r7r��sr�c@seZdZddgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Fr9rIN)rrrsrtr�r6r6r6r7r��sr��get_objectsc@seZdZdd�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.GcSsdS)NFr6)r1rqr6r6r7�__eq__�sz6ClassPropertiesAndMethods.test_slots.<locals>.G.__eq__N)rrrsrtrUr6r6r6r7r�srr�cs:eZdZddgZdd�Z�fdd�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Hr9rIcSsd|_d|_dS)NrVrW)r9rI)r1r6r6r7r+�s	z8ClassPropertiesAndMethods.test_slots.<locals>.H.__init__cs*�j|jd��j|jd�dS)NrVrW)r;r9rI)�self_)r1r6r7rR�sz7ClassPropertiesAndMethods.test_slots.<locals>.H.__del__N)rrrsrtr�r+rRr6)r1r6r7�H�srW�stderrrvc@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Xr9N)rrrsrtr�r6r6r6r7r�sr�)r�r�)r�r�r9r;rIrLr�Z_ClassPropertiesAndMethods__ar6ryrxrMr�r�r=r
�UnicodeEncodeErrorr�r�
gc_collect�zrSrl�gcr�rTr�Zcaptured_output�getvaluer�)r1rEr�rFrGrKrurLr�r�r��sr�gZorig_objectsriZnew_objectsrW�hr�r6)rQr1rNr7�
test_slots=s								












						
	
	
	
	
		
z$ClassPropertiesAndMethods.test_slotsc
Cs�Gdd�dt�}|�}|j|d�|j|d�d|_|j|jddi�Gdd�dt�}|�}|j|d�|j|d�y
d|_Wntk
r�YnX|jd	�Gd
d�d||�}|�}|j|d�|j|d�d|_|j|jddi�Gdd
�d
||�}|�}|j|d�|j|d�d|_|j|jddi�dS)Nc@seZdZdgZdS)z7ClassPropertiesAndMethods.test_slots_special.<locals>.Dr?N)rrrsrtr�r6r6r6r7r�	sr�r?�__weakref__r�r�c@seZdZdgZdS)z7ClassPropertiesAndMethods.test_slots_special.<locals>.WrbN)rrrsrtr�r6r6r6r7�Wsrcz!shouldn't be allowed to set a.fooc@seZdZgZdS)z8ClassPropertiesAndMethods.test_slots_special.<locals>.C1N)rrrsrtr�r6r6r6r7rFsrFc@seZdZgZdS)z8ClassPropertiesAndMethods.test_slots_special.<locals>.C2N)rrrsrtr�r6r6r6r7r�%sr�)r�r�r�r�r;r?r6ry)r1r�r9rcrFr�r6r6r7�test_slots_specials6			


				z,ClassPropertiesAndMethods.test_slots_specialcCs�ddl}Gdd�dd|j�}Gdd�dt�}|j|�|�}|j||�|jt|jj|d�dS)Nrc@seZdZdZdS)z>ClassPropertiesAndMethods.test_slots_descriptor.<locals>.MyABCr9N)rrrsrtr�r6r6r6r7�MyABC1srer�c@seZdZdS)zBClassPropertiesAndMethods.test_slots_descriptor.<locals>.UnrelatedN)rrrsrtr6r6r6r7�	Unrelated4srfrX)	rM�ABCMetar��registerr�r�rxr9�__set__)r1rMrerf�ur6r6r7�test_slots_descriptor-s
	z/ClassPropertiesAndMethods.test_slots_descriptorc
CsGdd�dt�}Gdd�d|�}Gdd�d|�}d|_|j|jd�|j|jd�|j|jd�Gdd	�d	t�}|�}|j|d
�d|_|j|jd�dd
�|_|j|j�d�dd
�|_|jt|�d�dd
�|_|jt	|�d�|j|jd�|j|d�dd�}||_
|j|jd�d|_|j|jd�dd�}||_
y
d|_Wntk
r�YnX|jd�|j|jd�Gdd�d|�}|�}d|_|j|jd�Gdd�dt	�}	|jd|	d�d�|j|	d�dd�|jd|	d �d!�|j|	d �dd!�|j|	d �|	d�d!�Gd"d#�d#t�}
Gd$d%�d%d&|
�}|j|t�dS)'Nc@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.DN)rrrsrtr6r6r6r7r�@sr�c@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.EN)rrrsrtr6r6r6r7r�Bsr�c@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.FN)rrrsrtr6r6r6r7r�Dsr�rVc@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.CN)rrrsrtr6r6r6r7ruLsru�foobarrWcSsdS)Nr�r6)r1r6r6r7�<lambda>Rsz9ClassPropertiesAndMethods.test_dynamics.<locals>.<lambda>r�cSsdS)NzC()r6)r1r6r6r7rmTszC()cSsdS)Nror6)r1r6r6r7rmVsror�cSs|dkrdSt�dS)Nr�)r6)r1r4r6r6r7�	mygetattrZsz:ClassPropertiesAndMethods.test_dynamics.<locals>.mygetattrr~cSs%|dkrt�tj|||�S)Nr�)r6r�r)r1r4r�r6r6r7�	mysetattrbsz:ClassPropertiesAndMethods.test_dynamics.<locals>.mysetattrznot spamzexpected AttributeErrorc@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.DN)rrrsrtr6r6r6r7r�nsc@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.IN)rrrsrtr6r6r6r7�Iusrpr9ZaarXr_c@seZdZdS)zAClassPropertiesAndMethods.test_dynamics.<locals>.dynamicmetaclassN)rrrsrtr6r6r6r7�dynamicmetaclass~srqc@seZdZdS)z:ClassPropertiesAndMethods.test_dynamics.<locals>.someclassN)rrrsrtr6r6r6r7�	someclass�srrr�)r�r�r;r�rl�methodrgrfrr'�__getattr__r��newrr6ryr=r5)r1r�r�r�rur9rnrorCrprqrrr6r6r7�
test_dynamics>s\						


		 z'ClassPropertiesAndMethods.test_dynamicsc3Cs�yGdd�dtt�}Wntk
r1YnX|jd�yGdd�dtd�}Wntk
rpYnX|jd�Gdd�d�}y Gdd�dtt��}Wntk
r�YnX|jd	�yGd
d�dt�}Wntk
rYnX|jd�yGdd�dt�}Wntk
r=YnX|jd
�Gdd�dt�}Gdd�dt�}Gdd�dtd|�}Gdd�dtd|�}yGdd�d||�}Wntk
r�YnX|jd�dS)Nc@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CN)rrrsrtr6r6r6r7ru�sruz5inheritance from both list and dict should be illegalc@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CN)rrrsrtr6r6r6r7ru�sz+inheritance from non-type should be illegalc@seZdZdS)z6ClassPropertiesAndMethods.test_errors.<locals>.ClassicN)rrrsrtr6r6r6r7�Classic�srwc@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CN)rrrsrtr6r6r6r7ru�sz,inheritance from CFunction should be illegalc@seZdZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CrVN)rrrsrtr�r6r6r6r7ru�sz__slots__ = 1 should be illegalc@seZdZdgZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CrVN)rrrsrtr�r6r6r6r7ru�sz!__slots__ = [1] should be illegalc@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.M1N)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.M2N)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.A1N)rrrsrtr6r6r6r7�A1�srxr�c@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.A2N)rrrsrtr6r6r6r7�A2�sryc@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.BN)rrrsrtr6r6r6r7r��sr�z5finding the most derived metaclass should have failed)r-rerxryr�r=r�)r1rurwr�r�rxryr�r6r6r7�test_errors�sF



 






z%ClassPropertiesAndMethods.test_errorsc	s�Gdd�dt�}|�}|j|jd�|df�|j|jd�|df�|j|jd�|df�Gdd�d|�}|�}|j|jd�|df�|j|jd�|df�|j|jd�|df�|j|j|d�|df�dd�}t|�}|j|jdt�d	�td	f�|j|jd�d	�td	f�|j|jj|�|j|jj|�|jt||�jj|�|jt||�jj|�|jt||�j�|f�|jt||�j�|f�td�jd�}|j	t
|�yt|d
d�Wnt
k
rzYnX|jd�t|�}|j|ji�d	|_
|j|j
d	�|j|jdd	i�|`
|j|d�dS)
Nc@s(eZdZdd�Zee�ZdS)z6ClassPropertiesAndMethods.test_classmethods.<locals>.CcWs|S)Nr6)r9r6r6r7r��sz:ClassPropertiesAndMethods.test_classmethods.<locals>.C.fooN)rrrsrtr�r��goor6r6r6r7ru�srurVc@seZdZdS)z6ClassPropertiesAndMethods.test_classmethods.<locals>.DN)rrrsrtr6r6r6r7r��sr�cSs
||fS)Nr6)r��argr6r6r7�f�sz6ClassPropertiesAndMethods.test_classmethods.<locals>.frr�r�z)classmethod shouldn't accept keyword argsr�)r�r;r{r�r�r�r'�__self__r�r�rxryr?r�r�)	r1rurLr�rCr}ZffrB�cm)r�r6r7�test_classmethods�sF		"(%""

	z+ClassPropertiesAndMethods.test_classmethodsz"the module 'xxsubtype' is internalcCs�ddl}d
}ddi}|jj||�\}}}|j||j�|j||�|j||�|j�j||�\}}}|j||j�|j||�|j||�|jjd}||j||�\}}	}
|j||j�|j|	|�|j|
|�Gdd	�d	|j�}||||�\}}	}
|j||�|j|	|�|j|
|�|jt��|�WdQRX|jt��||j��WdQRX|jt��|t�WdQRXdS)NrrVrWrXrM�{�	classmethc@seZdZdS)zAClassPropertiesAndMethods.test_classmethods_in_c.<locals>.SubSpamN)rrrsrtr6r6r6r7�SubSpamsr�)rVrWrX)r�r�r�r;r?r�rxr-)r1r�r9rCr�r��d1Zspam_cmZx2r��d2r�r6r6r7�test_classmethods_in_c�s6!z0ClassPropertiesAndMethods.test_classmethods_in_ccCspGdd�dt�}|�}|j|jd�d�|j|jd�d	�|j|jd�|df�Gdd�d|�}|�}|j|jd�d
�|j|jd�d�|j|jd�|df�|j|j|d�|df�td�}|j|ji�d|_|j|jd�|j|jddi�|`|j|d�dS)Nc@s(eZdZdd�Zee�ZdS)z7ClassPropertiesAndMethods.test_staticmethods.<locals>.CcWs|S)Nr6)r9r6r6r7r�sz;ClassPropertiesAndMethods.test_staticmethods.<locals>.C.fooN)rrrsrtr�r�r{r6r6r6r7rusrurVc@seZdZdS)z7ClassPropertiesAndMethods.test_staticmethods.<locals>.DN)rrrsrtr6r6r6r7r�sr�r�r�)rV)rV)rV)rV)r�r;r{r�r�r?r�r�)r1rurLr�rCZsmr6r6r7�test_staticmethodss$		"	z,ClassPropertiesAndMethods.test_staticmethodscCs�ddl}d}ddi}|jj||�\}}}|j|d�|j||�|j||�|j�j||�\}}}|j|d�|j||�|j||�dS)NrrVrWrXrMr�)rVrWrX)r�r�Z
staticmethr;)r1r�r9rCr�r�r�r�r6r6r7�test_staticmethods_in_c)s!z1ClassPropertiesAndMethods.test_staticmethods_in_ccs{Gdd�d����}|j�jd��df�|j|jd��df�|j|jd�|df�Gdd�d��}|�}|j|jd�|df�|j|jd�|df�|j|jd�|df�|j|j|d�|df�G�fdd�d�}|j|�jj�j�|jt�jj����jd��dS)	Nc@s(eZdZdd�Zee�ZdS)z1ClassPropertiesAndMethods.test_classic.<locals>.CcWs|S)Nr6)r9r6r6r7r�;sz5ClassPropertiesAndMethods.test_classic.<locals>.C.fooN)rrrsrtr�r�r{r6r6r6r7ru:srurVc@seZdZdS)z1ClassPropertiesAndMethods.test_classic.<locals>.DN)rrrsrtr6r6r6r7r�Asr�cseZdZ�jZdS)z1ClassPropertiesAndMethods.test_classic.<locals>.EN)rrrsrtr�r6)rur6r7r�Hsr�z<bound method )r;r{r��__func__r�rfr�r�)r1rLr�rCr�r6)rur7�test_classic8s		"z&ClassPropertiesAndMethods.test_classiccCs�Gdd�dt�}|�}|j|jd�|j|jd�d|_|j|jd�|j|jd�|`|j|d�dS)Nc@sheZdZGdd�de�Zdd�Zdd�Zdd�Zd	d
�Zeeee�Z	dS)z2ClassPropertiesAndMethods.test_compattr.<locals>.Cc@sIeZdZdddd�Zddd�Zdd�Zdd	�ZdS)
zEClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attributeNcSs||_||_||_dS)N)�_computed_attribute__get�_computed_attribute__set�_computed_attribute__delete)r1r�r�Zdeleter6r6r7r+Qs		zNClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__init__cSs
|j|�S)N)r�)r1r�r=r6r6r7r�UszMClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__get__cSs|j||�S)N)r�)r1r�r�r6r6r7riWszMClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__set__cSs
|j|�S)N)r�)r1r�r6r6r7�
__delete__YszPClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__delete__)rrrsrtr+r�rir�r6r6r6r7�computed_attributePsr�cSs
d|_dS)Nr)�_C__x)r1r6r6r7r+[sz;ClassPropertiesAndMethods.test_compattr.<locals>.C.__init__cSs|j}|d|_|S)NrV)r�)r1r�r6r6r7Z__get_x]s	
z:ClassPropertiesAndMethods.test_compattr.<locals>.C.__get_xcSs
||_dS)N)r�)r1r�r6r6r7Z__set_xasz:ClassPropertiesAndMethods.test_compattr.<locals>.C.__set_xcSs
|`dS)N)r�)r1r6r6r7Z
__delete_xcsz=ClassPropertiesAndMethods.test_compattr.<locals>.C.__delete_xN)
rrrsrtr�r�r+Z	_C__get_xZ	_C__set_xZ_C__delete_xr�r6r6r6r7ruOsrurrVr��r�)r�r;r�r�)r1rur9r6r6r7�
test_compattrMs		z'ClassPropertiesAndMethods.test_compattrcCs�Gdd�dt�}|�}|j|jd�|j|j|�Gdd�d|�}|�}|j|jd�|j|j|�dS)Nc@s(eZdZdd�Zdd�ZdS)z2ClassPropertiesAndMethods.test_newslots.<locals>.CcSstj|�}d|_|S)NrV)r-r�r�)r�r1r6r6r7r�rs	z:ClassPropertiesAndMethods.test_newslots.<locals>.C.__new__cSs|jd|_dS)NrW)r�)r1r6r6r7r+vsz;ClassPropertiesAndMethods.test_newslots.<locals>.C.__init__N)rrrsrtr�r+r6r6r6r7ruqsrurXc@seZdZdS)z2ClassPropertiesAndMethods.test_newslots.<locals>.DN)rrrsrtr6r6r6r7r�{sr�)r-r;r�r�)r1rur9r�rIr6r6r7�
test_newslotsos		z'ClassPropertiesAndMethods.test_newslotscCs�|jttj�|jttjd�|jttjt�|jttjt�Gdd�dt�}|jt|�Gdd�dt�}|jt|�dS)Nrvc@seZdZejZdS)z1ClassPropertiesAndMethods.test_bad_new.<locals>.CN)rrrsrtr-r�r6r6r6r7ru�sruc@seZdZejZdS)z1ClassPropertiesAndMethods.test_bad_new.<locals>.CN)rrrsrtr�r�r6r6r6r7ru�s)r�rxr�r�r-)r1rur6r6r7�test_bad_new�sz&ClassPropertiesAndMethods.test_bad_newcCs�Gdd�dt�}tj|�|jttj|d�tj|��|jttj|�d�Gdd�dt�}tj|�tj|d�tj|d��|jttj|d�d�Gdd�dt�}tj|�|jttj|d�tj|d��tj|d�d�Gdd�dt�}tj|�|jttj|d�tj|d��|jttj|d�d�dS)Nc@seZdZdS)z4ClassPropertiesAndMethods.test_object_new.<locals>.AN)rrrsrtr6r6r6r7r��sr�r^c@seZdZdd�ZdS)z4ClassPropertiesAndMethods.test_object_new.<locals>.AcSs
||_dS)N)r�)r1r�r6r6r7r+�sz=ClassPropertiesAndMethods.test_object_new.<locals>.A.__init__N)rrrsrtr+r6r6r6r7r��srXc@seZdZdd�ZdS)z4ClassPropertiesAndMethods.test_object_new.<locals>.AcSs
tj|�S)N)r�r�)r�r�r6r6r7r��sz<ClassPropertiesAndMethods.test_object_new.<locals>.A.__new__N)rrrsrtr�r6r6r6r7r��sc@s(eZdZdd�Zdd�ZdS)z4ClassPropertiesAndMethods.test_object_new.<locals>.AcSs
tj|�S)N)r�r�)r�r�r6r6r7r��sz<ClassPropertiesAndMethods.test_object_new.<locals>.A.__new__cSs
||_dS)N)r�)r1r�r6r6r7r+�sz=ClassPropertiesAndMethods.test_object_new.<locals>.A.__init__N)rrrsrtr�r+r6r6r6r7r��s)r�r�r�rxr+)r1r�r6r6r7�test_object_new�s(



z)ClassPropertiesAndMethods.test_object_newcCsGdd�dt�}|jt|�Gdd�d|�}tj��!tjdt�|d�}WdQRX|j|jd�|j|j	|�|`
|jt|�|`
tj��!tjdt�|d�}WdQRX|j|jd�|j|j	|�dS)Nc@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_restored_object_new.<locals>.Ac_s
t�dS)N)�AssertionError)r�r2r3r6r6r7r��szEClassPropertiesAndMethods.test_restored_object_new.<locals>.A.__new__N)rrrsrtr�r6r6r6r7r��sr�c@s%eZdZejZdd�ZdS)z=ClassPropertiesAndMethods.test_restored_object_new.<locals>.BcSs
||_dS)N)r�)r1r�r6r6r7r+�szFClassPropertiesAndMethods.test_restored_object_new.<locals>.B.__init__N)rrrsrtr�r�r+r6r6r6r7r��s	r��errorrX)r�r�r��warnings�catch_warnings�simplefilter�DeprecationWarningr;r�r�r�)r1r�r�rIr6r6r7�test_restored_object_new�s 

z2ClassPropertiesAndMethods.test_restored_object_newc	CsYGdd�dt�}Gdd�d|�}Gdd�d|�}Gdd�d||�}|j|j�||||tg�|j|j||||tf�|j|�j�d�Gd	d
�d
t�}Gdd�d||||d
|�}|j|jt|||||f�|j|�j�d�yOGdd�dt�}Gdd�dtd
|�}tj|�}d|d<Wntk
r�YnX|jd�y6Gdd�dt�}Gdd�dtd
|�}Wntk
r�YnX|jd�y6Gdd�dt�}Gdd�dtd
|�}Wntk
rGYnX|jd�dS)Nc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.AcSsdS)Nr�r6)r1r6r6r7r}�sz2ClassPropertiesAndMethods.test_altmro.<locals>.A.fN)rrrsrtr}r6r6r6r7r��sr�c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.BN)rrrsrtr6r6r6r7r��sr�c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.CcSsdS)Nrur6)r1r6r6r7r}�sz2ClassPropertiesAndMethods.test_altmro.<locals>.C.fN)rrrsrtr}r6r6r6r7ru�sruc@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.DN)rrrsrtr6r6r6r7r��sr�c@seZdZdd�ZdS)z?ClassPropertiesAndMethods.test_altmro.<locals>.PerverseMetaTypecSstj|�}|j�|S)N)r=�mro�reverse)r��Lr6r6r7r��s
zCClassPropertiesAndMethods.test_altmro.<locals>.PerverseMetaType.mroN)rrrsrtr�r6r6r6r7�PerverseMetaType�sr�c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)rrrsrtr6r6r6r7r��sr�r�c@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_altmro.<locals>._metaclasscSs
|ttgS)N)rer�)r1r6r6r7r��sz=ClassPropertiesAndMethods.test_altmro.<locals>._metaclass.mroN)rrrsrtr�r6r6r6r7r��sr�c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)rrrsrtr6r6r6r7r��sr_r^zdevious mro() return not caughtc@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_altmro.<locals>._metaclasscSsdgS)NrVr6)r1r6r6r7r��sz=ClassPropertiesAndMethods.test_altmro.<locals>._metaclass.mroN)rrrsrtr�r6r6r6r7r��sc@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)rrrsrtr6r6r6r7r��sz!non-class mro() return not caughtc@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_altmro.<locals>._metaclasscSsdS)NrVr6)r1r6r6r7r�sz=ClassPropertiesAndMethods.test_altmro.<locals>._metaclass.mroN)rrrsrtr�r6r6r6r7r��sc@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)rrrsrtr6r6r6r7r�sz$non-sequence mro() return not caught)	r�r;r�rr}r=r�rxry)	r1r�r�rur�r�r�r�r�r6r6r7�test_altmro�s>%"%%

 

 
z%ClassPropertiesAndMethods.test_altmrocsVGdd�dt��G�fdd�d��}|�}|j|jd�d|_|j|jd
�|`|j|jd�|j|dd�d	|d<|j|jd�|d=|j|jd�|j|d
d�dtd
d�f�d|d
d�<|j|jtd
d�df�|d
d�=|j|jtd
d��dS)Nc@seZdZdZdS)z5ClassPropertiesAndMethods.test_overloading.<locals>.Bz<Intermediate class because object doesn't have a __setattr__N)rrrsrtrJr6r6r6r7r�sr�csdeZdZdd�Z�fdd�Z�fdd�Zdd�Zd	d
�Zdd�Zd
S)z5ClassPropertiesAndMethods.test_overloading.<locals>.CcSs |dkrd|fSt�dS)Nr�r>)r6)r1r4r6r6r7rts
zAClassPropertiesAndMethods.test_overloading.<locals>.C.__getattr__cs5|dkr||f|_n�j|||�SdS)Nr�)r�r)r1r4r�)r�r6r7rszAClassPropertiesAndMethods.test_overloading.<locals>.C.__setattr__cs,|dkr||_n�j||�SdS)Nr�)rr)r1r4)r�r6r7rszAClassPropertiesAndMethods.test_overloading.<locals>.C.__delattr__cSs
d|fS)N�getitemr6)r1r�r6r6r7rK szAClassPropertiesAndMethods.test_overloading.<locals>.C.__getitem__cSs||f|_dS)N)�setitem)r1r�r�r6r6r7rS"szAClassPropertiesAndMethods.test_overloading.<locals>.C.__setitem__cSs
||_dS)N)�delitem)r1r�r6r6r7�__delitem__$szAClassPropertiesAndMethods.test_overloading.<locals>.C.__delitem__N)	rrrsrtrtrrrKrSr�r6)r�r6r7rusrur>r�r~r��rr�)r>r�)r�r~)r�r~)r~r�)r�r;r�r�rr�r�rM)r1rur9r6)r�r7�test_overloading	s$		
)"
z*ClassPropertiesAndMethods.test_overloadingcsGdd�dt���d��|j�j�d�G��fdd�d��}|d�}|j|j�d�|j|j�d�|j|j�d�G�fdd�dt�}|j|�jj�j�|jt�jj�d���j	d	��dS)
Nc@s(eZdZdd�Zdd�ZdS)z1ClassPropertiesAndMethods.test_methods.<locals>.CcSs
||_dS)N)r�)r1r�r6r6r7r+=sz:ClassPropertiesAndMethods.test_methods.<locals>.C.__init__cSs|jS)N)r�)r1r6r6r7r�?sz5ClassPropertiesAndMethods.test_methods.<locals>.C.fooN)rrrsrtr+r�r6r6r6r7ru<srurVcs"eZdZ�jZ�jZdS)z1ClassPropertiesAndMethods.test_methods.<locals>.DN)rrrsrtr�rr{r6)ru�c1r6r7r�Cs	r�rWcseZdZ�jZdS)z1ClassPropertiesAndMethods.test_methods.<locals>.EN)rrrsrtr�r6)rur6r7r�Jsr�z<bound method )
r�r;r�rr{r�r�rfr�r�)r1r�r�r�r6)rur�r7�test_methods:sz&ClassPropertiesAndMethods.test_methodscs+dd�}dd�}dd�}dd�}d	d
�}dd�}d
d�}ddd�}dd�}	dd�}
�fdd�}�fdd�}dd�}
dd�}dt|t�ifdt|t�ifdt|t�d |d!|ifd"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�ifd0t|t�ifg}G��fd1d2�d2t�}G�fd3d4�d4t�}Gd5d6�d6t��G�fd7d8�d8t�}xk|D]c\}}}�}Gd9d:�d:|�}x*|j�D]\}}t|||�q�Wt|||�||��g�Gd;d:�d:|�}x*|j�D]\}}t|||�q^Wt||||��||���j�d<g|�Gd=d:�d:|�}x*|j�D]\}}t|||�q�Wt|||���j�||��q�WdS)@Nc	Ss|�WdQRXdS)Nr6)Zmanagerr6r6r7�run_contextSszIClassPropertiesAndMethods.test_special_method_lookup.<locals>.run_contextcSs|S)Nr6)r1r6r6r7�idenVszBClassPropertiesAndMethods.test_special_method_lookup.<locals>.idencSsdS)Nshellor6)r1r6r6r7r
XszCClassPropertiesAndMethods.test_special_method_lookup.<locals>.hellocSsgS)Nr6)r1r6r6r7�	empty_seqZszGClassPropertiesAndMethods.test_special_method_lookup.<locals>.empty_seqcSsdS)Nrr6)r1r6r6r7�zero\szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.zerocSsdS)Ny�?r6)r1r6r6r7�complex_num^szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.complex_numcSs
t�dS)N)�
StopIteration)r1r6r6r7r�`szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.stopcSsdS)NTr6)r1�thingr6r6r7�return_truebszIClassPropertiesAndMethods.test_special_method_lookup.<locals>.return_truecSs
tt|�S)N)r�r')r�r6r6r7�
do_isinstancedszKClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_isinstancecSs
tt|�S)N)r�r')r�r6r6r7�
do_issubclassfszKClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_issubclasscs7Gdd�d|jt�}�j|�dd�dS)Nc@seZdZdS)z^ClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_dict_missing.<locals>.DictSubN)rrrsrtr6r6r6r7�DictSubisr��hirZ)r�rer;)Zcheckerr�)r1r6r7�do_dict_missinghszMClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_dict_missingcs�j|d�dS)Nr�rZ)r;)rVr�)r1r6r7�some_numberlszIClassPropertiesAndMethods.test_special_method_lookup.<locals>.some_numbercWsdS)Nr6)r2r6r6r7�swallowoszEClassPropertiesAndMethods.test_special_method_lookup.<locals>.swallowcSsdS)Nr
r6)r1�specr6r6r7�format_implpszIClassPropertiesAndMethods.test_special_method_lookup.<locals>.format_impl�	__bytes__�__reversed__�__length_hint__rd�__next__�
__sizeof__�__instancecheck__�__missing__r��__subclasscheck__r@�	__enter__�__exit__�__complex__�
__format__�	__floor__�	__trunc__�__ceil__�__dir__�	__round__cs4eZdZ�dd�Z��fdd�ZdS)zEClassPropertiesAndMethods.test_special_method_lookup.<locals>.CheckercSs|jdj|��dS)Nz__getattr__ called with {0})ry�format)r1�attr�testr6r6r7rt�szQClassPropertiesAndMethods.test_special_method_lookup.<locals>.Checker.__getattr__cs2|�kr"|jdj|��tj||�S)Nz __getattribute__ called with {0})ryr�r�r)r1r�r�)�okr6r7r�szVClassPropertiesAndMethods.test_special_method_lookup.<locals>.Checker.__getattribute__N)rrrsrtrtrr6)r�r1r6r7�Checker�sr�cs.eZdZdd�Z�fdd�ZdS)zJClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescrcSs
||_dS)N)�impl)r1r�r6r6r7r+�szSClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescr.__init__cs �jd�|jj||�S)NrV)rbr�r�)r1r��owner)�recordr6r7r��s
zRClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescr.__get__N)rrrsrtr+r�r6)r�r6r7�SpecialDescr�sr�c@seZdZdS)zIClassPropertiesAndMethods.test_special_method_lookup.<locals>.MyExceptionN)rrrsrtr6r6r6r7�MyException�sr�cs"eZdZ�fdd�ZdS)zFClassPropertiesAndMethods.test_special_method_lookup.<locals>.ErrDescrcs
��dS)Nr6)r1r�r�)r�r6r7r��szNClassPropertiesAndMethods.test_special_method_lookup.<locals>.ErrDescr.__get__N)rrrsrtr�r6)r�r6r7�ErrDescr�sr�c@seZdZdS)z?ClassPropertiesAndMethods.test_special_method_lookup.<locals>.XN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z?ClassPropertiesAndMethods.test_special_method_lookup.<locals>.XN)rrrsrtr6r6r6r7r��srVc@seZdZdS)z?ClassPropertiesAndMethods.test_special_method_lookup.<locals>.XN)rrrsrtr6r6r6r7r��s)r�)r@)rAr��reversedr-r�	getsizeofrr��mathZfloorZtruncr'Zceil�dir�roundr��	Exceptionr.r�r;r�)r1r�r�r
r�r�r�r�r�r�r�r�r�r�r�Zspecialsr�r�r�r4ZrunnerZ	meth_impl�envr�r�r�r6)r�r�r�r1r7�test_special_method_lookupOsp		

z4ClassPropertiesAndMethods.test_special_method_lookupc
Cs�Gdd�dt�}|�}|�}|j|�|jt|�t|��t|�t|�|j||�|j||k�|j||k�|j||k�|jt|�j	d�d�|jt|�t
|��|jd|�x$td�D]}|j
||�qW|jd|�Gdd�dt�}|�}|�}|j|�|jt|�t|��t|�t|�|j||�|j||�|j||k�|j||k�|jt|�j	d	�d�|jt|�t
|��|jd|�x$td�D]}|j
||�q5W|jd|�Gd
d�dt�}|d�}	|d�}
|d�}|j|	�|j|
�|jt|	�td��|j|	|	�|j|	|
�|j|	|	k�|j|	|
�|j|	|
k�|j|	|
k�|j|
|	k�|j|
|	k�|jt|	�d�|jt
|	�d
�|td��}|jd|�x$td�D]}|j
||�q�W|jd|�dS)Nc@seZdZdd�ZdS)z2ClassPropertiesAndMethods.test_specials.<locals>.CcSs*d|kodknr |St�dS)Nrr�)�
IndexError)r1rir6r6r7rK�sz>ClassPropertiesAndMethods.test_specials.<locals>.C.__getitem__N)rrrsrtrKr6r6r6r7ru�sruzC object at rrVr�c@seZdZdd�ZdS)z2ClassPropertiesAndMethods.test_specials.<locals>.DcSs*d|kodknr |St�dS)Nrr�)r�)r1rir6r6r7rK�sz>ClassPropertiesAndMethods.test_specials.<locals>.D.__getitem__N)rrrsrtrKr6r6r6r7r��sr�zD object at c@s�eZdZdd�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�)r1r�r6r6r7r+�sz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__init__cSs	|jS)N)r�)r1r6r6r7rw�sz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__bool__cSs
t|j�S)N)�hashr�)r1r6r6r7�__hash__�sz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__hash__cSs
|j|kS)N)r�)r1rqr6r6r7rU�sz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__eq__cSs
|j|kS)N)r�)r1rqr6r6r7�__ne__�sz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__ne__cSs
|j|kS)N)r�)r1rqr6r6r7�__ge__�sz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__ge__cSs
|j|kS)N)r�)r1rqr6r6r7�__gt__�sz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__gt__cSs
|j|kS)N)r�)r1rqr6r6r7�__le__�sz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__le__cSs
|j|kS)N)r�)r1rqr6r6r7�__lt__�sz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__lt__cSsd|jS)NzProxy:%s)r�)r1r6r6r7r��sz>ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__str__cSsd|jS)Nz	Proxy(%r))r�)r1r6r6r7rgsz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__repr__cSs
||jkS)N)r�)r1r�r6r6r7rYszCClassPropertiesAndMethods.test_specials.<locals>.Proxy.__contains__N)rrrsrtr+rwr�rUr�r�r�r�r�r�rgrYr6r6r6r7�Proxy�sr�zProxy:0zProxy(0)r�r�r�r�)r�r�r5�idr�r;r�ZassertGreaterEqualr
�findrf�assertNotInr�r�)
r1rur��c2rir�r�r�r�Zp0Zp1Zp_1Zp10r6r6r7�
test_specials�sp		

		


z'ClassPropertiesAndMethods.test_specialsc
CsSddl}Gdd�dt�}|�}|j|�}|j|�|�~tj�|j|�d�~Gdd�dt�}|�}y|j|�Wn;tk
r�}z|jdt|��WYdd}~XnX|j	d�Gdd	�d	t�}|�}	|j|	�}|j|�|	�~	tj�|j|�d�~dS)
Nrc@seZdZdS)z2ClassPropertiesAndMethods.test_weakrefs.<locals>.CN)rrrsrtr6r6r6r7rusruc@seZdZdgZdS)z7ClassPropertiesAndMethods.test_weakrefs.<locals>.NoWeakr�N)rrrsrtr�r6r6r6r7�NoWeak&sr�zweak referencez!weakref.ref(no) should be illegalc@seZdZddgZdS)z5ClassPropertiesAndMethods.test_weakrefs.<locals>.Weakr�rbN)rrrsrtr�r6r6r6r7�Weak/sr�)
�weakrefr��refr;rrZrxr�r
ry)
r1r�rurL�rr��nor,r��yesr6r6r7�
test_weakrefss0	
	)
	
z'ClassPropertiesAndMethods.test_weakrefsc
Cs�Gdd�dt�}|�}|j|d�d|_|j|jd�|j|jd�|`|j|d�|j|d�|jj|d�|j|jj|�d�|jj|�|j|d�|jd}|j	|t
�t|�}|jd|�|jd|�|jd	|�|jd
|�|j|j
d�|j|j|jd�|j|j|jd
�|j|j|jd�x�dD]�}yt||d�Wn]tk
r}z=t|�jd�dkr|jd|t|�f�WYdd}~Xq�X|jd|�q�Wd|_
|j|j
d�Gdd�dt�}|�}yx|D]}	t|	�qxWWntk
r�YnX|jd�dS)Nc@sLeZdZdd�Zdd�Zdd�Zeeeedd�Zd	S)
z4ClassPropertiesAndMethods.test_properties.<locals>.CcSs|jS)N)r�)r1r6r6r7�getx<sz9ClassPropertiesAndMethods.test_properties.<locals>.C.getxcSs
||_dS)N)r�)r1r�r6r6r7�setx>sz9ClassPropertiesAndMethods.test_properties.<locals>.C.setxcSs
|`dS)N)r�)r1r6r6r7�delx@sz9ClassPropertiesAndMethods.test_properties.<locals>.C.delx�doczI'm the x property.N)rrrsrtr�r�r�r�r�r6r6r6r7ru;srur�r�r�rorJ�fget�fset�fdelzI'm the x property.r�r�r��readonlyrzQwhen setting readonly attr %r on a property, got unexpected AttributeError msg %rzIexpected AttributeError from trying to set readonly %r attr on a propertyc@s"eZdZedd��ZdS)z4ClassPropertiesAndMethods.test_properties.<locals>.DcSsddS)NrVrr6)r^r6r6r7rmmsz=ClassPropertiesAndMethods.test_properties.<locals>.D.<lambda>N)rrrsrtr�rKr6r6r6r7r�lsr�z,expected ZeroDivisionError from bad property)r�r�r�)r�r�r�r;r�rir�r�r?r�r�r�r�rJr�r�r�r�r�r6r
r�ry�ZeroDivisionError)
r1rur9�raw�attrsr�r,r�rCrir6r6r7�test_properties9sV		

	'			

z)ClassPropertiesAndMethods.test_propertiesrWz)Docstrings are omitted with -O2 and abovecs G�fdd�dt�}dS)NcsieZdZdd�Zdd�Zee�Z�jejd�ede�Z	�je	jd�dS)z?ClassPropertiesAndMethods.test_properties_doc_attrib.<locals>.EcSsdS)z
getter methodrr6)r1r6r6r7�getter|szFClassPropertiesAndMethods.test_properties_doc_attrib.<locals>.E.gettercSsdS)z
setter methodNr6)rVr�r6r6r7�setterszFClassPropertiesAndMethods.test_properties_doc_attrib.<locals>.E.setterz
getter methodr�N)
rrrsrtrrr�Zpropr;rJZprop2r6)r1r6r7r�{sr�)r�)r1r�r6)r1r7�test_properties_doc_attribxsz4ClassPropertiesAndMethods.test_properties_doc_attribcsEyddl�Wntk
r$YnXG�fdd�dt�}dS)NrcseZdZe�j�ZdS)z>ClassPropertiesAndMethods.test_testcapi_no_segfault.<locals>.XN)rrrsrtr�Ztest_with_docstring�pr6)�	_testcapir6r7r��sr�)r�ImportErrorr�)r1r�r6)rr7�test_testcapi_no_segfault�s

z3ClassPropertiesAndMethods.test_testcapi_no_segfaultcs�Gdd�dt����}|j�jjd�|j|d�d|_|j|d�|j|jd�|j|jd�|`|j|d�|j|d�G�fdd�d��}|�}d	|_|j|jd	�|`|`Gd
d�dt����}d|_|j|jd�|`G�fdd
�d
��}|�}d|_|j|jd�|`dS)Nc@s^eZdZedd�Zejdd��Zejdd��Zejdd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.Cr�r
cSs|jS)N)�_foo)r1r6r6r7r��sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.C.foocSst|�|_dS)N)r$r)r1r�r6r6r7r��scSs
|`dS)N)r)r1r6r6r7r��sN)rrrsrtr�r�rr�deleterr6r6r6r7ru�srur
r�r�rcs(eZdZ�jjdd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.DcSs#y
|`Wntk
rYnXdS)N)rr6)r1r6r6r7r��s

z=ClassPropertiesAndMethods.test_properties_plus.<locals>.D.fooN)rrrsrtr�r	r6)rur6r7r��sr�r�c@sdeZdZedd��Zejdd��Zejdd��Zejddd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.EcSs|jS)N)r)r1r6r6r7r��sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.E.foocSs
t�dS)N)�RuntimeError)r1r�r6r6r7r��scSst|�|_dS)N)r$r)r1r�r6r6r7r��sNcSs
|`dS)N)r)r1r�r6r6r7r��s)rrrsrtr�r�rr	r6r6r6r7r��s
r�cs=eZdZ�jjdd��Zejdd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.FcSs
|`dS)N)r)r1r6r6r7r��sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.F.foocSstd|�|_dS)Nr)�maxr)r1r�r6r6r7r��sN)rrrsrtr�r	rr6)r�r6r7r��sr�r�ri���i���i����)r�r;r�rJr�r�r)r1rLr�rCrSr�r}r6)rur�r7�test_properties_plus�s6								z.ClassPropertiesAndMethods.test_properties_pluscCs�t�}|j|i�ti�}|j|i�tddddi�}|j|ddddi�|j|tt|j����|j|tt|j����tddddi�}|j|tdddd��|j|t|��|j|tddidd��|j|td#gdd��|j|td$d%g|��|j|t|��x�d	d	d
dd	gd&fD]k}yt|�WnCtk
r�Yq�tk
r�|dkr�n|jd|�Yq�X|jd|�q�Wytii�Wntk
r YnX|jd
�Gdd�d�}yt|��Wntk
rfYnX|jd�dd�|_dd�|_	t|��}|j||j�Gdd�d�}t|dd�|dd�|dd�|dd�g�}|j|ddddi�tt
td�tdd���}|j|tdd�td�D���xNd'gd(gfD]:}yt|�Wntk
r�YqX|jd"|�qWdS))NrVrWr9rI�one�tworor�ry�0zno TypeError from dict(%r)zno TypeError from dict({}, {})c@s(eZdZddddddiZdS)zAClassPropertiesAndMethods.test_dict_constructors.<locals>.MappingrVrWrXrZr9y�?N)rrrsrtrer6r6r6r7�Mapping�srz*no TypeError from dict(incomplete mapping)cSst|jj��S)N)r-rera)r1r6r6r7rm		szBClassPropertiesAndMethods.test_dict_constructors.<locals>.<lambda>cSs|j|S)N)re)r1rir6r6r7rm
	sc@s(eZdZdd�Zdd�ZdS)zJClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntrycSs||_||_dS)N)�first�last)r1rrr6r6r7r+	s	zSClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntry.__init__cSst|j|jg�S)N)rcrr)r1r6r6r7rd	szSClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntry.__iter__N)rrrsrtr+rdr6r6r6r7�AddressBookEntry	srZTimZWarsawZBarryZPetersrZr^cSs g|]}||df�qS)rVr6)�.0rir6r6r7�
<listcomp>	s	zDClassPropertiesAndMethods.test_dict_constructors.<locals>.<listcomp>�tooshort�too�long�by 1zno ValueError from dict(%r))rrW)r
ro)rr�)r)r)rrr)rer;r-r.rcrx�
ValueErrorryrarK�zipr�)r1rCZbadargrrZbadr6r6r7�test_dict_constructors�sl	""""





$)
z0ClassPropertiesAndMethods.test_dict_constructorscsd}|jt�ddg�~xEdddddgddd/ddit|jfD]}t|�qVWd	d
�}Gdd�dt�}d
dg}|j|t|��|�|�}|j|t|��|�d|_dd�|_|j|t|��|ddg�Gdd�d|�}ddg|}|j|t|��|�|�}	|j|t|	��|�d|	_dd�|	_|j|t|	��|ddg�Gdd�dtt	��}
|
d�}d|_
d|_dd d!d"d#g��fd$d%�t|�D�}|j|d&d'g�Gd(d)�d)|
�}
|
d*�}d|_
d|_|j|jd+�yt|�Wnt
k
r�YnX|jtt�tt��G�fd,d-�d-t��G�fd.d�dt�}t|��dS)0Nr~�junkr1rWy@g@�2�2cSsdd�|D�S)NcSs%g|]}|jd�s|�qS)r�)r�)rr^r6r6r7r5	s	zKClassPropertiesAndMethods.test_dir.<locals>.interesting.<locals>.<listcomp>r6)Zstringsr6r6r7�interesting4	sz7ClassPropertiesAndMethods.test_dir.<locals>.interestingc@s"eZdZdZdd�ZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.CrVcSsdS)Nr6)r1r6r6r7�Cmethod9	sz5ClassPropertiesAndMethods.test_dir.<locals>.C.CmethodN)rrrsrt�Cdatar!r6r6r6r7ru7	srur"r!cSsdS)Nrr6)r1r6r6r7rmC	sz4ClassPropertiesAndMethods.test_dir.<locals>.<lambda>�cdata�cmethodc@s"eZdZdZdd�ZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.ArVcSsdS)Nr6)r1r6r6r7�AmethodI	sz5ClassPropertiesAndMethods.test_dir.<locals>.A.AmethodN)rrrsrt�Adatar%r6r6r6r7r�G	sr�r&r%r�cSsdS)NrXr6)r1r6r6r7rmQ	s�adata�amethodc@seZdZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.MN)rrrsrtr6r6r6r7�MV	sr)rErVrrrJ�__package__�
__loader__�__spec__cs"g|]}|�kr|�qSr6r6)rr�)�default_attributesr6r7r]	s	z6ClassPropertiesAndMethods.test_dir.<locals>.<listcomp>r9rIc@s(eZdZdd�Zee�ZdS)z.ClassPropertiesAndMethods.test_dir.<locals>.M2cSsdS)NzNot a dict!r6)r1r6r6r7�getdicta	sz6ClassPropertiesAndMethods.test_dir.<locals>.M2.getdictN)rrrsrtr.r�r?r6r6r6r7r�`	sr��m2zNot a dict!csXeZdZdd�Zdd�Z�fdd�Zdd�Z�fd	d
�ZdS)z3ClassPropertiesAndMethods.test_dir.<locals>.WrappercSs
||_dS)N)�
_Wrapper__obj)r1r�r6r6r7r+t	sz<ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__init__cSsdt|j�S)NzWrapper(%s))rfr0)r1r6r6r7rgv	sz<ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__repr__cs�|j|�S)N)r0)r1r�)�Wrapperr6r7rKx	sz?ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__getitem__cSs
t|j�S)N)r�r0)r1r6r6r7r8z	sz;ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__len__cs�t|j|��S)N)r>r0)r1r4)r1r6r7rt|	sz?ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__getattr__N)rrrsrtr+rgrKr8rtr6)r1r6r7r1s	s
r1cs.eZdZ�fdd�Zee�ZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.Ccs�t|��S)N)r=)r1)r1r6r7Z
__getclass�	sz8ClassPropertiesAndMethods.test_dir.<locals>.C.__getclassN)rrrsrtZ_C__getclassr�r�r6)r1r6r7ru	s)rW)r;r�r=�test_dirr�r#r$r'r(rrIr9r?rxrp�Ellipsis)r1rr|r ruZcstuffrLr�Zastuffr9r)Z	minstance�namesr�Z
m2instancer6)r1r-r7r2(	sV:		&		&					
z"ClassPropertiesAndMethods.test_dirc+sEGdd�dt�}|j|�jd�d�G�fdd�d|��|j��jd�d�Gd	d
�d
|�}t|�|_|j|�jd�d�G�fd
d�d|���|j��jd�d�G�fdd�dt��G��fdd�d���|j��jd�d�Gdd�d��}�|�|_|j|�jd�d�yt�d�Wntk
r�YnX|jd�yt�|��Wntk
r�YnX|jd�yt��jd�Wntk
rYnX|jd�yt��j|��Wntk
rNYnX|jd �Gd!d"�d"t�}Gd#d$�d$|�}|�}|j|j	d%�|jt||�j	d�Gd&d'�d't�}G�fd(d)�d)|��|j�j
�|j�yt|d*d�Wntk
r3YnX|jd+�dS),Nc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.AcSsd|S)NzA(%r)r6)r1r9r6r6r7rB�	sz5ClassPropertiesAndMethods.test_supers.<locals>.A.methN)rrrsrtrBr6r6r6r7r��	sr�rVzA(1)cs1eZdZ��fdd�Zdd�Z�S)z0ClassPropertiesAndMethods.test_supers.<locals>.Bcst�|�|_dS)N)r�r�)r1)r�r�r6r7r+�	sz9ClassPropertiesAndMethods.test_supers.<locals>.B.__init__cSsd||jj|�S)NzB(%r))r�rB)r1r9r6r6r7rB�	sz5ClassPropertiesAndMethods.test_supers.<locals>.B.meth)rrrsrtr+rBr6)r�)r�r7r��	sr�rWzB(2)A(2)c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.CcSsd||jj|�S)NzC(%r))r�rB)r1r9r6r6r7rB�	sz5ClassPropertiesAndMethods.test_supers.<locals>.C.methN)rrrsrtrBr6r6r6r7ru�	srurXzC(3)A(3)cs%eZdZ��fdd�Z�S)z0ClassPropertiesAndMethods.test_supers.<locals>.Dcsd|t�|�j|�S)NzD(%r))r�rB)r1r9)r�r�r6r7rB�	sz5ClassPropertiesAndMethods.test_supers.<locals>.D.meth)rrrsrtrBr6)r�)r�r7r��	sr�rZzD(4)C(4)B(4)A(4)cs%eZdZ��fdd�Z�S)z6ClassPropertiesAndMethods.test_supers.<locals>.mysupercst�|�j|�S)N)r�r+)r1r2)r��mysuperr6r7r+�	sz?ClassPropertiesAndMethods.test_supers.<locals>.mysuper.__init__)rrrsrtr+r6)r5)r�r7r5�	sr5cs%eZdZ��fdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.Ecsd|��|�j|�S)NzE(%r))rB)r1r9)r�r5r6r7rB�	sz5ClassPropertiesAndMethods.test_supers.<locals>.E.methN)rrrsrtrBr6)r�r5r6r7r��	sr�r^zE(5)D(5)C(5)B(5)A(5)c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.FcSs*|j}d||jjf|j|�S)Nz	F(%r)[%s])�	_F__superr�rrrB)r1r9r^r6r6r7rB�	s	z5ClassPropertiesAndMethods.test_supers.<locals>.F.methN)rrrsrtrBr6r6r6r7r��	sr�r_z!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@s(eZdZdd�Zee�ZdS)z5ClassPropertiesAndMethods.test_supers.<locals>.DDbasecSsdS)Nr�r6)r1r6r6r7r��	sz:ClassPropertiesAndMethods.test_supers.<locals>.DDbase.getxN)rrrsrtr�r�r�r6r6r6r7�DDbase�	sr7c@s(eZdZdd�Zee�ZdS)z4ClassPropertiesAndMethods.test_supers.<locals>.DDsubcSsdS)Nr
r6)r1r6r6r7r��	sz9ClassPropertiesAndMethods.test_supers.<locals>.DDsub.getxN)rrrsrtr�r�r�r6r6r6r7�DDsub�	sr8r
c@s"eZdZedd��ZdS)z3ClassPropertiesAndMethods.test_supers.<locals>.BasecSsdS)Nr�r6)r1r6r6r7rm�	sz<ClassPropertiesAndMethods.test_supers.<locals>.Base.<lambda>N)rrrsrtr��aPropr6r6r6r7�Base�	sr:cs+eZdZe��fdd��Z�S)z2ClassPropertiesAndMethods.test_supers.<locals>.Subcst�|�jS)N)r�r9)�klass)�Subr�r6r7r��	sz7ClassPropertiesAndMethods.test_supers.<locals>.Sub.test)rrrsrtr�r�r6)r<)r�r7r<�	sr<r�z#super shouldn't accept keyword args)r�r;rBr�r�r6rxryr�r�r�r9)r1r�rur�r7r8Zddr:)r�)r�r�r�r<r5r7�test_supers�	s`







	
z%ClassPropertiesAndMethods.test_supersc
sHG�fdd�dt��|jt�d�d�d�|jt�d�d�d��d�}|j|d�|jt|�d�|jt|�jt�|jt|�td��|j|
jt�|j|d	?jt�|j|d	>jt�|j�d	�d
>jt�|j�d	�d
?jt�G�fdd�dt��|jt�d
�d�d�|jtd�d��d��d�}|j|d�|jt|�d�|jt|�td��|jt|�jt�|j|
jt�|j|jt�|j�d	�jt�|j|d	?jt�|j|d	>jt�|j|d	jt�|j|djt�|j|djt�|j|djt�|jd|jt�|j|d	Bjt�|j|d	Ajt�|j|d8@jt�|j�d	�d
>jt�|j�d	�d
?jt�|jt�d	��jt�Gdd�dt�}|d�}|j|d	jt�|jd	|jt�|d9�}|j|ji�|jt|�d:�Gdd�dt	�}|jt|d��d�|d�}|j|d�|jt	|�d�|jt	|�jt	�|jt|�td��|j|
jt	�Gdd�dt
�}|d;d�}|jt|�d�t
d<d�}|j|jt
�|j||�|jt
|�|�|jt
|�jt
�||�}|jt|�d�|j||�|jt
|�|�|jt
|�jt
�|jt|�t|��|j|
jt
�|j|d	jt
�|j|d	|�|j|d	jt
�|j|d	|�|j|djt
�|j|d|�|j|djt
�|j|d|�Gdd�dt�}|d=�}|j|d>�|j|j�|d?��|j|j�j�|d@��xNt
d#�D]@}|t
|��}|j�}	|	j�}
|j|
|�qW|dA�}|jt|�dB�|jt|�jt�|jt|�tdC��|j|dd�jt�|j|djt�|j|d	jt�|j|fjt�|f�}|jt|�f�|jt|�jt�|j||jt�|j|d	jt�|j|djt�|j|d jt�|j|dd�jt�Gd$d%�d%t�}|d&�}|j|d&�|j|j�|d'��|j|j�j�|d&��x`t
d(�D]R}|d)jttt
|����}|j�}|j�}	|j|	|�q9	W|d*�}|jt|�d*�|jt|�jt�dD}||�}|j||�|jt|�|�|jt|�jt�|jt|�t|��|j|di|d�|j|di|d�|j|d)jt�|j|d)|�|jd)|jt�|jd)||�|j|d	jt�|j|d	d)�|j|djt�|j|d|�|j|d jt�|j|d ||�|j|dd�jt�|j|dd�|�|j|d	d	�jt�|j|d	d	�d)�|j|j�jt�|j|j�|�|j|j�jt�|j|j�|�|j|j�jt�|j|j�|�i}
|j|j|
�jt�|j|j|
�|�|j|jd,d,�jt�|j|jd,d,�|�|j|jt|��jt�|j|jt|��|�|j|jt|��jt�|j|jt|��|�|j|jt|��jt�|j|jt|��|�|j|j�jt�|j|j�|�Gd-d.�d.t�}|d/�}	|j|	d/�|j|	j�|d0��|j|	j�j�|d/��d*}||�}	|jt|	�|�|jt|	�jt�|jt|	�t|��|j|	di|d�|j|di|	d�|j|	j�jt�|j|	j�|�|j|	j�jt�|j|	j�|�|j|	j�jt�|j|	j�|�|j|	jd,d,�jt�|j|	jd,d,�|�|j|	jd1d1�jt�|j|	jd1d1�|�|j|	jt|	��jt�|j|	jt|	��|�|j|	jt|	��jt�|j|	jt|	��|�|j|	jt|	��jt�|j|	jt|	��|�|j|	j�jt�|j|	j�|�|j|	j�jt�|j|	j�|�|j|	j�jt�|j|	j�|�|j|	j�jt�|j|	j�|�|j|	d)jt�|j|	d)|�|jd)|	jt�|jd)|	|�|j|	d	jt�|j|	d	d)�|j|	djt�|j|	d|�|j|	d jt�|j|	d ||�|j|	dd�jt�|j|	dd�|�|j|	d	d	�jt�|j|	d	d	�d)�Gd2d3�d3t�}|t
d��}|j|tt
d���|jd4�|j|tt
d��d4g�d|d<|j|tt
d!���|j t
d!d5��|j|tt
d5���g|dEd�<|j|tt
d6���|d7d6�=|jt|�d7�|j|tt
d7���|jt|�tt
d7���|j|d	d	�|j|dd�|j|dFd	�|j|dGd�|j|dd�tt
d���dS)HNcs.eZdZdd�Z�fdd�ZdS)z@ClassPropertiesAndMethods.test_basic_inheritance.<locals>.hexintcSs
t|�S)N)�hex)r1r6r6r7rg�	szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.hexint.__repr__cs�tj||��S)N)r'rH)r1rq)�hexintr6r7rH
szHClassPropertiesAndMethods.test_basic_inheritance.<locals>.hexint.__add__N)rrrsrtrgrHr6)r?r6r7r?�	sr?��	Z0x10i�Z0x3efi90rr~cs=eZdZgZdd�Z��fdd�ZeZ�S)zAClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlongcSs
t|�S)N)�oct)r1r6r6r7r�
szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlong.__str__cs|jt�|�j|��S)N)r�r�rH)r1rq)r��octlongr6r7rH
szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlong.__add__)rrrsrtr�r�rHr�r6)rC)r�r7rC
srCrXr^Z0o10i�Z0o5675rVc@seZdZdS)zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.longcloneN)rrrsrtr6r6r6r7�	longclone4
srDc@s7eZdZdgZdddd�Zdd�ZdS)	zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloatr}gr~cSst|�|_dS)N)r'r})r1r�r}r6r6r7r+A
szLClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloat.__init__cSsd|j|fS)Nz%.*g)r})r1r6r6r7rgC
szLClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloat.__repr__N)rrrsrtr�r+rgr6r6r6r7�	precfloat?
s	rEg�������?z1.1g��@c@seZdZdd�ZdS)zDClassPropertiesAndMethods.test_basic_inheritance.<locals>.madcomplexcSsd|j|jfS)Nz%.17gj%+.17g)r�r�)r1r6r6r7rgN
szMClassPropertiesAndMethods.test_basic_inheritance.<locals>.madcomplex.__repr__N)rrrsrtrgr6r6r6r7�
madcomplexM
srFrZz4j-3c@s"eZdZdZdd�ZdS)zBClassPropertiesAndMethods.test_basic_inheritance.<locals>.madtupleNcSsE|jdk	r|jSt|�}|j�|j|�|_|jS)N)�_revr-r�r�)r1r�r6r6r7�revi
s
zFClassPropertiesAndMethods.test_basic_inheritance.<locals>.madtuple.rev)rrrsrtrGrHr6r6r6r7�madtupleg
srIrWr_�ic@s"eZdZdZdd�ZdS)zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.madstringNcSsN|jdk	r|jSt|�}|j�|jdj|��|_|jS)Nrv)rGr-r�r��join)r1r�r6r6r7rH�
s
zGClassPropertiesAndMethods.test_basic_inheritance.<locals>.madstring.rev)rrrsrtrGrHr6r6r6r7�	madstring�
srLZabcdefghijklmnopqrstuvwxyzZzyxwvutsrqponmlkjihgfedcba�rvZ12345�r�c@s"eZdZdZdd�ZdS)zDClassPropertiesAndMethods.test_basic_inheritance.<locals>.madunicodeNcSsN|jdk	r|jSt|�}|j�|jdj|��|_|jS)Nrv)rGr-r�r�rK)r1r�r6r6r7rH�
s
zHClassPropertiesAndMethods.test_basic_inheritance.<locals>.madunicode.rev)rrrsrtrGrHr6r6r6r7�
madunicode�
srOZABCDEFZFEDCBAZxyc@seZdZdS)zAClassPropertiesAndMethods.test_basic_inheritance.<locals>.sublistN)rrrsrtr6r6r6r7�sublistsrPr
��r�r�r�r����rS)
rVrWrXrZr^r_r@rJrAr)
rVrWrXrZr^r_r@rJrAr)
rrArJr@r_r^rZrXrWrV)
rVrWrXrZr^r_r@rJrAr)rVrWrXrZr^)rVrWrXrZr^)rVrWrXrZr^z���i����r�)!r'r;rfr�r�r�r
r$r?r(rrBrHr�rK�maprP�strip�lstrip�rstrip�	translate�replace�ljustr��rjust�center�lower�upper�
capitalize�titler-rbr�)r1r9rDrErF�baserIrirDrjr�rLr^ZidentitytabrOrPr6)r?rCr7�test_basic_inheritance�	s�    	"	"$"""	""""
#

"z0ClassPropertiesAndMethods.test_basic_inheritancecCsS|jtdd�d�|jtdd�d�|jtdd�d�|jtdddd	�td	d��|jtd
d�d�|jtd
d
dd�d�|jtdtd��d�|jtdd�ttd���x]ttttttttfD]=}y|dd�Wntk
r9YqX|j	d|�qWdS)Nr�rVrWg@rXr�r�r�i�r�i��500sabc�errors�strictrM�sequencerZbogus_keyword_argz4expected TypeError from bogus keyword argument to %r)rrVrW)rrVrW)
r;r'r(rr
rBr�r-rxry)r1�constructorr6r6r7�
test_keywordsFs (%
	z'ClassPropertiesAndMethods.test_keywordscsG�fdd�dt��|j�d�d�|jd�d��|jt�d��d��d�d�d�d	�d
�di}|j|�d�d�|j|�d�d	�|j|�d
�d�|j�d�|�|j|j�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%|j�|_t|j�|_dS)N)r^�	canonicalr��hashcode)r1r�r6r6r7r+eszOClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__init__cs+t|��s�|�}|j|jkS)N)r�rj)r1rq)�cistrr6r7rUiszMClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__eq__cSs|jS)N)rk)r1r6r6r7r�nszOClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__hash__N)rrrsrtrJr+rUr�r6)rlr6r7rl_srl�ABCrMZaBcr
rVrrWZtHreerXZtWoZTHrEEZONeZthrEE)r
r;r�r�)r1rCr6)rlr7�test_str_subclass_as_dict_key\s*z7ClassPropertiesAndMethods.test_str_subclass_as_dict_keyc

s_Gdd�d�}xE|ttfD]4}G�fdd�d|���d�}�d�}�d�}|j|d�d|d|d|i}x�dD]�}x�dD]�}x�dD]�}	|jtd|	�td|	�d||f�|jtd|	�td|	�d||f�|jtd|	�td|	�d||f�q�Wq�Wq�Wq#WdS)Nc@seZdZdS)zCClassPropertiesAndMethods.test_classic_comparisons.<locals>.classicN)rrrsrtr6r6r6r7�classic~srocs�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�)r1r�r6r6r7r+�szFClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__init__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7rU�s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__eq__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7r��s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__ne__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7r��s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__lt__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7r��s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__le__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7r��s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__gt__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7r��s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__ge__N)
rrrsrtr+rUr�r�r�r�r�r6)rur6r7ru�srurVrWrXr�<=�==�!=r �>=zc[x] %s c[y]zx %s yz
x=%d, y=%dz	c[x] %s yz	x %s c[y])rVrWrX)rVrWrX)rrprqrrr rs)r'r�r;r<)
r1rorbr�r��c3rLr��y�opr6)rur7�test_classic_comparisons|s((





z2ClassPropertiesAndMethods.test_classic_comparisonsc
s�Gdd�dt�}|d�}�j|d��jd|�Gdd�dt�}|d�}�j|d��jd|�Gdd	�d	�}xK|tttfD]7}G��fd
d�d|���d�}�d�}�d
�}	�j|d�d|d|d
|	i}
x�dD]�}x�dD]�}x�dD]�}
�jtd|
�td|
�d||f��jtd|
�td|
�d||f��jtd|
�td|
�d||f�q<Wq/Wq"Wq�WdS) Nc@seZdZdS)z:ClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZN)rrrsrtr6r6r6r7r��sr�rVyc@seZdZdd�ZdS)z;ClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZZc	Ss+yt||�dkSWntSYnXdS)Ng���ư>)r$rp)r1rqr6r6r7rU�szBClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZZ.__eq__N)rrrsrtrUr6r6r6r7�ZZ�srxg�ׇP�?c@seZdZdS)z@ClassPropertiesAndMethods.test_rich_comparisons.<locals>.classicN)rrrsrtr6r6r6r7ro�srocs�eZdZdd�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�)r1r�r6r6r7r+�szCClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__init__cs�jd�dS)Nzshouldn't call __cmp__)ry)rVrq)r1r6r7�__cmp__�szBClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__cmp__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7rU�s

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__eq__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7r��s

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__ne__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7r��s

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__lt__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7r��s

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__le__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7r��s

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__gt__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r'rp)r1rq)rur6r7r��s

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__ge__N)rrrsrtr+ryrUr�r�r�r�r�r6)rur1r6r7ru�srurWrXr�<=�==�!=r �>=zc[x] %s c[y]zx %s yz
x=%d, y=%dz	c[x] %s yz	x %s c[y]y�?y�?y�?y�?)rVrWrX)rVrWrX)rrzr{r|r r})rr;r'r�r-r<)r1r�r[rxZzzrorbr�r�rtrLr�rurvr6)rur1r7�test_rich_comparisons�s8)





z/ClassPropertiesAndMethods.test_rich_comparisonscsFddlm}�fdd�}||jd�|tjd�dS)Nr)�FileIOcs�j|j|�dS)N)r;rJ)�descrZwhat)r1r6r7�checksz6ClassPropertiesAndMethods.test_descrdoc.<locals>.checkzTrue if the file is closedz!the real part of a complex number)�_ior�closedrr�)r1rr�r6)r1r7�
test_descrdocsz'ClassPropertiesAndMethods.test_descrdoccs�Gdd�dt��G�fdd�d�}G�fdd�dt�}|j|jd�|j|�jd�|j|jd	�|j|�jd
�dS)Nc@seZdZdd�ZdS)z?ClassPropertiesAndMethods.test_doc_descriptor.<locals>.DocDescrcSs3|r|jjd}|r%|j}d||fS)Nz	 instancezobject=%s; type=%s)r�rr)r1r�Zotyper6r6r7r�s
	zGClassPropertiesAndMethods.test_doc_descriptor.<locals>.DocDescr.__get__N)rrrsrtr�r6r6r6r7�DocDescrsr�cseZdZ��ZdS)z?ClassPropertiesAndMethods.test_doc_descriptor.<locals>.OldClassN)rrrsrtrJr6)r�r6r7�OldClasssr�cseZdZ��ZdS)z?ClassPropertiesAndMethods.test_doc_descriptor.<locals>.NewClassN)rrrsrtrJr6)r�r6r7�NewClasssr�zobject=None; type=OldClassz'object=OldClass instance; type=OldClasszobject=None; type=NewClassz'object=NewClass instance; type=NewClass)r�r;rJ)r1r�r�r6)r�r7�test_doc_descriptorsz-ClassPropertiesAndMethods.test_doc_descriptorcs?Gdd�dt�}Gdd�dt�}Gdd�dt�}Gdd�d||�}xx||||fD]d}x[||||fD]G}|�}||_�j|j|�||_�j|j|�q�WqnW�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]�\}}|�}d|_||_�j|j|d&||f��j|jd�||_�j|j|d&||f��j|jd�q�Wxz||||||||t|	f
D]T}xK||||||||t|	f
D]%}||kr�q�||�|�q�Wq�WGd'd(�d(t��G�fd)d*�d*t���fd+d,�t	d-�D�}~dS).Nc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.CN)rrrsrtr6r6r6r7ru(sruc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.DN)rrrsrtr6r6r6r7r�)sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.EN)rrrsrtr6r6r6r7r�*sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.FN)rrrsrtr6r6r6r7r�+sr�cszy
||_Wntk
r!YnX�jd||f�yt|d�Wnttfk
rdYnX�jd|�dS)Nz!shouldn't allow %r.__class__ = %rr�z shouldn't allow del %r.__class__)r�rxryrr6)r�ru)r1r6r7�cant3s

z6ClassPropertiesAndMethods.test_set_class.<locals>.cantrVc@seZdZgZdS)z5ClassPropertiesAndMethods.test_set_class.<locals>.IntN)rrrsrtr�r6r6r6r7�IntFsr�TrWc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Gr9rIN)rrrsrtr�r6r6r6r7rMsrc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.HrIr9N)rrrsrtr�r6r6r6r7rWOsrWc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Ir9rIN)rrrsrtr�r6r6r6r7rpQsrpc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.JrLrIN)rrrsrtr�r6r6r6r7�JSsr�c@seZdZdddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Kr9rIrCN)rrrsrtr�r6r6r6r7�KUsr�c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.LrSN)rrrsrtr�r6r6r6r7r�Wsr�c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.MrSN)rrrsrtr�r6r6r6r7r)Ysr)c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.NrbN)rrrsrtr�r6r6r6r7r�[sr�c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Pr?N)rrrsrtr�r6r6r6r7�P]sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.QN)rrrsrtr6r6r6r7�Q_sr�c@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Rr?rbN)rrrsrtr�r6r6r6r7�Rasr�z0assigning %r as __class__ for %r silently failedc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.ON)rrrsrtr6r6r6r7�Owsr�cs"eZdZ�fdd�ZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Acs
�|_dS)N)r�)r1)r�r6r7rRzsz;ClassPropertiesAndMethods.test_set_class.<locals>.A.__del__N)rrrsrtrRr6)r�r6r7r�ysr�csg|]}���qSr6r6)rr�)r�r6r7r|s	z<ClassPropertiesAndMethods.test_set_class.<locals>.<listcomp>ro)
r�r�r�r-r'�boolr=r9r;r�)r1rur�r�r�r�Zcls2r�r�r��orrWrpr�r�r�r)r�r�r�r�rjr6)r�r�r1r7�test_set_class&sp			


	@				++z(ClassPropertiesAndMethods.test_set_classcs�Gdd�dt�}|�}ddi|_�j|jd��fdd���|d��|g��|d�|`Gdd�dt�����fd	d
�}Gdd�dt��}Gd
d�d�t�}Gdd�dtd|�}Gdd�dtd|�}x^|||fD]M}||�|j}	yd|	d<Wntk
rcYq(X�jd|�q(WGdd�dtj��}
Gdd�d�tj�}x7|
|fD])}|d�}
||
�d|
jd<q�Wdd�}Gdd�dt	��}Gdd �d �t	�}xat	||fD]P}|�}d!di|_�j|j
d��j||�|t���q9WdS)"Nc@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.CN)rrrsrtr6r6r6r7ru�srurIrVcsCy
||_Wnttfk
r'YnX�jd||f�dS)Nz shouldn't allow %r.__dict__ = %r)r?r6rxry)r�re)r1r6r7r��s

z5ClassPropertiesAndMethods.test_set_dict.<locals>.cantc@seZdZdS)z5ClassPropertiesAndMethods.test_set_dict.<locals>.BaseN)rrrsrtr6r6r6r7r:�sr:cs��|i�y
|`Wnttfk
r1YnX�jd|��jd}y|j|i�Wnttfk
r~YnX�jd|�dS)zR
            x has to be an instance of a class inheriting from Base.
            zshouldn't allow del %r.__dict__r?z&dict_descr allowed access to %r's dictN)r?r6rxryri)r�Z
dict_descr)r:r�r1r6r7�verify_dict_readonly�s


zEClassPropertiesAndMethods.test_set_dict.<locals>.verify_dict_readonlyc@seZdZdS)z6ClassPropertiesAndMethods.test_set_dict.<locals>.Meta1N)rrrsrtr6r6r6r7�Meta1�sr�c@seZdZdS)z6ClassPropertiesAndMethods.test_set_dict.<locals>.Meta2N)rrrsrtr6r6r6r7�Meta2�sr�c@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.DN)rrrsrtr6r6r6r7r��sr�r�c@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.EN)rrrsrtr6r6r6r7r��sr�Zeggsr�z%r's __dict__ can be modifiedc@seZdZdS)z8ClassPropertiesAndMethods.test_set_dict.<locals>.Module1N)rrrsrtr6r6r6r7�Module1�sr�c@seZdZdS)z8ClassPropertiesAndMethods.test_set_dict.<locals>.Module2N)rrrsrtr6r6r6r7�Module2�sr�cSs1y
|`Wnttfk
r(dSYnXdSdS)NFT)r?rxr6)rSr6r6r7�can_delete_dict�s

	z@ClassPropertiesAndMethods.test_set_dict.<locals>.can_delete_dictc@seZdZdS)z;ClassPropertiesAndMethods.test_set_dict.<locals>.Exception1N)rrrsrtr6r6r6r7�
Exception1�sr�c@seZdZdS)z;ClassPropertiesAndMethods.test_set_dict.<locals>.Exception2N)rrrsrtr6r6r6r7�
Exception2�sr�r9)r�r?r;rIr=rxryrr	r�r9r)r1rur9r�r�r�r�r�r�Z
class_dictr�r�r	r|r�r�r�Z
ExceptionTyperSr6)r:r�r1r7�
test_set_dictsJ	



	

	z'ClassPropertiesAndMethods.test_set_dictcs6G�fdd�dt��|jt�d��d��d�|jt�d�d�d�|jtd�d��d�|jt�d��d��d�|jtd�d��d�|jt�d�d�d�|jtt�d��d��d���d�Gd	d
�d
t�}dS)Ncs^eZdZdd�Z�fdd�ZeZd�fdd�Zd�fdd	�ZdS)
zBClassPropertiesAndMethods.test_binary_operator_override.<locals>.IcSsdt|�S)NzI(%r))r')r1r6r6r7rg�szKClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__repr__cs�t|�t|��S)N)r')r1rq)rpr6r7rH�szJClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__add__NcsW|dkr+�tt|�t|���S�tt|�t|�t|���SdS)N)rr')r1rqr|)rpr6r7�__pow__�szJClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__pow__csZ|dkr.�tt|�t|�|��S�tt|�t|�t|���SdS)N)rr')r1rqr|)rpr6r7�__rpow__�s"zKClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__rpow__)rrrsrtrgrHr�r�r�r6)rpr6r7rp�s
rprVrWzI(3)rXzI(8)r^c@seZdZdd�ZdS)zBClassPropertiesAndMethods.test_binary_operator_override.<locals>.ScSs|j�|j�kS)N)r^)r1rqr6r6r7rU�szIClassPropertiesAndMethods.test_binary_operator_override.<locals>.S.__eq__N)rrrsrtrUr6r6r6r7�S�sr�)r'r;rfrr
)r1r�r6)rpr7�test_binary_operator_override�s&  &  4z7ClassPropertiesAndMethods.test_binary_operator_overridec	CsiGdd�dt�}Gdd�d|�}Gdd�d|�}Gdd�d||�}|�}t|�}d	d
�|_|jt|�d�dd
�|_|jt|�d
�dd
�|_|jt|�d�dd
�|_|jt|�d�d|_|jtt|�|`|jt|�d�d|_|jtt|�|`|jt|�d
�d|_|jtt|�|`|jt|�d�d|_|jtt|�|`|jt|�|�d|_d|_|j|jd�|j|jd�dd�}||_|j|jd�|j|jd�dd�}||_	|j|j
d�|j|jd�|j|jd�|`|j|jd�|`|j|jd�|j|jd�|`	y|jWntk
rYnX|jd�Gdd�dt�}Gdd�d|�}~t
j�dd
�|_dS)Nc@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.AN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.BN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.CN)rrrsrtr6r6r6r7ru�sruc@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.DN)rrrsrtr6r6r6r7r��sr�cSsdS)Nr�r6)r1r6r6r7rm
szEClassPropertiesAndMethods.test_subclass_propagation.<locals>.<lambda>r�cSsdS)Ni:r6)r1r6r6r7rm
si:cSsdS)N�r6)r1r6r6r7rm
sr�cSsdS)Nror6)r1r6r6r7rm
srocSs |dkrdStj||�S)Nr�r�)r�r)r1r4r6r6r7r
szMClassPropertiesAndMethods.test_subclass_propagation.<locals>.__getattribute__r�cSs |dkrdSt|��dS)Nr�r�r�r
)r�r�r�)r6)r1r4r6r6r7rt%
szHClassPropertiesAndMethods.test_subclass_propagation.<locals>.__getattr__r
zd.foo should be undefined nowc@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.AN)rrrsrtr6r6r6r7r�;
sc@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.BN)rrrsrtr6r6r6r7r�=
scWsdS)Nr6)r9r6r6r7rmA
s)r�r�r�r;r�rxr�r�rrtr�r6ryrrZrS)	r1r�r�rur�rCZ	orig_hashrrtr6r6r7�test_subclass_propagation�sv									


z3ClassPropertiesAndMethods.test_subclass_propagationcCs�ddl}Gdd�dt�}d}||�}|j|j|�|j|��Gdd�dt�}|d�}y|j|�|jd�Wntk
r�YnXdS)	Nrc@seZdZdS)zBClassPropertiesAndMethods.test_buffer_inheritance.<locals>.MyBytesN)rrrsrtr6r6r6r7r=I
sr=sabcc@seZdZdS)z@ClassPropertiesAndMethods.test_buffer_inheritance.<locals>.MyIntN)rrrsrtr6r6r6r7r9Q
sr9r�z2subclass of int should not have a buffer interface)�binasciirAr;�b2a_hexr'ryrx)r1r�r=rbrEr9r6r6r7�test_buffer_inheritanceC
s"

z1ClassPropertiesAndMethods.test_buffer_inheritancecsRddl�ddl}G�fdd�dt�}|d�}|jt|�|�|jtt|��t�|jtt|��t�|jt|�d�|jt|�d�|jt|�d�|j|j�d�|j|j�d�|j	�}t
|d|�t
t|�d|�|j|j�d	�|j�dS)
Nrcs.eZdZ�fdd�Zdd�ZdS)zGClassPropertiesAndMethods.test_str_of_str_subclass.<locals>.octetstringcs�j|jd��jd�S)N�ascii)r��encode�decode)r1)r�r6r7r�`
szOClassPropertiesAndMethods.test_str_of_str_subclass.<locals>.octetstring.__str__cSs|dS)Nz reprr6)r1r6r6r7rgb
szPClassPropertiesAndMethods.test_str_of_str_subclass.<locals>.octetstring.__repr__N)rrrsrtr�rgr6)r�r6r7�octetstring_
sr�r��AZ41zA repr�filez41
41
)
r��ior
r;r=rf�ordr�rg�StringIO�printr]�close)r1r�r�r�Zcapturer6)r�r7�test_str_of_str_subclassZ
s"z2ClassPropertiesAndMethods.test_str_of_str_subclasscCsgdd�}|j|jdd�d�g}tj|ddddg�|j|dddg�dS)	NcSs|S)Nr6)r9r6r6r7r}x
sz;ClassPropertiesAndMethods.test_keyword_arguments.<locals>.fr9r�rgrrVrW)r;r�r-r+)r1r}r9r6r6r7�test_keyword_argumentsv
s
z0ClassPropertiesAndMethods.test_keyword_argumentscCsVGdd�dt�}|�|_y|��Wntk
rDYnX|jd�dS)Nc@seZdZdS)z8ClassPropertiesAndMethods.test_recursive_call.<locals>.AN)rrrsrtr6r6r6r7r��
sr�z7Recursion limit should have been reached for __call__())r�r��RecursionErrorry)r1r�r6r6r7�test_recursive_call~
s
z-ClassPropertiesAndMethods.test_recursive_callcs�g�G�fdd�dt�}|�}|j�g�~tj�|j�dg�Gdd�dt�}|�}y|d=Wntk
r�YnX|jd�dS)Ncs"eZdZ�fdd�ZdS)z5ClassPropertiesAndMethods.test_delete_hook.<locals>.Ccs�jd�dS)NrV)rb)r1)rr6r7rR�
sz=ClassPropertiesAndMethods.test_delete_hook.<locals>.C.__del__N)rrrsrtrRr6)rr6r7ru�
srurVc@seZdZdS)z5ClassPropertiesAndMethods.test_delete_hook.<locals>.DN)rrrsrtr6r6r6r7r��
sr�rz$invalid del() didn't raise TypeError)r�r;rrZrxry)r1rurLr�rCr6)rr7�test_delete_hook�
s	
	
z*ClassPropertiesAndMethods.test_delete_hookcCs�Gdd�dt�}|�}yt|�Wntk
rAYnX|jd�Gdd�dt�}|�}yt|�Wntk
r�YnX|jd�dS)Nc@seZdZdS)z?ClassPropertiesAndMethods.test_hash_inheritance.<locals>.mydictN)rrrsrtr6r6r6r7�mydict�
sr�z#hash() of dict subclass should failc@seZdZdS)z?ClassPropertiesAndMethods.test_hash_inheritance.<locals>.mylistN)rrrsrtr6r6r6r7�mylist�
sr�z#hash() of list subclass should fail)rer�rxryr-)r1r�rCr�r6r6r7�test_hash_inheritance�
s	

	
z/ClassPropertiesAndMethods.test_hash_inheritancecSCs.yddWntk
r YnX|jd�ydjd�Wntk
rSYnX|jd�ydjdg�Wntk
r�YnX|jd�ydjd�Wntk
r�YnX|jd	�yd
dWntk
r�YnX|jd�ydiWntk
rYnX|jd
�yddWntk
rFYnX|jd�yddWntk
rtYnX|jd�yddWntk
r�YnX|jd�yddWntk
r�YnX|jd�|jdj�d�|jdj�d�|jdd�|jd d�dS)!Nr9r^z'' + 5 doesn't raise TypeErrorrvz%''.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%*srMz''%*s' % ('abc') doesn't raise TypeErrorz%*.*sz,'%*.*s' % ('abc', 5) doesn't raise TypeErrorz%srVrWz%'%s' % (1, 2) doesn't raise TypeError�%z#'%' % None doesn't raise ValueErrorZ534253Z534253xz%c�)rMr^)rVrWr�r�)rxry�splitrrK�rindexr;�isdigit)r1r6r6r7�test_str_operations�
sl



















z-ClassPropertiesAndMethods.test_str_operationscCsGGdd�d�}|�}|�}||_||_t|�}dS)Nc@seZdZdS)z?ClassPropertiesAndMethods.test_deepcopy_recursive.<locals>.NodeN)rrrsrtr6r6r6r7r�
sr)rIr9r)r1rr9rIr[r6r6r7�test_deepcopy_recursive�
s				z1ClassPropertiesAndMethods.test_deepcopy_recursivecCs�ddlm}|j|�}t|�|j|d�|j|d�|j|d�|j|j�d|_|j|jddi�dS)Nr)r	rr�__file__r�rV)	rr	r�r
r�r�r?r�r;)r1r)rEr6r6r7�test_uninitialized_modules�
s
	z4ClassPropertiesAndMethods.test_uninitialized_modulescs�G�fdd�dt�}Gdd�d|��|j|d�dddg�|j�d�dddg��d�}|j|jd�|d�}|j|��|j|jd��d�}|j|��|j|jd�Gd	d�dt�}|j|dd�|ddf�Gd
d�d|��|j�dd��ddf�Gdd�dt�}|j|dd�||ddf�Gdd�d|��|j�dd���ddf�dS)
Ncs"eZdZ�fdd�ZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.CcsIt|t�rdddgSt|t�r8tj��Stj|�SdS)NrVrWrX)r�r
r'r�r�)r�r|)r�r6r7r��
s


z;ClassPropertiesAndMethods.test_funny_new.<locals>.C.__new__N)rrrsrtr�r6)r�r6r7ru�
sruc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.DcSs
||_dS)N)r�)r1r|r6r6r7r+sz<ClassPropertiesAndMethods.test_funny_new.<locals>.D.__init__N)rrrsrtr+r6r6r6r7r��
sr�rLrVrWrXc@s"eZdZedd��ZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.CcWs|S)Nr6)r2r6r6r7r�sz;ClassPropertiesAndMethods.test_funny_new.<locals>.C.__new__N)rrrsrtr�r�r6r6r6r7ru
sc@seZdZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.DN)rrrsrtr6r6r6r7r�sc@s"eZdZedd��ZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.CcWs|S)Nr6)r2r6r6r7r�sz;ClassPropertiesAndMethods.test_funny_new.<locals>.C.__new__N)rrrsrtr�r�r6r6r6r7rusc@seZdZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.DN)rrrsrtr6r6r6r7r�s)r�r;r�r�)r1rurCr6)r�r7�test_funny_new�
s(""%z(ClassPropertiesAndMethods.test_funny_newcCsGdd�dt�}|�}|}|d9}|j||df�|}|d9}|j||df�|}|d9}|j||df�|}|d	9}|j||d
f�|}|d9}|j||df�|}|d9}|j||df�dS)Nc@seZdZdd�ZdS)z2ClassPropertiesAndMethods.test_imul_bug.<locals>.CcSs
||fS)Nr6)r1rqr6r6r7r[#sz;ClassPropertiesAndMethods.test_imul_bug.<locals>.C.__imul__N)rrrsrtr[r6r6r6r7ru"srug�?rWrXrVror�ll)r�r;)r1rur�rur6r6r7�
test_imul_bugs(	





z'ClassPropertiesAndMethods.test_imul_bugcs�ddl}G�fdd�dt�}|d�}|jd��j|jd��j|j�d�|j|�}�j|jd��j|j�d�|j|�}�j|jd��j|j�d�dS)NrcsXeZdZddd�Zddd�Zdd�Zdd	�Z�fd
d�ZdS)z7ClassPropertiesAndMethods.test_copy_setstate.<locals>.CNcSs||_||_dS)N)r��_C__foo)r1r�r6r6r7r+=s	z@ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__init__cSs
||_dS)N)r�)r1r�r6r6r7�setfoo@sz>ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.setfoocSs|jS)N)r�)r1r6r6r7�getfooBsz>ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.getfoocSs
|jgS)N)r�)r1r6r6r7�__getstate__DszDClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__getstate__cs.�jt|�d�|d|_|_dS)NrVr)r;r�r�r�)rVZlst)r1r6r7�__setstate__FszDClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__setstate__)rrrsrtr+r�r�r�r�r6)r1r6r7ru<s
rur�r�)r�r�r�r;r�r�r)r1r�rur9rIr6)r1r7�test_copy_setstate9s

z,ClassPropertiesAndMethods.test_copy_setstatecCs�|jddd�d�|jdtd�d�|jtjdtd��d�Gdd�dt�}|j|d�dd�d�|j|d�td�d�|j|d�jtd��d�|jddd�d�|jdtd�d�|jtjdtd��d�Gd	d
�d
t�}|j|d�dd�d�|j|d�td�d�|j|d�jtd��d�|jdddgdd�ddg�|jdddgtd�ddg�|jtjdddgtd��ddg�Gdd�dt�}|j|dddg�dd�ddg�|j|dddg�td�ddg�|j|dddg�jtd��ddg�|dddg�}ddg|tdd�<|j|dddg�ddg|td
dd�<|j|dddg�|jtdd�ddg�|j|dddg�|jtd
dd�ddg�|j|dddg�dS)Nr
rZZhellc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.ScSstj||�S)N)r
rK)r1r�r6r6r7rK\sz<ClassPropertiesAndMethods.test_slices.<locals>.S.__getitem__N)rrrsrtrKr6r6r6r7r�[sr�rVrWrXc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.TcSstj||�S)N)rBrK)r1r�r6r6r7rKfsz<ClassPropertiesAndMethods.test_slices.<locals>.T.__getitem__N)rrrsrtrKr6r6r6r7r�esr�c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.LcSstj||�S)N)r-rK)r1r�r6r6r7rKpsz<ClassPropertiesAndMethods.test_slices.<locals>.L.__getitem__N)rrrsrtrKr6r6r6r7r�osr�r)rVrWrX)rVrW)rVrWrX)rVrW)rVrWrX)rVrW)rVrWrX)rVrW)rVrWrX)rVrW)rVrWrX)rVrW)r;rMr
rKrBr-rS)r1r�r�r�r9r6r6r7�test_slicesTs<"  %"  %))1//4"z%ClassPropertiesAndMethods.test_slicescs^G�fdd�dt����}d|_~tj�|jt�j�d��`dS)Ncs(eZdZgZ�fdd�ZdS)z>ClassPropertiesAndMethods.test_subtype_resurrection.<locals>.Ccs�jj|�dS)N)�	containerrb)r1)rur6r7rR�szFClassPropertiesAndMethods.test_subtype_resurrection.<locals>.C.__del__N)rrrsrtr�rRr6)rur6r7ru�srur�rV)r�r�rrZr;r�r�rR)r1rLr6)rur7�test_subtype_resurrection�s		
z3ClassPropertiesAndMethods.test_subtype_resurrectioncCsFGdd�dt�}d}x td�D]}||�}q)W~dS)Nc@s%eZdZdgZdd�ZdS)z9ClassPropertiesAndMethods.test_slots_trash.<locals>.trashr�cSs
||_dS)N)r�)r1r�r6r6r7r+�szBClassPropertiesAndMethods.test_slots_trash.<locals>.trash.__init__N)rrrsrtr�r+r6r6r6r7�trash�s	r�iP�)r�r�)r1r�r�rir6r6r7�test_slots_trash�s
z*ClassPropertiesAndMethods.test_slots_trashcCs�Gdd�dt�}Gdd�dt�}Gdd�d||�}tj�rg|j|j|j�|j|d�|j|d�d	|�_dS)
Nc@seZdZfZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.AN)rrrsrtr�r6r6r6r7r��sr�c@seZdZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.BN)rrrsrtr6r6r6r7r��sr�c@seZdZfZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.CN)rrrsrtr�r6r6r6r7ru�srur?rbrW)r�rr(r;�
__basicsize__r�r�)r1r�r�rur6r6r7�test_slots_multiple_inheritance�sz9ClassPropertiesAndMethods.test_slots_multiple_inheritancecCssGdd�dt�}|�}|j|dd�|j|dd�|jd|d�|jd|d�dS)Nc@s(eZdZdd�Zdd�ZdS)z.ClassPropertiesAndMethods.test_rmul.<locals>.CcSsdS)Nr	r6)r1rqr6r6r7r\�sz6ClassPropertiesAndMethods.test_rmul.<locals>.C.__mul__cSsdS)N�rmulr6)r1rqr6r6r7r]�sz7ClassPropertiesAndMethods.test_rmul.<locals>.C.__rmul__N)rrrsrtr\r]r6r6r6r7ru�srurWr	g������@r�)r�r;)r1rur9r6r6r7�	test_rmul�s	z#ClassPropertiesAndMethods.test_rmulcCs-Gdd�dt�}|�}|dC}dS)Nc@seZdZdd�ZdS)z.ClassPropertiesAndMethods.test_ipow.<locals>.CcSsdS)Nr6)r1rqr6r6r7�__ipow__�sz7ClassPropertiesAndMethods.test_ipow.<locals>.C.__ipow__N)rrrsrtr�r6r6r6r7ru�srurW)r�)r1rur9r6r6r7�	test_ipow�s	z#ClassPropertiesAndMethods.test_ipowc1s#Gdd�dt�}G�fdd�dt��Gdd�d|�}Gdd�d|�}|�}|�}|f|_�f|_|j|j�d	�|j|j�d	�|j|jd
�|j|jd
�|j�j�|g�y
|`Wnttfk
rYnX|jd�y
f|_WnDtk
rx}z$t	|�dkrf|jd
�WYdd}~XnX|jd�y|f|_Wntk
r�YnX|jd�y||f|_Wntk
r�YnX|jd�y|f|_Wntk
rYnX|jd�dS)Nc@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.CN)rrrsrtr6r6r6r7ru�srucs1eZdZ��fdd�Zdd�Z�S)z8ClassPropertiesAndMethods.test_mutable_bases.<locals>.C2cs*|dkrdSt�|�j|�SdS)Nr9rW)r�r)r1r�)r�r�r6r7r�szIClassPropertiesAndMethods.test_mutable_bases.<locals>.C2.__getattribute__cSsdS)NrVr6)r1r6r6r7rB�sz=ClassPropertiesAndMethods.test_mutable_bases.<locals>.C2.meth)rrrsrtrrBr6)r�)r�r7r��sr�c@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.DN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.EN)rrrsrtr6r6r6r7r��sr�rVrWz&shouldn't be able to delete .__bases__z/a new-style class can't have only classic basesz'wrong error message for .__bases__ = ()z)shouldn't be able to set .__bases__ to ()z.shouldn't be able to create inheritance cyclesz#didn't detect repeated base classes)
r�r@r;rBr9�__subclasses__rxr6ryr
)r1rur�r�rCrSr,r6)r�r7�test_mutable_bases�sN		


 





z,ClassPropertiesAndMethods.test_mutable_basescCs7dd�tjj�D�}xF|D]>}tj|d�|tk	r#|jt|j�d|�q#WGdd�dt�}Gdd�dt�}Gd	d
�d
|�}yt	f|_Wnt
k
r�YnX|jd�yt	ft_Wnt
k
r�YnX|jd�y|tf|_Wnt
k
r2YnXdS)
NcSs%g|]}t|t�r|�qSr6)r�r=)r�tpr6r6r7rs	z@ClassPropertiesAndMethods.test_builtin_bases.<locals>.<listcomp>r@rVc@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.LN)rrrsrtr6r6r6r7r�sr�c@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.CN)rrrsrtr6r6r6r7rusruc@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.DN)rrrsrtr6r6r6r7r�sr�z/shouldn't turn list subclass into dict subclassz-shouldn't be able to assign to list.__bases__)�builtinsr?�valuesr�rr;r�r@r-rerxry)r1Z
builtin_typesr�r�rur�r6r6r7�test_builtin_basess.
 




z,ClassPropertiesAndMethods.test_builtin_basescHCs|jt��!Gdd�dtd��}WdQRX|jt��$Gdd�dttd��}WdQRX|jt��$Gdd�dtd�t�}WdQRXGdd�dt�}|jt��$Gdd�d|td��}WdQRX|jt��$Gdd�dtd�|�}WdQRXGd	d�dt�}|jt��td�f|_WdQRX|jt��ttd�f|_WdQRX|jt��td�tf|_WdQRX|jt��|td�f|_WdQRX|jt��td�|f|_WdQRXdS)
Nc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rrrsrtr6r6r6r7r�5sr�c@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rrrsrtr6r6r6r7r�8sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rrrsrtr6r6r6r7r�;sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.ON)rrrsrtr6r6r6r7r�=sr�c@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rrrsrtr6r6r6r7r�@sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rrrsrtr6r6r6r7r�Csc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rrrsrtr6r6r6r7r�Fs)r�rxr=r�r@)r1r�r�r6r6r7�test_unsubclassable_types3s,#&&&&z3ClassPropertiesAndMethods.test_unsubclassable_typesc
s0G�fdd�dt��Gdd�dt�}Gdd�dt�}Gdd�dt�}Gd	d
�d
|�}Gdd�d|�}Gd
d�d|d��}Gdd�d|d|�}|j}|j}	y|f|_Wn8tk
r|j|j|�|j|j|	�YnX|jd�dS)Ncs1eZdZ��fdd�Zdd�Z�S)zOClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkOncecs(d|_t�|�j�|||�S)Nr)�flagr�r�)r1r4r�r�)�WorkOncer�r6r7r�Vs	zWClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkOnce.__new__cSs>|jdkrtd��n|jd7_tj|�SdS)NrZbozorV)r�r
r=r�)r1r6r6r7r�YszSClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkOnce.mro)rrrsrtr�r�r6)r�)r�r7r�Usr�c@seZdZdd�ZdS)zQClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkAlwayscSs
tj|�S)N)r=r�)r1r6r6r7r�aszUClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkAlways.mroN)rrrsrtr�r6r6r6r7�
WorkAlways`sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.CN)rrrsrtr6r6r6r7ruhsruc@seZdZdS)zIClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.C2N)rrrsrtr6r6r6r7r�ksr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.DN)rrrsrtr6r6r6r7r�nsr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.EN)rrrsrtr6r6r6r7r�qsr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.FN)rrrsrtr6r6r6r7r�tsr�r�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.GN)rrrsrtr6r6r6r7rwsrzexception not propagated)r=r�rr@r
r;ry)
r1r�rur�r�r�r�rZE_mro_beforeZD_mro_beforer6)r�r7�#test_mutable_bases_with_failing_mroSs 		
z=ClassPropertiesAndMethods.test_mutable_bases_with_failing_mrocCs�Gdd�dt�}Gdd�dt�}Gdd�d||�}Gdd�d||�}Gd	d
�d
||�}y||f|_Wntk
r�YnX|jd�dS)Nc@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.AN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.BN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.CN)rrrsrtr6r6r6r7ru�sruc@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.DN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.EN)rrrsrtr6r6r6r7r��sr�zdidn't catch MRO conflict)r�r@rxry)r1r�r�rur�r�r6r6r7�%test_mutable_bases_catch_mro_conflict�s
z?ClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflictcCsyGdd�dt�}|j}d|_|j|j|jf|df�d|_|j|j|jf|df�dS)Nc@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_names.<locals>.CN)rrrsrtr6r6r6r7ru�srur�zD.E)r�rsrrr;)r1rur|r6r6r7�test_mutable_names�s		"	z,ClassPropertiesAndMethods.test_mutable_namescsKG�fdd�dt�}Gdd�d��|d��_d�_dS)Ncs"eZdZ�fdd�ZdS)z<ClassPropertiesAndMethods.test_evil_type_name.<locals>.Nastycs
d�_dS)Nrq)rr)r1)rur6r7rR�szDClassPropertiesAndMethods.test_evil_type_name.<locals>.Nasty.__del__N)rrrsrtrRr6)rur6r7�Nasty�sr�c@seZdZdS)z8ClassPropertiesAndMethods.test_evil_type_name.<locals>.CN)rrrsrtr6r6r6r7ru�srurMZnormal)r
rr)r1r�r6)rur7�test_evil_type_name�sz-ClassPropertiesAndMethods.test_evil_type_namecCsjGdd�dt�}|j|d�dd�|jd|d�d�Gdd�dt�}|j|�dd�|jd|�d	�Gd
d�d|�}|j|�|�d�|j|�|�d
�Gdd�d|�}|j|j|j�|j|�dd�|jd|�d	�|j|�|�d�|j|�|�d�dS)Nc@s(eZdZdd�Zdd�ZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.BcSsdS)NzB.__floordiv__r6)r1rqr6r6r7�__floordiv__�szHClassPropertiesAndMethods.test_subclass_right_op.<locals>.B.__floordiv__cSsdS)NzB.__rfloordiv__r6)r1rqr6r6r7�
__rfloordiv__�szIClassPropertiesAndMethods.test_subclass_right_op.<locals>.B.__rfloordiv__N)rrrsrtr�r�r6r6r6r7r��sr�rVzB.__floordiv__zB.__rfloordiv__c@s(eZdZdd�Zdd�ZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.CcSsdS)NzC.__floordiv__r6)r1rqr6r6r7r��szHClassPropertiesAndMethods.test_subclass_right_op.<locals>.C.__floordiv__cSsdS)NzC.__rfloordiv__r6)r1rqr6r6r7r��szIClassPropertiesAndMethods.test_subclass_right_op.<locals>.C.__rfloordiv__N)rrrsrtr�r�r6r6r6r7ru�sruzC.__floordiv__zC.__rfloordiv__c@s(eZdZdd�Zdd�ZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.DcSsdS)NzD.__floordiv__r6)r1rqr6r6r7r��szHClassPropertiesAndMethods.test_subclass_right_op.<locals>.D.__floordiv__cSsdS)NzD.__rfloordiv__r6)r1rqr6r6r7r��szIClassPropertiesAndMethods.test_subclass_right_op.<locals>.D.__rfloordiv__N)rrrsrtr�r�r6r6r6r7r��sr�zD.__floordiv__zD.__rfloordiv__c@seZdZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.EN)rrrsrtr6r6r6r7r��sr�)r'r;r�r�)r1r�rur�r�r6r6r7�test_subclass_right_op�sz0ClassPropertiesAndMethods.test_subclass_right_opz)testing an internal kind of method objectc#Cs�dddg}ddddddi}|jtj|�|�|jij|�|�tjd}|j|jdt�|�|�|j|ji�|�|�y|jdd�Wntk
r�YnX|jd�y|jd�Wntk
rYnX|jd�y|jdd�Wntk
r8YnX|jd�y|jdt�Wntk
rnYnX|jd	�dS)
NrVrWrX�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;rer�r?r�rxryr')r1r|rAr�r6r6r7�test_meth_class_get�s6
"






z-ClassPropertiesAndMethods.test_meth_class_getcCsCGdd�dt�}Gdd�d�}|�}||�}|j||�|j||�Gdd�d|�}|�}||�}|j||�|j||�Gdd�dt�}|�}||�}|j||�|j||�Gdd�d|�}|�}||�}|j||�|j||�dS)	Nc@s(eZdZdd�Zdd�ZdS)z<ClassPropertiesAndMethods.test_isinst_isclass.<locals>.ProxycSs
||_dS)N)�_Proxy__obj)r1r�r6r6r7r+szEClassPropertiesAndMethods.test_isinst_isclass.<locals>.Proxy.__init__cSs3|jd�rtj||�St|j|�SdS)N�_Proxy__)r�r�rr>r�)r1r4r6r6r7r!szMClassPropertiesAndMethods.test_isinst_isclass.<locals>.Proxy.__getattribute__N)rrrsrtr+rr6r6r6r7r�sr�c@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.CN)rrrsrtr6r6r6r7ru'sruc@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.DN)rrrsrtr6r6r6r7r�.sr�c@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.CN)rrrsrtr6r6r6r7ru5sc@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.DN)rrrsrtr6r6r6r7r�<s)r�r�)r1r�rur9Zpar�r6r6r7�test_isinst_isclasss*					z-ClassPropertiesAndMethods.test_isinst_isclasscs~Gdd�dt�}Gdd�dt�}G�fdd�d|����}||�}|j�jd|�d�dS)	Nc@s(eZdZdd�Zdd�ZdS)z9ClassPropertiesAndMethods.test_proxy_super.<locals>.ProxycSs
||_dS)N)r�)r1r�r6r6r7r+FszBClassPropertiesAndMethods.test_proxy_super.<locals>.Proxy.__init__cSs3|jd�rtj||�St|j|�SdS)Nr�)r�r�rr>r�)r1r4r6r6r7rHszJClassPropertiesAndMethods.test_proxy_super.<locals>.Proxy.__getattribute__N)rrrsrtr+rr6r6r6r7r�Esr�c@seZdZdd�ZdS)z5ClassPropertiesAndMethods.test_proxy_super.<locals>.BcSsdS)NzB.fr6)r1r6r6r7r}Osz7ClassPropertiesAndMethods.test_proxy_super.<locals>.B.fN)rrrsrtr}r6r6r6r7r�Nsr�cs%eZdZ��fdd�Z�S)z5ClassPropertiesAndMethods.test_proxy_super.<locals>.Ccst�|�j�dS)Nz->C.f)r�r})r1)rur�r6r7r}Ssz7ClassPropertiesAndMethods.test_proxy_super.<locals>.C.f)rrrsrtr}r6)ru)r�r7ruRsrur}zB.f->C.f)r�r;r?)r1r�r�r�rr6)rur7�test_proxy_superCs		z*ClassPropertiesAndMethods.test_proxy_supercCssytjtdd�Wntk
r+YnX|jd�ytjtd�Wntk
raYnX|jd�dS)Nr�r�z"Carlo Verre __setattr__ succeeded!r^z"Carlo Verre __delattr__ succeeded!)r�rr
rxryr)r1r6r6r7�test_carloverreZs


z)ClassPropertiesAndMethods.test_carloverrecsZddl�G�fdd�d�}Gdd�dt�}|�}||�|_~dS)Nrcs.eZdZ�fdd�Zdd�ZdS)zAClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provokercs�j|�|_dS)N)r�)r1Z	referrent)r�r6r7r+oszJClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provoker.__init__cSs|j�}dS)N)r�)r1r�r6r6r7rRrszIClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provoker.__del__N)rrrsrtr+rRr6)r�r6r7�Provokernsr�c@seZdZdS)z=ClassPropertiesAndMethods.test_weakref_segfault.<locals>.OopsN)rrrsrtr6r6r6r7�Oopsusr�)r�r�Zwhatever)r1r�r�r�r6)r�r7�test_weakref_segfaultis	z/ClassPropertiesAndMethods.test_weakref_segfaultcCs6dd�}xtd�D]}|j}qWd}dS)NcSsdS)Nr6r6r6r6r7rm~szAClassPropertiesAndMethods.test_wrapper_segfault.<locals>.<lambda>i@B)r�r�)r1r}rir6r6r7�test_wrapper_segfault|s
z/ClassPropertiesAndMethods.test_wrapper_segfaultcCs`tj}Gdd�d�}|�t_z'ytd�Wntk
rMYnXWd|t_XdS)Nc@seZdZdd�ZdS)z>ClassPropertiesAndMethods.test_file_fault.<locals>.StdoutGuardcSs tjt_td|��dS)Nz!Premature access to sys.stdout.%s)r�
__stdout__�stdoutr
)r1r�r6r6r7rt�szJClassPropertiesAndMethods.test_file_fault.<locals>.StdoutGuard.__getattr__N)rrrsrtrtr6r6r6r7�StdoutGuard�sr�zOops!)rr�r�r
)r1Ztest_stdoutr�r6r6r7�test_file_fault�s	
	z)ClassPropertiesAndMethods.test_file_faultcs�G�fdd�dt�}Gdd�dt��G�fdd�dt����}d|j|�<|j|jd�tj�|j|d	�dS)
Ncs.eZdZdd�Z�fdd�ZdS)zHClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.EvilcSs
td�S)Nr�)r�)r1r6r6r7r��szQClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Evil.__hash__cs
�`dS)Nr)r�)r1rq)rur6r7rU�szOClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Evil.__eq__N)rrrsrtr�rUr6)rur6r7�Evil�sr�c@seZdZddd�ZdS)zIClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.DescrNcSsdS)NrVr6)r1�obr=r6r6r7r��szQClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Descr.__get__)rrrsrtr�r6r6r6r7�Descr�sr�cseZdZ��ZdS)zEClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.CN)rrrsrtr�r6)r�r6r7ru�srurrVr�)r�r?r;r�rrZr�)r1r�rLr6)rur�r7� test_vicious_descriptor_nonsense�s	
z:ClassPropertiesAndMethods.test_vicious_descriptor_nonsensecCsGGdd�dt�}y|�Wntk
r5YnX|jd�dS)Nc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_init.<locals>.FoocSsdS)Nr�r6)r1r6r6r7r+�sz9ClassPropertiesAndMethods.test_init.<locals>.Foo.__init__N)rrrsrtr+r6r6r6r7�Foo�sr�z'did not test __init__() for None return)r�rxry)r1r�r6r6r7�	test_init�s
z#ClassPropertiesAndMethods.test_initcCsg}|j|j|j�|j|jgj�|j|jdgj�|j|j|j�|j|jjd�t|jd�r�|j|jj|�|j|jjt	�n,|j|jj
|�|j|jjt	�|j|jjt	jj�yt
|j�Wntk
r%YnX|jd�f}|d7}|j|jdj�|jt
|j�t
dj��dS)	Nr^rHr~z"no TypeError from hash([].__add__)r@)r@)r@)r@)r;rHr5r\rrrlr�r~�__objclass__r-Zim_selfZim_classrJr�rxry)r1rjrDr6r6r7�test_method_wrapper�s*


z-ClassPropertiesAndMethods.test_method_wrappercs�ddl�dd�}��fdd�}tjd}tj}xAd5d6d7d8d9d:d;d<d=d>d?d@dAdBgD]\}}}d0|d1d�}td2f||i�}	|	�}
|||
|
�|||
|�|||
|�|rt|||
|
�|||
|�|||
|�d3|d1d�}td4f||i�}|�}
|||
|
�|||
|�|||
|�qtWdS)CNrcSstS)N)rp)r1rqr6r6r7�
specialmethod�szEClassPropertiesAndMethods.test_not_implemented.<locals>.specialmethodcsPy#t|d|d|d�i�Wntk
r7YnX�jd|f�dS)Nr�ru�operatorzno TypeError from %r)rPrxry)r5r�ru)rr1r6r7r��s
#
z=ClassPropertiesAndMethods.test_not_implemented.<locals>.checkrVrH�x + y�x += y�__sub__�x - y�x -= yr\�x * y�x *= y�
__matmul__�x @ y�x @= y�__truediv__�x / y�x /= yr��x // y�x //= y�__mod__�x % y�x %= y�
__divmod__�divmod(x, y)r��x ** y�x **= y�
__lshift__�x << y�x <<= y�
__rshift__�x >> y�x >>= y�__and__�x & y�x &= y�__or__�x | y�x |= y�__xor__�x ^ y�x ^= yZ__rrWr�Z__iru)rHrr)rrr)r\rr)rr	r
)rrr
)r�rr)rrr)rrN)r�rr)rrr)rrr)rrr)r r!r")r#r$r%)rr�maxsizer=)r1r�r�ZN1ZN2r4r5ZiexprZrnamer�r9ZinamerurLr6)rr1r7�test_not_implemented�sH
			z.ClassPropertiesAndMethods.test_not_implementedcCsFGdd�dt�}|�}d|dd�<|j|jd�dS)Nc@seZdZdd�ZdS)z6ClassPropertiesAndMethods.test_assign_slice.<locals>.CcSs
||_dS)N)r�)r1�idxr�r6r6r7rSszBClassPropertiesAndMethods.test_assign_slice.<locals>.C.__setitem__N)rrrsrtrSr6r6r6r7rusrurXrVrW)r�r;r�)r1rurLr6r6r7�test_assign_slices	z+ClassPropertiesAndMethods.test_assign_slicecs�Gdd�dt�}|d��G�fdd�dt�}|�}|j|j��d|_|j|jd�Gdd�dt�}Gd	d�dd
|�}d|_|d�|_|j|jd�dS)Nc@s(eZdZdd�Zdd�ZdS)z<ClassPropertiesAndMethods.test_set_and_no_get.<locals>.DescrcSs
||_dS)N)r4)r1r4r6r6r7r+"szEClassPropertiesAndMethods.test_set_and_no_get.<locals>.Descr.__init__cSs||j|j<dS)N)r?r4)r1r�r�r6r6r7ri%szDClassPropertiesAndMethods.test_set_and_no_get.<locals>.Descr.__set__N)rrrsrtr+rir6r6r6r7r� sr�r9cseZdZ�ZdS)z8ClassPropertiesAndMethods.test_set_and_no_get.<locals>.XN)rrrsrtr9r6)r�r6r7r�)sr�r�c@seZdZdS)z;ClassPropertiesAndMethods.test_set_and_no_get.<locals>.MetaN)rrrsrtr6r6r6r7�Meta2sr*c@seZdZdS)z8ClassPropertiesAndMethods.test_set_and_no_get.<locals>.XN)rrrsrtr6r6r6r7r�4sr�)r�r�r9r;r=)r1r�r�r�r*r6)r�r7�test_set_and_no_gets			z-ClassPropertiesAndMethods.test_set_and_no_getcs0Gdd�dt�}|��G�fdd�dt�}G�fdd�dt�}G�fdd�dt�}|jtt|�d	�|j�jd
�|jtt|�d	�|j�jd�|jtt|�d	�|j�jd�G�fd
d�dt��|jtt��d	�dS)Nc@s%eZdZdZddd�ZdS)z@ClassPropertiesAndMethods.test_getattr_hooks.<locals>.DescriptorrNcs�fdd�}|S)Ncs�jd7_t|��dS)NrV)r�r6)r4)r1r6r7r@szXClassPropertiesAndMethods.test_getattr_hooks.<locals>.Descriptor.__get__.<locals>.getterr6)r1r�Zobjtyperr6)r1r7r�?szHClassPropertiesAndMethods.test_getattr_hooks.<locals>.Descriptor.__get__)rrrsrtr�r�r6r6r6r7�
Descriptor=sr,cseZdZ�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.AN)rrrsrtrr6)r�r6r7r�Fsr�cseZdZ�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.BN)rrrsrtrtr6)r�r6r7r�Hsr�cseZdZ�Z�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.CN)rrrsrtrrtr6)r�r6r7ruJsrur�rVrWrZcs.eZdZdd�Z�fdd�ZdS)zFClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattributecSst|��dS)N)r6)r1r4r6r6r7rtWszRClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattribute.__getattr__cs7�`xtd�D]}tj�qWt|��dS)Nr^)rtr�r\Zcollectr6)r1r4ri)�EvilGetattributer6r7rYszWClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattribute.__getattribute__N)rrrsrtrtrr6)r-r6r7r-Usr-)r�r�r6r>r;r�)r1r,r�r�rur6)r-r�r7�test_getattr_hooks:s	
z,ClassPropertiesAndMethods.test_getattr_hookscCs|jttjtt�dS)N)r�rxr=rr-)r1r6r6r7�test_type___getattribute__asz4ClassPropertiesAndMethods.test_type___getattribute__c	Csy|jtttd�Gdd�dt�}|jtt|d�Gdd�dt�}|jt��|`WdQRXdS)N�__abstractmethods__c@seZdZdS)z<ClassPropertiesAndMethods.test_abstractmethods.<locals>.metaN)rrrsrtr6r6r6r7�metagsr1c@seZdZdS)z9ClassPropertiesAndMethods.test_abstractmethods.<locals>.XN)rrrsrtr6r6r6r7r�jsr�)r�r6r>r=r�r0)r1r1r�r6r6r7�test_abstractmethodsdsz.ClassPropertiesAndMethods.test_abstractmethodscCs{Gdd�d�}|�}|j|t�|jt��tj|�WdQRX|jt��tj|d�WdQRXdS)Nc@seZdZeZdS)z:ClassPropertiesAndMethods.test_proxy_call.<locals>.FakeStrN)rrrsrtr
r�r6r6r6r7�FakeStrpsr3rM)r�r
r�rxr�rH)r1r3Zfake_strr6r6r7�test_proxy_callos	z)ClassPropertiesAndMethods.test_proxy_callcCsRGdd�d�}|j|_|�}|jtt|�|jtt|�dS)Nc@seZdZdS)z7ClassPropertiesAndMethods.test_repr_as_str.<locals>.FooN)rrrsrtr6r6r6r7r��sr�)r�rgr�r�r
rf)r1r�r�r6r6r7�test_repr_as_strs
	z*ClassPropertiesAndMethods.test_repr_as_strcCs@Gdd�dt�}|�}d|_|j|dd�dS)Nc@seZdZejZdS)z>ClassPropertiesAndMethods.test_mixing_slot_wrappers.<locals>.XN)rrrsrtrerSrr6r6r6r7r��sr�r�ru)rerur;)r1r�r�r6r6r7�test_mixing_slot_wrappers�s		z3ClassPropertiesAndMethods.test_mixing_slot_wrappersc
CsO|jt��}Gdd�d�}WdQRXt|j�}|jd|�dS)Nc@seZdZdgZdZdS)zEClassPropertiesAndMethods.test_slot_shadows_class_variable.<locals>.Xr�N)rrrsrtr�r�r6r6r6r7r��s	r�z0'foo' in __slots__ conflicts with class variable)r�rr
�	exceptionr;)r1rr�rEr6r6r7� test_slot_shadows_class_variable�sz:ClassPropertiesAndMethods.test_slot_shadows_class_variablecCs�Gdd�d�}d|_|j|jd�|jt��$}tt�jdjtd�WdQRX|jdt	|j
��|jt��!}t|�jdj|�WdQRX|jdt	|j
��|j|jd�dS)Nc@seZdZdZdS)z1ClassPropertiesAndMethods.test_set_doc.<locals>.XZelephantN)rrrsrtrJr6r6r6r7r��sr�ZbananarJZblahzcan't set list.__doc__zcan't delete X.__doc__)rJr;r�rxr=r-r?rir�r
r7r�)r1r�rr6r6r7�test_set_doc�s	$!z&ClassPropertiesAndMethods.test_set_doccCs�tjtjtjtjg}ddddg}x:t||�D])\}}|jt	|�j
|d�q@Wx8|D]0}|jjd|j
}|j|j|�qtW|jtjjd�|jtjjd�|jtjjd	�|jtjjd
�Gdd�d�}|j
t��|`WdQRX|j
tt	jd
jtd�Gdd�d�a|jtjd�|jtjjd�dS)NrsZmemberZgetset�wrapperZ_descriptor�.z	str.lowerzcomplex.realz
float.realzint.__add__c@seZdZdS)z2ClassPropertiesAndMethods.test_qualname.<locals>.XN)rrrsrtr6r6r6r7r��sr�rtZOinkc@s#eZdZGdd�d�ZdS)r�c@seZdZdS)zY.InsideN)rrrsrtr6r6r6r7�Inside�sr<N)rrrsrtr<r6r6r6r7r��sr�zY.Inside)r
r^rr�r(r'rHrr;r=rrr�rtr�rxr?rir�r<)r1ZdescriptorsrrC�n�qualnamer�r6r6r7�
test_qualname�s&!


z'ClassPropertiesAndMethods.test_qualnamecCs�ddi}tdf|�}|j|jd�|jd|j�|j|ddi�ddi}|jttdf|�dS)Nrtz	some.namer�rV)r=r;rtr�r?r�rx)r1r�r�r6r6r7�test_qualname_dict�sz,ClassPropertiesAndMethods.test_qualname_dictcCs�Gdd�dt�}|�}d|_tj|�}~tj�|j|��x*tj�D]}|j	t
|�|�qaWdS)Nc@seZdZdd�ZdS)z<ClassPropertiesAndMethods.test_cycle_through_dict.<locals>.XcSstj|�||_dS)N)rer+r?)r1r6r6r7r+�s
zEClassPropertiesAndMethods.test_cycle_through_dict.<locals>.X.__init__N)rrrsrtr+r6r6r6r7r��sr�r�)rer�r�r�rrZ�assertIsNoner\rT�assertIsNotr=)r1r�r��wrr�r6r6r7�test_cycle_through_dict�s		
z1ClassPropertiesAndMethods.test_cycle_through_dictcCs�Gdd�d�}|jt|d�|jt|dd�Gdd�d�}Gdd�d�}Gd	d
�d
||�}xf|||fD]U}|d�|ddd�|jt|ddd�|jt|ddd
d�q�WdS)Nc@seZdZdS)z[ClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNeitherN)rrrsrtr6r6r6r7�OverrideNeither�srErVr�c@seZdZddd�ZdS)zWClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNewrc_stj|||�S)N)r�r�)r�r�r�r2r�r6r6r7r��sz_ClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNew.__new__N)rrrsrtr�r6r6r6r7�OverrideNew�srFc@seZdZddd�ZdS)zXClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideInitrc_stj|||�S)N)r�r+)r1r�r�r2r3r6r6r7r+�szaClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideInit.__init__N)rrrsrtr+r6r6r6r7�OverrideInit�srGc@seZdZdS)zXClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideBothN)rrrsrtr6r6r6r7�OverrideBoth�srHrWrXr�)r�rx)r1rErFrGrHZcaser6r6r7�(test_object_new_and_init_with_parameters�s
zBClassPropertiesAndMethods.test_object_new_and_init_with_parameterscCsSGdd�d�}Gdd�d|�}|jd|j�|jd|j�dS)Nc@seZdZdS)z\ClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptors.<locals>.BaseN)rrrsrtr6r6r6r7r:�sr:c@seZdZdS)z[ClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptors.<locals>.SubN)rrrsrtr6r6r6r7r<�sr<r?)r�r?r�)r1r:r<r6r6r7�4test_subclassing_does_not_duplicate_dict_descriptors�szNClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptorscs�Gdd�d�}|jt|�j�d�Gdd�d�}Gdd�d|�}Gdd	�d	|�}|�}|�}|�}t||�}|jt|j�d
�|jt|j�d�|jt|j�d�|jt|j�d
�Gdd�d�}|�}	|jt|	j�d�|jt|j�d�Gdd�d�}
|
�}t�}tj||�}
|jt|
�d�d|_|jt|
�d�d|_|jt|
�d�dS)Nc@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_bound_method_repr.<locals>.FoocSsdS)Nr6)r1r6r6r7rs�szDClassPropertiesAndMethods.test_bound_method_repr.<locals>.Foo.methodN)rrrsrtrsr6r6r6r7r��sr�z4<bound method .*Foo\.method of <.*Foo object at .*>>c@seZdZdd�ZdS)z>ClassPropertiesAndMethods.test_bound_method_repr.<locals>.BasecSsdS)Nr6)r1r6r6r7rsszEClassPropertiesAndMethods.test_bound_method_repr.<locals>.Base.methodN)rrrsrtrsr6r6r6r7r:sr:c@seZdZdS)zBClassPropertiesAndMethods.test_bound_method_repr.<locals>.Derived1N)rrrsrtr6r6r6r7�Derived1srKc@seZdZdd�ZdS)zBClassPropertiesAndMethods.test_bound_method_repr.<locals>.Derived2cSsdS)Nr6)r1r6r6r7rsszIClassPropertiesAndMethods.test_bound_method_repr.<locals>.Derived2.methodN)rrrsrtrsr6r6r6r7�Derived2srLz6<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@s"eZdZedd��ZdS)z=ClassPropertiesAndMethods.test_bound_method_repr.<locals>.FoocSsdS)Nr6)r�r6r6r7rsszDClassPropertiesAndMethods.test_bound_method_repr.<locals>.Foo.methodN)rrrsrtr�rsr6r6r6r7r�sz/<bound method .*Foo\.method of <class '.*Foo'>>c@seZdZdd�ZdS)zDClassPropertiesAndMethods.test_bound_method_repr.<locals>.MyCallablecSsdS)Nr6)r1r|r6r6r7r�#szMClassPropertiesAndMethods.test_bound_method_repr.<locals>.MyCallable.__call__N)rrrsrtr�r6r6r6r7�
MyCallable"srMz*<bound method \? of <object object at .*>>r4z,<bound method name of <object object at .*>>r>z0<bound method qualname of <object object at .*>>)	ZassertRegexrfrsr�r�r�
MethodTyperrrt)r1r�r:rKrLrbZderived1Zderived2Zsuper_d2r�rMr��instancers)r�r6r7�test_bound_method_repr�sH								z0ClassPropertiesAndMethods.test_bound_method_repr)vrrrsrtr�r�r�r�r�rrrrr r'r3r7rDrardrkrvrzr�rr�r�r�r�r�r�r�r)ZexpectedFailurer�r�r�r�r�r�r�r�r�r�skipIfr�flags�optimizer�cpython_onlyrrrr2r=rcrirnrwr~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�r�r�r�r�r�r�r'r)r+r.r/r2r4r5r6r8r9r?r@rDrIrJrPr6r6)r�r7r��s�4�W")%
%=�&F<2"
"A1ib?CS^t�M @OYYM
.
',	A( 63,'!4
'

 
r�c@s�eZdZdd�Zejeed�o6ej�d�dd��Z	ejeed�oiej�d�dd��Z
ejeed�o�ej�d�d	d
��Zdd�Zd
d�Z
dS)�DictProxyTestscCs#Gdd�dt�}||_dS)Nc@seZdZdd�ZdS)zDictProxyTests.setUp.<locals>.CcSsdS)Nr6)r1r6r6r7rB5sz$DictProxyTests.setUp.<locals>.C.methN)rrrsrtrBr6r6r6r7ru4sru)r�ru)r1rur6r6r7�setUp3szDictProxyTests.setUp�gettracez#trace function introduces __local__cCs[|jjj�}|j|t�t|�}|j�|j|dddddg�dS)Nr?rJrsrbrB)rur?ra�assertNotIsInstancer-�sortr;)r1r�rar6r6r7�test_iter_keys9s
zDictProxyTests.test_iter_keyscCsH|jjj�}|j|t�t|�}|jt|�d�dS)Nr^)rur?r�rXr-r;r�)r1r�r�r6r6r7�test_iter_valuesDszDictProxyTests.test_iter_valuescCsb|jjj�}|j|t�dd�|D�}|j�|j|dddddg�dS)NcSsg|]}|d�qS)rr6)r�itemr6r6r7rSs	z2DictProxyTests.test_iter_items.<locals>.<listcomp>r?rJrsrbrB)rur?r.rXr-rYr;)r1r�rar6r6r7�test_iter_itemsMs
zDictProxyTests.test_iter_itemscCskGdd�dt�}Gdd�dt�}Gdd�dd|�}|jt|j�t|j��dS)Nc@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.BN)rrrsrtr6r6r6r7r�Zsr�c@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.MN)rrrsrtr6r6r6r7r)\sr)c@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.CN)rrrsrtr6r6r6r7ru^srur�)r�r=r;r?)r1r�r)rur6r6r7�test_dict_type_with_metaclassXsz,DictProxyTests.test_dict_type_with_metaclasscCs�t|jj�}|j|jd�|�|j|jd�|�x<|jjj�D](\}}|jdj||�|�qWWdS)Nz
mappingproxy(�)z
{!r}: {!r})	rfrur?r�r��endswithr.r�r�)r1r�r�r�r6r6r7�	test_reprcs
zDictProxyTests.test_reprN)rrrsrtrVr)rQrlrrWrZr[r]r^rar6r6r6r7rU2s

rUc@seZdZdd�ZdS)�PTypesLongInitTestc
CsIGdd�dt�}ytd|�d�WnYnXtjt�dS)Nc@seZdZdd�ZdS)z;PTypesLongInitTest.test_pytype_long_ready.<locals>.UserLongcWsdS)Nr6)r1r2r6r6r7r�xszCPTypesLongInitTest.test_pytype_long_ready.<locals>.UserLong.__pow__N)rrrsrtr�r6r6r6r7�UserLongwsrcr)r�rr=r�rB)r1rcr6r6r7�test_pytype_long_readypsz)PTypesLongInitTest.test_pytype_long_readyN)rrrsrtrdr6r6r6r7rbnsrbc@seZdZdd�ZdS)�	MiscTestscs�G��fdd�dt�}Gdd�dt�}Gdd�dt��td|f|�di��|j�jd	�|j�jd
�dS)Ncs1eZdZdd�Z��fdd�ZdS)z7MiscTests.test_type_lookup_mro_reference.<locals>.MyKeycSs
td�S)N�mykey)r�)r1r6r6r7r��sz@MiscTests.test_type_lookup_mro_reference.<locals>.MyKey.__hash__cs�f�_dS)N)r@)r1rq)�Base2r�r6r7rU�sz>MiscTests.test_type_lookup_mro_reference.<locals>.MyKey.__eq__N)rrrsrtr�rUr6)rgr�r6r7�MyKey�srhc@seZdZdZdZdS)z6MiscTests.test_type_lookup_mro_reference.<locals>.Basez	from BaseN)rrrsrtrf�mykey2r6r6r6r7r:�sr:c@seZdZdZdZdS)z7MiscTests.test_type_lookup_mro_reference.<locals>.Base2z
from Base2N)rrrsrtrfrir6r6r6r7rg�srgr�r^z	from Basez
from Base2)r�r=r;rfri)r1rhr:r6)rgr�r7�test_type_lookup_mro_reference�sz(MiscTests.test_type_lookup_mro_referenceN)rrrsrtrjr6r6r6r7re�srec@s�eZdZfiddddd�Zdd�Zdd�Zddd	�Zed
d��Zdd
�Z	dd�Z
dd�ZdS)�
PicklingTestsNc
Cs�|dkr!|j|�}|r^|j|dtj�|j|dt|�||f�n8|j|dtj�|j|dt|�f|�|j|d|�|dk	r�|jt|d�|�n|j|d�|dk	r
|j	t
|d�|�q�|j|d�n�t|�j}	tjt|�|	|	t
krTdn	|	|�ff}|dk	r||f7}|j|j|�|�|j|j�|�dS)NrWrrVrXrZ)�
__reduce_ex__r;�copyreg�
__newobj_ex__r=�
__newobj__�assertListEqualr-rA�assertDictEqualre�__base__�_reconstructorr��
__reduce__)
r1�protor�r2r3r��	listitems�	dictitemsZreduce_valueZ	base_typer6r6r7�
_check_reduce�s.&!	$
zPicklingTests._check_reducecs|ttjd�}d2�dd3dd4i�dd5i�G�fd
d�d�}|�}x!|D]}|j||��q`Wx*�j�D]\}}t|||�q�Wx'|D]}|j||�d��q�WGd
d�d�}|�}x>|D]6}|dkr�|jt��|j|�WdQRXq�WG��fdd�d�}|�}xc|D][}|dkr�|j||���q]|dkr]|jt	��|j|�WdQRXq]WG�fdd�d�}	G�fdd�d�}
Gdd�d�}Gdd�d�}xj|D]b}xY|	|
||fD]E}
|
�}|dkr4|jtt	f��|j|�WdQRXq4WqWG�fdd�d�}|�}x!|D]}|j||��q�WGdd�d�}|�}x>|D]6}|dkr�|jt
��|j|�WdQRXq�WG�fdd �d �}|�}x$|D]}|j||d��qMWGd!d"�d"�}|�}x$|D]}|j||dd#�q�WGd$d%�d%�}|�}x_|D]W}|jt
��|j|�WdQRX|dkr�|jt
��|j�WdQRXq�WG�fd&d'�d'�}|�}x~|D]v}|dkr�|j||dd�f�qW|jt��|j|�WdQRX|jt��|j�WdQRXqWWGd(d)�d)t�}|d*d6i�}x*|D]"}|j||d,t|��qWGd-d.�d.t
�}|d/g�}x*|D]"}|j||d0t
|��qRWdS)7NrVr�r�Zbacon��Zfishi-�cheesei�cs"eZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C1cs�S)Nr6)r1)r2r6r7�__getnewargs__�sz4PicklingTests.test_reduce.<locals>.C1.__getnewargs__N)rrrsrtr{r6)r2r6r7rF�srFr�c@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C2cSsdS)Nzbad argsr6)r1r6r6r7r{�sz4PicklingTests.test_reduce.<locals>.C2.__getnewargs__N)rrrsrtr{r6r6r6r7r��sr�rWcs%eZdZ��fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C3cs
��fS)Nr6)r1)r2r3r6r7�__getnewargs_ex__�sz7PicklingTests.test_reduce.<locals>.C3.__getnewargs_ex__N)rrrsrtr|r6)r2r3r6r7rG�srGrZcs"eZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C4cs
�dfS)Nzbad dictr6)r1)r2r6r7r|�sz7PicklingTests.test_reduce.<locals>.C4.__getnewargs_ex__N)rrrsrtr|r6)r2r6r7rK�srKcs"eZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C5cs
d�fS)Nz	bad tupler6)r1)r3r6r7r|�sz7PicklingTests.test_reduce.<locals>.C5.__getnewargs_ex__N)rrrsrtr|r6)r3r6r7�C5�sr}c@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C6cSsfS)Nr6)r1r6r6r7r|�sz7PicklingTests.test_reduce.<locals>.C6.__getnewargs_ex__N)rrrsrtr|r6r6r6r7�C6�sr~c@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C7cSsdS)Nzbad argsr6)r1r6r6r7r|�sz7PicklingTests.test_reduce.<locals>.C7.__getnewargs_ex__N)rrrsrtr|r6r6r6r7�C7�srcs"eZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C9cs
�ifS)Nr6)r1)r2r6r7r|�sz7PicklingTests.test_reduce.<locals>.C9.__getnewargs_ex__N)rrrsrtr|r6)r2r6r7�C9�sr�c@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C10cSs
t�dS)N)r�)r1r6r6r7r|sz8PicklingTests.test_reduce.<locals>.C10.__getnewargs_ex__N)rrrsrtr|r6r6r6r7�C10�sr�cs"eZdZ�fdd�ZdS)z&PicklingTests.test_reduce.<locals>.C11cs�S)Nr6)r1)r�r6r7r�	sz3PicklingTests.test_reduce.<locals>.C11.__getstate__N)rrrsrtr�r6)r�r6r7�C11sr�c@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C12cSsdS)Nznot dictr6)r1r6r6r7r�sz3PicklingTests.test_reduce.<locals>.C12.__getstate__N)rrrsrtr�r6r6r6r7�C12sr�znot dictc@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C13cSs
t�dS)N)r�)r1r6r6r7r�sz3PicklingTests.test_reduce.<locals>.C13.__getstate__N)rrrsrtr�r6r6r6r7�C13sr�cs.eZdZe��Z�fdd�ZdS)z&PicklingTests.test_reduce.<locals>.C14cs1x*�j�D]\}}t|||�q
WdS)N)r.r�)r1r4r�)r�r6r7r+#sz/PicklingTests.test_reduce.<locals>.C14.__init__N)rrrsrtrBr�r+r6)r�r6r7�C14!sr�c@seZdZdS)z&PicklingTests.test_reduce.<locals>.C15N)rrrsrtr6r6r6r7�C151sr�ZquebeciYrwc@seZdZdS)z&PicklingTests.test_reduce.<locals>.C16N)rrrsrtr6r6r6r7�C167sr�Zyukonrv���)r�r�i7���i���io���i����)r��pickle�HIGHEST_PROTOCOLrxr.r�r�rxrlrr�rtrer-)r1�	protocolsrFr�rur4r�r�rGrKr}r~rr�r�r�r�r�r�r�r�r�r6)r2r3r�r7�test_reduce�s�	

	
	

		
	
	
	
	
	

 
zPicklingTests.test_reducecCslttjd�}Gdd�d�}x?|D]7}|dkrEind}|j||�d|�q-WdS)NrVc@s(eZdZdd�Zdd�ZdS)z7PicklingTests.test_special_method_lookup.<locals>.PickycSsiS)Nr6)r1r6r6r7r�@szDPicklingTests.test_special_method_lookup.<locals>.Picky.__getstate__cSs|dkrt|��dS)Nr{r|)r{r|)r�)r1r�r6r6r7rtCszCPicklingTests.test_special_method_lookup.<locals>.Picky.__getattr__N)rrrsrtr�rtr6r6r6r7�Picky?sr�rWr�)r�r�r�rx)r1r�r�Zprotocolr�r6r6r7r�=s

z(PicklingTests.test_special_method_lookupcCs�|dkrdj||�}t|�jtjkrFtdd��|j||d|�|jt|�t|�d|�t|d�r�|j|j	|j	d|�|j|j	|j	d|�t|d�rZ|j
|j|jd|�xg|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}z&object passed to _assert_is_copy must zoverride the __repr__ method.r,r?r�)r�r=rgr�rrBr�rlrqr?rpr�r;r>rf)r1r��objcopyr,�slotr6r6r7�_assert_is_copyKs$
""zPicklingTests._assert_is_copycs^Gdd�d���fdd�tjttjd�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)ru�dumps�loads)r1rur�r�r6r6r7r+ks		zEPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.__init__cSs|j|j||j��S)N)r�r�ru)r1r�r6r6r7r�oszAPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.copycSs4dj|j|jj|jj|jj|jj�S)Nz0PickleCopier(proto={}, dumps={}.{}, loads={}.{}))r�rur�rsrtr�)r1r6r6r7rgqszEPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.__repr__N)rrrsrtrJr+r�rgr6r6r6r7�PickleCopierisr�c3s|]}�|�VqdS)Nr6)rr2)r�r6r7�	<genexpr>ysz9PicklingTests._generate_pickle_copiers.<locals>.<genexpr>rV)	�	itertools�productr�r�r�r�Z_dumpsr�Z_loadsr6r6)r�r7�_generate_pickle_copierses
z&PicklingTests._generate_pickle_copierscCs�Gdd�d�a|jt��tjt�d�WdQRXGdd�dt�a|jt��tjt�d�WdQRXGdd�d�aGdd�dt�aGdd	�d	t�ax�|j�D]�}|jd
|���t�}|j	|�}|j
||�d|_|j	|�}|j
||�t�}d|_d|_|j	|�}|j
||�t�}d|_d
|_|j	|�}|j
||�WdQRXq�WdS)Nc@seZdZdgZdS)rur9N)rrrsrtr�r6r6r6r7ru�srurc@seZdZdS)r�N)rrrsrtr6r6r6r7r��sr�c@sCeZdZdZdgZdd�Zdd�Zdd�Zd	S)
ruz7A class with __getstate__ and __setstate__ implemented.r9c
Ss�t|di�j�}xct|�jD]R}xI|jjdf�D]2}yt||�||<WqDtk
ruYqDXqDWq(W|S)Nr?r�)r>r�r=rr?r�r6)r1r�r�r�r6r6r7r��s

zC.__getstate__cSs1x*|j�D]\}}t|||�q
WdS)N)r.r�)r1r�r�r�r6r6r7r��szC.__setstate__cSsdt|�j|j�fS)Nz%s()<%r>)r=rrr�)r1r6r6r7rg�sz
C.__repr__N)rrrsrtrJr�r�r�rgr6r6r6r7ru�s
		c@seZdZdZdS)r�z!A subclass of a class with slots.N)rrrsrtrJr6r6r6r7r��sc@seZdZdZdgZdS)r�zA subclass with an extra slot.rIN)rrrsrtrJr�r6r6r6r7r��sr��
pickle_copierr�ror�)
rur�rxr�r�r�r�r��subTestr�r�r9rI)r1r�r�rur6r6r7�test_pickle_slots~s6								zPicklingTests.test_pickle_slotsc
CsSGdd�d�aGdd�dt�aGdd�dt�aGdd�dt�aGd	d
�d
t�atttttf}|j�}x#tj	||�D]\}}|j
d|d|���t|d
i�}||j|�}|j
}d|kodknrFt|d�rF|jt��|j||�WdQRXw�|j|�}|j||�|dkr�|jr�|jj�|j|�}	|j||	�WdQRXq�Wx�|D]�}|j
d|��wt|d
i�}||j|�}t|�}|j||�|jsD|jj�t|�}	|j||	�WdQRXq�WdS)Ncs@eZdZdZd	ZdZ�fdd�Zdd�Z�S)
rFz:The state of this class is copyable via its instance dict.rVrWTcs#t�j�||_||_dS)N)r�r+r9rI)r1r9rI)r�r6r7r+�s
	zC1.__init__cSsd|j|jfS)Nz
C1(%r, %r))r9rI)r1r6r6r7rg�szC1.__repr__)rVrW)rrrsrtrJ�ARGS�NEED_DICT_COPYINGr+rgr6r6)r�r7rF�s
rFcsdeZdZdZd
ZdZ�fdd�Z�fdd�Zed	d
��Z	dd�Z
�S)r�z,A list subclass copyable via __getnewargs__.rVrWFcs(t�j|�}||_||_|S)N)r�r�r9rI)r�r9rIr1)r�r6r7r��s		z
C2.__new__cst�j�|jd�dS)Nrz)r�r+rb)r1r2)r�r6r7r+�s
zC2.__init__cSs|jS)N)r�)r�r6r6r7r{�szC2.__getnewargs__cSsd|j|jt|�fS)NzC2(%r, %r)<%r>)r9rIr-)r1r6r6r7rg�szC2.__repr__)rVrW)rrrsrtrJr�r�r�r+r�r{rgr6r6)r�r7r��sr�c@sXeZdZdZdZdZdd�Zedd��Zd	d
�Z	dd�Z
d
S)rGz*A list subclass copyable via __getstate__.rVrWFcSs#||_||_|jd�dS)Nrz)r9rIrb)r1r9rIr6r6r7r+�s		zC3.__init__cSs|jS)N)r�)r�r6r6r7r��szC3.__getstate__cSs"|\}}||_||_dS)N)r9rI)r1r�r9rIr6r6r7r��s	zC3.__setstate__cSsd|j|jt|�fS)NzC3(%r, %r)<%r>)r9rIr-)r1r6r6r7rg�szC3.__repr__N)rVrW)rrrsrtrJr�r�r+r�r�r�rgr6r6r6r7rG�srGcsReZdZdZdZdZ�fdd�Zedd	��Zd
d�Z	�S)
rKz,An int subclass copyable via __getnewargs__.r
rrVFcs+t�j||�}||_||_|S)N)r�r�r9rI)r�r9rIr�r1)r�r6r7r��s		z
C4.__new__cSs|jS)N)r�)r�r6r6r7r{szC4.__getnewargs__cSsd|j|jt|�fS)NzC4(%r, %r)<%r>)r9rIr')r1r6r6r7rgszC4.__repr__)r
rrV)
rrrsrtrJr�r�r�r�r{rgr6r6)r�r7rK�srKcsdeZdZdZdZddiZdZdd�fdd	�Zed
d��Z	dd
�Z
�S)r}z/An int subclass copyable via __getnewargs_ex__.rVrWr�rXFrcs+t�j||�}||_||_|S)N)r�r�r9rI)r�r9rIr�r1)r�r6r7r�s		z
C5.__new__cSs|j|jfS)N)r��KWARGS)r�r6r6r7r|szC5.__getnewargs_ex__cSsd|j|jt|�fS)NzC5(%r, %r)<%r>)r9rIr')r1r6r6r7rgszC5.__repr__)rVrW)rrrsrtrJr�r�r�r�r�r|rgr6r6)r�r7r}
sr}r�r�r�rWrZr|)rFr-r�rGr'rKr}r�r�r�r�r>r�rurlr�rr�r�r�r�r?r�r)
r1Ztest_classesZpickle_copiersr�r�r3r�rur�Zobjcopy2r6r6r7�test_reduce_copying�s@	+

	
z!PicklingTests.test_reduce_copyingcs�Gdd�dt��G��fdd�d��ddl}|j�fdddifddf}|j��jd�|�dS)	Nc@seZdZdS)z(PicklingTests.test_issue24097.<locals>.SN)rrrsrtr6r6r6r7r�Csr�cs4eZdZ�d�gZ��fdd�ZdS)z(PicklingTests.test_issue24097.<locals>.Ar�cs6|dkr,�d�g�jdd�<dSt�dS)Nr�r�)�
__slotnames__r6)r1r�)r�r�r6r7rtGsz4PicklingTests.test_issue24097.<locals>.A.__getattr__N)rrrsrtr�rtr6)r�r�r6r7r�Esr�rr�r�rW)r
rmror;rt)r1rmr*r6)r�r�r7�test_issue24097As
	'zPicklingTests.test_issue24097)rrrsrtrxr�r�r�r�r�r�r�r�r6r6r6r7rk�s	~C�rkc@s%eZdZejdd��ZdS)�SharedKeyTestscCs�Gdd�d�}Gdd�d|�}|�|�}}|jtjt|��tjt|���|jtjt|��tji��td�\|_|_|_|_	|j
tjt|��tjt|���|�}|jtjt|��tjt|���|jtjt|��tji��td�\|_|_|_	|_
|jtjt|��tji��dS)Nc@seZdZdS)z)SharedKeyTests.test_subclasses.<locals>.AN)rrrsrtr6r6r6r7r�Xsr�c@seZdZdS)z)SharedKeyTests.test_subclasses.<locals>.BN)rrrsrtr6r6r6r7r�Zsr�rZ)r;rr��varsZ
assertLessr�r�rur[�wr5rjr�rD)r1r�r�r9rIr�r6r6r7�test_subclassesUs.($.	.($zSharedKeyTests.test_subclassesN)rrrsrtrrTr�r6r6r6r7r�Ssr�c@s.eZdZdZdd�Zdd�ZdS)�DebugHelperMetaz<
    Sets default __doc__ and simplifies repr() output.
    cCs5|jd�dkr||d<tj||||�S)NrJ)r�r=r�)r�r4r�r�r6r6r7r�ms
zDebugHelperMeta.__new__cCs
t|j�S)N)rfrr)r�r6r6r7rgqszDebugHelperMeta.__repr__N)rrrsrtrJr�rgr6r6r6r7r�isr�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)r1r6r6r7rV|s	z
MroTest.setUpcCs(|j|k}|r$|jd7_|S)NrV)r�)r1�limitZretr6r6r7�
step_until�szMroTest.step_untilcs9G�fdd�dt�}Gdd�dd|�}dS)zM
        type_set_bases must be aware that type->tp_mro can be NULL.
        cs"eZdZ�fdd�ZdS)z4MroTest.test_incomplete_set_bases_on_self.<locals>.Mcs+�jd�r|jf7_tj|�S)NrV)r�r@r=r�)r�)r1r6r7r��sz8MroTest.test_incomplete_set_bases_on_self.<locals>.M.mroN)rrrsrtr�r6)r1r6r7r)�sr)c@seZdZdS)z4MroTest.test_incomplete_set_bases_on_self.<locals>.AN)rrrsrtr6r6r6r7r��sr�r�N)r�)r1r)r�r6)r1r7�!test_incomplete_set_bases_on_self�sz)MroTest.test_incomplete_set_bases_on_selfcsaG��fdd�dt�}Gdd�dd|��Gdd�d��}|jf7_dS)	z?
        Deep reentrancy must not over-decref old_mro.
        cs%eZdZ��fdd�ZdS)z/MroTest.test_reent_set_bases_on_base.<locals>.McsI|jdk	r<|jdkr<�jd�r<�jf7_tj|�S)Nr�r�)rrrr�r@r=r�)r�)r�r1r6r7r��sz3MroTest.test_reent_set_bases_on_base.<locals>.M.mroN)rrrsrtr�r6)r�r1r6r7r)�sr)c@seZdZdS)z/MroTest.test_reent_set_bases_on_base.<locals>.AN)rrrsrtr6r6r6r7r��sr�r�c@seZdZdS)z/MroTest.test_reent_set_bases_on_base.<locals>.BN)rrrsrtr6r6r6r7r��sr�N)r�r@)r1r)r�r6)r�r1r7�test_reent_set_bases_on_base�s	z$MroTest.test_reent_set_bases_on_basecseG�fdd�dt�}Gdd�dd|�}Gdd�d|�}Gdd	�d	|�}d
S)zU
        Similar to test_reent_set_bases_on_base, but may crash differently.
        cs"eZdZ�fdd�ZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.McsD|jd}|tk	r7�jd�r7|jf7_tj|�S)Nrr^)r@r�r�r=r�)r�rb)r1r6r7r��s

z:MroTest.test_reent_set_bases_on_direct_base.<locals>.M.mroN)rrrsrtr�r6)r1r6r7r)�sr)c@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.AN)rrrsrtr6r6r6r7r��sr�r�c@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.BN)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.CN)rrrsrtr6r6r6r7ru�sruN)r�)r1r)r�r�rur6)r1r7�#test_reent_set_bases_on_direct_base�s	z+MroTest.test_reent_set_bases_on_direct_basec
s�G���fdd�dt�}Gdd�dd|�}Gdd�d|��Gdd	�d	|��d
�_�jt���jf7_WdQRXdS)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.
        cs(eZdZ���fdd�ZdS)z5MroTest.test_reent_set_bases_tp_base_cycle.<locals>.McsL�jr?|jdkr$�f�_|jdkr?�f�_tj|�S)N�B1�B2)r�rrr@r=r�)r�)r�r�r1r6r7r��s	z9MroTest.test_reent_set_bases_tp_base_cycle.<locals>.M.mroN)rrrsrtr�r6)r�r�r1r6r7r)�sr)c@seZdZdS)z5MroTest.test_reent_set_bases_tp_base_cycle.<locals>.AN)rrrsrtr6r6r6r7r��sr�r�c@seZdZdS)z6MroTest.test_reent_set_bases_tp_base_cycle.<locals>.B1N)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z6MroTest.test_reent_set_bases_tp_base_cycle.<locals>.B2N)rrrsrtr6r6r6r7r��sr�TN)r�r�r�rxr@)r1r)r�r6)r�r�r1r7�"test_reent_set_bases_tp_base_cycle�s"		z*MroTest.test_reent_set_bases_tp_base_cyclecsG���fdd�dt�}Gdd�dd|�}Gdd�d|�}Gdd	�d	|��Gd
d�d|��d�_|f�_�f|_�j�j�f��j�j��g��j|j�g��j|j�f��j�j�|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.
        cs(eZdZ���fdd�ZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.Mcs:�jr-|jdkr-d�_�f�_tj|�S)NruF)r�rrr@r=r�)r�)r�rur1r6r7r��s	z?MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.M.mroN)rrrsrtr�r6)r�rur1r6r7r)�sr)c@seZdZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.AN)rrrsrtr6r6r6r7r��sr�r�c@seZdZdS)z<MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.B1N)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z<MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.B2N)rrrsrtr6r6r6r7r��sr�c@seZdZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.CN)rrrsrtr6r6r6r7ru�sruTN)r�r�r@r;r�)r1r)r�r�r6)r�rur1r7�(test_tp_subclasses_cycle_in_update_slots�s	"	z0MroTest.test_tp_subclasses_cycle_in_update_slotscs
Gdd�dt��G����fdd�dt�}Gdd�dd|�}Gdd	�d	|�}Gd
d�d|��Gdd
�d
|��d�_�j���|f�_WdQRX�f|_�j�j�f��j�jttj	����dS)z�
        The same as test_tp_subclasses_cycle_in_update_slots, but tests
        a code path executed on error (goto bail).
        c@seZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.EN)rrrsrtr6r6r6r7r�	sr�cs+eZdZ����fdd�ZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.McsU�jrH|jdkrH�j�fkr6d�_n�f�_��tj|�S)NruF)r�rrr@r=r�)r�)r�rur�r1r6r7r�szAMroTest.test_tp_subclasses_cycle_error_return_path.<locals>.M.mroN)rrrsrtr�r6)r�rur�r1r6r7r)sr)c@seZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.AN)rrrsrtr6r6r6r7r�sr�r�c@seZdZdS)z>MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.B1N)rrrsrtr6r6r6r7r�sr�c@seZdZdS)z>MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.B2N)rrrsrtr6r6r6r7r�sr�c@seZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.CN)rrrsrtr6r6r6r7rusruTN)
r�r�r�r�r@r;rrBr=r�)r1r)r�r�r6)r�rur�r1r7�*test_tp_subclasses_cycle_error_return_paths%
	z2MroTest.test_tp_subclasses_cycle_error_return_pathcs9G�fdd�dt�}Gdd�dd|�}dS)z�
        Extending an unitialized type with type->tp_mro == NULL must
        throw a reasonable TypeError exception, instead of failing
        with PyErr_BadInternalCall.
        cs"eZdZ�fdd�ZdS)z)MroTest.test_incomplete_extend.<locals>.McsX|jdkrK|jdkrK�jt��Gdd�d|�}WdQRXtj|�S)Nr�c@seZdZdS)z8MroTest.test_incomplete_extend.<locals>.M.mro.<locals>.XN)rrrsrtr6r6r6r7r�0s)rrrr�rxr=r�)r�r�)r1r6r7r�-sz-MroTest.test_incomplete_extend.<locals>.M.mroN)rrrsrtr�r6)r1r6r7r),sr)c@seZdZdS)z)MroTest.test_incomplete_extend.<locals>.AN)rrrsrtr6r6r6r7r�5sr�r�N)r�)r1r)r�r6)r1r7�test_incomplete_extend&s	zMroTest.test_incomplete_extendcs9G�fdd�dt�}Gdd�dd|�}dS)z�
        Attrubute lookup on a super object must be aware that
        its target type can be uninitialized (type->tp_mro == NULL).
        cs%eZdZ��fdd�Z�S)z(MroTest.test_incomplete_super.<locals>.Mc
sC|jdkr6�jt��t||�jWdQRXtj|�S)N)rr�r6r�Zxxxr=r�)r�)r�r1r6r7r�>sz,MroTest.test_incomplete_super.<locals>.M.mro)rrrsrtr�r6)r1)r�r7r)=sr)c@seZdZdS)z(MroTest.test_incomplete_super.<locals>.AN)rrrsrtr6r6r6r7r�Esr�r�N)r�)r1r)r�r6)r1r7�test_incomplete_super8szMroTest.test_incomplete_superN)rrrsrtrJrVr�r�r�r�r�r�r�r�r�r6r6r6r7r�us$$"r�c	Cs&tjtttttttt	�dS)N)
rZrun_unittestrbrr�rUrerkr�r�r6r6r6r7�	test_mainIs	r��__main__)r�rmr\r�r�r�rrr)r�r�r�rr�rr*rr�rUrbrerkr�r=r�r�r�rrr6r6r6r7�<module>sT�s�����������������<���