Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/__pycache__/test_descr.cpython-34.pyc

�
g f?��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
Gdd�dej�ZGdd�dej�ZGdd	�d	ej�ZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�dej�Zdd�Zedkr�e�ndS)�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).�
OperatorsTestcOs�tjj|||�idd6dd6dd6dd6d	d
6dd6dd
6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6|_xSt|jj��D]<\}}|j�r�|d%}n
d&|}||j|<q�Widd'6dd(6d)d)6d*d+6d,d,6d-d-6|_xSt|jj��D]<\}}|j�rh|d.}n
d/|}||j|<qCWdS)0N�+�add�-�sub�*�mul�/�truedivz//�floordiv�divmodz**�powz<<�lshiftz>>�rshift�&�and�^�xor�|�orZcmp�<�ltz<=�lez==�eqz!=�ne�>�gtz>=�gez(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�r4�4/opt/alt/python34/lib64/python3.4/test/test_descr.pyr)sL
"


"

zOperatorsTest.__init__zlen(a)�__len__c	Cs�i|d6}|jt||�|�t|�}t||�}x ||jkrc|jd}qDW|jt|d|�|j|�|j||�|�t||�}|j|�|�dS)N�ar�im_func)�assertEqual�eval�type�getattr�__dict__�	__bases__)	r/r7�resr3�meth�d�t�m�bmr4r4r5�	unop_testAs
#zOperatorsTest.unop_testza+b�__add__c
Cs�i|d6|d6}|jt||�|�t|�}t||�}x ||jkrj|jd}qKW|jt|d|�|j|�|j|||�|�t||�}	|j|	|�|�dS)Nr7�brr8)r9r:r;r<r=r>)
r/r7rGr?r3r@rArBrCrDr4r4r5�
binop_testQs#zOperatorsTest.binop_testza[b:c]�__getitem__cCs�i|d6|d6|d6}|jt||�|�t|�}t||�}	x ||jkrq|jd}qRW|jt|	d|	�|j|�|j|	|t||��|�t||�}
|j|
t||��|�dS)Nr7rG�crr8)r9r:r;r<r=r>�slice)r/r7rGrJr?r3r@rArBrCrDr4r4r5�sliceop_test`s#"zOperatorsTest.sliceop_testza+=b�__iadd__c
Csit|�d6|d6}t||�|j|d|�t|�}t||�}x ||jkrx|jd}qYW|jt|d|�|j|�t|�|d<||d|�|j|d|�t|�|d<t|d|�}	|	|�|j|d|�dS)Nr7rGrr8)r�execr9r;r<r=r>)
r/r7rGr?�stmtr@rArBrCrDr4r4r5�
setop_testns
#
zOperatorsTest.setop_testza[b]=c�__setitem__cCs#it|�d6|d6|d6}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)Nr7rGrJrr8)rrNr9r;r<r=r>)r/r7rGrJr?rOr@rArBrCrDr4r4r5�set2op_test�s!
#
zOperatorsTest.set2op_testza[b:c]=dcCs<it|�d6|d6|d6|d6}t||�|j|d|�t|�}	x ||	jkrw|	jd}	qXWt|	|�}
|jt|
d|
�|	j|�t|�|d<|
|dt||�|�|j|d|�t|�|d<t|d|�}|t||�|�|j|d|�dS)Nr7rGrJrArr8)rrNr9r;r=r>r<rK)r/r7rGrJrAr?rOr@Z
dictionaryrBrCrDr4r4r5�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+brF�zb in a�__contains__�rza[b]rIza[b:c]za+=brMza*=b�__imul__zlen(a)r6za*b�__mul__zb*a�__rmul__za[b]=crQ��za[b:c]=d)rHrLrPrErRrS)r/r4r4r5�
test_lists�s%"""+%111(6zOperatorsTest.test_listscCs|jidd6dd6dddd�|jidd6dd6dddd�|jidd6dd6dddd	�idd6dd6}g}x't|j��D]}|j|�q�Wg}x!t|�D]}|j|�q�W|j||�g}x!|j�D]}|j|�qW|j||�g}x$tj|�D]}|j|�qCW|j||�idd6dd6}|j|dd
d�|jt	t
|�i�|�|jt	|j�i�|�|jidd6dd6ddidd6dd6dd6dd
�dS)NrUrTrXrVzb in arWrza[b]rIzlen(a)r6za[b]=crQ)
rHr+�keys�append�iterr9�__iter__�dictrEr:�repr�__repr__rR)r/rA�l1�i�lr4r4r5�
test_dicts�s2'''8zOperatorsTest.test_dictscCsi|d6|d6}xp|jj�D]_\}}||kr$d|}t||�r�t||�}|j|||||�q�q$q$Wxst|jj��D]\\}}||kr�d|}t||�r�t||�}|j||||�q�q�q�WdS)Nr7rGz__%s__)r*r,�hasattrr:rHr+r.rE)r/r7rG�skiprcr2r3r?r4r4r5�number_operators�s
#"
zOperatorsTest.number_operatorscCs�|jdd�|jdj�d�|jdj�d�Gdd�dt�}|j|d�d�y|�dWntk
r�YnX|jd	�dS)
N�drVrTrc@seZdZdd�ZdS)z"OperatorsTest.test_ints.<locals>.CcSstS)N)�NotImplemented)r/�otherr4r4r5rF�sz*OperatorsTest.test_ints.<locals>.C.__add__N)�__name__�
__module__�__qualname__rFr4r4r4r5�C�srsr\�z+NotImplemented should have caused TypeError)rlr9�__bool__r%�	TypeError�fail)r/rsr4r4r5�	test_ints�s
zOperatorsTest.test_intscCs|jdd�dS)NgY@g@)rl)r/r4r4r5�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@rkrrrrr%r&r
r�modc@s7eZdZdgZdd�Zdd�ZeZdS)z,OperatorsTest.test_complexes.<locals>.Number�precc_s+tj||�}|jdd�|_|S)Nr{�)�complex�__new__�getr{)�clsr0�kwds�resultr4r4r5r~sz4OperatorsTest.test_complexes.<locals>.Number.__new__cSsc|j}|jdkr)d||jfS|jdkrId||jfSd||j||jfS)Ngz%.*gz%.*gjz(%.*g+%.*gj))r{�imag�real)r/r{r4r4r5re	s	z5OperatorsTest.test_complexes.<locals>.Number.__repr__N)rprqrr�	__slots__r~re�__str__r4r4r4r5�Numbers	r�g��Q�	@r{r]z3.14rUz3.1gPm@z234.5r|)rlr}r9rdr{)r/r�r7r4r4r5�test_complexes�szOperatorsTest.test_complexescCsE|jtjdd�tdd��|jtjdd�d�dS)Ny@g@g@rTg@g�)r9r}�__radd__r&�__rsub__)r/r4r4r5�test_explicit_reverse_methodss%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)rh�memo�spamr4r4r5r�(sz/OperatorsTest.test_spam_lists.<locals>.spamlistrTrUza+brFrVzb in arWrXza[b]rIza[b:c]za+=brMza*=brYzlen(a)r6za*brZzb*ar[za[b]=crQr\r]za[b:c]=dc@seZdZdd�ZdS)z(OperatorsTest.test_spam_lists.<locals>.CcSsdS)NrTr4)r/r4r4r5�fooEsz,OperatorsTest.test_spam_lists.<locals>.C.fooN)rprqrrr�r4r4r4r5rsDsrsrm�*)�copyr��_deepcopy_dispatchr�rHrLrPrErRrSr9r�r`�getstate�setstate)r/r�r�r�rsr7r4r4r5�test_spam_lists#s@0(((006%66-0	

zOperatorsTest.test_spam_listscCsddl}ddl}ddd�}||j|j<|j|idd6dd6�dddd	�|j|idd6dd6�dddd	�|j|idd6dd6�ddd
d�|idd6dd6�}g}x't|j��D]}|j|�q�Wg}x!t|�D]}|j|�qW|j	||�g}x!|j
�D]}|j|�qUW|j	||�g}x0t|i��j
|�D]}|j|�q�W|j	||�idd6dd6}||�}	|j|	ddd
�|j|	t
|�dd�|j|idd6dd6�dd|idd6dd6dd6�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,)rAr�r�Zsd�k�vr4r4r5r�Ss
z/OperatorsTest.test_spam_dicts.<locals>.spamdictrUrTrXrVzb in arWza[b]rIzlen(a)r6zrepr(a)reza[b]=crQc@seZdZdd�ZdS)z(OperatorsTest.test_spam_dicts.<locals>.CcSsdS)NrTr4)r/r4r4r5r�wsz,OperatorsTest.test_spam_dicts.<locals>.C.fooN)rprqrrr�r4r4r4r5rsvsrs�barr�rm)zfoozbar)r�r�r�r�rHr+r_r`rar9rbr;rErdrRr,r�r�r�)r/r�r�r�rArfrgrhZ	straightdZspamdrsr7r4r4r5�test_spam_dictsOsJ---"A
	

zOperatorsTest.test_spam_dictsN)rprqrrr)rErHrLrPrRrSr^rirlrxryr�r�r�impl_detailr�r�r4r4r4r5rs /!,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$�Z�fd%d&�Zejd'�d(d)��Zd*d+�Zejd'�d,d-��Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@dA�Z$e%j&e'j(j)dBkdC�dDdE��Z*ej+dFdG��Z,dHdI�Z-dJdK�Z.dLdM�Z/�fdNdO�Z0dPdQ�Z1dRdS�Z2dTdU�Z3dVdW�Z4dXdY�Z5dZd[�Z6d\d]�Z7d^d_�Z8d`da�Z9dbdc�Z:ddde�Z;dfdg�Z<dhdi�Z=djdk�Z>dldm�Z?dndo�Z@dpdq�ZAdrds�ZBdtdu�ZCdvdw�ZDdxdy�ZEdzd{�ZFd|d}�ZGd~d�ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUejd��d�d���ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZd�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��Zo�S)��ClassPropertiesAndMethodscCs'|jt||�d||f�dS)Nz%r has no attribute %r)�
assertTruerj)r/�objr2r4r4r5�
assertHasAttr�sz'ClassPropertiesAndMethods.assertHasAttrcCs'|jt||�d||f�dS)Nz%r has unexpected attribute %r)�assertFalserj)r/r�r2r4r4r5�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>.CrTcsf|r,�jt|�d�|d|_n|rbx-t|j��D]\}}|||<qEWndS)NrTr)r9�len�stater+r,)�
self_localr7�kwr�r�)r/r4r5r)�sz?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.__init__cSs|j|d�S)Nr)r)r/�keyr4r4r5rI�szBClassPropertiesAndMethods.test_python_dicts.<locals>.C.__getitem__cs-�j|td��tj|||�dS)Nr)�assertIsInstancer;rcrQ)r�r��value)r/r4r5rQ�szBClassPropertiesAndMethods.test_python_dicts.<locals>.C.__setitem__cSs
||_dS)N)r�)r/r�r4r4r5r��sz?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.setstatecSs|jS)N)r�)r/r4r4r5r��sz?ClassPropertiesAndMethods.test_python_dicts.<locals>.C.getstateN���)	rprqrrr�r)rIrQr�r�r4)r/r4r5rs�srsr|r�rTr�rUr�
r���2r�r�)r��
issubclassrcr�r9�assertIs�	__class__r�r�r��range)	r/rArs�a1�a2r7�Nrg�jr4)r/r5�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)Nrm)�
isinstancerK�start�stopr+rI)r/rgr4r4r5rI�szBClassPropertiesAndMethods.test_python_lists.<locals>.C.__getitem__N)rprqrrrIr4r4r4r5rs�srsrrTrUrm�e�f��)rmr�)r+�extendr9)r/rsr7r4r4r5�test_python_lists�s	z+ClassPropertiesAndMethods.test_python_listsc s/Gdd�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�}WdQXGdRd�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��}WdQX|jt��!GdXdD�dDt�|�}WdQXdS)ZNc@s4eZdZdd�Zdd�Zdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSs
d|_dS)Nr)�	_C__state)r/r4r4r5r)�sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.__init__cSs|jS)N)r�)r/r4r4r5r��sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.getstatecSs
||_dS)N)r�)r/r�r4r4r5r��sz<ClassPropertiesAndMethods.test_metaclass.<locals>.C.setstateN)rprqrrr)r�r�r4r4r4r5rs�srs�	metaclassrr�c@seZdZdd�ZdS)z<ClassPropertiesAndMethods.test_metaclass.<locals>._metaclasscSs|S)Nr4)r�r4r4r5�myself�szCClassPropertiesAndMethods.test_metaclass.<locals>._metaclass.myselfN)rprqrrr�r4r4r4r5�
_metaclass�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)rprqrrr4r4r4r5�D�sr�c@seZdZdd�ZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.M1cSs d|d<tj||||�S)NrT�__spam__)r;r~)r�r2�basesrcr4r4r5r~�s
z<ClassPropertiesAndMethods.test_metaclass.<locals>.M1.__new__N)rprqrrr~r4r4r4r5�M1�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rprqrrr4r4r4r5rs�srTc@seZdZdS)z;ClassPropertiesAndMethods.test_metaclass.<locals>._instanceN)rprqrrr4r4r4r5�	_instance�sr�cs4eZdZedd��Z�fdd�ZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.M2cSs.tj|�}||_||_||_|S)N)�objectr~r2r�rc)r�r2r�rcr/r4r4r5r~�s
			z<ClassPropertiesAndMethods.test_metaclass.<locals>.M2.__new__csY��}xI|jD]>}|jd�r.qnt|||j|j||��qW|S)N�__)rc�
startswith�setattr�__get__)r/�itr�)r�r4r5�__call__�s	'z=ClassPropertiesAndMethods.test_metaclass.<locals>.M2.__call__N)rprqrr�staticmethodr~r�r4)r�r4r5�M2�sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSsdS)Nr�r4)r/r4r4r5r��sz8ClassPropertiesAndMethods.test_metaclass.<locals>.C.spamN)rprqrrr�r4r4r4r5rs�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)NrT�_z
_%s__superZ__super)�superr~r�)r�r2r�rcr�)r��	autosuperr4r5r~s
zCClassPropertiesAndMethods.test_metaclass.<locals>.autosuper.__new__)rprqrrr~r4)r�)r�r5r�sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AcSsdS)N�Ar4)r/r4r4r5r@sz8ClassPropertiesAndMethods.test_metaclass.<locals>.A.methN)rprqrrr@r4r4r4r5r�sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BcSsd|jj�S)N�B)�	_B__superr@)r/r4r4r5r@sz8ClassPropertiesAndMethods.test_metaclass.<locals>.B.methN)rprqrrr@r4r4r4r5r�sr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSsd|jj�S)Nrs)�	_C__superr@)r/r4r4r5r@sz8ClassPropertiesAndMethods.test_metaclass.<locals>.C.methN)rprqrrr@r4r4r4r5rssc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DcSsd|jj�S)Nr�)�	_D__superr@)r/r4r4r5r@!sz8ClassPropertiesAndMethods.test_metaclass.<locals>.D.methN)rprqrrr@r4r4r4r5r� sZDCBAc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.EcSsd|jj�S)N�E)Z	_E__superr@)r/r4r4r5r@%sz8ClassPropertiesAndMethods.test_metaclass.<locals>.E.methN)rprqrrr@r4r4r4r5r�$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||<qqWx3|j�D]%\}\}}t||�||<q�Wt�|�j||||�S)NZ_get_r\Z_set_)NN)NN)r,r�r�propertyr�r~)	r�r2r�rc�hitsr��valr�set)r��autopropertyr4r5r~,s zFClassPropertiesAndMethods.test_metaclass.<locals>.autoproperty.__new__)rprqrrr~r4)r�)r�r5r�)sr�c@s(eZdZdd�Zdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AcSs|jS)N)�_A__x)r/r4r4r5�_get_x>sz:ClassPropertiesAndMethods.test_metaclass.<locals>.A._get_xcSs||_dS)N)r�)r/�xr4r4r5�_set_x@sz:ClassPropertiesAndMethods.test_metaclass.<locals>.A._set_xN)rprqrrr�r�r4r4r4r5r�=sr�r|c@seZdZdS)z@ClassPropertiesAndMethods.test_metaclass.<locals>.multimetaclassN)rprqrrr4r4r4r5�multimetaclassHsr�c@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AcSsdS)Nr�r4)r/r4r4r5r�Lsz:ClassPropertiesAndMethods.test_metaclass.<locals>.A._get_xN)rprqrrr�r4r4r4r5r�Ksc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BcSsd|jj�S)Nr�)r�r�)r/r4r4r5r�Osz:ClassPropertiesAndMethods.test_metaclass.<locals>.B._get_xN)rprqrrr�r4r4r4r5r�Nsc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CcSsd|jj�S)Nrs)r�r�)r/r4r4r5r�Rsz:ClassPropertiesAndMethods.test_metaclass.<locals>.C._get_xN)rprqrrr�r4r4r4r5rsQsc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DcSsd|jj�S)Nr�)r�r�)r/r4r4r5r�Usz:ClassPropertiesAndMethods.test_metaclass.<locals>.D._get_xN)rprqrrr�r4r4r4r5r�Tscs(eZdZdZ�fdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.Trcs�jd7_dS)NrT)�counter)r/r0)�Tr4r5r)\sz<ClassPropertiesAndMethods.test_metaclass.<locals>.T.__init__N)rprqrrr�r)r4)r�r4r5r�Zsr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rprqrrr4r4r4r5rs^sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rprqrrr4r4r4r5rsesz5calling object w/o call method should raise TypeErrorc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.Ac_stj||�S)N)r;r~)r0r1r4r4r5r~nsz;ClassPropertiesAndMethods.test_metaclass.<locals>.A.__new__N)rprqrrr~r4r4r4r5r�msc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BN)rprqrrr4r4r4r5r�qsc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rprqrrr4r4r4r5rstsc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)rprqrrr4r4r4r5r�xscs=eZdZe��fdd��Zedd��Z�S)z7ClassPropertiesAndMethods.test_metaclass.<locals>.AMetacs&�jd�t�j||||�S)N�AMeta)r`r�r~)�mclsr2r��ns)r��	new_callsr4r5r~s
z?ClassPropertiesAndMethods.test_metaclass.<locals>.AMeta.__new__cSsiS)Nr4)r�r2r�r4r4r5�__prepare__�szCClassPropertiesAndMethods.test_metaclass.<locals>.AMeta.__prepare__)rprqrrr�r~�classmethodr�r4)r�)r�r5r�~sr�csCeZdZe��fdd��Ze�fdd��Z�S)z7ClassPropertiesAndMethods.test_metaclass.<locals>.BMetacs&�jd�t�j||||�S)N�BMeta)r`r�r~)r�r2r�r�)r�r�r4r5r~�s
z?ClassPropertiesAndMethods.test_metaclass.<locals>.BMeta.__new__cs#t�j||�}d|d<|S)NT�BMeta_was_here)r�r�)r�r2r�r�)r�r4r5r��s
zCClassPropertiesAndMethods.test_metaclass.<locals>.BMeta.__prepare__)rprqrrr�r~r�r�r4)r�)r�r5r��sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AN)rprqrrr4r4r4r5r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BN)rprqrrr4r4r4r5r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rprqrrr4r4r4r5rs�sr�c@seZdZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.C2N)rprqrrr4r4r4r5�C2�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)rprqrrr4r4r4r5r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.EN)rprqrrr4r4r4r5r��scs�S)Nr4)r0r1)�markerr4r5�func�sz6ClassPropertiesAndMethods.test_metaclass.<locals>.funcc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.XN)rprqrrr4r4r4r5�X�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.YN)rprqrrr4r4r4r5�Y�sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.ZN)rprqrrr4r4r4r5�Z�sr�cs=eZdZ��fdd�Ze�fdd��Z�S)z:ClassPropertiesAndMethods.test_metaclass.<locals>.ANotMetacs�jd�t�j|�S)N�ANotMeta)r`r�r~)r�r0r1)r�r�r4r5r~�s
zBClassPropertiesAndMethods.test_metaclass.<locals>.ANotMeta.__new__cs�jd�iS)Nr�)r`)r�r2r�)�
prepare_callsr4r5r��s
zFClassPropertiesAndMethods.test_metaclass.<locals>.ANotMeta.__prepare__)rprqrrr~r�r�r4)r�r�)r�r5r��sr�cs@eZdZ��fdd�Ze��fdd��Z�S)z:ClassPropertiesAndMethods.test_metaclass.<locals>.BNotMetacs�jd�t�j|�S)N�BNotMeta)r`r�r~)r�r0r1)r�r�r4r5r~�s
zBClassPropertiesAndMethods.test_metaclass.<locals>.BNotMeta.__new__cs �jd�t�j||�S)Nr�)r`r�r�)r�r2r�)r�r�r4r5r��s
zFClassPropertiesAndMethods.test_metaclass.<locals>.BNotMeta.__prepare__)rprqrrr~r�r�r4)r�r�)r�r5r��sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.AN)rprqrrr4r4r4r5r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.BN)rprqrrr4r4r4r5r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.CN)rprqrrr4r4r4r5rs�sc@seZdZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.C2N)rprqrrr4r4r4r5r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.DN)rprqrrr4r4r4r5r��sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.EN)rprqrrr4r4r4r5r�sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.FN)rprqrrr4r4r4r5�F
sr�c@seZdZdS)z4ClassPropertiesAndMethods.test_metaclass.<locals>.F2N)rprqrrr4r4r4r5�F2sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.XN)rprqrrr4r4r4r5r�sc@seZdZdS)z3ClassPropertiesAndMethods.test_metaclass.<locals>.XN)rprqrrr4r4r4r5r� si�)r;r9r�r�r�r�r�r�r2r��assertInrcr�r@r�r�r�r�rvrwr��clearr=�assertRaisesr%)r/rsr7r�r�rAr�rJr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r4)r�r�r�r�r�r�r�r5�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))r/r2)�MTr4r5r)(szEClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__init__cs#�jd|f��j||�S)Nr<)r`�__getattribute__)r/r2)r��logr4r5r�*szMClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__getattribute__cs-�jd||f��j|||�dS)Nr�)r`�__setattr__)r/r2r�)r�r�r4r5r-szHClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__setattr__cs'�jd|f��j||�dS)N�delattr)r`�__delattr__)r/r2)r�r�r4r5r0szHClassPropertiesAndMethods.test_module_subclasses.<locals>.MM.__delattr__N)rprqrrr)r�rrr4)r�r�r4r5�MM'srr7r|r�r�r<rc@seZdZdS)z@ClassPropertiesAndMethods.test_module_subclasses.<locals>.ModuleN)rprqrrr4r4r4r5�Module=srz?inheriting from ModuleType and str at the same time should fail)zsetattr�foor|)zgetattrr)zdelattrr)	r;�sysr�r9�types�
ModuleType�strrvrw)r/rr7r�rr4)r�r�r5�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�)r/r4r4r5r)HszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.__init__cSs|jS)N)r�)r/r4r4r5r�JszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.getstatecSs
||_dS)N)r�)r/r�r4r4r5r�LszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.C.setstateN)rprqrrr)r�r�r4r4r4r5rsGsrsrr�cs"eZdZ�fdd�ZdS)z>ClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Dcs$ti�j|��j|�dS)N)r;r))r/)rsr4r5r)SszGClassPropertiesAndMethods.test_multiple_inheritance.<locals>.D.__init__N)rprqrrr)r4)rsr4r5r�Rsr��world�helloc@s(eZdZdd�Zdd�ZdS)zAClassPropertiesAndMethods.test_multiple_inheritance.<locals>.NodecSst|j��S)N)r%r�)r/r4r4r5�__int__bszIClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Node.__int__cSsdS)NZ23r4)r/r4r4r5r�dszEClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Node.fooN)rprqrrr
r�r4r4r4r5�Nodeasrc@seZdZdd�ZdS)zAClassPropertiesAndMethods.test_multiple_inheritance.<locals>.FragcSsdS)NZ42r4)r/r4r4r5r�gszEClassPropertiesAndMethods.test_multiple_inheritance.<locals>.Frag.fooN)rprqrrr�r4r4r4r5�Fragfsr�r�)zhellor)r�r9r�r�rcr+r_r,�__mro__r
r%)r/r7r�rArrr4)rsr5�test_multiple_inheritanceEs*	
	

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_inheritence.<locals>.AcSsdS)Nr�r4)r/r4r4r5r�qszBClassPropertiesAndMethods.test_diamond_inheritence.<locals>.A.spamN)rprqrrr�r4r4r4r5r�psr�c@s(eZdZdd�Zdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritence.<locals>.BcSsdS)Nr�r4)r/r4r4r5�bootszAClassPropertiesAndMethods.test_diamond_inheritence.<locals>.B.boocSsdS)Nr�r4)r/r4r4r5r�uszBClassPropertiesAndMethods.test_diamond_inheritence.<locals>.B.spamN)rprqrrrr�r4r4r4r5r�ssr�c@seZdZdd�ZdS)z=ClassPropertiesAndMethods.test_diamond_inheritence.<locals>.CcSsdS)Nrsr4)r/r4r4r5ryszAClassPropertiesAndMethods.test_diamond_inheritence.<locals>.C.booN)rprqrrrr4r4r4r5rsxsrsc@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritence.<locals>.DN)rprqrrr4r4r4r5r�|sr�c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritence.<locals>.EN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritence.<locals>.FN)rprqrrr4r4r4r5r��sr�z#expected MRO order disagreement (F)c@seZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritence.<locals>.GN)rprqrrr4r4r4r5�G�srz#expected MRO order disagreement (G))r�r9r�rrrvrw)r/r�r�rsr�r�r�rr4r4r5�test_diamond_inheritencens4""


z2ClassPropertiesAndMethods.test_diamond_inheritencec	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)rprqrrr4r4r4r5r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.BN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.CN)rprqrrr4r4r4r5rs�srsc@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.XN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.YN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z<ClassPropertiesAndMethods.test_ex5_from_c3_switch.<locals>.ZN)rprqrrr4r4r4r5r��sr�)r�r9r)r/r�r�rsr�r�r�r4r4r5�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)rprqrrr4r4r4r5�Boat�src@seZdZdS)z<ClassPropertiesAndMethods.test_monotonicity.<locals>.DayBoatN)rprqrrr4r4r4r5�DayBoat�src@seZdZdS)z>ClassPropertiesAndMethods.test_monotonicity.<locals>.WheelBoatN)rprqrrr4r4r4r5�	WheelBoat�src@seZdZdS)z?ClassPropertiesAndMethods.test_monotonicity.<locals>.EngineLessN)rprqrrr4r4r4r5�
EngineLess�src@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.SmallMultihullN)rprqrrr4r4r4r5�SmallMultihull�src@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.PedalWheelBoatN)rprqrrr4r4r4r5�PedalWheelBoat�src@seZdZdS)zCClassPropertiesAndMethods.test_monotonicity.<locals>.SmallCatamaranN)rprqrrr4r4r4r5�SmallCatamaran�src@seZdZdS)z;ClassPropertiesAndMethods.test_monotonicity.<locals>.PedaloN)rprqrrr4r4r4r5�Pedalo�sr)r�r9r)	r/rrrrrrrrr4r4r5�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)rprqrrr4r4r4r5�Pane�sr c@seZdZdS)zKClassPropertiesAndMethods.test_consistency_with_epg.<locals>.ScrollingMixinN)rprqrrr4r4r4r5�ScrollingMixin�sr!c@seZdZdS)zIClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditingMixinN)rprqrrr4r4r4r5�EditingMixin�sr"c@seZdZdS)zKClassPropertiesAndMethods.test_consistency_with_epg.<locals>.ScrollablePaneN)rprqrrr4r4r4r5�ScrollablePane�sr#c@seZdZdS)zIClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditablePaneN)rprqrrr4r4r4r5�EditablePane�sr$c@seZdZdS)zSClassPropertiesAndMethods.test_consistency_with_epg.<locals>.EditableScrollablePaneN)rprqrrr4r4r4r5�EditableScrollablePane�sr%)r�r9r)r/r r!r"r#r$r%r4r4r5�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||�Wni|k
ry}zItj�rgt|�j|�sg�jdt|�|f�qgnWYdd}~XnX�jd|�dS)NzMessage %r, expected %rzExpected %s)r�check_impl_detailr	r�rw)�exc�expected�callabler0�msg)r/r4r5�raises�s	-z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.raisesc@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.AN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.BN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement.<locals>.CN)rprqrrr4r4r4r5rs�srszduplicate base class Ar�c@seZdZdS)zCClassPropertiesAndMethods.test_mro_disagreement.<locals>.GridLayoutN)rprqrrr4r4r4r5�
GridLayout�sr-c@seZdZdS)zGClassPropertiesAndMethods.test_mro_disagreement.<locals>.HorizontalGridN)rprqrrr4r4r4r5�HorizontalGrid�sr.c@seZdZdS)zEClassPropertiesAndMethods.test_mro_disagreement.<locals>.VerticalGridN)rprqrrr4r4r4r5�VerticalGrid�sr/c@seZdZdS)z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.HVGridN)rprqrrr4r4r4r5�HVGrid�sr0c@seZdZdS)z?ClassPropertiesAndMethods.test_mro_disagreement.<locals>.VHGridN)rprqrrr4r4r4r5�VHGrid�sr1ZConfusedGrid)r�rvr;)r/Zmro_err_msgr,r�r�rsr-r.r/r0r1r4)r/r5�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
idd6�dS)Nr�r|z1object() should not allow setting a foo attributer=c@seZdZdS)z:ClassPropertiesAndMethods.test_object_class.<locals>.CdictN)rprqrrr4r4r4r5�Cdict�sr3rT)r�r9r�r;�assertNotEqualr�r��AttributeErrorrvrwr=)r/r7rGr3r�r4r4r5�test_object_class�s$		

		z+ClassPropertiesAndMethods.test_object_classcFsOGdd�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||�nG�fd5d6�d6t�}tjd7��}|�}~WdQX�j|j�d8�Gd9d:�d:t�}�jt��|�`WdQXdS)<Nc@seZdZgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C0N)rprqrrr�r4r4r4r5�C0sr7r=r�c@seZdZdgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C1r7N)rprqrrr�r4r4r4r5�C1sr8r7rTc@seZdZdddgZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C3r7rGrJN)rprqrrr�r4r4r4r5�C3sr9rGrJrUrVc@s7eZdZdZdgZdd�Zdd�ZdS)z0ClassPropertiesAndMethods.test_slots.<locals>.C4zValidate name mangling�__acSs
||_dS)N)�_C4__a)r/r�r4r4r5r)#sz9ClassPropertiesAndMethods.test_slots.<locals>.C4.__init__cSs|jS)N)r;)r/r4r4r5r%sz4ClassPropertiesAndMethods.test_slots.<locals>.C4.getN)rprqrr�__doc__r�r)rr4r4r4r5�C4 s	r=r\r:r]z$Double underscored names not mangledc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CN)rprqrrr�r4r4r4r5rs4srsz[None] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Czfoo barN)rprqrrr�r4r4r4r5rs;sz['foo bar'] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CZfoobarN)rprqrrr�r4r4r4r5rsBsz['foo\0bar'] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.C�1N)rprqrrr�r4r4r4r5rsIsz['1'] slots not caughtc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CrtN)rprqrrr�r4r4r4r5rsPsz[''] slots not caughtc@s"eZdZddddgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Cr7Za_bZ_aZA0123456789ZN)rprqrrr�r4r4r4r5rsVsc@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.C�abcN)rprqrrr�r4r4r4r5rs\sc@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Cr?N)rprqrrr�r4r4r4r5rsdsr�cseZdZ�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.CN)rprqrrr�r4)�slotsr4r5rslsrc@seZdZed�gZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.C�N)rprqrr�chrr�r4r4r4r5rstszhr(128)] slots not caughtcs:eZdZdZ�fdd�Z�fdd�ZdS)z5ClassPropertiesAndMethods.test_slots.<locals>.Countedrcs�jd7_dS)NrT)r�)r/)�Countedr4r5r)~sz>ClassPropertiesAndMethods.test_slots.<locals>.Counted.__init__cs�jd8_dS)NrT)r�)r/)rCr4r5�__del__�sz=ClassPropertiesAndMethods.test_slots.<locals>.Counted.__del__N)rprqrrr�r)rDr4)rCr4r5rC|srCc@seZdZdddgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Cr7rGrJN)rprqrrr�r4r4r4r5rs�sc@seZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.DN)rprqrrr4r4r4r5r��sr�c@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.E�eN)rprqrrr�r4r4r4r5r��sr�c@seZdZddgZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Fr7rGN)rprqrrr�r4r4r4r5r��sr��get_objectsc@seZdZdd�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.GcSsdS)NFr4)r/ror4r4r5�__eq__�sz6ClassPropertiesAndMethods.test_slots.<locals>.G.__eq__N)rprqrrrGr4r4r4r5r�srr�cs:eZdZddgZdd�Z�fdd�ZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Hr7rGcSsd|_d|_dS)NrTrU)r7rG)r/r4r4r5r)�s	z8ClassPropertiesAndMethods.test_slots.<locals>.H.__init__cs*�j|jd��j|jd�dS)NrTrU)r9r7rG)�self_)r/r4r5rD�sz7ClassPropertiesAndMethods.test_slots.<locals>.H.__del__N)rprqrrr�r)rDr4)r/r4r5�H�srI�stderrrtc@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots.<locals>.Xr7N)rprqrrr�r4r4r4r5r��sr�)zfoozbar)r�r�r7r9rGrJrZ_ClassPropertiesAndMethods__ar5rwrvr?r�r�r;r	�UnicodeEncodeErrorr�r�
gc_collect�zrErj�gcr�rFr�Zcaptured_output�getvaluer�)r/r7r�r8r9r=rsrJr�r�r��sr�gZorig_objectsrgZnew_objectsrI�hr�r4)rCr/r@r5�
test_slots�s								












						
	
	
	
	
			z$ClassPropertiesAndMethods.test_slotsc
Cs�Gdd�dt�}|�}|j|d�|j|d�d|_|j|jidd6�Gdd�dt�}|�}|j|d�|j|d�y
d|_Wntk
r�YnX|jd	�Gd
d�d||�}|�}|j|d�|j|d�d|_|j|jidd6�Gdd
�d
||�}|�}|j|d�|j|d�d|_|j|jidd6�dS)Nc@seZdZdgZdS)z7ClassPropertiesAndMethods.test_slots_special.<locals>.Dr=N)rprqrrr�r4r4r4r5r��sr�r=�__weakref__r�r�c@seZdZdgZdS)z7ClassPropertiesAndMethods.test_slots_special.<locals>.WrTN)rprqrrr�r4r4r4r5�W�srUz!shouldn't be allowed to set a.fooc@seZdZgZdS)z8ClassPropertiesAndMethods.test_slots_special.<locals>.C1N)rprqrrr�r4r4r4r5r8�sr8c@seZdZgZdS)z8ClassPropertiesAndMethods.test_slots_special.<locals>.C2N)rprqrrr�r4r4r4r5r��sr�)r�r�r�r�r9r=r5rw)r/r�r7rUr8r�r4r4r5�test_slots_special�s6			


				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>.MyABCr7N)rprqrrr�r4r4r4r5�MyABC�srWr�c@seZdZdS)zBClassPropertiesAndMethods.test_slots_descriptor.<locals>.UnrelatedN)rprqrrr4r4r4r5�	Unrelated�srXrV)	r?�ABCMetar��registerr�r�rvr7�__set__)r/r?rWrX�ur4r4r5�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)rprqrrr4r4r4r5r�sr�c@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.EN)rprqrrr4r4r4r5r�sr�c@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.FN)rprqrrr4r4r4r5r�sr�rTc@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.CN)rprqrrr4r4r4r5rs
srs�foobarrUcSsdS)Nr�r4)r/r4r4r5�<lambda>sz9ClassPropertiesAndMethods.test_dynamics.<locals>.<lambda>r�cSsdS)NzC()r4)r/r4r4r5r_szC()cSsdS)Nrmr4)r/r4r4r5r_srmr�cSs|dkrdSt�dS)Nr�)r5)r/r2r4r4r5�	mygetattrsz:ClassPropertiesAndMethods.test_dynamics.<locals>.mygetattrr|cSs(|dkrt�ntj|||�S)Nr�)r5r�r)r/r2r�r4r4r5�	mysetattr#s	z:ClassPropertiesAndMethods.test_dynamics.<locals>.mysetattrznot spamzexpected AttributeErrorc@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.DN)rprqrrr4r4r4r5r�/sc@seZdZdS)z2ClassPropertiesAndMethods.test_dynamics.<locals>.IN)rprqrrr4r4r4r5�I6srbr7ZaarVr]c@seZdZdS)zAClassPropertiesAndMethods.test_dynamics.<locals>.dynamicmetaclassN)rprqrrr4r4r4r5�dynamicmetaclass?srcc@seZdZdS)z:ClassPropertiesAndMethods.test_dynamics.<locals>.someclassN)rprqrrr4r4r4r5�	someclassAsrdr�)r�r�r9r�r^�methodrerdr
r%�__getattr__r��newrr5rwr;r4)r/r�r�r�rsr7r`rarArbrcrdr4r4r5�
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)rprqrrr4r4r4r5rsHsrsz5inheritance from both list and dict should be illegalc@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CN)rprqrrr4r4r4r5rsPsz+inheritance from non-type should be illegalc@seZdZdS)z6ClassPropertiesAndMethods.test_errors.<locals>.ClassicN)rprqrrr4r4r4r5�ClassicVsric@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CN)rprqrrr4r4r4r5rsZsz,inheritance from CFunction should be illegalc@seZdZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CrTN)rprqrrr�r4r4r4r5rsbsz__slots__ = 1 should be illegalc@seZdZdgZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.CrTN)rprqrrr�r4r4r4r5rsjsz!__slots__ = [1] should be illegalc@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.M1N)rprqrrr4r4r4r5r�qsr�c@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.M2N)rprqrrr4r4r4r5r�ssr�c@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.A1N)rprqrrr4r4r4r5�A1usrjr�c@seZdZdS)z1ClassPropertiesAndMethods.test_errors.<locals>.A2N)rprqrrr4r4r4r5�A2wsrkc@seZdZdS)z0ClassPropertiesAndMethods.test_errors.<locals>.BN)rprqrrr4r4r4r5r�zsr�z5finding the most derived metaclass should have failed)r+rcrvrwr�r;r�)r/rsrir�r�rjrkr�r4r4r5�test_errorsEsF



 






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id	d6�|`
|j|d�dS)
Nc@s(eZdZdd�Zee�ZdS)z6ClassPropertiesAndMethods.test_classmethods.<locals>.CcWs|S)Nr4)r7r4r4r5r��sz:ClassPropertiesAndMethods.test_classmethods.<locals>.C.fooN)rprqrrr�r��goor4r4r4r5rs�srsrTc@seZdZdS)z6ClassPropertiesAndMethods.test_classmethods.<locals>.DN)rprqrrr4r4r4r5r��sr�cSs
||fS)Nr4)r��argr4r4r5�f�sz6ClassPropertiesAndMethods.test_classmethods.<locals>.frr�r�z)classmethod shouldn't accept keyword argsr�)r�r9rmr�r�r�r%�__self__r�r�rvrwr=r�r�)	r/rsrJr�rAroZffr@�cm)r�r4r5�test_classmethods�sF		"(%""

	z+ClassPropertiesAndMethods.test_classmethodsz"the module 'xxsubtype' is internalcCs�ddl}d
}idd6}|jj||�\}}}|j||j�|j||�|j||�|j�j||�\}}}|j||j�|j||�|j||�|jjd}||j||�\}}	}
|j||j�|j|	|�|j|
|�Gdd	�d	|j�}||||�\}}	}
|j||�|j|	|�|j|
|�|jt��|�WdQX|jt��||j��WdQX|jt��|t�WdQXdS)NrrTrUrV�{r?�	classmethc@seZdZdS)zAClassPropertiesAndMethods.test_classmethods_in_c.<locals>.SubSpamN)rprqrrr4r4r4r5�SubSpam�sru)rTrUrV)r�r�rtr9r=r�rvr+)r/r�r7rAr�r��d1Zspam_cmZx2r��d2rur4r4r5�test_classmethods_in_c�s6
!
z0ClassPropertiesAndMethods.test_classmethods_in_ccCsqGdd�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|jidd6�|`|j|d�dS)Nc@s(eZdZdd�Zee�ZdS)z7ClassPropertiesAndMethods.test_staticmethods.<locals>.CcWs|S)Nr4)r7r4r4r5r��sz;ClassPropertiesAndMethods.test_staticmethods.<locals>.C.fooN)rprqrrr�r�rmr4r4r4r5rs�srsrTc@seZdZdS)z7ClassPropertiesAndMethods.test_staticmethods.<locals>.DN)rprqrrr4r4r4r5r��sr�r�r�)rT)rT)rT)rT)r�r9rmr�r�r=r�r�)r/rsrJr�rAZsmr4r4r5�test_staticmethods�s$		"	z,ClassPropertiesAndMethods.test_staticmethodscCs�ddl}d}idd6}|jj||�\}}}|j|d�|j||�|j||�|j�j||�\}}}|j|d�|j||�|j||�dS)NrrTrUrVrsr?)rTrUrV)r�r�Z
staticmethr9)r/r�r7rAr�r�rvrwr4r4r5�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)Nr4)r7r4r4r5r��sz5ClassPropertiesAndMethods.test_classic.<locals>.C.fooN)rprqrrr�r�rmr4r4r4r5rs�srsrTc@seZdZdS)z1ClassPropertiesAndMethods.test_classic.<locals>.DN)rprqrrr4r4r4r5r�sr�cseZdZ�jZdS)z1ClassPropertiesAndMethods.test_classic.<locals>.EN)rprqrrr�r4)rsr4r5r�	sr�z<bound method )r9rmr��__func__r�rdr�r�)r/rJr�rAr�r4)rsr5�test_classic�s		"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)r/rr�Zdeleter4r4r5r)s		zNClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__init__cSs
|j|�S)N)r})r/r�r;r4r4r5r�szMClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__get__cSs|j||�S)N)r~)r/r�r�r4r4r5r[szMClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__set__cSs
|j|�S)N)r)r/r�r4r4r5�
__delete__szPClassPropertiesAndMethods.test_compattr.<locals>.C.computed_attribute.__delete__)rprqrrr)r�r[r�r4r4r4r5�computed_attributesr�cSs
d|_dS)Nr)�_C__x)r/r4r4r5r)sz;ClassPropertiesAndMethods.test_compattr.<locals>.C.__init__cSs|j}|d|_|S)NrT)r�)r/r�r4r4r5Z__get_xs	
z:ClassPropertiesAndMethods.test_compattr.<locals>.C.__get_xcSs
||_dS)N)r�)r/r�r4r4r5Z__set_x"sz:ClassPropertiesAndMethods.test_compattr.<locals>.C.__set_xcSs
|`dS)N)r�)r/r4r4r5Z
__delete_x$sz=ClassPropertiesAndMethods.test_compattr.<locals>.C.__delete_xN)
rprqrrr�r�r)Z	_C__get_xZ	_C__set_xZ_C__delete_xr�r4r4r4r5rssrsrrTr��r�)r�r9r�r�)r/rsr7r4r4r5�
test_compattrs		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)NrT)r+r~r�)r�r/r4r4r5r~3s	z:ClassPropertiesAndMethods.test_newslots.<locals>.C.__new__cSs|jd|_dS)NrU)r�)r/r4r4r5r)7sz;ClassPropertiesAndMethods.test_newslots.<locals>.C.__init__N)rprqrrr~r)r4r4r4r5rs2srsrVc@seZdZdS)z2ClassPropertiesAndMethods.test_newslots.<locals>.DN)rprqrrr4r4r4r5r�<sr�)r+r9r�r�)r/rsr7r�rGr4r4r5�
test_newslots0s		z'ClassPropertiesAndMethods.test_newslotsc	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�r4)r/r4r4r5roEsz2ClassPropertiesAndMethods.test_altmro.<locals>.A.fN)rprqrrror4r4r4r5r�Dsr�c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.BN)rprqrrr4r4r4r5r�Fsr�c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.CcSsdS)Nrsr4)r/r4r4r5roIsz2ClassPropertiesAndMethods.test_altmro.<locals>.C.fN)rprqrrror4r4r4r5rsHsrsc@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.DN)rprqrrr4r4r4r5r�Jsr�c@seZdZdd�ZdS)z?ClassPropertiesAndMethods.test_altmro.<locals>.PerverseMetaTypecSstj|�}|j�|S)N)r;�mro�reverse)r��Lr4r4r5r�Qs
zCClassPropertiesAndMethods.test_altmro.<locals>.PerverseMetaType.mroN)rprqrrr�r4r4r4r5�PerverseMetaTypePsr�c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)rprqrrr4r4r4r5r�Usr�r�c@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_altmro.<locals>._metaclasscSs
|ttgS)N)rcr�)r/r4r4r5r�\sz=ClassPropertiesAndMethods.test_altmro.<locals>._metaclass.mroN)rprqrrr�r4r4r4r5r�[sr�c@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)rprqrrr4r4r4r5r�^sr]r\zdevious mro() return not caughtc@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_altmro.<locals>._metaclasscSsdgS)NrTr4)r/r4r4r5r�osz=ClassPropertiesAndMethods.test_altmro.<locals>._metaclass.mroN)rprqrrr�r4r4r4r5r�nsc@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)rprqrrr4r4r4r5r�qsz!non-class mro() return not caughtc@seZdZdd�ZdS)z9ClassPropertiesAndMethods.test_altmro.<locals>._metaclasscSsdS)NrTr4)r/r4r4r5r�zsz=ClassPropertiesAndMethods.test_altmro.<locals>._metaclass.mroN)rprqrrr�r4r4r4r5r�ysc@seZdZdS)z0ClassPropertiesAndMethods.test_altmro.<locals>.XN)rprqrrr4r4r4r5r�|sz$non-sequence mro() return not caught)	r�r9r�rror;r~rvrw)	r/r�r�rsr�r�r�r�r�r4r4r5�test_altmroBs>%"%%

 

 
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)rprqrrr<r4r4r4r5r��sr�csdeZdZdd�Z�fdd�Z�fdd�Zdd�Zd	d
�Zdd�Zd
S)z5ClassPropertiesAndMethods.test_overloading.<locals>.CcSs |dkrd|fSt�dS)Nr�r<)r5)r/r2r4r4r5rf�s
zAClassPropertiesAndMethods.test_overloading.<locals>.C.__getattr__cs5|dkr||f|_n�j|||�SdS)Nr�)r�r)r/r2r�)r�r4r5r�szAClassPropertiesAndMethods.test_overloading.<locals>.C.__setattr__cs,|dkr||_n�j||�SdS)Nr�)rr)r/r2)r�r4r5r�szAClassPropertiesAndMethods.test_overloading.<locals>.C.__delattr__cSs
d|fS)N�getitemr4)r/r�r4r4r5rI�szAClassPropertiesAndMethods.test_overloading.<locals>.C.__getitem__cSs||f|_dS)N)�setitem)r/r�r�r4r4r5rQ�szAClassPropertiesAndMethods.test_overloading.<locals>.C.__setitem__cSs
||_dS)N)�delitem)r/r�r4r4r5�__delitem__�szAClassPropertiesAndMethods.test_overloading.<locals>.C.__delitem__N)	rprqrrrfrrrIrQr�r4)r�r4r5rs�srsr<r�r|r��rr�)zgetattr�foo)r�r|)zgetitemr|)r|r�)r�r9r�r�rr�r�rK)r/rsr7r4)r�r5�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�)r/r�r4r4r5r)�sz:ClassPropertiesAndMethods.test_methods.<locals>.C.__init__cSs|jS)N)r�)r/r4r4r5r��sz5ClassPropertiesAndMethods.test_methods.<locals>.C.fooN)rprqrrr)r�r4r4r4r5rs�srsrTcs"eZdZ�jZ�jZdS)z1ClassPropertiesAndMethods.test_methods.<locals>.DN)rprqrrr�rrmr4)rs�c1r4r5r��s	r�rUcseZdZ�jZdS)z1ClassPropertiesAndMethods.test_methods.<locals>.EN)rprqrrr�r4)rsr4r5r��sr�z<bound method )
r�r9r�rrmr{r�rdr�r�)r/r�rwr�r4)rsr�r5�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�i|d 6|d!6fd"tj|t�ifd#|	|t�ifd$||td>�ifd&|
|td?�ifd(||t�i|
d)6fd)||
t�i|d(6fd*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|||�qbWt||||��||���j�d<g|�Gd=d:�d:|�}x*|j�D]\}}t|||�q�Wt|||���j�||��q�WdS)@NcSs|�WdQXdS)Nr4)Zmanagerr4r4r5�run_context�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.run_contextcSs|S)Nr4)r/r4r4r5�iden�szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.idencSsdS)Nshellor4)r/r4r4r5r�szCClassPropertiesAndMethods.test_special_method_lookup.<locals>.hellocSsgS)Nr4)r/r4r4r5�	empty_seq�szGClassPropertiesAndMethods.test_special_method_lookup.<locals>.empty_seqcSsdS)Nrr4)r/r4r4r5�zero�szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.zerocSsdS)Ny�?r4)r/r4r4r5�complex_num�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.complex_numcSs
t�dS)N)�
StopIteration)r/r4r4r5r��szBClassPropertiesAndMethods.test_special_method_lookup.<locals>.stopcSsdS)NTr4)r/�thingr4r4r5�return_true�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.return_truecSs
tt|�S)N)r�r%)r�r4r4r5�
do_isinstance�szKClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_isinstancecSs
tt|�S)N)r�r%)r�r4r4r5�
do_issubclass�szKClassPropertiesAndMethods.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)rprqrrr4r4r4r5�DictSub�sr��hirX)r�rcr9)Zcheckerr�)r/r4r5�do_dict_missing�szMClassPropertiesAndMethods.test_special_method_lookup.<locals>.do_dict_missingcs�j|d�dS)Nr�rX)r9)rHr�)r/r4r5�some_number�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.some_numbercWsdS)Nr4)r0r4r4r5�swallow�szEClassPropertiesAndMethods.test_special_method_lookup.<locals>.swallowcSsdS)Nrr4)r/�specr4r4r5�format_impl�szIClassPropertiesAndMethods.test_special_method_lookup.<locals>.format_impl�	__bytes__�__reversed__�__length_hint__rb�__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})rw�format)r/�attr�testr4r4r5rfszQClassPropertiesAndMethods.test_special_method_lookup.<locals>.Checker.__getattr__cs5|�kr%|jdj|��ntj||�S)Nz __getattribute__ called with {0})rwr�r�r�)r/r�r�)�okr4r5r�
szVClassPropertiesAndMethods.test_special_method_lookup.<locals>.Checker.__getattribute__N)rprqrrrfr�r4)r�r/r4r5�Checkersr�cs.eZdZdd�Z�fdd�ZdS)zJClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescrcSs
||_dS)N)�impl)r/r�r4r4r5r)szSClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescr.__init__cs �jd�|jj||�S)NrT)r`r�r�)r/r��owner)�recordr4r5r�s
zRClassPropertiesAndMethods.test_special_method_lookup.<locals>.SpecialDescr.__get__N)rprqrrr)r�r4)r�r4r5�SpecialDescrsr�c@seZdZdS)zIClassPropertiesAndMethods.test_special_method_lookup.<locals>.MyExceptionN)rprqrrr4r4r4r5�MyExceptionsr�cs"eZdZ�fdd�ZdS)zFClassPropertiesAndMethods.test_special_method_lookup.<locals>.ErrDescrcs
��dS)Nr4)r/r�r�)r�r4r5r�szNClassPropertiesAndMethods.test_special_method_lookup.<locals>.ErrDescr.__get__N)rprqrrr�r4)r�r4r5�ErrDescrsr�c@seZdZdS)z?ClassPropertiesAndMethods.test_special_method_lookup.<locals>.XN)rprqrrr4r4r4r5r�sr�c@seZdZdS)z?ClassPropertiesAndMethods.test_special_method_lookup.<locals>.XN)rprqrrr4r4r4r5r�#srTc@seZdZdS)z?ClassPropertiesAndMethods.test_special_method_lookup.<locals>.XN)rprqrrr4r4r4r5r�+s)z	__class__)z	__bases__)�bytesr��reversedr+r�	getsizeofr}r��mathZfloorZtruncr%Zceil�dir�roundr��	Exceptionr,r�r9r�)r/r�r�rr�r�r�r�r�r�r�r�r�r�r�Zspecialsr�r�r�r2ZrunnerZ	meth_impl�envr�r�r�r4)r�r�r�r/r5�test_special_method_lookup�sp		

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)r/rgr4r4r5rI8sz>ClassPropertiesAndMethods.test_specials.<locals>.C.__getitem__N)rprqrrrIr4r4r4r5rs7srszC object at rrTr�c@seZdZdd�ZdS)z2ClassPropertiesAndMethods.test_specials.<locals>.DcSs*d|kodknr |St�dS)Nrr�)r�)r/rgr4r4r5rIOsz>ClassPropertiesAndMethods.test_specials.<locals>.D.__getitem__N)rprqrrrIr4r4r4r5r�Ns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�)r/r�r4r4r5r)fsz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__init__cSs	|jS)N)r�)r/r4r4r5ruhsz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__bool__cSs
t|j�S)N)�hashr�)r/r4r4r5�__hash__jsz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__hash__cSs
|j|kS)N)r�)r/ror4r4r5rGlsz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__eq__cSs
|j|kS)N)r�)r/ror4r4r5�__ne__nsz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__ne__cSs
|j|kS)N)r�)r/ror4r4r5�__ge__psz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__ge__cSs
|j|kS)N)r�)r/ror4r4r5�__gt__rsz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__gt__cSs
|j|kS)N)r�)r/ror4r4r5�__le__tsz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__le__cSs
|j|kS)N)r�)r/ror4r4r5�__lt__vsz=ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__lt__cSsd|jS)NzProxy:%s)r�)r/r4r4r5r�xsz>ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__str__cSsd|jS)Nz	Proxy(%r))r�)r/r4r4r5rezsz?ClassPropertiesAndMethods.test_specials.<locals>.Proxy.__repr__cSs
||jkS)N)r�)r/r�r4r4r5rW|szCClassPropertiesAndMethods.test_specials.<locals>.Proxy.__contains__N)rprqrrr)rur�rGr�r�r�r�r�r�rerWr4r4r4r5�Proxyesr�zProxy:0zProxy(0)r�r�r�r�)r�r�r4�idr�r9r�ZassertGreaterEqualr	�findrd�assertNotInr�r�)
r/rsr��c2rgr�rvrwr�Zp0Zp1Zp_1Zp10r4r4r5�
test_specials2sp		

		


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)rprqrrr4r4r4r5rs�srsc@seZdZdgZdS)z7ClassPropertiesAndMethods.test_weakrefs.<locals>.NoWeakr�N)rprqrrr�r4r4r4r5�NoWeak�sr�zweak referencez!weakref.ref(no) should be illegalc@seZdZddgZdS)z5ClassPropertiesAndMethods.test_weakrefs.<locals>.Weakr�rTN)rprqrrr�r4r4r4r5�Weak�sr�)
�weakrefr��refr9rrLrvr�r	rw)
r/r�rsrJ�rr��nor+r��yesr4r4r5�
test_weakrefs�s0	
	)
	
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�nWYdd}~Xq�X|jd|�q�WGdd�dt�}|�}yx|D]}	t|	�q_WWntk
r�YnX|jd�dS)Nc@sLeZdZdd�Zdd�Zdd�Zeeeedd�Zd	S)
z4ClassPropertiesAndMethods.test_properties.<locals>.CcSs|jS)N)r�)r/r4r4r5�getx�sz9ClassPropertiesAndMethods.test_properties.<locals>.C.getxcSs
||_dS)N)r�)r/r�r4r4r5�setx�sz9ClassPropertiesAndMethods.test_properties.<locals>.C.setxcSs
|`dS)N)r�)r/r4r4r5�delx�sz9ClassPropertiesAndMethods.test_properties.<locals>.C.delx�doczI'm the x property.N)rprqrrr�r�r�r�r�r4r4r4r5rs�srsr�r�r�rmr<�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)NrTrr4)rPr4r4r5r_�sz=ClassPropertiesAndMethods.test_properties.<locals>.D.<lambda>N)rprqrrr�rIr4r4r4r5r��sr�z,expected ZeroDivisionError from bad property)z__doc__zfgetzfsetzfdel)r�r�r�r9r�r[r�r�r=r�r�r�r�r<r�r�r�r�r�r5r	r�rw�ZeroDivisionError)
r/rsr7�raw�attrsr�r+r�rArgr4r4r5�test_properties�sR		

	*		

z)ClassPropertiesAndMethods.test_propertiesrUz)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 methodrr4)r/r4r4r5�getter�szFClassPropertiesAndMethods.test_properties_doc_attrib.<locals>.E.gettercSsdS)z
setter methodNr4)rHr�r4r4r5�setter�szFClassPropertiesAndMethods.test_properties_doc_attrib.<locals>.E.setterz
getter methodr�N)
rprqrrr�r�r�Zpropr9r<Zprop2r4)r/r4r5r��sr�)r�)r/r�r4)r/r5�test_properties_doc_attrib�sz4ClassPropertiesAndMethods.test_properties_doc_attribcsEyddl�Wntk
r$YnXG�fdd�dt�}dS)NrcseZdZe�j�ZdS)z>ClassPropertiesAndMethods.test_testcapi_no_segfault.<locals>.XN)rprqrrr�Ztest_with_docstring�pr4)�	_testcapir4r5r�sr�)r��ImportErrorr�)r/r�r4)r�r5�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)r/r4r4r5r�sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.C.foocSst|�|_dS)N)r"r�)r/r�r4r4r5r�scSs
|`dS)N)r�)r/r4r4r5r�sN)rprqrrr�r�r�r��deleterr4r4r4r5rs
srsrr�r�r�cs(eZdZ�jjdd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.DcSs#y
|`Wntk
rYnXdS)N)r�r5)r/r4r4r5r�!s

z=ClassPropertiesAndMethods.test_properties_plus.<locals>.D.fooN)rprqrrr�r�r4)rsr4r5r� sr�r�c@sdeZdZedd��Zejdd��Zejdd��Zejddd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.EcSs|jS)N)r�)r/r4r4r5r�.sz=ClassPropertiesAndMethods.test_properties_plus.<locals>.E.foocSs
t�dS)N)�RuntimeError)r/r�r4r4r5r�1scSst|�|_dS)N)r"r�)r/r�r4r4r5r�4sNcSs
|`dS)N)r�)r/r�r4r4r5r�7s)rprqrrr�r�r�r�r4r4r4r5r�-s
r�cs=eZdZ�jjdd��Zejdd��ZdS)z9ClassPropertiesAndMethods.test_properties_plus.<locals>.FcSs
|`dS)N)r�)r/r4r4r5r�Asz=ClassPropertiesAndMethods.test_properties_plus.<locals>.F.foocSstd|�|_dS)Nr)�maxr�)r/r�r4r4r5r�DsN)rprqrrr�r�r�r4)r�r4r5r�@sr�r�ri���i���i����)r�r9r�r<r�r�r�)r/rJr�rArEr�ror4)rsr�r5�test_properties_plus	s6								z.ClassPropertiesAndMethods.test_properties_pluscCs�t�}|j|i�ti�}|j|i�tidd6dd6�}|j|idd6dd6�|j|tt|j����|j|tt|j����tidd6dd6�}|j|tdddd��|j|t|��|j|tidd6dd��|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
rmYnX|jd�dd�|_dd�|_	t|��}|j||j�Gdd�d�}t|dd�|dd�|dd�|dd�g�}|j|idd6dd6�tt
td�tdd���}|j|tdd�td�D���xNd'gd(gfD]:}yt|�Wntk
r�Yq�X|jd"|�q�WdS))NrUrTrGr7�one�twormr�ry�0zno TypeError from dict(%r)zno TypeError from dict({}, {})c@s+eZdZidd6dd6dd6ZdS)zAClassPropertiesAndMethods.test_dict_constructors.<locals>.MappingrUrTrXrVy�?r7N)rprqrrrcr4r4r4r5�Mappingusr�z*no TypeError from dict(incomplete mapping)cSst|jj��S)N)r+rcr_)r/r4r4r5r_�szBClassPropertiesAndMethods.test_dict_constructors.<locals>.<lambda>cSs|j|S)N)rc)r/rgr4r4r5r_�sc@s(eZdZdd�Zdd�ZdS)zJClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntrycSs||_||_dS)N)�first�last)r/r�r�r4r4r5r)�s	zSClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntry.__init__cSst|j|jg�S)N)rar�r�)r/r4r4r5rb�szSClassPropertiesAndMethods.test_dict_constructors.<locals>.AddressBookEntry.__iter__N)rprqrrr)rbr4r4r4r5�AddressBookEntry�sr�ZTimZWarsawZBarryZPetersrXr\cSs g|]}||df�qS)rTr4)�.0rgr4r4r5�
<listcomp>�s	zDClassPropertiesAndMethods.test_dict_constructors.<locals>.<listcomp>�tooshort�too�long�by 1zno ValueError from dict(%r))�tworU)zonerm)rr�)r)r)rrr)rcr9r+r,rarv�
ValueErrorrwr_rI�zipr�)r/rAZbadargr�r�Zbadr4r4r5�test_dict_constructorsLsl	""#"





$)
z0ClassPropertiesAndMethods.test_dict_constructorscsd}|jt�ddg�~xFdddddgddd/idd6t|jfD]}t|�qWWd	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|�junkr/rUy@g@�2�2cSsdd�|D�S)NcSs%g|]}|jd�s|�qS)r�)r�)r�rPr4r4r5r�s	zKClassPropertiesAndMethods.test_dir.<locals>.interesting.<locals>.<listcomp>r4)Zstringsr4r4r5�interesting�sz7ClassPropertiesAndMethods.test_dir.<locals>.interestingc@s"eZdZdZdd�ZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.CrTcSsdS)Nr4)r/r4r4r5�Cmethod�sz5ClassPropertiesAndMethods.test_dir.<locals>.C.CmethodN)rprqrr�Cdatar
r4r4r4r5rs�srsrr
cSsdS)Nrr4)r/r4r4r5r_�sz4ClassPropertiesAndMethods.test_dir.<locals>.<lambda>�cdata�cmethodc@s"eZdZdZdd�ZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.ArTcSsdS)Nr4)r/r4r4r5�Amethod�sz5ClassPropertiesAndMethods.test_dir.<locals>.A.AmethodN)rprqrr�Adatarr4r4r4r5r��sr�rrr�cSsdS)NrVr4)r/r4r4r5r_�s�adata�amethodc@seZdZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.MN)rprqrrr4r4r4r5�M�srrCrTrpr<�__package__�
__loader__�__spec__cs"g|]}|�kr|�qSr4r4)r�r�)�default_attributesr4r5r�s	z6ClassPropertiesAndMethods.test_dir.<locals>.<listcomp>r7rGc@s(eZdZdd�Zee�ZdS)z.ClassPropertiesAndMethods.test_dir.<locals>.M2cSsdS)NzNot a dict!r4)r/r4r4r5�getdict�sz6ClassPropertiesAndMethods.test_dir.<locals>.M2.getdictN)rprqrrrr�r=r4r4r4r5r��sr�Zm2zNot a dict!csXeZdZdd�Zdd�Z�fdd�Zdd�Z�fd	d
�ZdS)z3ClassPropertiesAndMethods.test_dir.<locals>.WrappercSs
||_dS)N)�
_Wrapper__obj)r/r�r4r4r5r)�sz<ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__init__cSsdt|j�S)NzWrapper(%s))rdr)r/r4r4r5re�sz<ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__repr__cs�|j|�S)N)r)r/r�)�Wrapperr4r5rI�sz?ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__getitem__cSs
t|j�S)N)r�r)r/r4r4r5r6�sz;ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__len__cs�t|j|��S)N)r<r)r/r2)rr4r5rf�sz?ClassPropertiesAndMethods.test_dir.<locals>.Wrapper.__getattr__N)rprqrrr)rerIr6rfr4)rr4r5r�s
rcs.eZdZ�fdd�Zee�ZdS)z-ClassPropertiesAndMethods.test_dir.<locals>.Ccs�t|��S)N)r;)r/)rr4r5Z
__getclass�sz8ClassPropertiesAndMethods.test_dir.<locals>.C.__getclassN)rprqrrZ_C__getclassr�r�r4)rr4r5rs�s)rU)r9r�r;�test_dirr�rrrrrrGr7r=rvrn�Ellipsis)r/r	rnrrsZcstuffrJr�Zastuffr7rZ	minstance�namesr�Z
m2instancer4)rrr5r�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)r4)r/r7r4r4r5r@	sz5ClassPropertiesAndMethods.test_supers.<locals>.A.methN)rprqrrr@r4r4r4r5r�	sr�rTzA(1)cs1eZdZ��fdd�Zdd�Z�S)z0ClassPropertiesAndMethods.test_supers.<locals>.Bcst�|�|_dS)N)r�r�)r/)r�r�r4r5r)	sz9ClassPropertiesAndMethods.test_supers.<locals>.B.__init__cSsd||jj|�S)NzB(%r))r�r@)r/r7r4r4r5r@		sz5ClassPropertiesAndMethods.test_supers.<locals>.B.meth)rprqrrr)r@r4)r�)r�r5r�	sr�rUzB(2)A(2)c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.CcSsd||jj|�S)NzC(%r))r�r@)r/r7r4r4r5r@	sz5ClassPropertiesAndMethods.test_supers.<locals>.C.methN)rprqrrr@r4r4r4r5rs	srsrVzC(3)A(3)cs%eZdZ��fdd�Z�S)z0ClassPropertiesAndMethods.test_supers.<locals>.Dcsd|t�|�j|�S)NzD(%r))r�r@)r/r7)r�r�r4r5r@	sz5ClassPropertiesAndMethods.test_supers.<locals>.D.meth)rprqrrr@r4)r�)r�r5r�	sr�rXzD(4)C(4)B(4)A(4)cs%eZdZ��fdd�Z�S)z6ClassPropertiesAndMethods.test_supers.<locals>.mysupercst�|�j|�S)N)r�r))r/r0)r��mysuperr4r5r)	sz?ClassPropertiesAndMethods.test_supers.<locals>.mysuper.__init__)rprqrrr)r4)r )r�r5r 	sr cs%eZdZ��fdd�ZdS)z0ClassPropertiesAndMethods.test_supers.<locals>.Ecsd|��|�j|�S)NzE(%r))r@)r/r7)r�r r4r5r@"	sz5ClassPropertiesAndMethods.test_supers.<locals>.E.methN)rprqrrr@r4)r�r r4r5r�!	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�rpr@)r/r7rPr4r4r5r@(	s	z5ClassPropertiesAndMethods.test_supers.<locals>.F.methN)rprqrrr@r4r4r4r5r�'	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�r4)r/r4r4r5r�Q	sz:ClassPropertiesAndMethods.test_supers.<locals>.DDbase.getxN)rprqrrr�r�r�r4r4r4r5�DDbaseP	sr"c@s(eZdZdd�Zee�ZdS)z4ClassPropertiesAndMethods.test_supers.<locals>.DDsubcSsdS)Nrr4)r/r4r4r5r�U	sz9ClassPropertiesAndMethods.test_supers.<locals>.DDsub.getxN)rprqrrr�r�r�r4r4r4r5�DDsubT	sr#rc@s"eZdZedd��ZdS)z3ClassPropertiesAndMethods.test_supers.<locals>.BasecSsdS)Nr�r4)r/r4r4r5r_`	sz<ClassPropertiesAndMethods.test_supers.<locals>.Base.<lambda>N)rprqrrr��aPropr4r4r4r5�Base_	sr%cs+eZdZe��fdd��Z�S)z2ClassPropertiesAndMethods.test_supers.<locals>.Subcst�|�jS)N)r�r$)�klass)�Subr�r4r5r�c	sz7ClassPropertiesAndMethods.test_supers.<locals>.Sub.test)rprqrrr�r�r4)r')r�r5r'b	sr'r�z#super shouldn't accept keyword args)r�r9r@r�r�r!rvrwr�r�r�r$)r/r�rsr�r"r#Zddr%)r�)r�r�r�r'r r5�test_supers�s`







	
z%ClassPropertiesAndMethods.test_supersc
sLG�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|��|jid|6|d�|jid|6|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|��|jid|	6|d�|jid|6|	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)r/r4r4r5reu	szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.hexint.__repr__cs�tj||��S)N)r%rF)r/ro)�hexintr4r5rFw	szHClassPropertiesAndMethods.test_basic_inheritance.<locals>.hexint.__add__N)rprqrrrerFr4)r*r4r5r*t	sr*��	Z0x10i�Z0x3efi90rr|cs=eZdZgZdd�Z��fdd�ZeZ�S)zAClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlongcSs
t|�S)N)�oct)r/r4r4r5r��	szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlong.__str__cs|jt�|�j|��S)N)r�r�rF)r/ro)r��octlongr4r5rF�	szIClassPropertiesAndMethods.test_basic_inheritance.<locals>.octlong.__add__)rprqrrr�r�rFr�r4)r.)r�r5r.�	sr.rVr\Z0o10i�Z0o5675rTc@seZdZdS)zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.longcloneN)rprqrrr4r4r4r5�	longclone�	sr/c@s7eZdZdgZdddd�Zdd�ZdS)	zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloatr{gr|cSst|�|_dS)N)r%r{)r/r�r{r4r4r5r)�	szLClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloat.__init__cSsd|j|fS)Nz%.*g)r{)r/r4r4r5re�	szLClassPropertiesAndMethods.test_basic_inheritance.<locals>.precfloat.__repr__N)rprqrrr�r)rer4r4r4r5�	precfloat�	s	r0g�������?z1.1g��@c@seZdZdd�ZdS)zDClassPropertiesAndMethods.test_basic_inheritance.<locals>.madcomplexcSsd|j|jfS)Nz%.17gj%+.17g)r�r�)r/r4r4r5re�	szMClassPropertiesAndMethods.test_basic_inheritance.<locals>.madcomplex.__repr__N)rprqrrrer4r4r4r5�
madcomplex�	sr1rXz4j-3c@s"eZdZdZdd�ZdS)zBClassPropertiesAndMethods.test_basic_inheritance.<locals>.madtupleNcSsE|jdk	r|jSt|�}|j�|j|�|_|jS)N)�_revr+r�r�)r/r�r4r4r5�rev�	s
zFClassPropertiesAndMethods.test_basic_inheritance.<locals>.madtuple.rev)rprqrrr2r3r4r4r4r5�madtuple�	sr4rUr]�ic@s"eZdZdZdd�ZdS)zCClassPropertiesAndMethods.test_basic_inheritance.<locals>.madstringNcSsN|jdk	r|jSt|�}|j�|jdj|��|_|jS)Nrt)r2r+r�r��join)r/r�r4r4r5r3
s
zGClassPropertiesAndMethods.test_basic_inheritance.<locals>.madstring.rev)rprqrrr2r3r4r4r4r5�	madstring
sr7ZabcdefghijklmnopqrstuvwxyzZzyxwvutsrqponmlkjihgfedcba�rtZ12345�r�c@s"eZdZdZdd�ZdS)zDClassPropertiesAndMethods.test_basic_inheritance.<locals>.madunicodeNcSsN|jdk	r|jSt|�}|j�|jdj|��|_|jS)Nrt)r2r+r�r�r6)r/r�r4r4r5r3C
s
zHClassPropertiesAndMethods.test_basic_inheritance.<locals>.madunicode.rev)rprqrrr2r3r4r4r4r5�
madunicodeA
sr:ZABCDEFZFEDCBAZxyc@seZdZdS)zAClassPropertiesAndMethods.test_basic_inheritance.<locals>.sublistN)rprqrrr4r4r4r5�sublist|
sr;r��r�r�r�r����r>)
rTrUrVrXr\r]r+r5r,r)
rTrUrVrXr\r]r+r5r,r)
rr,r5r+r]r\rXrVrUrT)
rTrUrVrXr\r]r+r5r,r)rTrUrVrXr\)rTrUrVrXr\)rTrUrVrXr\Z���i����r�)!r%r9rdr�r�r�r	r"r=r&r}�tupler3r�r6�maprB�strip�lstrip�rstrip�	translate�replace�ljustr��rjust�center�lower�upper�
capitalize�titler+r`r�)r/r7r/r0r1�baser4rgrBr\r�r7rPZidentitytabr:r;r4)r*r.r5�test_basic_inheritanceq	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�rTrUg@rVr�r�r�i�r�i��500sabc�errors�strictr?�sequencerZbogus_keyword_argz4expected TypeError from bogus keyword argument to %r)rrTrU)rrTrU)
r9r%r&r}r	r@r�r+rvrw)r/�constructorr4r4r5�
test_keywords�
s (%
	z'ClassPropertiesAndMethods.test_keywordscsG�fdd�dt��|j�d�d�|jd�d��|jt�d��d�id�d�6d�d	�6d
�d�6}|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)rJ�	canonicalr��hashcode)r/r�r4r4r5r)�
szOClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__init__cs.t|��s�|�}n|j|jkS)N)r�rV)r/ro)�cistrr4r5rG�
szMClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__eq__cSs|jS)N)rW)r/r4r4r5r��
szOClassPropertiesAndMethods.test_str_subclass_as_dict_key.<locals>.cistr.__hash__N)rprqrrr<r)rGr�r4)rXr4r5rX�
srX�ABCr?ZaBcrTr�rUr�rVZtHreeZtWoZTHrEEZONeZthrEE)r	r9r�r)r/rAr4)rXr5�test_str_subclass_as_dict_key�
s-z7ClassPropertiesAndMethods.test_str_subclass_as_dict_keyc

sbGdd�d�}xH|ttfD]7}G�fdd�d|���d�}�d�}�d�}|j|d�i|d6|d6|d6}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)rprqrrr4r4r4r5�classic�
sr[cs�eZdZdd�Z�fdd�Z�fdd�Z�fdd�Z�fd	d
�Z�fdd�Z�fd
d�Z	dS)z=ClassPropertiesAndMethods.test_classic_comparisons.<locals>.CcSst|�|_dS)N)r%r�)r/r�r4r4r5r)�
szFClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__init__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5rG�
s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__eq__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5r�s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__ne__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5r�s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__lt__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5r�s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__le__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5r�s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__gt__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5r�s

zDClassPropertiesAndMethods.test_classic_comparisons.<locals>.C.__ge__N)
rprqrrr)rGr�r�r�r�r�r4)rsr4r5rs�
srsrTrUrVr�<=�==�!=r�>=zc[x] %s c[y]zx %s yz
x=%d, y=%dz	c[x] %s yz	x %s c[y])rTrUrV)rTrUrV)rr\r]r^rr_)r%r�r9r:)
r/r[rNr�r��c3rJr��y�opr4)rsr5�test_classic_comparisons�
s((





z2ClassPropertiesAndMethods.test_classic_comparisonsc
s�Gdd�dt�}|d�}�j|d��jd|�Gdd�dt�}|d�}�j|d��jd|�Gdd	�d	�}xN|tttfD]:}G��fd
d�d|���d�}�d�}�d
�}	�j|d�i|d6|d6|	d
6}
x�dD]�}x�dD]�}x�dD]�}
�jtd|
�td|
�d||f��jtd|
�td|
�d||f��jtd|
�td|
�d||f�q?Wq2Wq%Wq�WdS) Nc@seZdZdS)z:ClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZN)rprqrrr4r4r4r5r�5sr�rTyc@seZdZdd�ZdS)z;ClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZZc	Ss+yt||�dkSWntSYnXdS)Ng���ư>)r"rn)r/ror4r4r5rG;szBClassPropertiesAndMethods.test_rich_comparisons.<locals>.ZZ.__eq__N)rprqrrrGr4r4r4r5�ZZ:srdg�ׇP�?c@seZdZdS)z@ClassPropertiesAndMethods.test_rich_comparisons.<locals>.classicN)rprqrrr4r4r4r5r[Dsr[cs�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�)r/r�r4r4r5r)HszCClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__init__cs�jd�dS)Nzshouldn't call __cmp__)rw)rHro)r/r4r5�__cmp__JszBClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__cmp__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5rGLs

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__eq__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5r�Rs

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__ne__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5r�Xs

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__lt__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5r�^s

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__le__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5r�ds

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__gt__csNt|��r|j|jkSt|t�s=t|t�rJ|j|kStS)N)r�r�r%rn)r/ro)rsr4r5r�js

zAClassPropertiesAndMethods.test_rich_comparisons.<locals>.C.__ge__N)rprqrrr)rerGr�r�r�r�r�r4)rsr/r4r5rsGsrsrUrVr�<=�==�!=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�?)rTrUrV)rTrUrV)rrfrgrhrri)r}r9r%r�r+r:)r/r�rMrdZzzr[rNr�r�r`rJr�rarbr4)rsr/r5�test_rich_comparisons3s8)





z/ClassPropertiesAndMethods.test_rich_comparisonscsFddlm}�fdd�}||jd�|tjd�dS)Nr)�FileIOcs�j|j|�dS)N)r9r<)�descrZwhat)r/r4r5�check�sz6ClassPropertiesAndMethods.test_descrdoc.<locals>.checkzTrue if the file is closedz!the real part of a complex number)�_iork�closedr}r�)r/rkrmr4)r/r5�
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>.DocDescrcSs9|r|jjd}n|r+|j}nd||fS)Nz	 instancezobject=%s; type=%s)r�rp)r/r�Zotyper4r4r5r��s
zGClassPropertiesAndMethods.test_doc_descriptor.<locals>.DocDescr.__get__N)rprqrrr�r4r4r4r5�DocDescr�srqcseZdZ��ZdS)z?ClassPropertiesAndMethods.test_doc_descriptor.<locals>.OldClassN)rprqrrr<r4)rqr4r5�OldClass�srrcseZdZ��ZdS)z?ClassPropertiesAndMethods.test_doc_descriptor.<locals>.NewClassN)rprqrrr<r4)rqr4r5�NewClass�srszobject=None; type=OldClassz'object=OldClass instance; type=OldClasszobject=None; type=NewClassz'object=NewClass instance; type=NewClass)r�r9r<)r/rrrsr4)rqr5�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�}	|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�Wx}||||||||t|	f
D]W}xN||||||||t|	f
D](}||kr�q�n||�|�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)rprqrrr4r4r4r5rs�srsc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.DN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.EN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.FN)rprqrrr4r4r4r5r��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�rvrwrr5)r�rs)r/r4r5�cant�s

z6ClassPropertiesAndMethods.test_set_class.<locals>.cantrTc@seZdZgZdS)z5ClassPropertiesAndMethods.test_set_class.<locals>.IntN)rprqrrr�r4r4r4r5�Int�srvrUTc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Gr7rGN)rprqrrr�r4r4r4r5r�src@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.HrGr7N)rprqrrr�r4r4r4r5rI�srIc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Ir7rGN)rprqrrr�r4r4r4r5rb�srbc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.JrJrGN)rprqrrr�r4r4r4r5�J�srwc@seZdZdddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Kr7rGrAN)rprqrrr�r4r4r4r5�K�srxc@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.LrEN)rprqrrr�r4r4r4r5r��sr�c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.MrEN)rprqrrr�r4r4r4r5r�src@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.NrTN)rprqrrr�r4r4r4r5r��sr�c@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Pr=N)rprqrrr�r4r4r4r5�P�sryc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.QN)rprqrrr4r4r4r5�Q�srzc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Rr=rTN)rprqrrr�r4r4r4r5�R�sr{z0assigning %r as __class__ for %r silently failedc@seZdZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.ON)rprqrrr4r4r4r5�O�sr|cs"eZdZ�fdd�ZdS)z3ClassPropertiesAndMethods.test_set_class.<locals>.Acs
�|_dS)N)r�)r/)r|r4r5rD�sz;ClassPropertiesAndMethods.test_set_class.<locals>.A.__del__N)rprqrrrDr4)r|r4r5r��sr�csg|]}���qSr4r4)r�r�)r�r4r5r�s	z<ClassPropertiesAndMethods.test_set_class.<locals>.<listcomp>rm)
r�r�r�r+r%�boolr;r7r9r�)r/rsr�r�r�r�Zcls2r�rurv�orrIrbrwrxr�rr�ryrzr{rhr4)r�r|r/r5�test_set_class�st			



	@				++z(ClassPropertiesAndMethods.test_set_classcs�Gdd�dt�}|�}idd6|_�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
rdYq)X�jd|�q)WGdd�dtj��}
Gdd�d�tj�}x7|
|fD])}|d�}
||
�d|
jd<q�Wdd�}Gdd�dt	��}Gdd �d �t	�}xbt	||fD]Q}|�}idd!6|_�j|j
d��j||�|t���q:WdS)"Nc@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.CN)rprqrrr4r4r4r5rs�srsrTrGcsCy
||_Wnttfk
r'YnX�jd||f�dS)Nz shouldn't allow %r.__dict__ = %r)r=r5rvrw)r�rc)r/r4r5ru�s

z5ClassPropertiesAndMethods.test_set_dict.<locals>.cantc@seZdZdS)z5ClassPropertiesAndMethods.test_set_dict.<locals>.BaseN)rprqrrr4r4r4r5r%
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=r5rvrwr[)r�Z
dict_descr)r%rur/r4r5�verify_dict_readonlys


zEClassPropertiesAndMethods.test_set_dict.<locals>.verify_dict_readonlyc@seZdZdS)z6ClassPropertiesAndMethods.test_set_dict.<locals>.Meta1N)rprqrrr4r4r4r5�Meta1 sr�c@seZdZdS)z6ClassPropertiesAndMethods.test_set_dict.<locals>.Meta2N)rprqrrr4r4r4r5�Meta2"sr�c@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.DN)rprqrrr4r4r4r5r�$sr�r�c@seZdZdS)z2ClassPropertiesAndMethods.test_set_dict.<locals>.EN)rprqrrr4r4r4r5r�&sr�Zeggsr�z%r's __dict__ can be modifiedc@seZdZdS)z8ClassPropertiesAndMethods.test_set_dict.<locals>.Module1N)rprqrrr4r4r4r5�Module13sr�c@seZdZdS)z8ClassPropertiesAndMethods.test_set_dict.<locals>.Module2N)rprqrrr4r4r4r5�Module25sr�cSs1y
|`Wnttfk
r(dSYnXdSdS)NFT)r=rvr5)rEr4r4r5�can_delete_dict@s

	z@ClassPropertiesAndMethods.test_set_dict.<locals>.can_delete_dictc@seZdZdS)z;ClassPropertiesAndMethods.test_set_dict.<locals>.Exception1N)rprqrrr4r4r4r5�
Exception1Gsr�c@seZdZdS)z;ClassPropertiesAndMethods.test_set_dict.<locals>.Exception2N)rprqrrr4r4r4r5�
Exception2Isr�r7)r�r=r9rGr;rvrwrrr�r7r)r/rsr7r�r�r�r�r�r�Z
class_dictr�r�rrzr�r�r�Z
ExceptionTyperEr4)r%rur/r5�
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%)r/r4r4r5reTszKClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__repr__cs�t|�t|��S)N)r%)r/ro)rbr4r5rFVszJClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__add__NcsW|dkr+�tt|�t|���S�tt|�t|�t|���SdS)N)rr%)r/rorz)rbr4r5�__pow__YszJClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__pow__csZ|dkr.�tt|�t|�|��S�tt|�t|�t|���SdS)N)rr%)r/rorz)rbr4r5�__rpow__^s"zKClassPropertiesAndMethods.test_binary_operator_override.<locals>.I.__rpow__)rprqrrrerFr�r�r�r4)rbr4r5rbSs
rbrTrUzI(3)rVzI(8)r\c@seZdZdd�ZdS)zBClassPropertiesAndMethods.test_binary_operator_override.<locals>.ScSs|j�|j�kS)N)rJ)r/ror4r4r5rGlszIClassPropertiesAndMethods.test_binary_operator_override.<locals>.S.__eq__N)rprqrrrGr4r4r4r5�Sksr�)r%r9rdrr	)r/r�r4)rbr5�test_binary_operator_overrideQ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)rprqrrr4r4r4r5r�qsr�c@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.BN)rprqrrr4r4r4r5r�ssr�c@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.CN)rprqrrr4r4r4r5rsusrsc@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.DN)rprqrrr4r4r4r5r�wsr�cSsdS)Nr�r4)r/r4r4r5r_{szEClassPropertiesAndMethods.test_subclass_propagation.<locals>.<lambda>r�cSsdS)Ni:r4)r/r4r4r5r_}si:cSsdS)N�r4)r/r4r4r5r_sr�cSsdS)Nrmr4)r/r4r4r5r_�srmcSs |dkrdStj||�S)Nr�r�)r�r�)r/r2r4r4r5r��szMClassPropertiesAndMethods.test_subclass_propagation.<locals>.__getattribute__r�cSs |dkrdSt|��dS)Nr�r�r�r)zspamzfoozbar)r5)r/r2r4r4r5rf�szHClassPropertiesAndMethods.test_subclass_propagation.<locals>.__getattr__rzd.foo should be undefined nowc@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.AN)rprqrrr4r4r4r5r��sc@seZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation.<locals>.BN)rprqrrr4r4r4r5r��scWsdS)Nr4)r7r4r4r5r_�s)r�r�r�r9r�rvr�r�r�rfr�r5rwrrLrQ)	r/r�r�rsr�rAZ	orig_hashr�rfr4r4r5�test_subclass_propagationo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)rprqrrr4r4r4r5�MyBytes�sr�sabcc@seZdZdS)z@ClassPropertiesAndMethods.test_buffer_inheritance.<locals>.MyIntN)rprqrrr4r4r4r5�MyInt�sr�r�z2subclass of int should not have a buffer interface)�binasciir�r9�b2a_hexr%rwrv)r/r�r�rNrCr�r4r4r5�test_buffer_inheritance�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)r/)r�r4r5r��szOClassPropertiesAndMethods.test_str_of_str_subclass.<locals>.octetstring.__str__cSs|dS)Nz reprr4)r/r4r4r5re�szPClassPropertiesAndMethods.test_str_of_str_subclass.<locals>.octetstring.__repr__N)rprqrrr�rer4)r�r4r5�octetstring�sr�r��AZ41zA repr�filez41
41
)
r��ior	r9r;rd�ordr�re�StringIO�printrO�close)r/r�r�r~Zcapturer4)r�r5�test_str_of_str_subclass�s"z2ClassPropertiesAndMethods.test_str_of_str_subclasscCsgdd�}|j|jdd�d�g}tj|ddddg�|j|dddg�dS)	NcSs|S)Nr4)r7r4r4r5ro�sz;ClassPropertiesAndMethods.test_keyword_arguments.<locals>.fr7r�rSrrTrU)r9r�r+r))r/ror7r4r4r5�test_keyword_arguments�s
z0ClassPropertiesAndMethods.test_keyword_argumentscCsVGdd�dt�}|�|_y|��Wntk
rDYnX|jd�dS)Nc@seZdZdS)z8ClassPropertiesAndMethods.test_recursive_call.<locals>.AN)rprqrrr4r4r4r5r��sr�z7Recursion limit should have been reached for __call__())r�r�r�rw)r/r�r4r4r5�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)NrT)r`)r/)r�r4r5rD
sz=ClassPropertiesAndMethods.test_delete_hook.<locals>.C.__del__N)rprqrrrDr4)r�r4r5rs
srsrTc@seZdZdS)z5ClassPropertiesAndMethods.test_delete_hook.<locals>.DN)rprqrrr4r4r4r5r�
sr�rz$invalid del() didn't raise TypeError)r�r9rrLrvrw)r/rsrJr�rAr4)r�r5�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)rprqrrr4r4r4r5�mydict
sr�z#hash() of dict subclass should failc@seZdZdS)z?ClassPropertiesAndMethods.test_hash_inheritance.<locals>.mylistN)rprqrrr4r4r4r5�mylist#
sr�z#hash() of list subclass should fail)rcr�rvrwr+)r/r�rAr�r4r4r5�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)!Nr7r\z'' + 5 doesn't raise TypeErrorrtz%''.split('') doesn't raise ValueErrorrz$''.join([0]) doesn't raise TypeError�5z'''.rindex('5') doesn't raise ValueErrorz%(n)sz&'%(n)s' % None doesn't raise TypeErrorz%(nz&'%(n' % {} '' doesn't raise ValueErrorz%*sr?z''%*s' % ('abc') doesn't raise TypeErrorz%*.*sz,'%*.*s' % ('abc', 5) doesn't raise TypeErrorz%srTrUz%'%s' % (1, 2) doesn't raise TypeError�%z#'%' % None doesn't raise ValueErrorZ534253Z534253xz%c�)zabcr\)rTrUr�r�)rvrw�splitrr6�rindexr9�isdigit)r/r4r4r5�test_str_operations-
sl



















z-ClassPropertiesAndMethods.test_str_operationscCsGGdd�d�}|�}|�}||_||_t|�}dS)Nc@seZdZdS)z?ClassPropertiesAndMethods.test_deepcopy_recursive.<locals>.NodeN)rprqrrr4r4r4r5r]
sr)rGr7r)r/rr7rGrMr4r4r5�test_deepcopy_recursive[
s				z1ClassPropertiesAndMethods.test_deepcopy_recursivecCs�ddlm}|j|�}t|�|j|d�|j|d�|j|d�|j|j�d|_|j|jidd6�dS)Nr)rrp�__file__r�rT)	rrr~r	r�r�r=r�r9)r/rrCr4r4r5�test_unintialized_modulese
s
	z3ClassPropertiesAndMethods.test_unintialized_modulescs�G�fdd�dt�}Gdd�d|��|j|d�dddg�|j�d�dddg��d�}|j|jd�|d�}|j|��|j|jd��d�}|j|��|j|jd�dS)	Ncs"eZdZ�fdd�ZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.CcsIt|t�rdddgSt|t�r8tj��Stj|�SdS)NrTrUrV)r�r	r%r�r~)r�rn)r�r4r5r~t
s


z;ClassPropertiesAndMethods.test_funny_new.<locals>.C.__new__N)rprqrrr~r4)r�r4r5rss
srsc@seZdZdd�ZdS)z3ClassPropertiesAndMethods.test_funny_new.<locals>.DcSs
||_dS)N)r�)r/rnr4r4r5r)y
sz<ClassPropertiesAndMethods.test_funny_new.<locals>.D.__init__N)rprqrrr)r4r4r4r5r�x
sr�r>rTrUrV)r�r9r�r�)r/rsrAr4)r�r5�test_funny_newq
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)Nr4)r/ror4r4r5rY�
sz;ClassPropertiesAndMethods.test_imul_bug.<locals>.C.__imul__N)rprqrrrYr4r4r4r5rs�
srsg�?rUrVrTrmr�ll)r�r9)r/rsr�rar4r4r5�
test_imul_bug�
s(	





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)r/r�r4r4r5r)�
s	z@ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__init__cSs
||_dS)N)r�)r/r�r4r4r5�setfoo�
sz>ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.setfoocSs|jS)N)r�)r/r4r4r5�getfoo�
sz>ClassPropertiesAndMethods.test_copy_setstate.<locals>.C.getfoocSs
|jgS)N)r�)r/r4r4r5�__getstate__�
szDClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__getstate__cs.�jt|�d�|d|_|_dS)NrTr)r9r�r�r�)rHZlst)r/r4r5�__setstate__�
szDClassPropertiesAndMethods.test_copy_setstate.<locals>.C.__setstate__)rprqrrr)r�r�r�r�r4)r/r4r5rs�
s
rsr�r�)r�r�r�r9r�r�r)r/r�rsr7rGr4)r/r5�test_copy_setstate�
s

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rXZhellc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.ScSstj||�S)N)r	rI)r/r�r4r4r5rI�
sz<ClassPropertiesAndMethods.test_slices.<locals>.S.__getitem__N)rprqrrrIr4r4r4r5r��
sr�rTrUrVc@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.TcSstj||�S)N)r@rI)r/r�r4r4r5rI�
sz<ClassPropertiesAndMethods.test_slices.<locals>.T.__getitem__N)rprqrrrIr4r4r4r5r��
sr�c@seZdZdd�ZdS)z0ClassPropertiesAndMethods.test_slices.<locals>.LcSstj||�S)N)r+rI)r/r�r4r4r5rI�
sz<ClassPropertiesAndMethods.test_slices.<locals>.L.__getitem__N)rprqrrrIr4r4r4r5r��
sr�r)rTrUrV)rTrU)rTrUrV)rTrU)rTrUrV)rTrU)rTrUrV)rTrU)rTrUrV)rTrU)rTrUrV)rTrU)r9rKr	rIr@r+rQ)r/r�r�r�r7r4r4r5�test_slices�
s<"  %"  %))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)�	containerr`)r/)rsr4r5rD�
szFClassPropertiesAndMethods.test_subtype_resurrection.<locals>.C.__del__N)rprqrrr�rDr4)rsr4r5rs�
srsr�rT)r�r�rrLr9r�r�rD)r/rJr4)rsr5�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�)r/r�r4r4r5r)szBClassPropertiesAndMethods.test_slots_trash.<locals>.trash.__init__N)rprqrrr�r)r4r4r4r5�trashs	r�iP�)r�r�)r/r�r~rgr4r4r5�test_slots_trashs
z*ClassPropertiesAndMethods.test_slots_trashcCs�Gdd�dt�}Gdd�dt�}Gdd�d||�}tj�rj|j|j|j�n|j|d�|j|d�d	|�_dS)
Nc@seZdZfZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.AN)rprqrrr�r4r4r4r5r�sr�c@seZdZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.BN)rprqrrr4r4r4r5r�sr�c@seZdZfZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance.<locals>.CN)rprqrrr�r4r4r4r5rssrsr=rTrU)r�rr'r9�
__basicsize__r�r�)r/r�r�rsr4r4r5�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
r4)r/ror4r4r5rZsz6ClassPropertiesAndMethods.test_rmul.<locals>.C.__mul__cSsdS)N�rmulr4)r/ror4r4r5r[ sz7ClassPropertiesAndMethods.test_rmul.<locals>.C.__rmul__N)rprqrrrZr[r4r4r4r5rssrsrUr
g������@r�)r�r9)r/rsr7r4r4r5�	test_rmuls	z#ClassPropertiesAndMethods.test_rmulcCs-Gdd�dt�}|�}|dC}dS)Nc@seZdZdd�ZdS)z.ClassPropertiesAndMethods.test_ipow.<locals>.CcSsdS)Nr4)r/ror4r4r5�__ipow__,sz7ClassPropertiesAndMethods.test_ipow.<locals>.C.__ipow__N)rprqrrr�r4r4r4r5rs+srsrU)r�)r/rsr7r4r4r5�	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|_WnGtk
r{}z't	|�dkri|jd
�nWYdd}~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)rprqrrr4r4r4r5rs5srscs1eZdZ��fdd�Zdd�Z�S)z8ClassPropertiesAndMethods.test_mutable_bases.<locals>.C2cs*|dkrdSt�|�j|�SdS)Nr7rU)r�r�)r/r�)r�r�r4r5r�8szIClassPropertiesAndMethods.test_mutable_bases.<locals>.C2.__getattribute__cSsdS)NrTr4)r/r4r4r5r@=sz=ClassPropertiesAndMethods.test_mutable_bases.<locals>.C2.meth)rprqrrr�r@r4)r�)r�r5r�7sr�c@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.DN)rprqrrr4r4r4r5r�?sr�c@seZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases.<locals>.EN)rprqrrr4r4r4r5r�Asr�rTrUz&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>r9r@r7�__subclasses__rvr5rwr	)r/rsr�r�rArEr+r4)r�r5�test_mutable_bases1sN		


#





z,ClassPropertiesAndMethods.test_mutable_basescCsLdd�tjj�D�}xI|D]A}tj|d�|tk	r#|jt|j�d|�q#q#WGdd�dt�}Gdd�dt�}Gd	d
�d
|�}yt	f|_Wnt
k
r�YnX|jd�yt	ft_Wnt
k
rYnX|jd�y|tf|_Wnt
k
r5YnXd
sHtd��dS)NcSs%g|]}t|t�r|�qSr4)r�r;)r��tpr4r4r5rus	z@ClassPropertiesAndMethods.test_builtin_bases.<locals>.<listcomp>r>rTc@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.LN)rprqrrr4r4r4r5r�|sr�c@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.CN)rprqrrr4r4r4r5rssrsc@seZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases.<locals>.DN)rprqrrr4r4r4r5r��sr�z/shouldn't turn list subclass into dict subclassz-shouldn't be able to assign to list.__bases__rz#best_base calculation found wanting)
�builtinsr=�valuesr�r�r9r�r>r+rcrvrw�AssertionError)r/Z
builtin_typesr�r�rsr�r4r4r5�test_builtin_basesrs.
#




z,ClassPropertiesAndMethods.test_builtin_basesc?Cs
|jt��!Gdd�dtd��}WdQX|jt��$Gdd�dttd��}WdQX|jt��$Gdd�dtd�t�}WdQXGdd�dt�}|jt��$Gdd�d|td��}WdQX|jt��$Gdd�dtd�|�}WdQXGd	d�dt�}|jt��td�f|_WdQX|jt��ttd�f|_WdQX|jt��td�tf|_WdQX|jt��|td�f|_WdQX|jt��td�|f|_WdQXdS)
Nc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rprqrrr4r4r4r5r��sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rprqrrr4r4r4r5r��sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.ON)rprqrrr4r4r4r5r|�sr|c@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rprqrrr4r4r4r5r��sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rprqrrr4r4r4r5r��sc@seZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types.<locals>.XN)rprqrrr4r4r4r5r��s)r�rvr;r�r>)r/r�r|r4r4r5�test_unsubclassable_types�s,"%%%%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~)r/r2r�r�)�WorkOncer�r4r5r~�s	zWClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkOnce.__new__cSs>|jdkrtd��n|jd7_tj|�SdS)NrZbozorT)r�r�r;r�)r/r4r4r5r��szSClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkOnce.mro)rprqrrr~r�r4)r�)r�r5r��sr�c@seZdZdd�ZdS)zQClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkAlwayscSs
tj|�S)N)r;r�)r/r4r4r5r��szUClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.WorkAlways.mroN)rprqrrr�r4r4r4r5�
WorkAlways�sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.CN)rprqrrr4r4r4r5rs�srsc@seZdZdS)zIClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.C2N)rprqrrr4r4r4r5r��sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.DN)rprqrrr4r4r4r5r��sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.EN)rprqrrr4r4r4r5r��sr�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.FN)rprqrrr4r4r4r5r��sr�r�c@seZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro.<locals>.GN)rprqrrr4r4r4r5r�srzexception not propagated)r;r�rr>r�r9rw)
r/r�rsr�r�r�r�rZE_mro_beforeZD_mro_beforer4)r�r5�#test_mutable_bases_with_failing_mro�s 		
z=ClassPropertiesAndMethods.test_mutable_bases_with_failing_mrocCs�Gdd�dt�}Gdd�dt�}Gdd�d||�}Gdd�d||�}Gd	d
�d
||�}y||f|_Wntk
r�YnX|jd�dS)Nc@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.AN)rprqrrr4r4r4r5r��sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.BN)rprqrrr4r4r4r5r��sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.CN)rprqrrr4r4r4r5rs�srsc@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.DN)rprqrrr4r4r4r5r��sr�c@seZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict.<locals>.EN)rprqrrr4r4r4r5r��sr�zdidn't catch MRO conflict)r�r>rvrw)r/r�r�rsr�r�r4r4r5�%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)rprqrrr4r4r4r5rs
srsr�zD.E)r�rqrpr9)r/rsrzr4r4r5�test_mutable_namess		"	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)Nro)rp)r/)rsr4r5rDszDClassPropertiesAndMethods.test_evil_type_name.<locals>.Nasty.__del__N)rprqrrrDr4)rsr4r5�Nastysr�c@seZdZdS)z8ClassPropertiesAndMethods.test_evil_type_name.<locals>.CN)rprqrrr4r4r4r5rssrsr?Znormal)r	rp)r/r�r4)rsr5�test_evil_type_namesz-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__r4)r/ror4r4r5�__floordiv__-szHClassPropertiesAndMethods.test_subclass_right_op.<locals>.B.__floordiv__cSsdS)NzB.__rfloordiv__r4)r/ror4r4r5�
__rfloordiv__/szIClassPropertiesAndMethods.test_subclass_right_op.<locals>.B.__rfloordiv__N)rprqrrr�r�r4r4r4r5r�,sr�rTzB.__floordiv__zB.__rfloordiv__c@s(eZdZdd�Zdd�ZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.CcSsdS)NzC.__floordiv__r4)r/ror4r4r5r�8szHClassPropertiesAndMethods.test_subclass_right_op.<locals>.C.__floordiv__cSsdS)NzC.__rfloordiv__r4)r/ror4r4r5r�:szIClassPropertiesAndMethods.test_subclass_right_op.<locals>.C.__rfloordiv__N)rprqrrr�r�r4r4r4r5rs7srszC.__floordiv__zC.__rfloordiv__c@s(eZdZdd�Zdd�ZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.DcSsdS)NzD.__floordiv__r4)r/ror4r4r5r�CszHClassPropertiesAndMethods.test_subclass_right_op.<locals>.D.__floordiv__cSsdS)NzD.__rfloordiv__r4)r/ror4r4r5r�EszIClassPropertiesAndMethods.test_subclass_right_op.<locals>.D.__rfloordiv__N)rprqrrr�r�r4r4r4r5r�Bsr�zD.__floordiv__zD.__rfloordiv__c@seZdZdS)z;ClassPropertiesAndMethods.test_subclass_right_op.<locals>.EN)rprqrrr4r4r4r5r�Msr�)r%r9r�r�)r/r�rsr�r�r4r4r5�test_subclass_right_op$sz0ClassPropertiesAndMethods.test_subclass_right_opz)testing an internal kind of method objectc#Cs�dddg}idd6dd6dd6}|jtj|�|�|jij|�|�tjd}|j|jdt�|�|�|j|ji�|�|�y|jdd�Wntk
r�YnX|jd�y|jd�Wntk
rYnX|jd�y|jdd�Wntk
r;YnX|jd�y|jdt�Wntk
rqYnX|jd	�dS)
NrTrUrV�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))r9rcr�r=r�rvrwr%)r/rnr?rlr4r4r5�test_meth_class_getWs6
"






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)r/r�r4r4r5r)�szEClassPropertiesAndMethods.test_isinst_isclass.<locals>.Proxy.__init__cSs3|jd�rtj||�St|j|�SdS)N�_Proxy__)r�r�r�r<r�)r/r2r4r4r5r��szMClassPropertiesAndMethods.test_isinst_isclass.<locals>.Proxy.__getattribute__N)rprqrrr)r�r4r4r4r5r��sr�c@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.CN)rprqrrr4r4r4r5rs�srsc@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.DN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.CN)rprqrrr4r4r4r5rs�sc@seZdZdS)z8ClassPropertiesAndMethods.test_isinst_isclass.<locals>.DN)rprqrrr4r4r4r5r��s)r�r�)r/r�rsr7Zpar�r4r4r5�test_isinst_isclass�s*					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�)r/r�r4r4r5r)�szBClassPropertiesAndMethods.test_proxy_super.<locals>.Proxy.__init__cSs3|jd�rtj||�St|j|�SdS)Nr�)r�r�r�r<r�)r/r2r4r4r5r��szJClassPropertiesAndMethods.test_proxy_super.<locals>.Proxy.__getattribute__N)rprqrrr)r�r4r4r4r5r��sr�c@seZdZdd�ZdS)z5ClassPropertiesAndMethods.test_proxy_super.<locals>.BcSsdS)NzB.fr4)r/r4r4r5ro�sz7ClassPropertiesAndMethods.test_proxy_super.<locals>.B.fN)rprqrrror4r4r4r5r��sr�cs%eZdZ��fdd�Z�S)z5ClassPropertiesAndMethods.test_proxy_super.<locals>.Ccst�|�j�dS)Nz->C.f)r�ro)r/)rsr�r4r5ro�sz7ClassPropertiesAndMethods.test_proxy_super.<locals>.C.f)rprqrrror4)rs)r�r5rs�srsrozB.f->C.f)r�r9r=)r/r�r�r�r�r4)rsr5�test_proxy_super�s		z*ClassPropertiesAndMethods.test_proxy_supercCssytjtdd�Wntk
r+YnX|jd�ytjtd�Wntk
raYnX|jd�dS)Nr�r�z"Carlo Verre __setattr__ succeeded!rJz"Carlo Verre __delattr__ succeeded!)r�rr	rvrwr)r/r4r4r5�test_carloverre�s


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�)r/Z	referrent)r�r4r5r)�szJClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provoker.__init__cSs|j�}dS)N)r�)r/r�r4r4r5rD�szIClassPropertiesAndMethods.test_weakref_segfault.<locals>.Provoker.__del__N)rprqrrr)rDr4)r�r4r5�Provoker�sr�c@seZdZdS)z=ClassPropertiesAndMethods.test_weakref_segfault.<locals>.OopsN)rprqrrr4r4r4r5�Oops�sr�)r�r�Zwhatever)r/r�r�r~r4)r�r5�test_weakref_segfault�s	z/ClassPropertiesAndMethods.test_weakref_segfaultcCs6dd�}xtd�D]}|j}qWd}dS)NcSsdS)Nr4r4r4r4r5r_�szAClassPropertiesAndMethods.test_wrapper_segfault.<locals>.<lambda>i@B)r�r�)r/rorgr4r4r5�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�)r/r�r4r4r5rf�szJClassPropertiesAndMethods.test_file_fault.<locals>.StdoutGuard.__getattr__N)rprqrrrfr4r4r4r5�StdoutGuard�sr�zOops!)rr�r�r�)r/Ztest_stdoutr�r4r4r5�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�)r/r4r4r5r�szQClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Evil.__hash__cs
�`dS)Nr)r�)r/ro)rsr4r5rGszOClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Evil.__eq__N)rprqrrr�rGr4)rsr4r5�Evilsr�c@seZdZddd�ZdS)zIClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.DescrNcSsdS)NrTr4)r/�obr;r4r4r5r�szQClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.Descr.__get__)rprqrrr�r4r4r4r5�Descrsr�cseZdZ��ZdS)zEClassPropertiesAndMethods.test_vicious_descriptor_nonsense.<locals>.CN)rprqrrr�r4)r�r4r5rssrsrrTr�)r�r=r9r�rrLr�)r/r�rJr4)rsr�r5� 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�r4)r/r4r4r5r)sz9ClassPropertiesAndMethods.test_init.<locals>.Foo.__init__N)rprqrrr)r4r4r4r5�Foosr�z'did not test __init__() for None return)r�rvrw)r/r�r4r4r5�	test_inits
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\rFrpz"no TypeError from hash([].__add__)r+)r+)r+)r+)r9rFr4rZrprjr�rp�__objclass__r+Zim_selfZim_classr<r�rvrw)r/rhrBr4r4r5�test_method_wrapper"s*


z-ClassPropertiesAndMethods.test_method_wrappercs�ddl�dd�}��fdd�}tjd}tj}xCd2d3d4d5d6d7d8d9d:d;d<d=d>g
D]\}}}d-|d.d�}td/fi||6�}	|	�}
|||
|
�|||
|�|||
|�|rq|||
|
�|||
|�|||
|�d0|d.d�}td1fi||6�}|�}
|||
|
�|||
|�|||
|�qqqqWdS)?NrcSstS)N)rn)r/ror4r4r5�
specialmethodHszEClassPropertiesAndMethods.test_not_implemented.<locals>.specialmethodcsSy&t|i|d6|d6�d6�Wntk
r:YnX�jd|f�dS)Nr�ra�operatorzno TypeError from %r)rNrvrw)r3r�ra)r�r/r4r5rmKs
&
z=ClassPropertiesAndMethods.test_not_implemented.<locals>.checkrTrF�x + y�x += y�__sub__�x - y�x -= yrZ�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__rrUr�Z__irs)z__add__r�r�)z__sub__r�r�)z__mul__r�r�)z__truediv__r�r�)z__floordiv__r�r�)z__mod__r�r�)z
__divmod__r�N)z__pow__rr)z
__lshift__rr)z
__rshift__rr)z__and__r	r
)z__or__rr
)z__xor__rr)r�r�maxsizer;)r/r�rmZN1ZN2r2r3ZiexprZrnamer�r7ZinamersrJr4)r�r/r5�test_not_implementedCsF
			z.ClassPropertiesAndMethods.test_not_implementedcCsFGdd�dt�}|�}d|dd�<|j|jd�dS)Nc@seZdZdd�ZdS)z6ClassPropertiesAndMethods.test_assign_slice.<locals>.CcSs
||_dS)N)r�)r/�idxr�r4r4r5rQ|szBClassPropertiesAndMethods.test_assign_slice.<locals>.C.__setitem__N)rprqrrrQr4r4r4r5rs{srsrVrTrU)r�r9r�)r/rsrJr4r4r5�test_assign_slicevs	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)r2)r/r2r4r4r5r)�szEClassPropertiesAndMethods.test_set_and_no_get.<locals>.Descr.__init__cSs||j|j<dS)N)r=r2)r/r�r�r4r4r5r[�szDClassPropertiesAndMethods.test_set_and_no_get.<locals>.Descr.__set__N)rprqrrr)r[r4r4r4r5r��sr�r7cseZdZ�ZdS)z8ClassPropertiesAndMethods.test_set_and_no_get.<locals>.XN)rprqrrr7r4)rlr4r5r��sr�r�c@seZdZdS)z;ClassPropertiesAndMethods.test_set_and_no_get.<locals>.MetaN)rprqrrr4r4r4r5�Meta�src@seZdZdS)z8ClassPropertiesAndMethods.test_set_and_no_get.<locals>.XN)rprqrrr4r4r4r5r��sr�)r�r�r7r9r;)r/r�r�r�rr4)rlr5�test_set_and_no_get�s			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)NrT)r�r5)r2)r/r4r5r��szXClassPropertiesAndMethods.test_getattr_hooks.<locals>.Descriptor.__get__.<locals>.getterr4)r/r�Zobjtyper�r4)r/r5r��szHClassPropertiesAndMethods.test_getattr_hooks.<locals>.Descriptor.__get__)rprqrrr�r�r4r4r4r5�
Descriptor�srcseZdZ�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.AN)rprqrrr�r4)rlr4r5r��sr�cseZdZ�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.BN)rprqrrrfr4)rlr4r5r��sr�cseZdZ�Z�ZdS)z7ClassPropertiesAndMethods.test_getattr_hooks.<locals>.CN)rprqrrr�rfr4)rlr4r5rs�srsr�rTrUrXcs.eZdZdd�Z�fdd�ZdS)zFClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattributecSst|��dS)N)r5)r/r2r4r4r5rf�szRClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattribute.__getattr__cs7�`xtd�D]}tj�qWt|��dS)Nr\)rfr�rNZcollectr5)r/r2rg)�EvilGetattributer4r5r��szWClassPropertiesAndMethods.test_getattr_hooks.<locals>.EvilGetattribute.__getattribute__N)rprqrrrfr�r4)rr4r5r�sr)r�r�r5r<r9r�)r/rr�r�rsr4)rrlr5�test_getattr_hooks�s	
z,ClassPropertiesAndMethods.test_getattr_hookscCs|jttjtt�dS)N)r�rvr;r�r+)r/r4r4r5�test_type___getattribute__�sz4ClassPropertiesAndMethods.test_type___getattribute__cCsx|jtttd�Gdd�dt�}|jtt|d�Gdd�dt�}|jt��|`WdQXdS)N�__abstractmethods__c@seZdZdS)z<ClassPropertiesAndMethods.test_abstractmethods.<locals>.metaN)rprqrrr4r4r4r5�meta�src@seZdZdS)z9ClassPropertiesAndMethods.test_abstractmethods.<locals>.XN)rprqrrr4r4r4r5r��sr�)r�r5r<r;r�r)r/rr�r4r4r5�test_abstractmethods�sz.ClassPropertiesAndMethods.test_abstractmethodscCsyGdd�d�}|�}|j|t�|jt��tj|�WdQX|jt��tj|d�WdQXdS)Nc@seZdZeZdS)z:ClassPropertiesAndMethods.test_proxy_call.<locals>.FakeStrN)rprqrrr	r�r4r4r4r5�FakeStr�srr?)r�r	r�rvr�rF)r/rZfake_strr4r4r5�test_proxy_call�s	z)ClassPropertiesAndMethods.test_proxy_callcCsRGdd�d�}|j|_|�}|jtt|�|jtt|�dS)Nc@seZdZdS)z7ClassPropertiesAndMethods.test_repr_as_str.<locals>.FooN)rprqrrr4r4r4r5r��sr�)r�rer�r�r	rd)r/r�r�r4r4r5�test_repr_as_str�s
	z*ClassPropertiesAndMethods.test_repr_as_strcCs@Gdd�dt�}|�}d|_|j|dd�dS)Nc@seZdZejZdS)z>ClassPropertiesAndMethods.test_mixing_slot_wrappers.<locals>.XN)rprqrrrcrQrr4r4r4r5r��sr�r�ra)rcrar9)r/r�r�r4r4r5�test_mixing_slot_wrappers�s		z3ClassPropertiesAndMethods.test_mixing_slot_wrappersc
CsN|jt��}Gdd�d�}WdQXt|j�}|jd|�dS)Nc@seZdZdgZdZdS)zEClassPropertiesAndMethods.test_slot_shadows_class_variable.<locals>.Xr�N)rprqrrr�r�r4r4r4r5r��s	r�z0'foo' in __slots__ conflicts with class variable)r�rr	�	exceptionr9)r/rqr�rCr4r4r5� test_slot_shadows_class_variable�sz:ClassPropertiesAndMethods.test_slot_shadows_class_variablecCs�Gdd�d�}d|_|j|jd�|jt��$}tt�jdjtd�WdQX|jdt	|j
��|jt��!}t|�jdj|�WdQX|jdt	|j
��|j|jd�dS)Nc@seZdZdZdS)z1ClassPropertiesAndMethods.test_set_doc.<locals>.XZelephantN)rprqrrr<r4r4r4r5r��sr�Zbananar<Zblahzcan't set list.__doc__zcan't delete X.__doc__)r<r9r�rvr;r+r=r[r�r	r"r�)r/r�rqr4r4r5�test_set_doc�s	# z&ClassPropertiesAndMethods.test_set_doccCs�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��|`WdQX|j
tt	jd
jtd�Gdd�d�a|jtjd�|jtjjd�dS)NreZmemberZgetset�wrapperZ_descriptor�.z	str.lowerzcomplex.realz
float.realzint.__add__c@seZdZdS)z2ClassPropertiesAndMethods.test_qualname.<locals>.XN)rprqrrr4r4r4r5r�sr�rrZOinkc@s#eZdZGdd�d�ZdS)r�c@seZdZdS)zY.InsideN)rprqrrr4r4r4r5�Inside&sr'N)rprqrrr'r4r4r4r5r�%sr�zY.Inside)r	rJr}r�r&r%rFrr9r;rpr�rrr�rvr=r[r�r')r/ZdescriptorsrrA�nZqualnamer�r4r4r5�
test_qualnames&!

z'ClassPropertiesAndMethods.test_qualnamecCs�idd6}tdf|�}|j|jd�|jd|j�|j|idd6�idd6}|jttdf|�dS)Nz	some.namerrr�rT)r;r9rrr�r=r�rv)r/r�r�r4r4r5�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)rcr)r=)r/r4r4r5r)8s
zEClassPropertiesAndMethods.test_cycle_through_dict.<locals>.X.__init__N)rprqrrr)r4r4r4r5r�7sr�r�)rcr�r�r�rrL�assertIsNonerNrF�assertIsNotr;)r/r�r��wrr~r4r4r5�test_cycle_through_dict5s		
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)rprqrrr4r4r4r5�OverrideNeitherFsr/rTr�c@seZdZddd�ZdS)zWClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNewrc_stj|||�S)N)r�r~)r�r�r�r0r�r4r4r5r~Ksz_ClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideNew.__new__N)rprqrrr~r4r4r4r5�OverrideNewJsr0c@seZdZddd�ZdS)zXClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideInitrc_stj|||�S)N)r�r))r/r�r�r0r1r4r4r5r)NszaClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideInit.__init__N)rprqrrr)r4r4r4r5�OverrideInitMsr1c@seZdZdS)zXClassPropertiesAndMethods.test_object_new_and_init_with_parameters.<locals>.OverrideBothN)rprqrrr4r4r4r5�OverrideBothPsr2rUrVr�)r�rv)r/r/r0r1r2Zcaser4r4r5�(test_object_new_and_init_with_parametersDs
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)rprqrrr4r4r4r5r%Ysr%c@seZdZdS)z[ClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptors.<locals>.SubN)rprqrrr4r4r4r5r'[sr'r=)r�r=r�)r/r%r'r4r4r5�4test_subclassing_does_not_duplicate_dict_descriptorsXszNClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptors)prprqrrr�r�r�r�r�r
rrrrr&r2r6rSrVr]rhrlrrrr�rxryrzr|r�r�r�r�r�r�r�r�r�r'�skipIfr�flags�optimizer��cpython_onlyr�r�rrr(rOrUrZrcrjrprtrr�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�rrrrrrrr r!r#r$r)r*r.r3r4r4r4)r�r5r��s�4�W")%
%�&F<2"A1ib<CS^t�M @O[YM
.
,	A( 63,'!3
'

 
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)Nr4)r/r4r4r5r@dsz$DictProxyTests.setUp.<locals>.C.methN)rprqrrr@r4r4r4r5rscsrs)r�rs)r/rsr4r4r5�setUpbszDictProxyTests.setUp�gettracez#trace function introduces __local__cCs[|jjj�}|j|t�t|�}|j�|j|dddddg�dS)Nr=r<rqrTr@)rsr=r_�assertNotIsInstancer+�sortr9)r/r�r_r4r4r5�test_iter_keyshs
zDictProxyTests.test_iter_keyscCsH|jjj�}|j|t�t|�}|jt|�d�dS)Nr\)rsr=r�r<r+r9r�)r/r�r�r4r4r5�test_iter_valuessszDictProxyTests.test_iter_valuescCsb|jjj�}|j|t�dd�|D�}|j�|j|dddddg�dS)NcSsg|]}|d�qS)rr4)r��itemr4r4r5r�s	z2DictProxyTests.test_iter_items.<locals>.<listcomp>r=r<rqrTr@)rsr=r,r<r+r=r9)r/r�r_r4r4r5�test_iter_items|s
zDictProxyTests.test_iter_itemscCskGdd�dt�}Gdd�dt�}Gdd�dd|�}|jt|j�t|j��dS)Nc@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.BN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.MN)rprqrrr4r4r4r5r�src@seZdZdS)z7DictProxyTests.test_dict_type_with_metaclass.<locals>.CN)rprqrrr4r4r4r5rs�srsr�)r�r;r9r=)r/r�rrsr4r4r5�test_dict_type_with_metaclass�sz,DictProxyTests.test_dict_type_with_metaclasscCs�t|jj�}|j|jd�|�|j|jd�|�x<|jjj�D](\}}|jdj||�|�qWWdS)Nz
mappingproxy(�)z
{!r}: {!r})	rdrsr=r�r��endswithr,r�r�)r/r�r�r�r4r4r5�	test_repr�s
zDictProxyTests.test_reprN)rprqrrr:r'r5rjrr;r>r?rArBrEr4r4r4r5r9as

r9c@seZdZdd�ZdS)�PTypesLongInitTestc
CsIGdd�dt�}ytd|�d�WnYnXtjt�dS)Nc@seZdZdd�ZdS)z;PTypesLongInitTest.test_pytype_long_ready.<locals>.UserLongcWsdS)Nr4)r/r0r4r4r5r��szCPTypesLongInitTest.test_pytype_long_ready.<locals>.UserLong.__pow__N)rprqrrr�r4r4r4r5�UserLong�srGr)r�rr;r�r@)r/rGr4r4r5�test_pytype_long_ready�sz)PTypesLongInitTest.test_pytype_long_readyN)rprqrrrHr4r4r4r5rF�srFc@seZdZdd�ZdS)�	MiscTestscs�G��fdd�dt�}Gdd�dt�}Gdd�dt��td|fid|�6��|j�jd	�|j�jd
�dS)Ncs1eZdZdd�Z��fdd�ZdS)z7MiscTests.test_type_lookup_mro_reference.<locals>.MyKeycSs
td�S)N�mykey)r�)r/r4r4r5r��sz@MiscTests.test_type_lookup_mro_reference.<locals>.MyKey.__hash__cs�f�_dS)N)r>)r/ro)�Base2r�r4r5rG�sz>MiscTests.test_type_lookup_mro_reference.<locals>.MyKey.__eq__N)rprqrrr�rGr4)rKr�r4r5�MyKey�srLc@seZdZdZdZdS)z6MiscTests.test_type_lookup_mro_reference.<locals>.Basez	from BaseN)rprqrrrJ�mykey2r4r4r4r5r%�sr%c@seZdZdZdZdS)z7MiscTests.test_type_lookup_mro_reference.<locals>.Base2z
from Base2N)rprqrrrJrMr4r4r4r5rK�srKr�r\z	from Basez
from Base2)r�r;r9rJrM)r/rLr%r4)rKr�r5�test_type_lookup_mro_reference�sz(MiscTests.test_type_lookup_mro_referenceN)rprqrrrNr4r4r4r5rI�srIc@s�eZdZfiddddd�Zdd�Zdd�Zddd	�Zed
d��Zdd
�Z	dd�Z
dd�ZdS)�
PicklingTestsNc
Cs |dkr�|j|�}|j|dd�tjt|�||f|f�|dk	ry|jt|d�|�n|j|d�|dk	r�|jt	|d�|�q|j|d�nU|dkr�|j|�}|j|dd�tj
t|�f||f�|dk	r>|jt|d�|�n|j|d�|dk	rx|jt	|d�|�q|j|d�n�t|�j}	tjt|�|	|	t
kr�dn	|	|�ff}|dk	r�||f7}n|j|j|�|�|j|j�|�dS)NrXrVrU)�
__reduce_ex__r9�copyreg�
__newobj_ex__r;�assertListEqualr+r+�assertDictEqualrc�
__newobj__�__base__�_reconstructorr��
__reduce__)
r/�protor�r0r1r��	listitems�	dictitemsZreduce_valueZ	base_typer4r4r5�
_check_reduce�sB

	$zPicklingTests._check_reducecs�ttjd�}d2�id3d6d4d6�id5d	6�G�fd
d�d�}|�}x!|D]}|j||��qcWx*�j�D]\}}t|||�q�Wx'|D]}|j||�d��q�WGd
d�d�}|�}x@|D]8}|dkr�|jt��|j|�WdQXq�q�WG��fdd�d�}|�}xe|D]]}|dkr�|j||���qb|dkrb|jt	��|j|�WdQXqbqbWG�fdd�d�}	G�fdd�d�}
Gdd�d�}Gdd�d�}xl|D]d}x[|	|
||fD]G}
|
�}|dkr;|jtt	f��|j|�WdQXq;q;Wq"WG�fdd�d�}|�}x!|D]}|j||��q�WGdd�d�}|�}x@|D]8}|dkr�|jt
��|j|�WdQXq�q�WG�fdd �d �}|�}x$|D]}|j||d��qXWGd!d"�d"�}|�}x$|D]}|j||dd#�q�WGd$d%�d%�}|�}x`|D]X}|jt
��|j|�WdQX|dkr�|jt
��|j�WdQXq�q�WG�fd&d'�d'�}|�}x||D]t}|dkr�|j||dd�f�qc|jt��|j|�WdQX|jt��|j�WdQXqcWGd(d)�d)t�}|id6d+6�}x*|D]"}|j||d,t|��qWGd-d.�d.t
�}|d/g�}x*|D]"}|j||d0t
|��q]WdS)7NrTr�r���Zbaconi-Zfishi��cheesecs"eZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C1cs�S)Nr4)r/)r0r4r5�__getnewargs__sz4PicklingTests.test_reduce.<locals>.C1.__getnewargs__N)rprqrrr_r4)r0r4r5r8�sr8r�c@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C2cSsdS)Nzbad argsr4)r/r4r4r5r_sz4PicklingTests.test_reduce.<locals>.C2.__getnewargs__N)rprqrrr_r4r4r4r5r�sr�rUcs%eZdZ��fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C3cs
��fS)Nr4)r/)r0r1r4r5�__getnewargs_ex__sz7PicklingTests.test_reduce.<locals>.C3.__getnewargs_ex__N)rprqrrr`r4)r0r1r4r5r9sr9rXcs"eZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C4cs
�dfS)Nzbad dictr4)r/)r0r4r5r` sz7PicklingTests.test_reduce.<locals>.C4.__getnewargs_ex__N)rprqrrr`r4)r0r4r5r=sr=cs"eZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C5cs
d�fS)Nz	bad tupler4)r/)r1r4r5r`#sz7PicklingTests.test_reduce.<locals>.C5.__getnewargs_ex__N)rprqrrr`r4)r1r4r5�C5"srac@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C6cSsfS)Nr4)r/r4r4r5r`&sz7PicklingTests.test_reduce.<locals>.C6.__getnewargs_ex__N)rprqrrr`r4r4r4r5�C6%srbc@seZdZdd�ZdS)z%PicklingTests.test_reduce.<locals>.C7cSsdS)Nzbad argsr4)r/r4r4r5r`)sz7PicklingTests.test_reduce.<locals>.C7.__getnewargs_ex__N)rprqrrr`r4r4r4r5�C7(srccs"eZdZ�fdd�ZdS)z%PicklingTests.test_reduce.<locals>.C9cs
�ifS)Nr4)r/)r0r4r5r`3sz7PicklingTests.test_reduce.<locals>.C9.__getnewargs_ex__N)rprqrrr`r4)r0r4r5�C92srdc@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C10cSs
t�dS)N)r�)r/r4r4r5r`:sz8PicklingTests.test_reduce.<locals>.C10.__getnewargs_ex__N)rprqrrr`r4r4r4r5�C109srecs"eZdZ�fdd�ZdS)z&PicklingTests.test_reduce.<locals>.C11cs�S)Nr4)r/)r�r4r5r�Csz3PicklingTests.test_reduce.<locals>.C11.__getstate__N)rprqrrr�r4)r�r4r5�C11Bsrfc@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C12cSsdS)Nznot dictr4)r/r4r4r5r�Jsz3PicklingTests.test_reduce.<locals>.C12.__getstate__N)rprqrrr�r4r4r4r5�C12Isrgznot dictc@seZdZdd�ZdS)z&PicklingTests.test_reduce.<locals>.C13cSs
t�dS)N)r�)r/r4r4r5r�Qsz3PicklingTests.test_reduce.<locals>.C13.__getstate__N)rprqrrr�r4r4r4r5�C13Psrhcs.eZdZe��Z�fdd�ZdS)z&PicklingTests.test_reduce.<locals>.C14cs1x*�j�D]\}}t|||�q
WdS)N)r,r�)r/r2r�)r�r4r5r)]sz/PicklingTests.test_reduce.<locals>.C14.__init__N)rprqrrr@r�r)r4)r�r4r5�C14[sric@seZdZdS)z&PicklingTests.test_reduce.<locals>.C15N)rprqrrr4r4r4r5�C15ksrjiYZquebecr[c@seZdZdS)z&PicklingTests.test_reduce.<locals>.C16N)rprqrrr4r4r4r5�C16qsrkZyukonrZ���)rlzspami7���i���io���i����)r��pickle�HIGHEST_PROTOCOLr\r,r�r�rvrPrr�rXrcr+)r/�	protocolsr8r�rYr2r�r�r9r=rarbrcr�rdrerfrgrhrirjrkr4)r0r1r�r5�test_reduce�s�
	

	
	

		
	
	
	
	
	

 
zPicklingTests.test_reducecCslttjd�}Gdd�d�}x?|D]7}|dkrEind}|j||�d|�q-WdS)NrTc@s(eZdZdd�Zdd�ZdS)z7PicklingTests.test_special_method_lookup.<locals>.PickycSsiS)Nr4)r/r4r4r5r�zszDPicklingTests.test_special_method_lookup.<locals>.Picky.__getstate__cSs|dkrt|��ndS)Nr_r`)z__getnewargs__z__getnewargs_ex__)r�)r/r�r4r4r5rf}szCPicklingTests.test_special_method_lookup.<locals>.Picky.__getattr__N)rprqrrr�rfr4r4r4r5�PickyysrqrUr�)r�rmrnr\)r/rorqZprotocolr�r4r4r5r�ws

z(PicklingTests.test_special_method_lookupcCs�|dkr!dj||�}nt|�jtjkrLtdd��n|j||d|�|jt|�t|�d|�t|d�r�|j|j	|j	d|�|j|j	|j	d|�nt|d�rf|j
|j|jd|�xj|jD]\}|jt||�t||�d|�|jt
||d�t
||d�d|�qWn|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;rer�rr,r�rjrTr=rSr�r9r<rd)r/r��objcopyr+�slotr4r4r5�_assert_is_copy�s$
"" 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)rY�dumps�loads)r/rYrurvr4r4r5r)�s		zEPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.__init__cSs|j|j||j��S)N)rvrurY)r/r�r4r4r5r��szAPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.copycSs4dj|j|jj|jj|jj|jj�S)Nz0PickleCopier(proto={}, dumps={}.{}, loads={}.{}))r�rYrurqrrrv)r/r4r4r5re�szEPicklingTests._generate_pickle_copiers.<locals>.PickleCopier.__repr__N)rprqrrr<r)r�rer4r4r4r5�PickleCopier�srwc3s|]}�|�VqdS)Nr4)r�r0)rwr4r5�	<genexpr>�sz9PicklingTests._generate_pickle_copiers.<locals>.<genexpr>rT)	�	itertools�productr�rmrnruZ_dumpsrvZ_loadsr4r4)rwr5�_generate_pickle_copiers�s
z&PicklingTests._generate_pickle_copierscCs�Gdd�d�a|jt��tjt�d�WdQXGdd�dt�a|jt��tjt�d�WdQXGdd�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
||�WdQXq�WdS)Nc@seZdZdgZdS)rsr7N)rprqrrr�r4r4r4r5rs�srsrc@seZdZdS)r�N)rprqrrr4r4r4r5r��sr�c@sCeZdZdZdgZdd�Zdd�Zdd�Zd	S)
rsz7A class with __getstate__ and __setstate__ implemented.r7c
Ss�t|di�j�}xct|�jD]R}xI|jjdf�D]2}yt||�||<WqDtk
ruYqDXqDWq(W|S)Nr=r�)r<r�r;rr=rr5)r/r�r�rsr4r4r5r��s

zC.__getstate__cSs1x*|j�D]\}}t|||�q
WdS)N)r,r�)r/r�r�r�r4r4r5r��szC.__setstate__cSsdt|�j|j�fS)Nz%s()<%r>)r;rpr�)r/r4r4r5re�sz
C.__repr__N)rprqrrr<r�r�r�rer4r4r4r5rs�s
		c@seZdZdZdS)r�z!A subclass of a class with slots.N)rprqrrr<r4r4r4r5r��sc@seZdZdZdgZdS)r�zA subclass with an extra slot.rGN)rprqrrr<r�r4r4r4r5r��sr��
pickle_copierr�rmr�)
rsr�rvrmrur�r�r{�subTestr�rtr7rG)r/r|r�rar4r4r5�test_pickle_slots�s6								zPicklingTests.test_pickle_slotsc
CsnGdd�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|kodknrHt|d�rH|jt��|j||�WdQXw�n|j|�}|j||�|dkr�|jr�|jj�|j|�}	|j||	�nWdQXq�Wx�|D]�}|j
d|���t|d
i�}||j|�}t|d�rw�nt|�}|j||�|js`|jj�t|�}	|j||	�nWdQXq�WdS)Ncs@eZdZdZd	ZdZ�fdd�Zdd�Z�S)
r8z:The state of this class is copyable via its instance dict.rTrUTcs#t�j�||_||_dS)N)r�r)r7rG)r/r7rG)r�r4r5r)s
	zC1.__init__cSsd|j|jfS)Nz
C1(%r, %r))r7rG)r/r4r4r5reszC1.__repr__)rTrU)rprqrrr<�ARGS�NEED_DICT_COPYINGr)rer4r4)r�r5r8�s
r8csdeZdZdZd
ZdZ�fdd�Z�fdd�Zed	d
��Z	dd�Z
�S)r�z,A list subclass copyable via __getnewargs__.rTrUFcs(t�j|�}||_||_|S)N)r�r~r7rG)r�r7rGr/)r�r4r5r~s		z
C2.__new__cst�j�|jd�dS)Nr^)r�r)r`)r/r0)r�r4r5r)s
zC2.__init__cSs|jS)N)r)r�r4r4r5r_szC2.__getnewargs__cSsd|j|jt|�fS)NzC2(%r, %r)<%r>)r7rGr+)r/r4r4r5reszC2.__repr__)rTrU)rprqrrr<rr�r~r)r�r_rer4r4)r�r5r�
sr�c@sXeZdZdZdZdZdd�Zedd��Zd	d
�Z	dd�Z
d
S)r9z*A list subclass copyable via __getstate__.rTrUFcSs#||_||_|jd�dS)Nr^)r7rGr`)r/r7rGr4r4r5r)#s		zC3.__init__cSs|jS)N)r)r�r4r4r5r�)szC3.__getstate__cSs"|\}}||_||_dS)N)r7rG)r/r�r7rGr4r4r5r�,s	zC3.__setstate__cSsd|j|jt|�fS)NzC3(%r, %r)<%r>)r7rGr+)r/r4r4r5re0szC3.__repr__N)rTrU)rprqrrr<rr�r)r�r�r�rer4r4r4r5r9sr9csReZdZdZdZdZ�fdd�Zedd	��Zd
d�Z	�S)
r=z,An int subclass copyable via __getnewargs__.rrrTFcs+t�j||�}||_||_|S)N)r�r~r7rG)r�r7rGr�r/)r�r4r5r~8s		z
C4.__new__cSs|jS)N)r)r�r4r4r5r_=szC4.__getnewargs__cSsd|j|jt|�fS)NzC4(%r, %r)<%r>)r7rGr%)r/r4r4r5re@szC4.__repr__)zhellozworldrT)
rprqrrr<rr�r~r�r_rer4r4)r�r5r=4sr=cseeZdZdZdZidd6ZdZdd�fdd	�Zed
d��Z	dd
�Z
�S)raz/An int subclass copyable via __getnewargs_ex__.rTrUrVr�Frcs+t�j||�}||_||_|S)N)r�r~r7rG)r�r7rGr�r/)r�r4r5r~Is		z
C5.__new__cSs|j|jfS)N)r�KWARGS)r�r4r4r5r`NszC5.__getnewargs_ex__cSsd|j|jt|�fS)NzC5(%r, %r)<%r>)r7rGr%)r/r4r4r5reQszC5.__repr__)rTrU)rprqrrr<rr�r�r~r�r`rer4r4)r�r5raDs
rar�r|r�rUrXr`)r8r+r�r9r%r=rar{ryrzr}r<rrYrjr�rrur�rtr�r=r�r)
r/Ztest_classesZpickle_copiersr�r|r1r�rYrrZobjcopy2r4r4r5�test_reduce_copying�sD	+

	
z!PicklingTests.test_reduce_copyingcs�Gdd�dt��G��fdd�d��ddl}|j�fdidd6fddf}|j��jd�|�dS)	Nc@seZdZdS)z(PicklingTests.test_issue24097.<locals>.SN)rprqrrr4r4r4r5r��sr�cs4eZdZ�d�gZ��fdd�ZdS)z(PicklingTests.test_issue24097.<locals>.Ar�cs6|dkr,�d�g�jdd�<dSt�dS)Nr�r�)�
__slotnames__r5)r/r�)r�r�r4r5rf�sz4PicklingTests.test_issue24097.<locals>.A.__getattr__N)rprqrrr�rfr4)r�r�r4r5r��sr�rr�r�rU)r	rQrUr9rX)r/rQr)r4)r�r�r5�test_issue24097s
	(zPicklingTests.test_issue24097)rprqrrr\rpr�rtr�r{r~r�r�r4r4r4r5rO�s	(~C�rOc@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)rprqrrr4r4r4r5r��sr�c@seZdZdS)z)SharedKeyTests.test_subclasses.<locals>.BN)rprqrrr4r4r4r5r��sr�rX)r9rr��varsZ
assertLessr�r�rarM�wr4r\r�rB)r/r�r�r7rGr�r4r4r5�test_subclasses�s.($.	.($zSharedKeyTests.test_subclassesN)rprqrrrr8r�r4r4r4r5r��sr�c@s.eZdZdZdd�Zdd�ZdS)�DebugHelperMetaz<
    Sets default __doc__ and simplifies repr() output.
    cCs8|jd�dkr"||d<ntj||||�S)Nr<)rr;r~)r�r2r�r�r4r4r5r~�s
zDebugHelperMeta.__new__cCs
t|j�S)N)rdrp)r�r4r4r5re�szDebugHelperMeta.__repr__N)rprqrrr<r~rer4r4r4r5r��s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)r/r4r4r5r:�s	z
MroTest.setUpcCs+|j|k}|r'|jd7_n|S)NrT)r�)r/�limitZretr4r4r5�
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>.McsC�jd�r6|jdks$t�|jf7_ntj|�S)NrT)r�rr�r>r;r�)r�)r/r4r5r��sz8MroTest.test_incomplete_set_bases_on_self.<locals>.M.mroN)rprqrrr�r4)r/r4r5r�src@seZdZdS)z4MroTest.test_incomplete_set_bases_on_self.<locals>.AN)rprqrrr4r4r4r5r��sr�r�N)r�)r/rr�r4)r/r5�!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>.McsO|jdk	rB|jdkrB�jd�rB�jf7_qBntj|�S)Nr�r�)rrpr�r>r;r�)r�)r�r/r4r5r��sz3MroTest.test_reent_set_bases_on_base.<locals>.M.mroN)rprqrrr�r4)r�r/r4r5r�src@seZdZdS)z/MroTest.test_reent_set_bases_on_base.<locals>.AN)rprqrrr4r4r4r5r��sr�r�c@seZdZdS)z/MroTest.test_reent_set_bases_on_base.<locals>.BN)rprqrrr4r4r4r5r��sr�N)r�r>)r/rr�r4)r�r/r5�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>.McsJ|jd}|tk	r=�jd�r=|jf7_q=ntj|�S)Nrr\)r>r�r�r;r�)r�rN)r/r4r5r��s

z:MroTest.test_reent_set_bases_on_direct_base.<locals>.M.mroN)rprqrrr�r4)r/r4r5r�src@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.AN)rprqrrr4r4r4r5r��sr�r�c@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.BN)rprqrrr4r4r4r5r��sr�c@seZdZdS)z6MroTest.test_reent_set_bases_on_direct_base.<locals>.CN)rprqrrr4r4r4r5rs�srsN)r�)r/rr�r�rsr4)r/r5�#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_WdQXdS)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>.McsU�jrH|jdkr'�f�_n|jdkrH�f�_qHntj|�S)N�B1�B2)r�rpr>r;r�)r�)r�r�r/r4r5r�s	z9MroTest.test_reent_set_bases_tp_base_cycle.<locals>.M.mroN)rprqrrr�r4)r�r�r/r4r5r
src@seZdZdS)z5MroTest.test_reent_set_bases_tp_base_cycle.<locals>.AN)rprqrrr4r4r4r5r�sr�r�c@seZdZdS)z6MroTest.test_reent_set_bases_tp_base_cycle.<locals>.B1N)rprqrrr4r4r4r5r�sr�c@seZdZdS)z6MroTest.test_reent_set_bases_tp_base_cycle.<locals>.B2N)rprqrrr4r4r4r5r�sr�TN)r�r�r�rvr>)r/rr�r4)r�r�r/r5�"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=�jr0|jdkr0d�_�f�_ntj|�S)NrsF)r�rpr>r;r�)r�)r�rsr/r4r5r�(s	z?MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.M.mroN)rprqrrr�r4)r�rsr/r4r5r'src@seZdZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.AN)rprqrrr4r4r4r5r�.sr�r�c@seZdZdS)z<MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.B1N)rprqrrr4r4r4r5r�0sr�c@seZdZdS)z<MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.B2N)rprqrrr4r4r4r5r�2sr�c@seZdZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots.<locals>.CN)rprqrrr4r4r4r5rs4srsTN)r�r�r>r9r�)r/rr�r�r4)r�rsr/r5�(test_tp_subclasses_cycle_in_update_slotss	"	z0MroTest.test_tp_subclasses_cycle_in_update_slotscs	Gdd�dt��G����fdd�dt�}Gdd�dd|�}Gdd	�d	|�}Gd
d�d|��Gdd
�d
|��d�_�j���|f�_WdQX�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)rprqrrr4r4r4r5r�Gsr�cs+eZdZ����fdd�ZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.McsX�jrK|jdkrK�j�fkr6d�_qK�f�_��ntj|�S)NrsF)r�rpr>r;r�)r�)r�rsr�r/r4r5r�Js	zAMroTest.test_tp_subclasses_cycle_error_return_path.<locals>.M.mroN)rprqrrr�r4)r�rsr�r/r4r5rIsrc@seZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.AN)rprqrrr4r4r4r5r�Ssr�r�c@seZdZdS)z>MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.B1N)rprqrrr4r4r4r5r�Usr�c@seZdZdS)z>MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.B2N)rprqrrr4r4r4r5r�Wsr�c@seZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path.<locals>.CN)rprqrrr4r4r4r5rsYsrsTN)
r�r�r�r�r>r9rr@r;r�)r/rr�r�r4)r�rsr�r/r5�*test_tp_subclasses_cycle_error_return_pathBs%
	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>.McsZ|jdkrM|jdkrM�jt��Gdd�d|�}WdQXntj|�S)Nr�c@seZdZdS)z8MroTest.test_incomplete_extend.<locals>.M.mro.<locals>.XN)rprqrrr4r4r4r5r�ns)rrpr�rvr;r�)r�r�)r/r4r5r�ksz-MroTest.test_incomplete_extend.<locals>.M.mroN)rprqrrr�r4)r/r4r5rjsrc@seZdZdS)z)MroTest.test_incomplete_extend.<locals>.AN)rprqrrr4r4r4r5r�ssr�r�N)r�)r/rr�r4)r/r5�test_incomplete_extendds	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
sE|jdkr8�jt��t||�jWdQXntj|�S)N)rr�r5r�Zxxxr;r�)r�)r�r/r4r5r�|sz,MroTest.test_incomplete_super.<locals>.M.mro)rprqrrr�r4)r/)r�r5r{src@seZdZdS)z(MroTest.test_incomplete_super.<locals>.AN)rprqrrr4r4r4r5r��sr�r�N)r�)r/rr�r4)r/r5�test_incomplete_supervszMroTest.test_incomplete_superN)rprqrrr<r:r�r�r�r�r�r�r�r�r�r4r4r4r5r��s$$"r�c	Cs&tjtttttttt	�dS)N)
rZrun_unittestrFrr�r9rIrOr�r�r4r4r4r5�	test_main�s	r��__main__)r�rQrNryr�rmrrr'r�r�rr�rr(rr�r9rFrIrOr�r;r�r�r�rpr4r4r4r5�<module>sP�r����������������<���