Your IP : 216.73.216.52


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



���]��n@svddlZddlZddlZddlZddlmZddlmZmZmZm	Z	ddl
mZddlm
Z
mZmZmZyGdd�de�ZWn+ek
r�ZzeZWYddZ[XnXyGdd	�d	ee�ZWn+ek
r&ZzeZWYddZ[XnXyGd
d�dee�ZWn+ek
rqZzeZWYddZ[XnXy3Gdd
�d
ee�ZGdd�de�ZWn+ek
r�ZzeZWYddZ[XnXyeddde�ZWn+ek
rZzeZWYddZ[XnXyedd�ZWn+ek
rZZzeZWYddZ[XnXyedddd�ZWn+ek
r�ZzeZWYddZ[XnXyGdd�de�ZWnek
r�YnXddd�Z dd�Z!Gdd �d ej"�Z#Gd!d"�d"ej"�Z$Gd#d$�d$ej"�Z%d%Z&d&Z'Gd'd(�d(ej"�Z(ed)krrej)�dS)*�N)�OrderedDict)�Enum�IntEnum�EnumMeta�unique)�StringIO)�dumps�loads�
PicklingError�HIGHEST_PROTOCOLc@s"eZdZdZdZdZdS)�Stooges���N)�__name__�
__module__�__qualname__�LARRY�CURLY�MOE�rr�./opt/alt/python35/lib64/python3.5/test_enum.pyrsrc@s"eZdZdZdZdZdS)�
IntStoogesr
rrN)rrrrrrrrrrrsrc@s"eZdZdZdZdZdS)�FloatStoogesg=
ףp=�?g�(\��@g�R$_	$	@N)rrrrrrrrrrrsrc@seZdZdS)�StrEnumN)rrrrrrrr%src@seZdZdZdZdS)�NamezGuido van RossumzBarry WarsawN)rrr�BDFLZFLUFLrrrrr'sr�Questionzwho what when where why�module�Answerzhim this then there because�Theoryzrule law supposition�qualname�spanish_inquisitionc@s"eZdZdZdZdZdS)�Fruitr
rrN)rrrZtomatoZbananaZcherryrrrrr#>sr#cCsP|dkr|}x7ttd�D]%}|tt|d|��|�q#WdS)Nr
�protocol)�rangerr	r)�	assertion�source�targetr$rrr�test_pickle_dump_loadEsr)cCsCx<ttd�D]*}||��t|d|�WdQRXqWdS)Nr
r$)r%rr)r&�	exception�objr$rrr�test_pickle_exceptionKs
r,c@s4eZdZdd�Zdd�Zdd�ZdS)�TestHelperscCsmGdd�d�}xSdD]K}|�}|jtj|��t||d�|jtj|��qWdS)Nc@seZdZdS)z+TestHelpers.test_is_descriptor.<locals>.fooN)rrrrrrr�fooTsr.�__get__�__set__�
__delete__r
)r/r0r1)�assertFalse�enum�_is_descriptor�setattr�
assertTrue)�selfr.�attrr+rrr�test_is_descriptorSs
	zTestHelpers.test_is_descriptorc
CsRx$dD]}|jtj|��qWx$dD]}|jtj|��q.WdS)N�_a_�_aa_�a�a_�_a�__a�a__�__a__�_a__�__a_�_�__�___�____�_____)r:r;)
r<r=r>r?r@rArBrCrDrErFrGrH)r6r3�
_is_sunderr2)r7�srrr�test_is_sunder\s


zTestHelpers.test_is_sunderc
CsRx$dD]}|jtj|��qWx$dD]}|jtj|��q.WdS)NrA�__aa__r<r=r>r?r@r:rBrCrDrErFrGrH)rArL)
r<r=r>r?r@r:rBrCrDrErFrGrH)r6r3�
_is_dunderr2)r7rJrrr�test_is_dunderds


zTestHelpers.test_is_dunderN)rrrr9rKrNrrrrr-Ps	r-c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0d]d^�Z1d_d`�Z2dadb�Z3dcdd�Z4dedf�Z5dgdh�Z6didj�Z7dkdl�Z8dmdn�Z9dodp�Z:dqdr�Z;dsdt�Z<dudv�Z=dwdx�Z>dydz�Z?d{d|�Z@d}d~�ZAdd��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��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�S)��TestEnumcCs�Gdd�dt�}||_Gdd�dtt�}||_Gdd�dt�}||_Gdd�dtt�}||_d	d
lm	}Gdd�d|t�}||_
dS)
Nc@s(eZdZdZdZdZdZdS)zTestEnum.setUp.<locals>.Seasonr
rr�N)rrr�SPRING�SUMMER�AUTUMN�WINTERrrrr�SeasonosrUc@s&eZdZdZdZdeZdS)z!TestEnum.setUp.<locals>.KonstantsgB�
�@gJ�M�!	@rN)rrr�EZPI�TAUrrrr�	KonstantsvsrXc@s.eZdZdZdZdZdZdZdS)zTestEnum.setUp.<locals>.Grades�rPrrrN)rrr�A�B�C�D�Frrrr�Grades|s
r_c@s(eZdZdZdZdZdZdS)z#TestEnum.setUp.<locals>.DirectionalZeastZwestZnorthZsouthN)rrrZEAST�WESTZNORTHZSOUTHrrrr�Directional�srar)�datec@seZdZdZdZdS)zTestEnum.setUp.<locals>.Holiday��r
r�N)rcr
r
)rcrrd)rrrZNEW_YEAR�
IDES_OF_MARCHrrrr�Holiday�srf)rrU�floatrXrr_�strraZdatetimerbrf)r7rUrXr_rarbrfrrr�setUpns				zTestEnum.setUpcCsG|j}|jtt|��tddddddddg��dS)	N�	__class__�__doc__�__members__rrQrRrSrT)rU�assertEqual�set�dir)r7rUrrr�test_dir_on_class�s
	zTestEnum.test_dir_on_classcCsA|j}|jtt|j��tdddddg��dS)Nrjrkr�name�value)rUrmrnrorT)r7rUrrr�test_dir_on_item�s	zTestEnum.test_dir_on_itemc	Cs�Gdd�dt�}|jtt|��tddddddg��|jtt|j��tdddd	d
dg��dS)Nc@s(eZdZdZdZdd�ZdS)z3TestEnum.test_dir_with_added_behavior.<locals>.Test�that�thosecSsd|jS)NzWowser! I'm %s!)rq)r7rrr�wowser�sz:TestEnum.test_dir_with_added_behavior.<locals>.Test.wowserN)rrr�this�theservrrrr�Test�sryrjrkrlrrwrxrqrrrv)rrmrnrorw)r7ryrrr�test_dir_with_added_behavior�sz%TestEnum.test_dir_with_added_behaviorc	CsgGdd�dt�}Gdd�d|�}|jtt|j��tddddd	d
g��dS)Nc@seZdZdd�ZdS)zBTestEnum.test_dir_on_sub_with_behavior_on_super.<locals>.SuperEnumcSsdS)Nzdid you see me?r)r7rrr�	invisible�szLTestEnum.test_dir_on_sub_with_behavior_on_super.<locals>.SuperEnum.invisibleN)rrrr{rrrr�	SuperEnum�sr|c@seZdZdZdS)z@TestEnum.test_dir_on_sub_with_behavior_on_super.<locals>.SubEnumrYN)rrr�samplerrrr�SubEnum�sr~rjrkrrqrrr{)rrmrnror})r7r|r~rrr�&test_dir_on_sub_with_behavior_on_super�s
z/TestEnum.test_dir_on_sub_with_behavior_on_supercCs)|j}|j||j�|j�dS)N)rU�assertIsrT)r7rUrrr�test_enum_in_enum_out�s	zTestEnum.test_enum_in_enum_outcCs#|j}|j|jjd�dS)Nr
)rUrmrQrr)r7rUrrr�test_enum_value�s	zTestEnum.test_enum_valuecCs|jtjjd�dS)Nr)rmrrrr)r7rrr�test_intenum_value�szTestEnum.test_intenum_valuecCsi|j}t|�}|jt|�t|��|jt|�d|�|j|j|j|j|jg|�x�tdj	�d�D]�\}}||�}|j|t
||��|j|j|�|j||�|j|j
|�|j||�|jt|�|�|j||�|jt|�d|�|jt|�dj||��q�WdS)NrPzSPRING SUMMER AUTUMN WINTERr
zSeason.z<Season.{0}: {1}>)rU�listrm�lenrQrRrSrT�	enumerate�split�getattrrr�assertNotEqualrq�assertInr��type�assertIsInstancerh�repr�format)r7rU�lst�iZseason�errr�	test_enum�s&	""	zTestEnum.test_enumcCs|j}|j|jjd�|j|jjd�|jt��d|j_WdQRX|jt��d|j_WdQRXdS)NrQr
Zinviernor)rUrmrQrqrr�assertRaises�AttributeError)r7rUrrr�test_value_name�s	zTestEnum.test_value_namec	Cs-|j}|jt��d|_WdQRXdS)Nzreally cold)rUr�r�rT)r7rUrrr�test_changing_member�s	zTestEnum.test_changing_membercCs�Gdd�dt�}|jt|d��|`|jt|d��|jt��|`WdQRX|jt��|`WdQRX|jt��|j`	WdQRXdS)Nc@s4eZdZdZdZdZdZdd�ZdS)z0TestEnum.test_attribute_deletion.<locals>.Seasonr
rrrPcSsdS)Nr)�clsrrr�spam�sz5TestEnum.test_attribute_deletion.<locals>.Season.spamN)rrrrQrRrSrTr�rrrrrU�s
rUr�)
rr6�hasattrr�r2r�r�rQZDRYrq)r7rUrrr�test_attribute_deletion�s	

z TestEnum.test_attribute_deletioncCs-Gdd�dt�}|jt|��dS)Nc@seZdZdS)z*TestEnum.test_bool_of_class.<locals>.EmptyN)rrrrrrr�Emptysr�)rr6�bool)r7r�rrr�test_bool_of_classszTestEnum.test_bool_of_classcCs>Gdd�dt�}x!|D]}|jt|��qWdS)Nc@s"eZdZdZdZdZdS)z+TestEnum.test_bool_of_member.<locals>.Countrr
rN)rrrZzero�one�tworrrr�Countsr�)rr6r�)r7r��memberrrr�test_bool_of_members
zTestEnum.test_bool_of_memberc'Cs�|jt��Gdd�dt�}WdQRX|jt��Gdd�dt�}WdQRX|jt��Gdd�dt�}WdQRX|jt��Gdd�dt�}WdQRX|jt��Gdd�dt�}WdQRXdS)Nc@seZdZdZdS)z*TestEnum.test_invalid_names.<locals>.Wrong�	N)rrr�mrorrrr�Wrongsr�c@seZdZdZdS)z*TestEnum.test_invalid_names.<locals>.Wrong�N)rrr�_create_rrrrr�sc@seZdZdZdS)z*TestEnum.test_invalid_names.<locals>.Wrongr�N)rrr�_get_mixins_rrrrr�sc@seZdZdZdS)z*TestEnum.test_invalid_names.<locals>.Wrongr
N)rrr�
_find_new_rrrrr�sc@seZdZdZdS)z*TestEnum.test_invalid_names.<locals>.Wrongr�N)rrrZ
_any_name_rrrrr�s)r��
ValueErrorr)r7r�rrr�test_invalid_names
szTestEnum.test_invalid_namescCsu|j}|j|j|�|jd|�|d�}|j||�Gdd�dt�}|j|j|�dS)Nrc@seZdZdZdZdS)z)TestEnum.test_contains.<locals>.OtherEnumr
rN)rrrr�r�rrrr�	OtherEnum&sr�)rUr�rSZassertNotInrr�)r7rU�valr�rrr�
test_containss	zTestEnum.test_containscCs�|j}|jt��|j|jkWdQRX|jt��|jdkWdQRX|j|jd�Gdd�dt�}|j|j|j�|jt��|j|jkWdQRXdS)NrPr
c@s"eZdZdZdZdZdS)z'TestEnum.test_comparisons.<locals>.Partr
rrN)rrrrQ�CLIPZBARRELrrrr�Part3sr�)rUr��	TypeErrorrQrTr�rr�)r7rUr�rrr�test_comparisons*s	zTestEnum.test_comparisonscCsGdd�dt�}t|�}|j||j|j|j|jg�|j|j|j�|j|jj	d�|j|jj	d�|j|d�|j�|j|d�|j�|j|jj
d�|jdd�|jj�D�dd	g�dS)
Nc@s2eZdZdZdZdZZdZdZdS)z-TestEnum.test_enum_duplicates.<locals>.Seasonr
rrrPN)	rrrrQrRrS�FALLrT�ANOTHER_SPRINGrrrrrU=s

rUrr
rScSs+g|]!\}}|j|kr|�qSr)rq)�.0�k�vrrr�
<listcomp>Ps	z1TestEnum.test_enum_duplicates.<locals>.<listcomp>r�r�)
rr�rmrQrRrSrTr�r�rrrqrl�items)r7rUr�rrr�test_enum_duplicates<szTestEnum.test_enum_duplicatescCs�|jt��Gdd�dt�}WdQRX|jt��Gdd�dt�}WdQRX|jt��Gdd�dt�}WdQRXdS)Nc@s(eZdZdZdZdZdZdS)z+TestEnum.test_duplicate_name.<locals>.Colorr
rrrPN)rrr�red�green�bluerrrr�ColorVsr�c@s.eZdZdZdZdZdd�ZdS)z+TestEnum.test_duplicate_name.<locals>.Colorr
rrcSsdS)Nr�r)r7rrrr�asz/TestEnum.test_duplicate_name.<locals>.Color.redN)rrrr�r�r�rrrrr�]sc@s4eZdZedd��ZdZdZdZdS)z+TestEnum.test_duplicate_name.<locals>.ColorcSsdS)NZredderr)r7rrrr�fsz/TestEnum.test_duplicate_name.<locals>.Color.redr
rrN)rrr�propertyr�r�r�rrrrr�es)r�r�r)r7r�rrr�test_duplicate_nameTszTestEnum.test_duplicate_namecCs�Gdd�dt�}|jt|�|j|jg�|jt|j�|�|j|jjd�|j|jjd�dS)Nc@seZdZdZdZdS)z/TestEnum.test_enum_with_value_name.<locals>.Huhr
rN)rrrrqrrrrrr�Huhosr�rqr
)rrmr�rqrrr�r�)r7r�rrr�test_enum_with_value_namens	z"TestEnum.test_enum_with_value_namecCs!|j}|jdj|j�djt|j���|jdj|j�djt|j���|jdj|j�djt|j���|jdj|j�djt|j���|jdj|j�djt|j���|jdj|j�djt|j���dS)Nz{}z{:}z{:20}z{:^20}z{:>20}z{:<20})rUrmr�rQrh)r7rUrrr�test_format_enumzs	zTestEnum.test_format_enumcCs9Gdd�dtt�}|jdj|j�d�dS)Nc@s(eZdZdZdZdd�ZdS)z3TestEnum.test_format_enum_custom.<locals>.TestFloatg�?g@cSsdS)NzTestFloat success!r)r7�specrrr�
__format__�sz>TestEnum.test_format_enum_custom.<locals>.TestFloat.__format__N)rrrr�r�r�rrrr�	TestFloat�sr�z{}zTestFloat success!)rgrrmr�r�)r7r�rrr�test_format_enum_custom�sz TestEnum.test_format_enum_customcCs)|j|j|�|j|j��dS)N)rmr�rr)r7r�r�rrr�assertFormatIsValue�szTestEnum.assertFormatIsValuecCs�|j}|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�dS)	Nz{}z{:}z{:20}z{:^20}z{:>20}z{:<20}z{:%Y %m}z{:%Y %m %M:00})rfr�re)r7rfrrr�test_format_enum_date�s	zTestEnum.test_format_enum_datecCs�|j}|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd	|j�dS)
Nz{}z{:}z{:20}z{:^20}z{:>20}z{:<20}z{:n}z{:5.2}z{:f})rXr�rW)r7rXrrr�test_format_enum_float�s	zTestEnum.test_format_enum_floatcCs�|j}|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd	|j�dS)
Nz{}z{:}z{:20}z{:^20}z{:>20}z{:<20}z{:+}z{:08X}z{:b})r_r�r\)r7r_rrr�test_format_enum_int�s	zTestEnum.test_format_enum_intcCs|j}|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j�dS)Nz{}z{:}z{:20}z{:^20}z{:>20}z{:<20})rar�r`)r7rarrr�test_format_enum_str�s	zTestEnum.test_format_enum_strcCs^|j}i}d||j<d||j<d||j<d||j<|j||jd�dS)NZ1225Z0315Z0704Z1031)rUrTrQrRrSrm)r7rUZdatesrrr�	test_hash�s	



zTestEnum.test_hashcCs6Gdd�dtt�}|j|j|jk�dS)Nc@s eZdZdZdeZdS)z/TestEnum.test_intenum_from_scratch.<locals>.phyrrN)rrr�pi�taurrrr�phy�sr�)�intrr6r�r�)r7r�rrr�test_intenum_from_scratch�sz"TestEnum.test_intenum_from_scratchcCsLGdd�dtt�}Gdd�d|�}|j|j|jk�dS)Nc@seZdZdS)z0TestEnum.test_intenum_inherited.<locals>.IntEnumN)rrrrrrrr�src@s eZdZdZdeZdS)z,TestEnum.test_intenum_inherited.<locals>.phyrrN)rrrr�r�rrrrr��sr�)r�rr6r�r�)r7rr�rrr�test_intenum_inherited�szTestEnum.test_intenum_inheritedcCs6Gdd�dtt�}|j|j|jk�dS)Nc@s eZdZdZdeZdS)z1TestEnum.test_floatenum_from_scratch.<locals>.phygJ�M�!	@rN)rrrr�r�rrrrr��sr�)rgrr6r�r�)r7r�rrr�test_floatenum_from_scratch�sz$TestEnum.test_floatenum_from_scratchcCsLGdd�dtt�}Gdd�d|�}|j|j|jk�dS)Nc@seZdZdS)z4TestEnum.test_floatenum_inherited.<locals>.FloatEnumN)rrrrrrr�	FloatEnum�sr�c@s eZdZdZdeZdS)z.TestEnum.test_floatenum_inherited.<locals>.phygJ�M�!	@rN)rrrr�r�rrrrr��sr�)rgrr6r�r�)r7r�r�rrr�test_floatenum_inherited�sz!TestEnum.test_floatenum_inheritedcCs6Gdd�dtt�}|j|j|jk�dS)Nc@seZdZdZdZdS)z/TestEnum.test_strenum_from_scratch.<locals>.phy�Pi�TauN)rrrr�r�rrrrr��sr�)rhrr6r�r�)r7r�rrr�test_strenum_from_scratch�sz"TestEnum.test_strenum_from_scratchcCsLGdd�dtt�}Gdd�d|�}|j|j|jk�dS)Nc@seZdZdS)z0TestEnum.test_strenum_inherited.<locals>.StrEnumN)rrrrrrrr�src@seZdZdZdZdS)z,TestEnum.test_strenum_inherited.<locals>.phyr�r�N)rrrr�r�rrrrr��sr�)rhrr6r�r�)r7rr�rrr�test_strenum_inherited�szTestEnum.test_strenum_inheritedcCs�Gdd�dt�}|jdddg|jd�|jdd�t|j�D�dd	d
g�t|�}|jt|�t|��|jt|�d�d}|j�}x�t|d	�D]�\}}||�}|j||�|jt	|�|�|j|j
|�|j||�|j|j|�d	|�|j
d|ko`d
kn�|jt|�|�|j|t	�|j|t�q�WdS)Nc@s:eZdZdZdZdZdZdZdZdZ	dS)	z&TestEnum.test_intenum.<locals>.WeekDayr
rrrPrY��N)
rrr�SUNDAY�MONDAY�TUESDAY�	WEDNESDAY�THURSDAY�FRIDAY�SATURDAYrrrr�WeekDay�sr�r<�b�ccSsg|]}|�qSrr)r�r�rrrr��s	z)TestEnum.test_intenum.<locals>.<listcomp>rr
rr�z8SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY�)rrmr�r%r�r�r�r�r�r�rqr��indexr6r�r�r�r)r7r�r�r(r�Zweekdayr�rrr�test_intenum�s&	 /#zTestEnum.test_intenumcCsrGdd�dt�}|j|j|j�|j|d�jd�|jdd�|jj�D�dg�dS)Nc@s>eZdZdZdZdZZdZdZdZ	dZ
dS)	z1TestEnum.test_intenum_duplicates.<locals>.WeekDayr
rrrPrYr�r�N)rrrr�r�r��TEUSDAYr�r�r�r�rrrrr�s
r�rr�cSs+g|]!\}}|j|kr|�qSr)rq)r�r�r�rrrr�s		z4TestEnum.test_intenum_duplicates.<locals>.<listcomp>r�)rr�r�r�rmrqrlr�)r7r�rrr�test_intenum_duplicatess
z TestEnum.test_intenum_duplicatesc
CsJ|jtjdd�tj�|jt��tjdd�WdQRXdS)Ns�bigs)r�r�
from_bytesrr�r�)r7rrr�test_intenum_from_bytes sz TestEnum.test_intenum_from_bytesc	Csrtjtjj�}|jtj|�tj�tjtjjd�}|jt��tj|�WdQRXdS)Ng{�G�z�?)	rg�hexrrrrr��fromhexr�r�)r7�hrrr�test_floatenum_fromhex%s
zTestEnum.test_floatenum_fromhexcCs<ttt�rt�t|jtj�t|jt�dS)N)�
isinstancer�	Exceptionr)r�r)r7rrr�test_pickle_enum,szTestEnum.test_pickle_enumcCs<ttt�rt�t|jtj�t|jt�dS)N)r�rr�r)r�r)r7rrr�test_pickle_int2szTestEnum.test_pickle_intcCs<ttt�rt�t|jtj�t|jt�dS)N)r�rr�r)r�r)r7rrr�test_pickle_float8szTestEnum.test_pickle_floatcCs<ttt�rt�t|jtj�t|jt�dS)N)r�rr�r)r�Zhim)r7rrr�test_pickle_enum_function>sz"TestEnum.test_pickle_enum_functioncCs<ttt�rt�t|jtj�t|jt�dS)N)r�rr�r)r�Zwho)r7rrr�%test_pickle_enum_function_with_moduleDsz.TestEnum.test_pickle_enum_function_with_modulecCs,ttt�rt�|jtjd�dS)Nr")r�r r�rmr)r7rrr� test_enum_function_with_qualnameJsz)TestEnum.test_enum_function_with_qualnamecCsRGdd�dt�}||j_d|jj|j_t|j|jj�dS)Nc@seZdZdZdZdS)zLTestEnum.test_class_nested_enum_and_pickle_protocol_four.<locals>.NestedEnum�commonZrareN)rrr�twigsZshinyrrrr�
NestedEnumQsr�z
%s.NestedEnum)rrjr�rrr)r�r�)r7r�rrr�/test_class_nested_enum_and_pickle_protocol_fourOsz8TestEnum.test_class_nested_enum_and_pickle_protocol_fourcCsYGdd�dt�}tj|_x0tt�D]"}|j|jj|�d�q/WdS)Nc@seZdZdZdZdS)z6TestEnum.test_pickle_by_name.<locals>.ReplaceGlobalIntr
rN)rrrZONE�TWOrrrr�ReplaceGlobalIntZsrr�)rr3�_reduce_ex_by_name�
__reduce_ex__r%rrmr�)r7r�protorrr�test_pickle_by_nameYszTestEnum.test_pickle_by_namecCs\tdddt�}|t�d<tj|�t|jt|j�t|jt	|�dS)N�	BadPicklezdill sweet bread-n-butterr)
rr�globalsr3�_make_class_unpicklabler,r�r�Zdillr
)r7rrrr�test_exploding_pickleas

zTestEnum.test_exploding_picklecCs0Gdd�dtt�}|j|jd�dS)Nc@s"eZdZdZdZdZdS)z-TestEnum.test_string_enum.<locals>.SkillLevelz'what is the sound of one hand clapping?z#why did the chicken cross the road?z
knock, knock!N)rrrZmasterZ
journeyman�
apprenticerrrr�
SkillLevelksr
z
knock, knock!)rhrrmr	)r7r
rrr�test_string_enumjszTestEnum.test_string_enumcCsfGdd�dt�}|j|d�|j�|jt|d�|j�|j|d|j�dS)Nc@s(eZdZdZdZdZdZdS)z-TestEnum.test_getattr_getitem.<locals>.Periodr
rrrPN)rrr�morning�noonZevening�nightrrrr�Periodrsrrrr)rr�r
r�rr)r7rrrr�test_getattr_getitemqszTestEnum.test_getattr_getitemcCs#|j}|jt|d��dS)N�__eq__)rUr6r�)r7rUrrr�test_getattr_dunder{s	zTestEnum.test_getattr_dundercCsHGdd�dt�}|jt|�|j|j|j|jg�dS)Nc@s(eZdZdZdZdZdZdS)z-TestEnum.test_iteration_order.<locals>.SeasonrrPrr
N)rrrrRrTrSrQrrrrrU�srU)rrmr�rRrTrSrQ)r7rUrrr�test_iteration_orders	zTestEnum.test_iteration_ordercCsG|jtt|j��|jj|jj|jj|jjg�dS)N)rmr��reversedrUrTrSrRrQ)r7rrr�test_reversed_iteration_order�sz&TestEnum.test_reversed_iteration_ordercCs
tdd�}t|�}|jt|�t|��|jt|�d|�|j|j|j|jg|�x�tdj�d�D]z\}}||�}|jt	|j
�|�|j||�|j|j|�|j
||�|jt|�|�q�WdS)N�SummerMonthzjune july augustrr
)rr�rmr��june�july�augustr�r�r�rrr�rqr�r�r�)r7rr�r��monthr�rrr�!test_programmatic_function_string�s"z*TestEnum.test_programmatic_function_stringcCstdddd�}t|�}|jt|�t|��|jt|�d|�|j|j|j|jg|�x�tdj�d�D]z\}}||�}|jt	|j
�|�|j||�|j|j|�|j
||�|jt|�|�q�WdS)Nrzjune july august�start�
r)rr�rmr�rrrr�r�r�rrr�rqr�r�r�)r7rr�r�rr�rrr�,test_programmatic_function_string_with_start�s"z5TestEnum.test_programmatic_function_string_with_startcCstddddg�}t|�}|jt|�t|��|jt|�d|�|j|j|j|jg|�x�tdj�d�D]z\}}||�}|jt	|j
�|�|j||�|j|j|�|j
||�|jt|�|�q�WdS)Nrrrrrzjune july augustr
)rr�rmr�rrrr�r�r�rrr�rqr�r�r�)r7rr�r�rr�rrr�&test_programmatic_function_string_list�s"z/TestEnum.test_programmatic_function_string_listcCstddddgdd�}t|�}|jt|�t|��|jt|�d|�|j|j|j|jg|�x�tdj�d�D]z\}}||�}|jt	|j
�|�|j||�|j|j|�|j
||�|jt|�|�q�WdS)	Nrrrrr�rzjune july august)rr�rmr�rrrr�r�r�rrr�rqr�r�r�)r7rr�r�rr�rrr�1test_programmatic_function_string_list_with_start�s"z:TestEnum.test_programmatic_function_string_list_with_startcCs
tdd�}t|�}|jt|�t|��|jt|�d|�|j|j|j|jg|�x�tdj�d�D]z\}}||�}|jt	|j
�|�|j||�|j|j|�|j
||�|jt|�|�q�WdS)
Nrrr
rrrrzjune july august�rr
�rr�rr)r"r#r$)rr�rmr�rrrr�r�r�rrr�rqr�r�r�)r7rr�r�rr�rrr�#test_programmatic_function_iterable�s 	"z,TestEnum.test_programmatic_function_iterablecCstdtd��}t|�}|jt|�t|��|jt|�d|�|j|j|j|jg|�x�tdj	�d�D]z\}}||�}|jt
|j�|�|j||�|j|j
|�|j||�|jt|�|�q�WdS)
Nrrr
rrrrzjune july august�rr
�rr�rr)r&r'r()rrr�rmr�rrrr�r�r�rrr�rqr�r�r�)r7rr�r�rr�rrr�$test_programmatic_function_from_dict�s "z-TestEnum.test_programmatic_function_from_dictcCs�tdddt�}t|�}|jt|�t|��|jt|�d|�|j|j|j|jg|�xxtdj	�d�D]a\}}||�}|j||�|j|j
|�|j||�|jt
|�|�q�WdS)Nrzjune july augustr�rr
)rr�r�rmr�rrrr�r�rqr�r�r�)r7rr�r�rr�rrr�test_programmatic_function_type�s"z(TestEnum.test_programmatic_function_typecCs�tdddtdd�}t|�}|jt|�t|��|jt|�d|�|j|j|j|jg|�xxtdj	�d�D]a\}}||�}|j||�|j|j
|�|j||�|jt
|�|�q�WdS)Nrzjune july augustr�r�r)rr�r�rmr�rrrr�r�rqr�r�r�)r7rr�r�rr�rrr�*test_programmatic_function_type_with_start
s"z3TestEnum.test_programmatic_function_type_with_startcCs�tdd�}t|�}|jt|�t|��|jt|�d|�|j|j|j|jg|�xxtdj�d�D]a\}}||�}|j||�|j|j	|�|j
||�|jt|�|�q�WdS)Nrzjune july augustrr
)
rr�rmr�rrrr�r�rqr�r�r�)r7rr�r�rr�rrr�-test_programmatic_function_type_from_subclasss"z6TestEnum.test_programmatic_function_type_from_subclasscCs�tdddd�}t|�}|jt|�t|��|jt|�d|�|j|j|j|jg|�xxtdj�d�D]a\}}||�}|j||�|j|j	|�|j
||�|jt|�|�q�WdS)Nrzjune july augustr�(r)
rr�rmr�rrrr�r�rqr�r�r�)r7rr�r�rr�rrr�8test_programmatic_function_type_from_subclass_with_start-s"zATestEnum.test_programmatic_function_type_from_subclass_with_startcCstttt�rt�|jtjd�|jtjtd��|jtjttd��t|jtj�dS)NzGuido van Rossumr)	r�rr�rmrr6r�r�r))r7rrr�test_subclassing=szTestEnum.test_subclassingcCsGGdd�dt�}|jt��Gdd�d|�}WdQRXdS)Nc@s"eZdZdZdZdZdS)z&TestEnum.test_extending.<locals>.Colorr
rrN)rrrr�r�r�rrrrr�Fsr�c@s"eZdZdZdZdZdS)z*TestEnum.test_extending.<locals>.MoreColorrPrYr�N)rrr�cyan�magenta�yellowrrrr�	MoreColorKsr4)rr�r�)r7r�r4rrr�test_extendingEszTestEnum.test_extendingcCsLGdd�dt�}|jt|j�|�|j|jj�d�dS)Nc@s(eZdZdZdZdd�ZdS)z/TestEnum.test_exclude_methods.<locals>.whateverrtrucSsd|jS)Nz
no, not %s)rr)r7rrr�reallyTsz6TestEnum.test_exclude_methods.<locals>.whatever.reallyN)rrrrwrxr6rrrr�whateverQsr7zno, not that)rZassertIsNotr�r6rmrw)r7r7rrr�test_exclude_methodsPszTestEnum.test_exclude_methodscCs4|jt��Gdd�dtt�}WdQRXdS)Nc@seZdZdZdS)z4TestEnum.test_wrong_inheritance_order.<locals>.Wrongzerror before this pointN)rrrZNotHererrrrr�[sr�)r�r�rrh)r7r�rrr�test_wrong_inheritance_orderYsz%TestEnum.test_wrong_inheritance_ordercCsrGdd�dt�}Gdd�dt�}|j|j|j�|j|j|j�|j|j|j�dS)Nc@s"eZdZdZdZdZdS)z2TestEnum.test_intenum_transitivity.<locals>.numberr
rrN)rrrr�r��threerrrr�number_sr;c@s"eZdZdZdZdZdS)z2TestEnum.test_intenum_transitivity.<locals>.numeror
rrN)rrr�uno�dos�tresrrrr�numerocsr?)rrmr�r<r�r=r:r>)r7r;r?rrr�test_intenum_transitivity^s
z"TestEnum.test_intenum_transitivitycCsFGdd�dt�}Gdd�dt�}|jt||j�dS)Nc@seZdZdZdZdS)z4TestEnum.test_wrong_enum_in_call.<locals>.Monochromerr
N)rrr�black�whiterrrr�
MonochromelsrCc@seZdZdZdZdS)z0TestEnum.test_wrong_enum_in_call.<locals>.Genderrr
N)rrr�male�femalerrrr�GenderosrF)rr�r�rD)r7rCrFrrr�test_wrong_enum_in_callksz TestEnum.test_wrong_enum_in_callcCsFGdd�dt�}Gdd�dt�}|jt||j�dS)Nc@seZdZdZdZdS)z:TestEnum.test_wrong_enum_in_mixed_call.<locals>.Monochromerr
N)rrrrArBrrrrrCusrCc@seZdZdZdZdS)z6TestEnum.test_wrong_enum_in_mixed_call.<locals>.Genderrr
N)rrrrDrErrrrrFxsrF)rrr�r�rD)r7rCrFrrr�test_wrong_enum_in_mixed_calltsz&TestEnum.test_wrong_enum_in_mixed_callcCsLGdd�dt�}Gdd�dt�}|j||j�|j�dS)Nc@seZdZdZdZdS)z6TestEnum.test_mixed_enum_in_call_1.<locals>.Monochromerr
N)rrrrArBrrrrrC~srCc@seZdZdZdZdS)z2TestEnum.test_mixed_enum_in_call_1.<locals>.Genderrr
N)rrrrDrErrrrrF�srF)rr�rErB)r7rCrFrrr�test_mixed_enum_in_call_1}sz"TestEnum.test_mixed_enum_in_call_1cCsLGdd�dt�}Gdd�dt�}|j||j�|j�dS)Nc@seZdZdZdZdS)z6TestEnum.test_mixed_enum_in_call_2.<locals>.Monochromerr
N)rrrrArBrrrrrC�srCc@seZdZdZdZdS)z2TestEnum.test_mixed_enum_in_call_2.<locals>.Genderrr
N)rrrrDrErrrrrF�srF)rrr�rDrA)r7rCrFrrr�test_mixed_enum_in_call_2�sz"TestEnum.test_mixed_enum_in_call_2cCsIGdd�dt�}Gdd�d|�}|jt|j�d�dS)Nc@seZdZdd�ZdS)z*TestEnum.test_flufl_enum.<locals>.FluflnumcSs
t|j�S)N)r�rr)r7rrr�__int__�sz2TestEnum.test_flufl_enum.<locals>.Fluflnum.__int__N)rrrrKrrrr�Fluflnum�srLc@s"eZdZdZdZdZdS)z0TestEnum.test_flufl_enum.<locals>.MailManOptionsr
rrN)rrr�option1Zoption2Zoption3rrrr�MailManOptions�srNr
)rrmr�rM)r7rLrNrrr�test_flufl_enum�szTestEnum.test_flufl_enumcCs�Gdd�dt�}|j|jjt�|j|jt�Gdd�dtt�}|j|jjt�|j|jt�Gdd�dt�}|j|jjt	�|j|jt	�dS)Nc@seZdZdZdZdS)z+TestEnum.test_introspection.<locals>.Number�d��N)rrrr�r�rrrr�Number�srRc@s"eZdZdZdZdZdS)z+TestEnum.test_introspection.<locals>.StringZsoftZroughZhardN)rrr�yarnZropeZwirerrrr�String�srTc@seZdZdZdZdS)z*TestEnum.test_introspection.<locals>.PlainrBr
N)rrr�vanillar�rrrr�Plain�srV)
rr�r��
_member_type_r�rhrrSrU�object)r7rRrTrVrrr�test_introspection�szTestEnum.test_introspectioncCsZGdd�dt�}|jt��|d�WdQRX|jt��
|dWdQRXdS)Nc@s"eZdZdZdZdZdS)z0TestEnum.test_no_such_enum_member.<locals>.Colorr
rrN)rrrr�r�r�rrrrr��sr�rPZ
chartreuse)rr�r��KeyError)r7r�rrr�test_no_such_enum_member�s
z!TestEnum.test_no_such_enum_membercCs3Gdd�dt�}|jt|j�d�dS)Nc@s.eZdZdZdZdZdd�ZdS)z%TestEnum.test_new_repr.<locals>.Colorr
rrcSsd|jS)Nz!don't you just love shades of %s?)rq)r7rrr�__repr__�sz.TestEnum.test_new_repr.<locals>.Color.__repr__N)rrrr�r�r�r\rrrrr��sr�z#don't you just love shades of blue?)rrmr�r�)r7r�rrr�
test_new_repr�szTestEnum.test_new_reprcCsLGdd�dt�}Gdd�dt|�}|jt|j�d�dS)Nc@seZdZdd�ZdS)z,TestEnum.test_inherited_repr.<locals>.MyEnumcSsd|jS)NzMy name is %s.)rq)r7rrrr\�sz5TestEnum.test_inherited_repr.<locals>.MyEnum.__repr__N)rrrr\rrrr�MyEnum�sr^c@s"eZdZdZdZdZdS)z/TestEnum.test_inherited_repr.<locals>.MyIntEnumr
rrN)rrrrwrtZtheotherrrrr�	MyIntEnum�sr_zMy name is that.)rr�rmr�rt)r7r^r_rrr�test_inherited_repr�szTestEnum.test_inherited_reprcs�G�fdd�dtt���Gdd�dtd��}Gdd�dtd��}Gdd	�d	|�}Gd
d�d|�}dS)Ncs%eZdZ��fdd�Z�S)z3TestEnum.test_multiple_mixin_mro.<locals>.auto_enumc	s�t|��}t|j�}d}xJ|jD]?}||}|tkrS|}n|}|d7}|||<q.Wx0|j�D]"\}}||kr~|||<q~Wt�|�j||||�S)Nrr
)r�rn�
_member_names�Ellipsisr��super�__new__)	�metaclsr��bases�	classdict�temp�namesr�r�r�)rj�	auto_enumrrrd�s
	
z;TestEnum.test_multiple_mixin_mro.<locals>.auto_enum.__new__)rrrrdr)rj)rjrrj�srjc@seZdZdS)z:TestEnum.test_multiple_mixin_mro.<locals>.AutoNumberedEnumN)rrrrrrr�AutoNumberedEnum�srk�	metaclassc@seZdZdS)z5TestEnum.test_multiple_mixin_mro.<locals>.AutoIntEnumN)rrrrrrr�AutoIntEnum�srmc@s"eZdZdZdZdZdS)z8TestEnum.test_multiple_mixin_mro.<locals>.TestAutoNumber.rN)rrrr<r�r�rrrr�TestAutoNumber�srnc@s"eZdZdZdZdZdS)z5TestEnum.test_multiple_mixin_mro.<locals>.TestAutoInt.rN)rrrr<r�r�rrrr�TestAutoInt�sro)r�rr)r7rkrmrnror)rjr�test_multiple_mixin_mro�s
"z TestEnum.test_multiple_mixin_mrocs�G�fdd�dt��Gdd�d�t�}|j|jtj�|jt|j|j�d��t�d<|t�d<�dd�}|j|d�t	|j|d�|j|jj
d�t	|j|j�t	|j|�dS)	NcsjeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z�fdd
�ZdS)z:TestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt�NamedIntcWsX|}|^}}t|�dkr0td��tj||�}||_||_|S)Nrz name and value must be specified)r�r�r�rd�_intname�_args)r��argsrsrqr7rrrrd�s		zBTestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__new__cSs|jS)N)rs)r7rrr�__getnewargs__�szITestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__getnewargs__cSs|jS)N)rr)r7rrrr�szCTestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__name__cSs(djt|�j|jtj|��S)Nz{}({!r}, {}))r�r�rr�r\)r7rrrr\szCTestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__repr__cSs5t}|j}|jtkr+|j|�S||�S)N)r��__str__�__objclass__rXr\)r7�base�base_strrrrrvs
	
zBTestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__str__cs[t|�t|�}t|��rSt|��rS�dj|j|j�|�S|SdS)Nz({0} + {1}))r�r�r�r)r7�otherrh)rqrr�__add__szBTestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__add__N)	rrrrdrur�r\rvr{r)rqrrrq�s		rqc@s"eZdZdZdZdZdS)	z5TestEnum.test_subclasses_with_getnewargs.<locals>.NEI�NEI�the-xr
�the-yrN)r}r
)r~r)rrr�x�yrrrrr|sr|zNamedInt('(the-x + the-y)', 3)�testrYr)r�rr�rdrmr�rr�rr)rr)r7r|�NI5r)rqr�test_subclasses_with_getnewargs�s' 

z(TestEnum.test_subclasses_with_getnewargscs�G�fdd�dt��Gdd�d�t�}|j|jtj�|jt|j|j�d��t�d<|t�d<�dd�}|j|d�t	|j|d�|j|jj
d�t	|j|j�t	|j|�dS)	NcsjeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z�fdd
�ZdS)z=TestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedIntrqcWsX|}|^}}t|�dkr0td��tj||�}||_||_|S)Nrz name and value must be specified)r�r�r�rdrrrs)r�rtrsrqr7rrrrd+s		zETestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__new__cSs
|jifS)N)rs)r7rrr�__getnewargs_ex__4szOTestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__getnewargs_ex__cSs|jS)N)rr)r7rrrr6szFTestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__name__cSs(djt|�j|jtj|��S)Nz{}({!r}, {}))r�r�rr�r\)r7rrrr\9szFTestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__repr__cSs5t}|j}|jtkr+|j|�S||�S)N)r�rvrwrXr\)r7rxryrrrrv>s
	
zETestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__str__cs[t|�t|�}t|��rSt|��rS�dj|j|j�|�S|SdS)Nz({0} + {1}))r�r�r�r)r7rzrh)rqrrr{GszETestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__add__N)	rrrrdr�r�r\rvr{r)rqrrrq)s		rqc@s"eZdZdZdZdZdS)	z8TestEnum.test_subclasses_with_getnewargs_ex.<locals>.NEIr|�the-xr
�the-yrN)r�r
)r�r)rrrrr�rrrrr|Psr|zNamedInt('(the-x + the-y)', 3)r�rYr)r�rr�rdrmr�rr�rr)rr)r7r|r�r)rqr�"test_subclasses_with_getnewargs_ex(s' 

z+TestEnum.test_subclasses_with_getnewargs_excs�G�fdd�dt��Gdd�d�t�}|j|jtj�|jt|j|j�d��t�d<|t�d<�dd�}|j|d�t	|j|d�|j|jj
d�t	|j|j�t	|j|�dS)	NcsjeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z�fdd
�ZdS)z6TestEnum.test_subclasses_with_reduce.<locals>.NamedIntrqcWsX|}|^}}t|�dkr0td��tj||�}||_||_|S)Nrz name and value must be specified)r�r�r�rdrrrs)r�rtrsrqr7rrrrdds		z>TestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__new__cSs|j|jfS)N)rjrs)r7rrr�
__reduce__mszATestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__reduce__cSs|jS)N)rr)r7rrrrosz?TestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__name__cSs(djt|�j|jtj|��S)Nz{}({!r}, {}))r�r�rr�r\)r7rrrr\rsz?TestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__repr__cSs5t}|j}|jtkr+|j|�S||�S)N)r�rvrwrXr\)r7rxryrrrrvws
	
z>TestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__str__cs[t|�t|�}t|��rSt|��rS�dj|j|j�|�S|SdS)Nz({0} + {1}))r�r�r�r)r7rzrh)rqrrr{�sz>TestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__add__N)	rrrrdr�r�r\rvr{r)rqrrrqbs		rqc@s"eZdZdZdZdZdS)	z1TestEnum.test_subclasses_with_reduce.<locals>.NEIr|�the-xr
�the-yrN)r�r
)r�r)rrrrr�rrrrr|�sr|zNamedInt('(the-x + the-y)', 3)r�rYr)r�rr�rdrmr�rr�rr)rr)r7r|r�r)rqr�test_subclasses_with_reduceas' 

z$TestEnum.test_subclasses_with_reducecs�G�fdd�dt��Gdd�d�t�}|j|jtj�|jt|j|j�d��t�d<|t�d<�dd�}|j|d�t	|j|d�|j|jj
d�t	|j|j�t	|j|�dS)	NcsjeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z�fdd
�ZdS)z9TestEnum.test_subclasses_with_reduce_ex.<locals>.NamedIntrqcWsX|}|^}}t|�dkr0td��tj||�}||_||_|S)Nrz name and value must be specified)r�r�r�rdrrrs)r�rtrsrqr7rrrrd�s		zATestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__new__cSs|j|jfS)N)rjrs)r7rrrrr�szGTestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__reduce_ex__cSs|jS)N)rr)r7rrrr�szBTestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__name__cSs(djt|�j|jtj|��S)Nz{}({!r}, {}))r�r�rr�r\)r7rrrr\�szBTestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__repr__cSs5t}|j}|jtkr+|j|�S||�S)N)r�rvrwrXr\)r7rxryrrrrv�s
	
zATestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__str__cs[t|�t|�}t|��rSt|��rS�dj|j|j�|�S|SdS)Nz({0} + {1}))r�r�r�r)r7rzrh)rqrrr{�szATestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__add__N)	rrrrdrr�r\rvr{r)rqrrrq�s		rqc@s"eZdZdZdZdZdS)	z4TestEnum.test_subclasses_with_reduce_ex.<locals>.NEIr|�the-xr
�the-yrN)r�r
)r�r)rrrrr�rrrrr|�sr|zNamedInt('(the-x + the-y)', 3)r�rYr)r�rr�rdrmr�rr�rr)rr)r7r|r�r)rqr�test_subclasses_with_reduce_ex�s' 

z'TestEnum.test_subclasses_with_reduce_excs�G�fdd�dt��Gdd�d�t�}|j|jtj�|jt|j|j�d��t�d<|t�d<�dd�}|j|d�|j|jj	d�t
|jt|j�t
|jt
|�dS)	Ncs^eZdZdZdd�Zedd��Zdd�Zdd	�Z�fd
d�ZdS)
zHTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedIntrqcWsX|}|^}}t|�dkr0td��tj||�}||_||_|S)Nrz name and value must be specified)r�r�r�rdrrrs)r�rtrsrqr7rrrrd�s		zPTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedInt.__new__cSs|jS)N)rr)r7rrrr�szQTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedInt.__name__cSs(djt|�j|jtj|��S)Nz{}({!r}, {}))r�r�rr�r\)r7rrrr\�szQTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedInt.__repr__cSs5t}|j}|jtkr+|j|�S||�S)N)r�rvrwrXr\)r7rxryrrrrv�s
	
zPTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedInt.__str__cs[t|�t|�}t|��rSt|��rS�dj|j|j�|�S|SdS)Nz({0} + {1}))r�r�r�r)r7rzrh)rqrrr{�szPTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedInt.__add__N)rrrrdr�r\rvr{r)rqrrrq�s		rqc@s"eZdZdZdZdZdS)	zCTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NEIr|�the-xr
�the-yrN)r�r
)r�r)rrrrr�rrrrr|�sr|zNamedInt('(the-x + the-y)', 3)r�rYr)r�rr�rdrmr�rr�rrrr,r�r�r
)r7r|r�r)rqr�-test_subclasses_without_direct_pickle_support�s% 

z6TestEnum.test_subclasses_without_direct_pickle_supportcs�G�fdd�dt��Gdd�d�t�}|j|jtj�|jt|j|j�d��t�d<|t�d<�dd�}|j|d�|j|jj	d�t
|j|j�t
|j|�dS)	Ncs^eZdZdZdd�Zedd��Zdd�Zdd	�Z�fd
d�ZdS)
zSTestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedIntrqcWsX|}|^}}t|�dkr0td��tj||�}||_||_|S)Nrz name and value must be specified)r�r�r�rdrrrs)r�rtrsrqr7rrrrds		z[TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedInt.__new__cSs|jS)N)rr)r7rrrrsz\TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedInt.__name__cSs(djt|�j|jtj|��S)Nz{}({!r}, {}))r�r�rr�r\)r7rrrr\sz\TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedInt.__repr__cSs5t}|j}|jtkr+|j|�S||�S)N)r�rvrwrXr\)r7rxryrrrrvs
	
z[TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedInt.__str__cs[t|�t|�}t|��rSt|��rS�dj|j|j�|�S|SdS)Nz({0} + {1}))r�r�r�r)r7rzrh)rqrrr{%sz[TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedInt.__add__N)rrrrdr�r\rvr{r)rqrrrq	s		rqc@s.eZdZdZd	Zd
Zdd�ZdS)zNTestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NEIr|�the-xr
�the-yrcSst|j|jffS)N)r�rj�_name_)r7rrrrr2sz\TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NEI.__reduce_ex__N)r�r
)r�r)rrrrr�rrrrrr|.sr|zNamedInt('(the-x + the-y)', 3)r�rYr)r�rr�rdrmr�rr�rrrr))r7r|r�r)rqr�8test_subclasses_without_direct_pickle_support_using_names% 

zATestEnum.test_subclasses_without_direct_pickle_support_using_namecCs|Gdd�dtt�}|jt|j�|�|j|jt�|j|jd�|t	�d<t
|j|j�dS)Nc@s(eZdZdZd	Zd
ZdZdS)z/TestEnum.test_tuple_subclass.<locals>.SomeTuple�	SomeTupler
�
for the moneyr�for the showr�
for the musicN)r
r�)rr�)rr�)rrr�first�second�thirdrrrrr�@sr�r�
for the music)rr�)�tuplerr�r�r�r�r�rmr�rr))r7r�rrr�test_tuple_subclass?s
zTestEnum.test_tuple_subclasscCs�Gdd�dt�}|jt|�|j|j|jg�|jt|j�d�|j|jjd�|j|d�|j�dS)Nc@s:eZdZfZfZfZdd�Zdd�ZdS)zITestEnum.test_duplicate_values_give_unique_enum_items.<locals>.AutoNumbercSs/t|j�d}tj|�}||_|S)Nr
)r�rlrXrd�_value_)r�rrr+rrrrdPs	zQTestEnum.test_duplicate_values_give_unique_enum_items.<locals>.AutoNumber.__new__cSs
t|j�S)N)r�r�)r7rrrrKUszQTestEnum.test_duplicate_values_give_unique_enum_items.<locals>.AutoNumber.__int__N)rrrr�r�r�rdrKrrrr�
AutoNumberLs
r�rrr
)	rrmr�r�r�r�r�rrr�)r7r�rrr�,test_duplicate_values_give_unique_enum_itemsKs	z5TestEnum.test_duplicate_values_give_unique_enum_itemscCs�Gdd�dt�}Gdd�d|�}|jt|�|j|j|jg�|jttt|��dddg�dS)Nc@s(eZdZdd�Zdd�ZdS)zBTestEnum.test_inherited_new_from_enhanced_enum.<locals>.AutoNumbercSs/t|j�d}tj|�}||_|S)Nr
)r�rlrXrdr�)r�rrr+rrrrdas	zJTestEnum.test_inherited_new_from_enhanced_enum.<locals>.AutoNumber.__new__cSs
t|j�S)N)r�r�)r7rrrrKfszJTestEnum.test_inherited_new_from_enhanced_enum.<locals>.AutoNumber.__int__N)rrrrdrKrrrrr�`sr�c@s"eZdZfZfZfZdS)z=TestEnum.test_inherited_new_from_enhanced_enum.<locals>.ColorN)rrrr�r�r�rrrrr�hsr�r
rr)rrmr�r�r�r��mapr�)r7r�r�rrr�%test_inherited_new_from_enhanced_enum_s(z.TestEnum.test_inherited_new_from_enhanced_enumcCs�Gdd�dt�}Gdd�d|�}|jt|�|j|j|jg�|jttt|��dddg�dS)Nc@seZdZdd�ZdS)z?TestEnum.test_inherited_new_from_mixed_enum.<locals>.AutoNumbercSs2t|j�d}tj||�}||_|S)Nr
)r�rlr�rdr�)r�rrr+rrrrdqs	zGTestEnum.test_inherited_new_from_mixed_enum.<locals>.AutoNumber.__new__N)rrrrdrrrrr�psr�c@s"eZdZfZfZfZdS)z:TestEnum.test_inherited_new_from_mixed_enum.<locals>.ColorN)rrrr�r�r�rrrrr�vsr�r
rr)rrmr�r�r�r�r�r�)r7r�r�rrr�"test_inherited_new_from_mixed_enumos(z+TestEnum.test_inherited_new_from_mixed_enumcCsYGdd�d�}Gdd�dt�}|j|�|j�|j|j|��dS)Nc@seZdZdd�ZdS)z+TestEnum.test_equality.<locals>.AlwaysEqualcSsdS)NTr)r7rzrrrrsz2TestEnum.test_equality.<locals>.AlwaysEqual.__eq__N)rrrrrrrr�AlwaysEqual~sr�c@seZdZdZdS)z,TestEnum.test_equality.<locals>.OrdinaryEnumr
N)rrrr<rrrr�OrdinaryEnum�sr�)rrmr<)r7r�r�rrr�
test_equality}szTestEnum.test_equalitycCs�Gdd�dt�}Gdd�d|�}|j|j|j�|j|j|j�|j|j|j�|j	|j|j�|j
|j|j�|j|j|j�dS)Nc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
z0TestEnum.test_ordered_mixin.<locals>.OrderedEnumcSs&|j|jkr"|j|jkStS)N)rjr��NotImplemented)r7rzrrr�__ge__�sz7TestEnum.test_ordered_mixin.<locals>.OrderedEnum.__ge__cSs&|j|jkr"|j|jkStS)N)rjr�r�)r7rzrrr�__gt__�sz7TestEnum.test_ordered_mixin.<locals>.OrderedEnum.__gt__cSs&|j|jkr"|j|jkStS)N)rjr�r�)r7rzrrr�__le__�sz7TestEnum.test_ordered_mixin.<locals>.OrderedEnum.__le__cSs&|j|jkr"|j|jkStS)N)rjr�r�)r7rzrrr�__lt__�sz7TestEnum.test_ordered_mixin.<locals>.OrderedEnum.__lt__N)rrrr�r�r�r�rrrr�OrderedEnum�sr�c@s.eZdZdZdZdZdZdZdS)z*TestEnum.test_ordered_mixin.<locals>.GraderYrPrrr
N)rrrrZr[r\r]r^rrrr�Grade�s
r�)rZ
assertGreaterrZr[ZassertLessEqualr^r\Z
assertLessr]ZassertGreaterEqualrmr�)r7r�r�rrr�test_ordered_mixin�szTestEnum.test_ordered_mixincCs]Gdd�dt�}Gdd�d|�}|jt��Gdd�d|�}WdQRXdS)Nc@seZdZdd�ZdS)z'TestEnum.test_extending2.<locals>.ShadecSst|j�dS)N)�printrq)r7rrr�shade�sz-TestEnum.test_extending2.<locals>.Shade.shadeN)rrrr�rrrr�Shade�sr�c@s"eZdZdZdZdZdS)z'TestEnum.test_extending2.<locals>.Colorr
rrN)rrrr�r�r�rrrrr��sr�c@s"eZdZdZdZdZdS)z+TestEnum.test_extending2.<locals>.MoreColorrPrYr�N)rrrr1r2r3rrrrr4�sr4)rr�r�)r7r�r�r4rrr�test_extending2�szTestEnum.test_extending2cCs_Gdd�dt�}Gdd�d|�}Gdd�d|�}|j|jj�d�dS)Nc@seZdZdd�ZdS)z'TestEnum.test_extending3.<locals>.ShadecSs|jS)N)rq)r7rrrr��sz-TestEnum.test_extending3.<locals>.Shade.shadeN)rrrr�rrrrr��sr�c@seZdZdd�ZdS)z'TestEnum.test_extending3.<locals>.ColorcSsd|jS)Nz
%s hexlified!)rr)r7rrrr��sz+TestEnum.test_extending3.<locals>.Color.hexN)rrrr�rrrrr��sr�c@s"eZdZdZdZdZdS)z+TestEnum.test_extending3.<locals>.MoreColorrPrYr�N)rrrr1r2r3rrrrr4�sr4z5 hexlified!)rrmr2r�)r7r�r�r4rrr�test_extending3�szTestEnum.test_extending3cCs]Gdd�dt�}Gdd�d|�}|jt��Gdd�d|�}WdQRXdS)Nc@seZdZdd�ZdS)z/TestEnum.test_no_duplicates.<locals>.UniqueEnumcs]�j}t�fdd�|D��rY�j}|�j�j}td||f��dS)Nc3s!|]}�j|jkVqdS)N)rr)r�r�)r7rr�	<genexpr>�szKTestEnum.test_no_duplicates.<locals>.UniqueEnum.__init__.<locals>.<genexpr>z-aliases not allowed in UniqueEnum:  %r --> %r)rj�anyrqrrr�)r7rtr�r<r�r)r7r�__init__�s		z8TestEnum.test_no_duplicates.<locals>.UniqueEnum.__init__N)rrrr�rrrr�
UniqueEnum�sr�c@s"eZdZdZdZdZdS)z*TestEnum.test_no_duplicates.<locals>.Colorr
rrN)rrrr�r�r�rrrrr��sr�c@s(eZdZdZdZdZdZdS)z*TestEnum.test_no_duplicates.<locals>.Colorr
rrN)rrrr�r�r�Zgrenerrrrr��s)rr�r�)r7r�r�rrr�test_no_duplicates�s
zTestEnum.test_no_duplicatescCsOGdd�dt�}|jt|jjd�d�|j|jjd�dS)Nc@s^eZdZdZdZdZdZdZdZdZ	dZ
dd�Zedd��Z
dS)z"TestEnum.test_init.<locals>.Planet�I�Tf|�D�
�BA�QX4E��WA��o��E��TXA���	��D�(�IA��c�����E����A�[�\h}E�,A�#'?�T�QE���_xA�J��-UE���wAcSs||_||_dS)N)�mass�radius)r7r�r�rrrr��s	z+TestEnum.test_init.<locals>.Planet.__init__cSsd}||j|j|jS)Ng
yдW�=)r�r�)r7�Grrr�surface_gravity�sz2TestEnum.test_init.<locals>.Planet.surface_gravityN)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)r�r�)rrrZMERCURYZVENUS�EARTHZMARSZJUPITERZSATURNZURANUSZNEPTUNEr�r�r�rrrr�Planet�sr�rg������#@��o��E��TXA)r�r�)rrm�roundr�r�rr)r7r�rrr�	test_init�szTestEnum.test_initcCs�Gdd�dt�}Gdd�d|�}|jt|�|j|j|jg�x\t|td��D]E\}}|d7}|j|j|g�|j	||g�|�qjWdS)Nc@seZdZdd�ZdS)z6TestEnum.test_nonhash_value.<locals>.AutoNumberInAListcSs2t|j�dg}tj|�}||_|S)Nr
)r�rlrXrdr�)r�rrr+rrrrd�s	z>TestEnum.test_nonhash_value.<locals>.AutoNumberInAList.__new__N)rrrrdrrrr�AutoNumberInAList�sr�c@s"eZdZfZfZfZdS)z1TestEnum.test_nonhash_value.<locals>.ColorInAListN)rrrr�r�r�rrrr�ColorInAList�sr�rr
)
rrmr�r�r�r��zipr%rrr�)r7r�r�r3rrrrr�test_nonhash_value�s("
zTestEnum.test_nonhash_valuecCs�Gdd�dtt�}Gdd�d|�}|jt|�|j|jg�|j|jd�|j|d�|j�dS)Nc@seZdZdd�ZdS)zHTestEnum.test_conflicting_types_resolved_in_new.<locals>.LabelledIntEnumcWs4|\}}tj||�}||_||_|S)N)r�rd�labelr�)r�rtrrr�r+rrrrd�s
		zPTestEnum.test_conflicting_types_resolved_in_new.<locals>.LabelledIntEnum.__new__N)rrrrdrrrr�LabelledIntEnum�sr�c@seZdZdZdZdS)zETestEnum.test_conflicting_types_resolved_in_new.<locals>.LabelledListr
�Unprocessedr�Payment CompleteN)r
r�)rr�)rrr�unprocessed�payment_completerrrr�LabelledListsr�r
)r�rrmr�r�r�)r7r�r�rrr�&test_conflicting_types_resolved_in_new�s
"z/TestEnum.test_conflicting_types_resolved_in_newN)brrrrirprsrzrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrrrr!r%r)r*r,r-r/r0r5r8r9r@rGrHrIrJrOrYr[r]r`rpr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrOls�#				
	
	
				


$999957	rOc@s4eZdZdd�Zdd�Zdd�ZdS)�
TestUniquecCs<tGdd�dt��}tGdd�dt��}dS)Nc@s"eZdZdZdZdZdS)z+TestUnique.test_unique_clean.<locals>.Cleanr
r=g@N)rrrr�r�r>rrrr�Cleansr�c@s"eZdZdZdZdZdS)z-TestUnique.test_unique_clean.<locals>.Cleanerr
rrN)rrr�single�double�triplerrrr�Cleanersr�)rrr)r7r�r�rrr�test_unique_cleanszTestUnique.test_unique_cleancCsp|jtd��!tGdd�dt��}WdQRX|jtd��!tGdd�dt��}WdQRXdS)Nz	tres.*onec@s"eZdZdZdZdZdS)z+TestUnique.test_unique_dirty.<locals>.Dirtyr
r=N)rrrr�r�r>rrrr�Dirtysr�zdouble.*single.*turkey.*triplec@s(eZdZdZdZdZdZdS)z-TestUnique.test_unique_dirty.<locals>.Dirtierr
rN)rrrr�r�r�Zturkeyrrrr�Dirtier(sr�)ZassertRaisesRegexr�rrr)r7r�r�rrr�test_unique_dirtys
zTestUnique.test_unique_dirtycCs<tGdd�dt��}tGdd�dt��}dS)Nc@s"eZdZdZdZdZdS)z/TestUnique.test_unique_with_name.<locals>.Sillyr
r=rN)rrrr�r�rqrrrr�Silly0sr�c@s(eZdZdZdZdZdZdS)z1TestUnique.test_unique_with_name.<locals>.Sillierr
rrrPN)rrrr�rqr�rrrrrr�Sillier5sr�)rrr)r7r�r�rrr�test_unique_with_name/sz TestUnique.test_unique_with_nameN)rrrr�r�r�rrrrr�sr�auHelp on class Color in module %s:

class Color(enum.Enum)
 |  An enumeration.
 |  
 |  Method resolution order:
 |      Color
 |      enum.Enum
 |      builtins.object
 |  
 |  Data and other attributes defined here:
 |  
 |  blue = <Color.blue: 3>
 |  
 |  green = <Color.green: 2>
 |  
 |  red = <Color.red: 1>
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from enum.Enum:
 |  
 |  name
 |      The name of the Enum member.
 |  
 |  value
 |      The value of the Enum member.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from enum.EnumMeta:
 |  
 |  __members__
 |      Returns a mapping of member name->value.
 |      
 |      This mapping lists all enum members, including aliases. Note that this
 |      is a read-only view of the internal mapping.aSHelp on class Color in module %s:

class Color(enum.Enum)
 |  Method resolution order:
 |      Color
 |      enum.Enum
 |      builtins.object
 |  
 |  Data and other attributes defined here:
 |  
 |  blue = <Color.blue: 3>
 |  
 |  green = <Color.green: 2>
 |  
 |  red = <Color.red: 1>
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from enum.Enum:
 |  
 |  name
 |  
 |  value
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from enum.EnumMeta:
 |  
 |  __members__c@sPeZdZdZGdd�de�Zdd�Zdd�Zdd	�ZdS)
�
TestStdLibNc@s"eZdZdZdZdZdS)zTestStdLib.Colorr
rrN)rrrr�r�r�rrrrr��sr�cCsttjdkrtt}n
tt}t�}tjd|�}||j�|j	�j
�}|j||�dS)N�output)rrk�!expected_help_output_without_docsr�expected_help_output_with_docsr�pydocZHelperr��getvalue�striprm)r7Z
expected_textr��helper�resultrrr�
test_pydoc�s

	
zTestStdLib.test_pydoccCs9tdtfdd|jjfdtfd|jjfd|jjfdtjdfd	|jj	fd
tjd
ff	�}tt
j|j��}|j|j
�|j
��d}xh|j
�D]Z}||||kr�t�tdd
d|||||d
dfdd�d}q�W|r5|jd�dS)Nrjrk�An enumeration.rlrr�r�rqr�rrFz.
%s
     key: %s
  result: %s
expected: %s
%s
�=�K�sep�Tz/result does not equal expected, see print above)rkr�)�dictrr�rlrr�r�r�__dict__r��inspectZ
getmembersrm�keysr��fail)r7�valuesr��failedr�rrr�test_inspect_getmembers�s*		-
z"TestStdLib.test_inspect_getmemberscCsddlm}|dddddtdt�|dd	ddd|jdd
�|dddddtdtj�|dd
ddd|jdt�|ddddd|jd|jj�|ddddd|jd|jj�|ddddd|jd|jj	�|dddddt
dt
jd�|dddddt
dt
jd�g	}|jddd��t
tj|j��}|jddd��d}xWt||�D]F\}}||kr�tddd||ddfdd�d}q�W|r
|jd�dS)Nr)�	Attributerqrj�kind�dataZdefining_classrXrkzAn enumeration.rlr�rr�r�r�rr�keycSs|jS)N)rq)�itemrrr�<lambda>�sz>TestStdLib.test_inspect_classify_class_attrs.<locals>.<lambda>cSs|jS)N)rq)r	rrrr
�sFz
%s
%s
%s
%s
r�r�r�r�Tz/result does not equal expected, see print above)r�rrXrr�rlrr�r�r�rr��sortr�Zclassify_class_attrsr�r�r)r7rrr�rr��rrrr�!test_inspect_classify_class_attrs�s:(
z,TestStdLib.test_inspect_classify_class_attrs)	rrrZmaxDiffrr�r�rr
rrrrr�s
r��__main__)*r3r�r�Zunittest�collectionsrrrrr�ior�picklerr	r
rrr��excr�rrgrrhrrrrrr r#r)r,ZTestCaser-rOr�r�r�r��mainrrrr�<module>sn""
������QO