B
    u9a             
   @   s  d dl Z d dlZd dlZd dlZd dlZd dlmZ d dl mZmZm	Z	m
Z
mZmZmZ d dlmZ d dlmZmZmZmZ d dlmZ d dlmZ yd dlZW n ek
r   dZY nX yG dd	 d	eZW n& ek
r Z zeZW ddZ[X Y nX yG d
d deeZW n( ek
r4 Z zeZW ddZ[X Y nX yG dd deeZ W n( ek
rt Z zeZ W ddZ[X Y nX yG dd de
Z!W n( ek
r Z zeZ!W ddZ[X Y nX y&G dd de"eZ#G dd de#Z$W n( ek
r Z zeZ$W ddZ[X Y nX yedde%dZ&W n( ek
r> Z zeZ&W ddZ[X Y nX yeddZ'W n( ek
rv Z zeZ'W ddZ[X Y nX yeddddZ(W n( ek
r Z zeZ(W ddZ[X Y nX yG dd deZ)W n ek
r   Y nX d=dd Z*d!d" Z+G d#d$ d$ej,Z-G d%d& d&Z.G d'd( d(ej,Z/G d)d* d*ej,Z0G d+d, d,ej,Z1G d-d. d.ej,Z2G d/d0 d0ej,Z3G d1d2 d2ej,Z4d3Z5d4Z6G d5d6 d6ej,Z7G d7d8 d8ej,Z8d9Z9d9Z:d9Z;d9Z<d9Z=d9Z>G d:d; d;ej,Z?e%d<kre@  dS )>    N)OrderedDict)EnumIntEnumEnumMetaFlagIntFlaguniqueauto)StringIO)dumpsloadsPicklingErrorHIGHEST_PROTOCOL)support)	timedeltac               @   s   e Zd ZdZdZdZdS )Stooges         N)__name__
__module____qualname__LARRYCURLYMOE r   r   /usr/lib/python3.7/test_enum.pyr      s   r   c               @   s   e Zd ZdZdZdZdS )
IntStoogesr   r   r   N)r   r   r   r   r   r   r   r   r   r   r      s   r   c               @   s   e Zd ZdZdZdZdS )FloatStoogesg=
ףp=?g(\@gR$_	$	@N)r   r   r   r   r   r   r   r   r   r   r   $   s   r   c               @   s   e Zd ZdZdZdZdS )FlagStoogesr   r   r   N)r   r   r   r   r   r   r   r   r   r   r   ,   s   r   c               @   s   e Zd ZdS )StrEnumN)r   r   r   r   r   r   r   r    5   s   r    c               @   s   e Zd ZdZdZdS )NamezGuido van RossumzBarry WarsawN)r   r   r   BDFLZFLUFLr   r   r   r   r!   7   s   r!   Questionzwho what when where why)moduleAnswerzhim this then there becauseTheoryzrule law suppositionspanish_inquisition)qualnamec               @   s   e Zd ZdZdZdZdS )Fruitr   r   r   N)r   r   r   ZTOMATOZBANANAZCHERRYr   r   r   r   r)   N   s   r)   c             C   s<   |d kr|}x*t td D ]}| tt||d| qW d S )Nr   )protocol)ranger   r   r   )	assertionsourcetargetr*   r   r   r   test_pickle_dump_loadU   s    r/   c          
   C   s:   x4t td D ]$}| | t||d W d Q R X qW d S )Nr   )r*   )r+   r   r   )r,   Z	exceptionobjr*   r   r   r   test_pickle_exception[   s    
r1   c               @   s$   e Zd Zdd Zdd Zdd ZdS )TestHelpersc             C   sR   G dd d}x>dD ]6}| }|  t| t||d | t| qW d S )Nc               @   s   e Zd ZdS )z+TestHelpers.test_is_descriptor.<locals>.fooN)r   r   r   r   r   r   r   food   s   r3   )__get____set__
__delete__r   )assertFalseenum_is_descriptorsetattr
assertTrue)selfr3   attrr0   r   r   r   test_is_descriptorc   s    
zTestHelpers.test_is_descriptorc             C   s@   xdD ]}|  t| qW xdD ]}| t| q$W d S )N)_a_Z_aa_)aa__a__aa____a___a____a________________)r;   r8   
_is_sunderr7   )r<   sr   r   r   test_is_sunderl   s    

zTestHelpers.test_is_sunderc             C   s@   xdD ]}|  t| qW xdD ]}| t| q$W d S )N)rE   Z__aa__)r@   rA   rB   rC   rD   r?   rF   rG   rH   rI   rJ   rK   rL   )r;   r8   
_is_dunderr7   )r<   rN   r   r   r   test_is_dundert   s    

zTestHelpers.test_is_dunderN)r   r   r   r>   rO   rQ   r   r   r   r   r2   `   s   	r2   c               @   s   e Zd ZdddZdd ZdS )classpropertyNc             C   s2   || _ || _|| _|d kr(|d k	r(|j}|| _d S )N)fgetfsetfdel__doc__)r<   rS   rT   rU   docr   r   r   __init__   s    zclassproperty.__init__c             C   s
   |  |S )N)rS   )r<   instance
ownerclassr   r   r   r4      s    zclassproperty.__get__)NNNN)r   r   r   rX   r4   r   r   r   r   rR   }   s   
rR   c               @   s|  e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Zd3d4 Zd5d6 Zd7d8 Zd9d: Zd;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~ ZAdd ZBdd ZCdd ZDdd ZEdd ZFdd ZGdd ZHdd ZIdd ZJdd ZKdd ZLdd ZMdd ZNdd ZOdd ZPdd ZQdd ZRdd ZSdd ZTdd ZUdd ZVdd ZWdd ZXdd ZYdd ZZdd Z[dd Z\dd Z]dd Z^dd Z_dd Z`dd Zadd Zbdd ZcddĄ ZdddƄ ZeddȄ Zfddʄ Zgdd̄ Zhdd΄ ZiddЄ Zjdd҄ ZkddԄ Zlddք Zmdd؄ Znddڄ Zodd܄ ZpdS )TestEnumc             C   s   G dd dt }|| _G dd dtt }|| _G dd dt}|| _G dd dtt }|| _d	d
lm	} G dd d|t }|| _
d S )Nc               @   s   e Zd ZdZdZdZdZdS )zTestEnum.setUp.<locals>.Seasonr   r   r      N)r   r   r   SPRINGSUMMERAUTUMNWINTERr   r   r   r   Season   s   ra   c               @   s   e Zd ZdZdZde ZdS )z!TestEnum.setUp.<locals>.KonstantsgB
@gJM!	@r   N)r   r   r   EZPITAUr   r   r   r   	Konstants   s   rd   c               @   s    e Zd ZdZdZdZdZdZdS )zTestEnum.setUp.<locals>.Grades   r\   r   r   r   N)r   r   r   ABCDFr   r   r   r   Grades   s
   rk   c               @   s   e Zd ZdZdZdZdZdS )z#TestEnum.setUp.<locals>.DirectionalZeastZwestZnorthZsouthN)r   r   r   ZEASTWESTZNORTHZSOUTHr   r   r   r   Directional   s   rm   r   )datec               @   s   e Zd ZdZdZdS )zTestEnum.setUp.<locals>.Holiday)i  r   r   )i  r      N)r   r   r   ZNEW_YEARIDES_OF_MARCHr   r   r   r   Holiday   s   rq   )r   ra   floatrd   r   rk   strrm   datetimern   rq   )r<   ra   rd   rk   rm   rn   rq   r   r   r   setUp   s    zTestEnum.setUpc             C   s2   | j }| tt|tddddddddg d S )	N	__class__rV   __members__r   r]   r^   r_   r`   )ra   assertEqualsetdir)r<   ra   r   r   r   test_dir_on_class   s
    

zTestEnum.test_dir_on_classc          	   C   s.   | j }| tt|jtdddddg d S )Nrv   rV   r   namevalue)ra   rx   ry   rz   r`   )r<   ra   r   r   r   test_dir_on_item   s    zTestEnum.test_dir_on_itemc          
   C   s^   G dd dt }| tt|tddddddg | tt|jtdddd	d
dg d S )Nc               @   s   e Zd ZdZdZdd ZdS )z3TestEnum.test_dir_with_added_behavior.<locals>.Testthatthosec             S   s
   d| j  S )NzWowser! I'm %s!)r|   )r<   r   r   r   wowser   s    z:TestEnum.test_dir_with_added_behavior.<locals>.Test.wowserN)r   r   r   thistheser   r   r   r   r   Test   s   r   rv   rV   rw   r   r   r   r|   r}   r   )r   rx   ry   rz   r   )r<   r   r   r   r   test_dir_with_added_behavior   s    
z%TestEnum.test_dir_with_added_behaviorc          
   C   sJ   G dd dt }G dd d|}| tt|jtddddd	d
g d S )Nc               @   s   e Zd Zdd ZdS )zBTestEnum.test_dir_on_sub_with_behavior_on_super.<locals>.SuperEnumc             S   s   dS )Nzdid you see me?r   )r<   r   r   r   	invisible   s    zLTestEnum.test_dir_on_sub_with_behavior_on_super.<locals>.SuperEnum.invisibleN)r   r   r   r   r   r   r   r   	SuperEnum   s   r   c               @   s   e Zd ZdZdS )z@TestEnum.test_dir_on_sub_with_behavior_on_super.<locals>.SubEnumre   N)r   r   r   sampler   r   r   r   SubEnum   s   r   rv   rV   r   r|   r}   r   )r   rx   ry   rz   r   )r<   r   r   r   r   r   &test_dir_on_sub_with_behavior_on_super   s
    z/TestEnum.test_dir_on_sub_with_behavior_on_superc             C   s   | j }| ||j|j d S )N)ra   assertIsr`   )r<   ra   r   r   r   test_enum_in_enum_out   s    zTestEnum.test_enum_in_enum_outc             C   s   | j }| |jjd d S )Nr   )ra   rx   r]   r}   )r<   ra   r   r   r   test_enum_value   s    zTestEnum.test_enum_valuec             C   s   |  tjjd d S )Nr   )rx   r   r   r}   )r<   r   r   r   test_intenum_value   s    zTestEnum.test_intenum_valuec             C   s  | j }t|}| t|t| | t|d| | |j|j|j|jg| xtd	 dD ]\}}||}| |t
|| | |j| | || | |j| | || | t|| | || | t|d|  | t|d|| q`W d S )Nr\   zSPRING SUMMER AUTUMN WINTERr   zSeason.z<Season.{0}: {1}>)ra   listrx   lenr]   r^   r_   r`   	enumeratesplitgetattrr}   assertNotEqualr|   assertInr   typeassertIsInstancers   reprformat)r<   ra   lstiZseasoner   r   r   	test_enum   s&    zTestEnum.test_enumc          	   C   sf   | j }| |jjd | |jjd | t d|j_W d Q R X | t d|j_W d Q R X d S )Nr]   r   Zinviernor   )ra   rx   r]   r|   r}   assertRaisesAttributeError)r<   ra   r   r   r   test_value_name   s    zTestEnum.test_value_namec          	   C   s&   | j }| t d|_W d Q R X d S )Nzreally cold)ra   r   r   r`   )r<   ra   r   r   r   test_changing_member  s    zTestEnum.test_changing_memberc          	   C   s   G dd dt }| t|d |`| t|d | t
 |`W d Q R X | t
 |`W d Q R X | t |j`	W d Q R X d S )Nc               @   s$   e Zd ZdZdZdZdZdd ZdS )z0TestEnum.test_attribute_deletion.<locals>.Seasonr   r   r   r\   c             S   s   d S )Nr   )clsr   r   r   spam  s    z5TestEnum.test_attribute_deletion.<locals>.Season.spamN)r   r   r   r]   r^   r_   r`   r   r   r   r   r   ra     s
   ra   r   )
r   r;   hasattrr   r7   r   r   r]   ZDRYr|   )r<   ra   r   r   r   test_attribute_deletion  s    	z TestEnum.test_attribute_deletionc             C   s"   G dd dt }| t| d S )Nc               @   s   e Zd ZdS )z*TestEnum.test_bool_of_class.<locals>.EmptyN)r   r   r   r   r   r   r   Empty"  s   r   )r   r;   bool)r<   r   r   r   r   test_bool_of_class!  s    zTestEnum.test_bool_of_classc             C   s0   G dd dt }x|D ]}| t| qW d S )Nc               @   s   e Zd ZdZdZdZdS )z+TestEnum.test_bool_of_member.<locals>.Countr   r   r   N)r   r   r   Zzeroonetwor   r   r   r   Count'  s   r   )r   r;   r   )r<   r   memberr   r   r   test_bool_of_member&  s    
zTestEnum.test_bool_of_memberc          	   C   s   |  t G dd dt}W d Q R X |  t G dd dt}W d Q R X |  t G dd dt}W d Q R X |  t G dd dt}W d Q R X |  t G dd dt}W d Q R X d S )Nc               @   s   e Zd ZdZdS )z*TestEnum.test_invalid_names.<locals>.Wrong	   N)r   r   r   mror   r   r   r   Wrong0  s   r   c               @   s   e Zd ZdZdS )z*TestEnum.test_invalid_names.<locals>.Wrong   N)r   r   r   _create_r   r   r   r   r   3  s   c               @   s   e Zd ZdZdS )z*TestEnum.test_invalid_names.<locals>.Wrongr   N)r   r   r   _get_mixins_r   r   r   r   r   6  s   c               @   s   e Zd ZdZdS )z*TestEnum.test_invalid_names.<locals>.Wrongr   N)r   r   r   
_find_new_r   r   r   r   r   9  s   c               @   s   e Zd ZdZdS )z*TestEnum.test_invalid_names.<locals>.Wrongr   N)r   r   r   Z
_any_name_r   r   r   r   r   <  s   )r   
ValueErrorr   )r<   r   r   r   r   test_invalid_names.  s    zTestEnum.test_invalid_namesc             C   s~   G dd dt }| |j | |j G dd dt }| |j | |j G dd dtt }| |j | |j d S )Nc               @   s   e Zd ZdZdZdS )z!TestEnum.test_bool.<locals>.LogicTFN)r   r   r   truefalser   r   r   r   LogicA  s   r   c               @   s   e Zd ZdZdZdd ZdS )z%TestEnum.test_bool.<locals>.RealLogicTFc             S   s
   t | jS )N)r   _value_)r<   r   r   r   __bool__J  s    z.TestEnum.test_bool.<locals>.RealLogic.__bool__N)r   r   r   r   r   r   r   r   r   r   	RealLogicG  s   r   c               @   s   e Zd ZdZdZdS )z$TestEnum.test_bool.<locals>.IntLogicr   r   N)r   r   r   r   r   r   r   r   r   IntLogicO  s   r   )r   r;   r   r   r7   int)r<   r   r   r   r   r   r   	test_bool?  s    zTestEnum.test_boolc          	   C   s   | j }| |j| | t | d| W d Q R X | t | d| W d Q R X |d}| || G dd dt}| |j| d S )Nr   r_   c               @   s   e Zd ZdZdZdS )z)TestEnum.test_contains.<locals>.OtherEnumr   r   N)r   r   r   r   r   r   r   r   r   	OtherEnum`  s    r   )ra   r   r_   assertWarnsDeprecationWarningZassertNotInr   r   )r<   ra   valr   r   r   r   test_containsU  s    zTestEnum.test_containsc                s@     t fdd   t fdd   t fdd d S )Nc                  s   d j jkS )Ntest)ra   r_   r   )r<   r   r   <lambda>e      z/TestEnum.test_member_contains.<locals>.<lambda>c                  s   d j jkS )Nr   )ra   r_   r   )r<   r   r   r   f  r   c                  s   d j jkS )Nr_   )ra   r_   r   )r<   r   r   r   g  r   )r   	TypeError)r<   r   )r<   r   test_member_containsd  s    zTestEnum.test_member_containsc          	   C   s   | j }| t |j|jk  W d Q R X | t |jdk W d Q R X | |jd G dd dt}| |j|j | t |j|jk  W d Q R X d S )Nr\   r   c               @   s   e Zd ZdZdZdZdS )z'TestEnum.test_comparisons.<locals>.Partr   r   r   N)r   r   r   r]   CLIPZBARRELr   r   r   r   Partr  s   r   )ra   r   r   r]   r`   r   r   r   )r<   ra   r   r   r   r   test_comparisonsi  s    zTestEnum.test_comparisonsc             C   s   G dd dt }t|}| ||j|j|j|jg | |j|j | |jj	d | |jj	d | |d|j | |d|j | |jj
d | dd |j D dd	g d S )
Nc               @   s$   e Zd ZdZdZd ZZdZdZdS )z-TestEnum.test_enum_duplicates.<locals>.Seasonr   r   r   r\   N)	r   r   r   r]   r^   r_   FALLr`   ANOTHER_SPRINGr   r   r   r   ra   |  s
   ra   r   r   r_   c             S   s   g | ]\}}|j |kr|qS r   )r|   ).0kvr   r   r   
<listcomp>  s    z1TestEnum.test_enum_duplicates.<locals>.<listcomp>r   r   )r   r   rx   r]   r^   r_   r`   r   r   r}   r|   rw   items)r<   ra   r   r   r   r   test_enum_duplicates{  s    zTestEnum.test_enum_duplicatesc          	   C   sv   |  t G dd dt}W d Q R X |  t G dd dt}W d Q R X |  t G dd dt}W d Q R X d S )Nc               @   s   e Zd ZdZdZdZdZdS )z+TestEnum.test_duplicate_name.<locals>.Colorr   r   r   r\   N)r   r   r   redgreenbluer   r   r   r   Color  s   r   c               @   s    e Zd ZdZdZdZdd ZdS )z+TestEnum.test_duplicate_name.<locals>.Colorr   r   r   c             S   s   dS )Nr   r   )r<   r   r   r   r     s    z/TestEnum.test_duplicate_name.<locals>.Color.redN)r   r   r   r   r   r   r   r   r   r   r     s   c               @   s$   e Zd Zedd ZdZdZdZdS )z+TestEnum.test_duplicate_name.<locals>.Colorc             S   s   dS )NZredderr   )r<   r   r   r   r     s    z/TestEnum.test_duplicate_name.<locals>.Color.redr   r   r   N)r   r   r   propertyr   r   r   r   r   r   r   r     s   )r   r   r   )r<   r   r   r   r   test_duplicate_name  s    zTestEnum.test_duplicate_namec             C   s^   G dd dt }| t||j|jg | t|j| | |jjd | |jjd d S )Nc               @   s   e Zd ZdZdZdS )z/TestEnum.test_enum_with_value_name.<locals>.Huhr   r   N)r   r   r   r|   r}   r   r   r   r   Huh  s   r   r|   r   )r   rx   r   r|   r}   r   r   )r<   r   r   r   r   test_enum_with_value_name  s    z"TestEnum.test_enum_with_value_namec             C   s   | j }| d|jdt|j | d|jdt|j | d|jdt|j | d|jdt|j | d|jdt|j | d|jdt|j d S )Nz{}z{:}z{:20}z{:^20}z{:>20}z{:<20})ra   rx   r   r]   rs   )r<   ra   r   r   r   test_format_enum  s    zTestEnum.test_format_enumc             C   s*   G dd dt t}| d|jd d S )Nc               @   s   e Zd ZdZdZdd ZdS )z3TestEnum.test_format_enum_custom.<locals>.TestFloatg      ?g       @c             S   s   dS )NzTestFloat success!r   )r<   specr   r   r   
__format__  s    z>TestEnum.test_format_enum_custom.<locals>.TestFloat.__format__N)r   r   r   r   r   r   r   r   r   r   	TestFloat  s   r   z{}zTestFloat success!)rr   r   rx   r   r   )r<   r   r   r   r   test_format_enum_custom  s    z TestEnum.test_format_enum_customc             C   s   |  ||||j d S )N)rx   r   r}   )r<   r   r   r   r   r   assertFormatIsValue  s    zTestEnum.assertFormatIsValuec             C   sz   | j }| d|j | d|j | d|j | d|j | d|j | d|j | d|j | d|j d S )	Nz{}z{:}z{:20}z{:^20}z{:>20}z{:<20}z{:%Y %m}z{:%Y %m %M:00})rq   r   rp   )r<   rq   r   r   r   test_format_enum_date  s    zTestEnum.test_format_enum_datec             C   s   | j }| d|j | d|j | d|j | d|j | d|j | d|j | d|j | d|j | d	|j d S )
Nz{}z{:}z{:20}z{:^20}z{:>20}z{:<20}z{:n}z{:5.2}z{:f})rd   r   rc   )r<   rd   r   r   r   test_format_enum_float  s    zTestEnum.test_format_enum_floatc             C   s   | j }| d|j | d|j | d|j | d|j | d|j | d|j | d|j | d|j | d	|j d S )
Nz{}z{:}z{:20}z{:^20}z{:>20}z{:<20}z{:+}z{:08X}z{:b})rk   r   rh   )r<   rk   r   r   r   test_format_enum_int  s    zTestEnum.test_format_enum_intc             C   s^   | j }| d|j | d|j | d|j | d|j | d|j | d|j d S )Nz{}z{:}z{:20}z{:^20}z{:>20}z{:<20})rm   r   rl   )r<   rm   r   r   r   test_format_enum_str  s    zTestEnum.test_format_enum_strc             C   sH   | j }i }d||j< d||j< d||j< d||j< | ||j d d S )NZ1225Z0315Z0704Z1031)ra   r`   r]   r^   r_   rx   )r<   ra   Zdatesr   r   r   	test_hash  s    



zTestEnum.test_hashc             C   s(   G dd dt t}| |j|jk  d S )Nc               @   s   e Zd ZdZde ZdS )z/TestEnum.test_intenum_from_scratch.<locals>.phyr   r   N)r   r   r   pitaur   r   r   r   phy	  s   r   )r   r   r;   r   r   )r<   r   r   r   r   test_intenum_from_scratch  s    z"TestEnum.test_intenum_from_scratchc             C   s8   G dd dt t}G dd d|}| |j|jk  d S )Nc               @   s   e Zd ZdS )z0TestEnum.test_intenum_inherited.<locals>.IntEnumN)r   r   r   r   r   r   r   r     s   r   c               @   s   e Zd ZdZde ZdS )z,TestEnum.test_intenum_inherited.<locals>.phyr   r   N)r   r   r   r   r   r   r   r   r   r     s   r   )r   r   r;   r   r   )r<   r   r   r   r   r   test_intenum_inherited  s    zTestEnum.test_intenum_inheritedc             C   s(   G dd dt t}| |j|jk  d S )Nc               @   s   e Zd ZdZde ZdS )z1TestEnum.test_floatenum_from_scratch.<locals>.phygJM!	@r   N)r   r   r   r   r   r   r   r   r   r     s   r   )rr   r   r;   r   r   )r<   r   r   r   r   test_floatenum_from_scratch  s    z$TestEnum.test_floatenum_from_scratchc             C   s8   G dd dt t}G dd d|}| |j|jk  d S )Nc               @   s   e Zd ZdS )z4TestEnum.test_floatenum_inherited.<locals>.FloatEnumN)r   r   r   r   r   r   r   	FloatEnum  s   r   c               @   s   e Zd ZdZde ZdS )z.TestEnum.test_floatenum_inherited.<locals>.phygJM!	@r   N)r   r   r   r   r   r   r   r   r   r     s   r   )rr   r   r;   r   r   )r<   r   r   r   r   r   test_floatenum_inherited  s    z!TestEnum.test_floatenum_inheritedc             C   s(   G dd dt t}| |j|jk  d S )Nc               @   s   e Zd ZdZdZdS )z/TestEnum.test_strenum_from_scratch.<locals>.phyPiTauN)r   r   r   r   r   r   r   r   r   r   %  s   r   )rs   r   r;   r   r   )r<   r   r   r   r   test_strenum_from_scratch$  s    z"TestEnum.test_strenum_from_scratchc             C   s8   G dd dt t}G dd d|}| |j|jk  d S )Nc               @   s   e Zd ZdS )z0TestEnum.test_strenum_inherited.<locals>.StrEnumN)r   r   r   r   r   r   r   r    +  s   r    c               @   s   e Zd ZdZdZdS )z,TestEnum.test_strenum_inherited.<locals>.phyr   r   N)r   r   r   r   r   r   r   r   r   r   -  s   r   )rs   r   r;   r   r   )r<   r    r   r   r   r   test_strenum_inherited*  s    zTestEnum.test_strenum_inheritedc             C   s:  G dd dt }| dddg|j d | dd t|jD dd	d
g t|}| t|t| | t|d d}| }xt|d	D ]\}}||}| || | t	|| | |j
| | || | ||d	 | | d|  k odk n   | t|| | |t	 | |t qW d S )Nc               @   s(   e Zd ZdZdZdZdZdZdZdZ	dS )	z&TestEnum.test_intenum.<locals>.WeekDayr   r   r   r\   re         N)
r   r   r   SUNDAYMONDAYTUESDAY	WEDNESDAYTHURSDAYFRIDAYSATURDAYr   r   r   r   WeekDay4  s   r   r@   bcc             S   s   g | ]}|qS r   r   )r   r   r   r   r   r   >  s    z)TestEnum.test_intenum.<locals>.<listcomp>r   r   r   r   z8SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY   )r   rx   r   r+   r   r   r   r   r   r   r|   r   indexr;   r   r   r   r   )r<   r   r   r.   r   Zweekdayr   r   r   r   test_intenum3  s&    	" zTestEnum.test_intenumc             C   sT   G dd dt }| |j|j | |djd | dd |j D dg d S )Nc               @   s,   e Zd ZdZdZd ZZdZdZdZ	dZ
dS )	z1TestEnum.test_intenum_duplicates.<locals>.WeekDayr   r   r   r\   re   r   r   N)r   r   r   r   r   r   TEUSDAYr   r   r   r   r   r   r   r   r   R  s   r   r   r   c             S   s   g | ]\}}|j |kr|qS r   )r|   )r   r   r   r   r   r   r   \  s    z4TestEnum.test_intenum_duplicates.<locals>.<listcomp>r  )r   r   r  r   rx   r|   rw   r   )r<   r   r   r   r   test_intenum_duplicatesQ  s
    z TestEnum.test_intenum_duplicatesc          	   C   s<   |  tddtj | t tdd W d Q R X d S )Ns    Zbigs    )r   r   
from_bytesr   r   r   )r<   r   r   r   test_intenum_from_bytes_  s    z TestEnum.test_intenum_from_bytesc          	   C   sX   t tjj}| t|tj t tjjd }| t t| W d Q R X d S )Ng{Gz?)	rr   hexr   r   r}   r   fromhexr   r   )r<   hr   r   r   test_floatenum_fromhexd  s
    zTestEnum.test_floatenum_fromhexc             C   s,   t ttrtt| jtj t| jt d S )N)
isinstancer   	Exceptionr/   r   r   )r<   r   r   r   test_pickle_enumk  s    
zTestEnum.test_pickle_enumc             C   s,   t ttrtt| jtj t| jt d S )N)r  r   r  r/   r   r   )r<   r   r   r   test_pickle_intq  s    
zTestEnum.test_pickle_intc             C   s,   t ttrtt| jtj t| jt d S )N)r  r   r  r/   r   r   )r<   r   r   r   test_pickle_floatw  s    
zTestEnum.test_pickle_floatc             C   s,   t ttrtt| jtj t| jt d S )N)r  r%   r  r/   r   Zhim)r<   r   r   r   test_pickle_enum_function}  s    
z"TestEnum.test_pickle_enum_functionc             C   s,   t ttrtt| jtj t| jt d S )N)r  r#   r  r/   r   Zwho)r<   r   r   r   %test_pickle_enum_function_with_module  s    
z.TestEnum.test_pickle_enum_function_with_modulec             C   s    t ttrt| tjd d S )Nr'   )r  r&   r  rx   r   )r<   r   r   r    test_enum_function_with_qualname  s    
z)TestEnum.test_enum_function_with_qualnamec             C   s<   G dd dt }|| j_d| jj | j_t| j| jj d S )Nc               @   s   e Zd ZdZdZdS )zLTestEnum.test_class_nested_enum_and_pickle_protocol_four.<locals>.NestedEnumcommonZrareN)r   r   r   twigsZshinyr   r   r   r   
NestedEnum  s   r  z%s.NestedEnum)r   rv   r  r   r   r/   r   r  )r<   r  r   r   r   /test_class_nested_enum_and_pickle_protocol_four  s    z8TestEnum.test_class_nested_enum_and_pickle_protocol_fourc             C   sB   G dd dt }tj|_x$ttD ]}| |j|d q"W d S )Nc               @   s   e Zd ZdZdZdS )z6TestEnum.test_pickle_by_name.<locals>.ReplaceGlobalIntr   r   N)r   r   r   ZONETWOr   r   r   r   ReplaceGlobalInt  s   r  r  )r   r8   _reduce_ex_by_name__reduce_ex__r+   r   rx   r  )r<   r  protor   r   r   test_pickle_by_name  s    zTestEnum.test_pickle_by_namec             C   sD   t ddtd}|t d< t| t| jt|j t| jt	| d S )N	BadPicklezdill sweet bread-n-butter)r$   )
r   r   globalsr8   _make_class_unpicklabler1   r   r   Zdillr   )r<   r  r   r   r   test_exploding_pickle  s    

zTestEnum.test_exploding_picklec             C   s$   G dd dt t}| |jd d S )Nc               @   s   e Zd ZdZdZdZdS )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)r   r   r   ZmasterZ
journeyman
apprenticer   r   r   r   
SkillLevel  s   r"  zknock, knock!)rs   r   rx   r!  )r<   r"  r   r   r   test_string_enum  s    zTestEnum.test_string_enumc             C   sL   G dd dt }| |d|j | t|d|j | |d |j d S )Nc               @   s   e Zd ZdZdZdZdZdS )z-TestEnum.test_getattr_getitem.<locals>.Periodr   r   r   r\   N)r   r   r   morningnoonZeveningnightr   r   r   r   Period  s   r'  r   r&  r$  )r   r   r%  r   r&  r$  )r<   r'  r   r   r   test_getattr_getitem  s    zTestEnum.test_getattr_getitemc             C   s   | j }| t|d d S )N__eq__)ra   r;   r   )r<   ra   r   r   r   test_getattr_dunder  s    zTestEnum.test_getattr_dunderc             C   s4   G dd dt }| t||j|j|j|jg d S )Nc               @   s   e Zd ZdZdZdZdZdS )z-TestEnum.test_iteration_order.<locals>.Seasonr   r\   r   r   N)r   r   r   r^   r`   r_   r]   r   r   r   r   ra     s   ra   )r   rx   r   r^   r`   r_   r]   )r<   ra   r   r   r   test_iteration_order  s    zTestEnum.test_iteration_orderc             C   s2   |  tt| j| jj| jj| jj| jjg d S )N)rx   r   reversedra   r`   r_   r^   r]   )r<   r   r   r   test_reversed_iteration_order  s    z&TestEnum.test_reversed_iteration_orderc             C   s   t dd}t|}| t|t| | t|d| | |j|j|jg| xjtd dD ]X\}}||}| t	|j
| | || | |j| | || | t|| q`W d S )NSummerMonthzjune july augustr   r   )r   r   rx   r   junejulyaugustr   r   r   r}   r   r|   r   r   r   )r<   r.  r   r   monthr   r   r   r   !test_programmatic_function_string  s    
z*TestEnum.test_programmatic_function_stringc             C   s   t dddd}t|}| t|t| | t|d| | |j|j|jg| xjtd dD ]X\}}||}| t	|j
| | || | |j| | || | t|| qdW d S )Nr.  zjune july august
   )startr   )r   r   rx   r   r/  r0  r1  r   r   r   r}   r   r|   r   r   r   )r<   r.  r   r   r2  r   r   r   r   ,test_programmatic_function_string_with_start  s    z5TestEnum.test_programmatic_function_string_with_startc             C   s   t ddddg}t|}| t|t| | t|d| | |j|j|jg| xjtd dD ]X\}}||}| t	|j
| | || | |j| | || | t|| qfW d S )Nr.  r/  r0  r1  r   zjune july augustr   )r   r   rx   r   r/  r0  r1  r   r   r   r}   r   r|   r   r   r   )r<   r.  r   r   r2  r   r   r   r   &test_programmatic_function_string_list  s    z/TestEnum.test_programmatic_function_string_listc             C   s   t ddddgdd}t|}| t|t| | t|d| | |j|j|jg| xjtd dD ]X\}}||}| t	|j
| | || | |j| | || | t|| qjW d S )	Nr.  r/  r0  r1     )r5  r   zjune july august)r   r   rx   r   r/  r0  r1  r   r   r   r}   r   r|   r   r   r   )r<   r.  r   r   r2  r   r   r   r   1test_programmatic_function_string_list_with_start  s    z:TestEnum.test_programmatic_function_string_list_with_startc             C   s   t dd}t|}| t|t| | t|d| | |j|j|jg| xjtd dD ]X\}}||}| t	|j
| | || | |j| | || | t|| q`W d S )Nr.  ))r/  r   )r0  r   )r1  r   r   zjune july augustr   )r   r   rx   r   r/  r0  r1  r   r   r   r}   r   r|   r   r   r   )r<   r.  r   r   r2  r   r   r   r   #test_programmatic_function_iterable  s     z,TestEnum.test_programmatic_function_iterablec             C   s   t dtd}t|}| t|t| | t|d| | |j|j|jg| xjtd	 dD ]X\}}||}| t
|j| | || | |j| | || | t|| qdW d S )Nr.  ))r/  r   )r0  r   )r1  r   r   zjune july augustr   )r   r   r   rx   r   r/  r0  r1  r   r   r   r}   r   r|   r   r   r   )r<   r.  r   r   r2  r   r   r   r   $test_programmatic_function_from_dict(  s     
z-TestEnum.test_programmatic_function_from_dictc             C   s   t ddtd}t|}| t|t| | t|d| | |j|j|jg| xXtd	 dD ]F\}}||}| || | |j
| | || | t|| qdW d S )Nr.  zjune july august)r   r   r   )r   r   r   rx   r   r/  r0  r1  r   r   r|   r   r   r   )r<   r.  r   r   r2  r   r   r   r   test_programmatic_function_type<  s    z(TestEnum.test_programmatic_function_typec             C   s   t ddtdd}t|}| t|t| | t|d| | |j|j|jg| xXtd	 dD ]F\}}||}| || | |j
| | || | t|| qfW d S )Nr.  zjune july august   )r   r5  r   )r   r   r   rx   r   r/  r0  r1  r   r   r|   r   r   r   )r<   r.  r   r   r2  r   r   r   r   *test_programmatic_function_type_with_startL  s    z3TestEnum.test_programmatic_function_type_with_startc             C   s   t dd}t|}| t|t| | t|d| | |j|j|jg| xXtd dD ]F\}}||}| || | |j	| | 
|| | t|| q`W d S )Nr.  zjune july augustr   r   )r   r   rx   r   r/  r0  r1  r   r   r|   r   r   r   )r<   r.  r   r   r2  r   r   r   r   -test_programmatic_function_type_from_subclass\  s    
z6TestEnum.test_programmatic_function_type_from_subclassc             C   s   t dddd}t|}| t|t| | t|d| | |j|j|jg| xXtd dD ]F\}}||}| || | |j	| | 
|| | t|| qdW d S )Nr.  zjune july august(   )r5  r   )r   r   rx   r   r/  r0  r1  r   r   r|   r   r   r   )r<   r.  r   r   r2  r   r   r   r   8test_programmatic_function_type_from_subclass_with_startl  s    zATestEnum.test_programmatic_function_type_from_subclass_with_startc             C   sT   t ttrt| tjd | tjtd | tjttd t| jtj d S )NzGuido van Rossumr"   )	r  r!   r  rx   r"   r;   r   r   r/   )r<   r   r   r   test_subclassing|  s    
zTestEnum.test_subclassingc          	   C   s:   G dd dt }| t G dd d|}W d Q R X d S )Nc               @   s   e Zd ZdZdZdZdS )z&TestEnum.test_extending.<locals>.Colorr   r   r   N)r   r   r   r   r   r   r   r   r   r   r     s   r   c               @   s   e Zd ZdZdZdZdS )z*TestEnum.test_extending.<locals>.MoreColorr\   re   r   N)r   r   r   cyanmagentayellowr   r   r   r   	MoreColor  s   rF  )r   r   r   )r<   r   rF  r   r   r   test_extending  s    zTestEnum.test_extendingc             C   s8   G dd dt }| t|j| | |j d d S )Nc               @   s   e Zd ZdZdZdd ZdS )z/TestEnum.test_exclude_methods.<locals>.whateverr   r   c             S   s
   d| j  S )Nz
no, not %s)r}   )r<   r   r   r   really  s    z6TestEnum.test_exclude_methods.<locals>.whatever.reallyN)r   r   r   r   r   rH  r   r   r   r   whatever  s   rI  zno, not that)r   ZassertIsNotr   rH  rx   r   )r<   rI  r   r   r   test_exclude_methods  s    zTestEnum.test_exclude_methodsc          	   C   s,   |  t G dd dtt}W d Q R X d S )Nc               @   s   e Zd ZdZdS )z4TestEnum.test_wrong_inheritance_order.<locals>.Wrongzerror before this pointN)r   r   r   ZNotHerer   r   r   r   r     s   r   )r   r   r   rs   )r<   r   r   r   r   test_wrong_inheritance_order  s    z%TestEnum.test_wrong_inheritance_orderc             C   sT   G dd dt }G dd dt }| |j|j | |j|j | |j|j d S )Nc               @   s   e Zd ZdZdZdZdS )z2TestEnum.test_intenum_transitivity.<locals>.numberr   r   r   N)r   r   r   r   r   threer   r   r   r   number  s   rM  c               @   s   e Zd ZdZdZdZdS )z2TestEnum.test_intenum_transitivity.<locals>.numeror   r   r   N)r   r   r   unodostresr   r   r   r   numero  s   rQ  )r   rx   r   rN  r   rO  rL  rP  )r<   rM  rQ  r   r   r   test_intenum_transitivity  s
    z"TestEnum.test_intenum_transitivityc             C   s4   G dd dt }G dd dt }| t||j d S )Nc               @   s   e Zd ZdZdZdS )z4TestEnum.test_wrong_enum_in_call.<locals>.Monochromer   r   N)r   r   r   blackwhiter   r   r   r   
Monochrome  s   rU  c               @   s   e Zd ZdZdZdS )z0TestEnum.test_wrong_enum_in_call.<locals>.Genderr   r   N)r   r   r   malefemaler   r   r   r   Gender  s   rX  )r   r   r   rV  )r<   rU  rX  r   r   r   test_wrong_enum_in_call  s    z TestEnum.test_wrong_enum_in_callc             C   s4   G dd dt }G dd dt}| t||j d S )Nc               @   s   e Zd ZdZdZdS )z:TestEnum.test_wrong_enum_in_mixed_call.<locals>.Monochromer   r   N)r   r   r   rS  rT  r   r   r   r   rU    s   rU  c               @   s   e Zd ZdZdZdS )z6TestEnum.test_wrong_enum_in_mixed_call.<locals>.Genderr   r   N)r   r   r   rV  rW  r   r   r   r   rX    s   rX  )r   r   r   r   rV  )r<   rU  rX  r   r   r   test_wrong_enum_in_mixed_call  s    z&TestEnum.test_wrong_enum_in_mixed_callc             C   s8   G dd dt }G dd dt }| ||j|j d S )Nc               @   s   e Zd ZdZdZdS )z6TestEnum.test_mixed_enum_in_call_1.<locals>.Monochromer   r   N)r   r   r   rS  rT  r   r   r   r   rU    s   rU  c               @   s   e Zd ZdZdZdS )z2TestEnum.test_mixed_enum_in_call_1.<locals>.Genderr   r   N)r   r   r   rV  rW  r   r   r   r   rX    s   rX  )r   r   rW  rT  )r<   rU  rX  r   r   r   test_mixed_enum_in_call_1  s    z"TestEnum.test_mixed_enum_in_call_1c             C   s8   G dd dt }G dd dt}| ||j|j d S )Nc               @   s   e Zd ZdZdZdS )z6TestEnum.test_mixed_enum_in_call_2.<locals>.Monochromer   r   N)r   r   r   rS  rT  r   r   r   r   rU    s   rU  c               @   s   e Zd ZdZdZdS )z2TestEnum.test_mixed_enum_in_call_2.<locals>.Genderr   r   N)r   r   r   rV  rW  r   r   r   r   rX    s   rX  )r   r   r   rV  rS  )r<   rU  rX  r   r   r   test_mixed_enum_in_call_2  s    z"TestEnum.test_mixed_enum_in_call_2c             C   s6   G dd dt }G dd d|}| t|jd d S )Nc               @   s   e Zd Zdd ZdS )z*TestEnum.test_flufl_enum.<locals>.Fluflnumc             S   s
   t | jS )N)r   r}   )r<   r   r   r   __int__  s    z2TestEnum.test_flufl_enum.<locals>.Fluflnum.__int__N)r   r   r   r]  r   r   r   r   Fluflnum  s   r^  c               @   s   e Zd ZdZdZdZdS )z0TestEnum.test_flufl_enum.<locals>.MailManOptionsr   r   r   N)r   r   r   option1Zoption2Zoption3r   r   r   r   MailManOptions  s   r`  r   )r   rx   r   r_  )r<   r^  r`  r   r   r   test_flufl_enum  s    zTestEnum.test_flufl_enumc             C   s   G dd dt }| |jjt | |jt G dd dtt}| |jjt | |jt G dd dt}| |jjt	 | |jt	 d S )Nc               @   s   e Zd ZdZdZdS )z+TestEnum.test_introspection.<locals>.Numberd      N)r   r   r   r   r   r   r   r   r   Number  s   rd  c               @   s   e Zd ZdZdZdZdS )z+TestEnum.test_introspection.<locals>.StringZsoftZroughZhardN)r   r   r   yarnZropeZwirer   r   r   r   String  s   rf  c               @   s   e Zd ZdZdZdS )z*TestEnum.test_introspection.<locals>.PlainrT  r   N)r   r   r   vanillar   r   r   r   r   Plain  s   rh  )
r   r   r   _member_type_r   rs   r   re  rg  object)r<   rd  rf  rh  r   r   r   test_introspection  s    zTestEnum.test_introspectionc          	   C   sP   G dd dt }| t |d W d Q R X | t |d  W d Q R X d S )Nc               @   s   e Zd ZdZdZdZdS )z0TestEnum.test_no_such_enum_member.<locals>.Colorr   r   r   N)r   r   r   r   r   r   r   r   r   r   r     s   r   r\   Z
chartreuse)r   r   r   KeyError)r<   r   r   r   r   test_no_such_enum_member  s
    z!TestEnum.test_no_such_enum_memberc             C   s&   G dd dt }| t|jd d S )Nc               @   s    e Zd ZdZdZdZdd ZdS )z%TestEnum.test_new_repr.<locals>.Colorr   r   r   c             S   s
   d| j  S )Nz!don't you just love shades of %s?)r|   )r<   r   r   r   __repr__  s    z.TestEnum.test_new_repr.<locals>.Color.__repr__N)r   r   r   r   r   r   rn  r   r   r   r   r     s   r   z#don't you just love shades of blue?)r   rx   r   r   )r<   r   r   r   r   test_new_repr  s    zTestEnum.test_new_reprc             C   s8   G dd dt }G dd dt|}| t|jd d S )Nc               @   s   e Zd Zdd ZdS )z,TestEnum.test_inherited_repr.<locals>.MyEnumc             S   s
   d| j  S )NzMy name is %s.)r|   )r<   r   r   r   rn    s    z5TestEnum.test_inherited_repr.<locals>.MyEnum.__repr__N)r   r   r   rn  r   r   r   r   MyEnum  s   rp  c               @   s   e Zd ZdZdZdZdS )z/TestEnum.test_inherited_repr.<locals>.MyIntEnumr   r   r   N)r   r   r   r   r   Ztheotherr   r   r   r   	MyIntEnum  s   rq  zMy name is that.)r   r   rx   r   r   )r<   rp  rq  r   r   r   test_inherited_repr   s    zTestEnum.test_inherited_reprc                sd   G  fdddt t G dd dt d}G dd dt d}G dd	 d	|}G d
d d|}d S )Nc                   s   e Zd Z fddZ  ZS )z3TestEnum.test_multiple_mixin_mro.<locals>.auto_enumc       	         s   t | }t|j}d}x8|jD ].}|| }|tkr:|}n|}|d7 }|||< q W x$| D ]\}}||kr\|||< q\W t| | |||S )Nr   r   )r   ry   _member_namesEllipsisr   super__new__)	metaclsr   bases	classdicttempnamesr   r   r   )rv   	auto_enumr   r   rv    s    


z;TestEnum.test_multiple_mixin_mro.<locals>.auto_enum.__new__)r   r   r   rv  __classcell__r   )r|  )rv   r   r|    s   r|  c               @   s   e Zd ZdS )z:TestEnum.test_multiple_mixin_mro.<locals>.AutoNumberedEnumN)r   r   r   r   r   r   r   AutoNumberedEnum  s   r~  )	metaclassc               @   s   e Zd ZdS )z5TestEnum.test_multiple_mixin_mro.<locals>.AutoIntEnumN)r   r   r   r   r   r   r   AutoIntEnum!  s   r  c               @   s   e Zd ZdZdZdZdS )z8TestEnum.test_multiple_mixin_mro.<locals>.TestAutoNumber.r   N)r   r   r   r@   r   r   r   r   r   r   TestAutoNumber$  s   r  c               @   s   e Zd ZdZdZdZdS )z5TestEnum.test_multiple_mixin_mro.<locals>.TestAutoInt.r   N)r   r   r   r@   r   r   r   r   r   r   TestAutoInt)  s   r  )r   r   r   )r<   r~  r  r  r  r   )r|  r   test_multiple_mixin_mro
  s
    z TestEnum.test_multiple_mixin_mroc                s   G  fdddt  G dd d t}| |jtj | t|j|j d  t d< |t d<  dd}| |d t	| j|d | |jj
d t	| j|j t	| j| d S )	Nc                   sH   e Zd ZdZdd Zdd Zedd Z dd	 Zd
d Z fddZdS )z:TestEnum.test_subclasses_with_getnewargs.<locals>.NamedIntNamedIntc             W   s@   |}|^}}t |dkr tdtj| f| }||_||_|S )Nr   z name and value must be specified)r   r   r   rv  _intname_args)r   argsr  r|   r<   r   r   r   rv  1  s    zBTestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__new__c             S   s   | j S )N)r  )r<   r   r   r   __getnewargs__:  s    zITestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__getnewargs__c             S   s   | j S )N)r  )r<   r   r   r   r   <  s    zCTestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__name__c             S   s   d t| j| jt| S )Nz{}({!r}, {}))r   r   r   r   rn  )r<   r   r   r   rn  ?  s    zCTestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__repr__c             S   s&   t }|j}|jtkr|| S || S )N)r   __str____objclass__rj  rn  )r<   basebase_strr   r   r   r  D  s
    

zBTestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__str__c                sB   t | t | }t|  r:t| r: d| j|j|S |S d S )Nz({0} + {1}))r   r  r   r   )r<   otherrz  )r  r   r   __add__M  s    zBTestEnum.test_subclasses_with_getnewargs.<locals>.NamedInt.__add__N)	r   r   r   rv  r  r   rn  r  r  r   )r  r   r   r  /  s   		r  c               @   s   e Zd ZdZdZdZdS )z5TestEnum.test_subclasses_with_getnewargs.<locals>.NEINEI)zthe-xr   )zthe-yr   N)r   r   r   xyr   r   r   r   r  V  s   r  zNamedInt('(the-x + the-y)', 3)r   re   r   )r   r   r   rv  rx   r   r  r  r  r/   r}   )r<   r  NI5r   )r  r   test_subclasses_with_getnewargs.  s    '


z(TestEnum.test_subclasses_with_getnewargsc                s   G  fdddt  G dd d t}| |jtj | t|j|j d  t d< |t d<  dd}| |d t	| j|d | |jj
d t	| j|j t	| j| d S )	Nc                   sH   e Zd ZdZdd Zdd Zedd Z dd	 Zd
d Z fddZdS )z=TestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedIntr  c             W   s@   |}|^}}t |dkr tdtj| f| }||_||_|S )Nr   z name and value must be specified)r   r   r   rv  r  r  )r   r  r  r|   r<   r   r   r   rv  j  s    zETestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__new__c             S   s
   | j i fS )N)r  )r<   r   r   r   __getnewargs_ex__s  s    zOTestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__getnewargs_ex__c             S   s   | j S )N)r  )r<   r   r   r   r   u  s    zFTestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__name__c             S   s   d t| j| jt| S )Nz{}({!r}, {}))r   r   r   r   rn  )r<   r   r   r   rn  x  s    zFTestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__repr__c             S   s&   t }|j}|jtkr|| S || S )N)r   r  r  rj  rn  )r<   r  r  r   r   r   r  }  s
    

zETestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__str__c                sB   t | t | }t|  r:t| r: d| j|j|S |S d S )Nz({0} + {1}))r   r  r   r   )r<   r  rz  )r  r   r   r    s    zETestEnum.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__add__N)	r   r   r   rv  r  r   rn  r  r  r   )r  r   r   r  h  s   		r  c               @   s   e Zd ZdZdZdZdS )z8TestEnum.test_subclasses_with_getnewargs_ex.<locals>.NEIr  )zthe-xr   )zthe-yr   N)r   r   r   r  r  r   r   r   r   r    s   r  zNamedInt('(the-x + the-y)', 3)r   re   r   )r   r   r   rv  rx   r   r  r  r  r/   r}   )r<   r  r  r   )r  r   "test_subclasses_with_getnewargs_exg  s    '


z+TestEnum.test_subclasses_with_getnewargs_exc                s   G  fdddt  G dd d t}| |jtj | t|j|j d  t d< |t d<  dd}| |d t	| j|d | |jj
d t	| j|j t	| j| d S )	Nc                   sH   e Zd ZdZdd Zdd Zedd Z dd	 Zd
d Z fddZdS )z6TestEnum.test_subclasses_with_reduce.<locals>.NamedIntr  c             W   s@   |}|^}}t |dkr tdtj| f| }||_||_|S )Nr   z name and value must be specified)r   r   r   rv  r  r  )r   r  r  r|   r<   r   r   r   rv    s    z>TestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__new__c             S   s   | j | jfS )N)rv   r  )r<   r   r   r   
__reduce__  s    zATestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__reduce__c             S   s   | j S )N)r  )r<   r   r   r   r     s    z?TestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__name__c             S   s   d t| j| jt| S )Nz{}({!r}, {}))r   r   r   r   rn  )r<   r   r   r   rn    s    z?TestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__repr__c             S   s&   t }|j}|jtkr|| S || S )N)r   r  r  rj  rn  )r<   r  r  r   r   r   r    s
    

z>TestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__str__c                sB   t | t | }t|  r:t| r: d| j|j|S |S d S )Nz({0} + {1}))r   r  r   r   )r<   r  rz  )r  r   r   r    s    z>TestEnum.test_subclasses_with_reduce.<locals>.NamedInt.__add__N)	r   r   r   rv  r  r   rn  r  r  r   )r  r   r   r    s   		r  c               @   s   e Zd ZdZdZdZdS )z1TestEnum.test_subclasses_with_reduce.<locals>.NEIr  )zthe-xr   )zthe-yr   N)r   r   r   r  r  r   r   r   r   r    s   r  zNamedInt('(the-x + the-y)', 3)r   re   r   )r   r   r   rv  rx   r   r  r  r  r/   r}   )r<   r  r  r   )r  r   test_subclasses_with_reduce  s    '


z$TestEnum.test_subclasses_with_reducec                s   G  fdddt  G dd d t}| |jtj | t|j|j d  t d< |t d<  dd}| |d t	| j|d | |jj
d t	| j|j t	| j| d S )	Nc                   sH   e Zd ZdZdd Zdd Zedd Z dd	 Zd
d Z fddZdS )z9TestEnum.test_subclasses_with_reduce_ex.<locals>.NamedIntr  c             W   s@   |}|^}}t |dkr tdtj| f| }||_||_|S )Nr   z name and value must be specified)r   r   r   rv  r  r  )r   r  r  r|   r<   r   r   r   rv    s    zATestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__new__c             S   s   | j | jfS )N)rv   r  )r<   r  r   r   r   r    s    zGTestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__reduce_ex__c             S   s   | j S )N)r  )r<   r   r   r   r     s    zBTestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__name__c             S   s   d t| j| jt| S )Nz{}({!r}, {}))r   r   r   r   rn  )r<   r   r   r   rn    s    zBTestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__repr__c             S   s&   t }|j}|jtkr|| S || S )N)r   r  r  rj  rn  )r<   r  r  r   r   r   r    s
    

zATestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__str__c                sB   t | t | }t|  r:t| r: d| j|j|S |S d S )Nz({0} + {1}))r   r  r   r   )r<   r  rz  )r  r   r   r    s    zATestEnum.test_subclasses_with_reduce_ex.<locals>.NamedInt.__add__N)	r   r   r   rv  r  r   rn  r  r  r   )r  r   r   r    s   		r  c               @   s   e Zd ZdZdZdZdS )z4TestEnum.test_subclasses_with_reduce_ex.<locals>.NEIr  )zthe-xr   )zthe-yr   N)r   r   r   r  r  r   r   r   r   r    s   r  zNamedInt('(the-x + the-y)', 3)r   re   r   )r   r   r   rv  rx   r   r  r  r  r/   r}   )r<   r  r  r   )r  r   test_subclasses_with_reduce_ex  s    '


z'TestEnum.test_subclasses_with_reduce_exc                s   G  fdddt  G dd d t}| |jtj | t|j|j d  t d< |t d<  dd}| |d | |jj	d t
| jt|j t
| jt| d S )	Nc                   s@   e Zd ZdZdd Zedd Z dd Zdd	 Z fd
dZdS )zHTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedIntr  c             W   s@   |}|^}}t |dkr tdtj| f| }||_||_|S )Nr   z name and value must be specified)r   r   r   rv  r  r  )r   r  r  r|   r<   r   r   r   rv    s    zPTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedInt.__new__c             S   s   | j S )N)r  )r<   r   r   r   r     s    zQTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedInt.__name__c             S   s   d t| j| jt| S )Nz{}({!r}, {}))r   r   r   r   rn  )r<   r   r   r   rn  !  s    zQTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedInt.__repr__c             S   s&   t }|j}|jtkr|| S || S )N)r   r  r  rj  rn  )r<   r  r  r   r   r   r  &  s
    

zPTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedInt.__str__c                sB   t | t | }t|  r:t| r: d| j|j|S |S d S )Nz({0} + {1}))r   r  r   r   )r<   r  rz  )r  r   r   r  /  s    zPTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NamedInt.__add__N)r   r   r   rv  r   rn  r  r  r   )r  r   r   r    s   		r  c               @   s   e Zd ZdZdZdZdS )zCTestEnum.test_subclasses_without_direct_pickle_support.<locals>.NEIr  )zthe-xr   )zthe-yr   N)r   r   r   r  r  r   r   r   r   r  8  s   r  zNamedInt('(the-x + the-y)', 3)r   re   r   )r   r   r   rv  rx   r   r  r  r  r}   r1   r   r   r   )r<   r  r  r   )r  r   -test_subclasses_without_direct_pickle_support  s    %


z6TestEnum.test_subclasses_without_direct_pickle_supportc                s   G  fdddt  G dd d t}| |jtj | t|j|j d  t d< |t d<  dd}| |d | |jj	d t
| j|j t
| j| d S )	Nc                   s@   e Zd ZdZdd Zedd Z dd Zdd	 Z fd
dZdS )zSTestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedIntr  c             W   s@   |}|^}}t |dkr tdtj| f| }||_||_|S )Nr   z name and value must be specified)r   r   r   rv  r  r  )r   r  r  r|   r<   r   r   r   rv  J  s    z[TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedInt.__new__c             S   s   | j S )N)r  )r<   r   r   r   r   S  s    z\TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedInt.__name__c             S   s   d t| j| jt| S )Nz{}({!r}, {}))r   r   r   r   rn  )r<   r   r   r   rn  V  s    z\TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedInt.__repr__c             S   s&   t }|j}|jtkr|| S || S )N)r   r  r  rj  rn  )r<   r  r  r   r   r   r  [  s
    

z[TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedInt.__str__c                sB   t | t | }t|  r:t| r: d| j|j|S |S d S )Nz({0} + {1}))r   r  r   r   )r<   r  rz  )r  r   r   r  d  s    z[TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NamedInt.__add__N)r   r   r   rv  r   rn  r  r  r   )r  r   r   r  H  s   		r  c               @   s    e Zd ZdZdZdZdd ZdS )zNTestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NEIr  )zthe-xr   )zthe-yr   c             S   s   t | j| jffS )N)r   rv   _name_)r<   r  r   r   r   r  q  s    z\TestEnum.test_subclasses_without_direct_pickle_support_using_name.<locals>.NEI.__reduce_ex__N)r   r   r   r  r  r  r   r   r   r   r  m  s   r  zNamedInt('(the-x + the-y)', 3)r   re   r   )r   r   r   rv  rx   r   r  r  r  r}   r/   )r<   r  r  r   )r  r   8test_subclasses_without_direct_pickle_support_using_nameG  s    %


zATestEnum.test_subclasses_without_direct_pickle_support_using_namec             C   s\   G dd dt t}| t|j| | |jt  | |jd |t	 d< t
| j|j d S )Nc               @   s   e Zd ZdZdZdZdZdS )z/TestEnum.test_tuple_subclass.<locals>.SomeTuple	SomeTuple)r   zfor the money)r   zfor the show)r   zfor the musicN)r   r   r   firstsecondthirdr   r   r   r   r    s   r  )r   zfor the music)tupler   r   r   r  r   r  rx   r  r  r/   )r<   r  r   r   r   test_tuple_subclass~  s    
zTestEnum.test_tuple_subclassc             C   sd   G dd dt }| t||j|j|jg | t|jd | |jjd | |d|j d S )Nc               @   s(   e Zd ZdZdZdZdd Zdd ZdS )zITestEnum.test_duplicate_values_give_unique_enum_items.<locals>.AutoNumberr   c             S   s"   t | jd }t| }||_|S )Nr   )r   rw   rj  rv  r   )r   r}   r0   r   r   r   rv    s    
zQTestEnum.test_duplicate_values_give_unique_enum_items.<locals>.AutoNumber.__new__c             S   s
   t | jS )N)r   r   )r<   r   r   r   r]    s    zQTestEnum.test_duplicate_values_give_unique_enum_items.<locals>.AutoNumber.__int__N)r   r   r   r  r  r  rv  r]  r   r   r   r   
AutoNumber  s
   r  r   r   r   )	r   rx   r   r  r  r  r   r}   r   )r<   r  r   r   r   ,test_duplicate_values_give_unique_enum_items  s    z5TestEnum.test_duplicate_values_give_unique_enum_itemsc             C   s\   G dd dt }G dd d|}| t||j|j|jg | ttt|dddg d S )Nc               @   s   e Zd Zdd Zdd ZdS )zBTestEnum.test_inherited_new_from_enhanced_enum.<locals>.AutoNumberc             S   s"   t | jd }t| }||_|S )Nr   )r   rw   rj  rv  r   )r   r}   r0   r   r   r   rv    s    
zJTestEnum.test_inherited_new_from_enhanced_enum.<locals>.AutoNumber.__new__c             S   s
   t | jS )N)r   r   )r<   r   r   r   r]    s    zJTestEnum.test_inherited_new_from_enhanced_enum.<locals>.AutoNumber.__int__N)r   r   r   rv  r]  r   r   r   r   r    s   r  c               @   s   e Zd ZdZdZdZdS )z=TestEnum.test_inherited_new_from_enhanced_enum.<locals>.Colorr   N)r   r   r   r   r   r   r   r   r   r   r     s   r   r   r   r   )r   rx   r   r   r   r   mapr   )r<   r  r   r   r   r   %test_inherited_new_from_enhanced_enum  s    z.TestEnum.test_inherited_new_from_enhanced_enumc             C   s\   G dd dt }G dd d|}| t||j|j|jg | ttt|dddg d S )Nc               @   s   e Zd Zdd ZdS )z?TestEnum.test_inherited_new_from_mixed_enum.<locals>.AutoNumberc             S   s$   t | jd }t| |}||_|S )Nr   )r   rw   r   rv  r   )r   r}   r0   r   r   r   rv    s    zGTestEnum.test_inherited_new_from_mixed_enum.<locals>.AutoNumber.__new__N)r   r   r   rv  r   r   r   r   r    s   r  c               @   s   e Zd ZdZdZdZdS )z:TestEnum.test_inherited_new_from_mixed_enum.<locals>.Colorr   N)r   r   r   r   r   r   r   r   r   r   r     s   r   r   r   r   )r   rx   r   r   r   r   r  r   )r<   r  r   r   r   r   "test_inherited_new_from_mixed_enum  s    z+TestEnum.test_inherited_new_from_mixed_enumc             C   sB   G dd d}G dd dt }| | |j | |j|  d S )Nc               @   s   e Zd Zdd ZdS )z+TestEnum.test_equality.<locals>.AlwaysEqualc             S   s   dS )NTr   )r<   r  r   r   r   r)    s    z2TestEnum.test_equality.<locals>.AlwaysEqual.__eq__N)r   r   r   r)  r   r   r   r   AlwaysEqual  s   r  c               @   s   e Zd ZdZdS )z,TestEnum.test_equality.<locals>.OrdinaryEnumr   N)r   r   r   r@   r   r   r   r   OrdinaryEnum  s   r  )r   rx   r@   )r<   r  r  r   r   r   test_equality  s    zTestEnum.test_equalityc             C   s   G dd dt }G dd d|}| |j|j | |j|j | |j|j | 	|j|j | 
|j|j | |j|j d S )Nc               @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
z0TestEnum.test_ordered_mixin.<locals>.OrderedEnumc             S   s   | j |j kr| j|jkS tS )N)rv   r   NotImplemented)r<   r  r   r   r   __ge__  s    z7TestEnum.test_ordered_mixin.<locals>.OrderedEnum.__ge__c             S   s   | j |j kr| j|jkS tS )N)rv   r   r  )r<   r  r   r   r   __gt__  s    z7TestEnum.test_ordered_mixin.<locals>.OrderedEnum.__gt__c             S   s   | j |j kr| j|jkS tS )N)rv   r   r  )r<   r  r   r   r   __le__  s    z7TestEnum.test_ordered_mixin.<locals>.OrderedEnum.__le__c             S   s   | j |j kr| j|jk S tS )N)rv   r   r  )r<   r  r   r   r   __lt__  s    z7TestEnum.test_ordered_mixin.<locals>.OrderedEnum.__lt__N)r   r   r   r  r  r  r  r   r   r   r   OrderedEnum  s   r  c               @   s    e Zd ZdZdZdZdZdZdS )z*TestEnum.test_ordered_mixin.<locals>.Gradere   r\   r   r   r   N)r   r   r   rf   rg   rh   ri   rj   r   r   r   r   Grade  s
   r  )r   ZassertGreaterrf   rg   ZassertLessEqualrj   rh   Z
assertLessri   ZassertGreaterEqualrx   r   )r<   r  r  r   r   r   test_ordered_mixin  s    zTestEnum.test_ordered_mixinc          	   C   sJ   G dd dt }G dd d|}| t G dd d|}W d Q R X d S )Nc               @   s   e Zd Zdd ZdS )z'TestEnum.test_extending2.<locals>.Shadec             S   s   t | j d S )N)printr|   )r<   r   r   r   shade  s    z-TestEnum.test_extending2.<locals>.Shade.shadeN)r   r   r   r  r   r   r   r   Shade  s   r  c               @   s   e Zd ZdZdZdZdS )z'TestEnum.test_extending2.<locals>.Colorr   r   r   N)r   r   r   r   r   r   r   r   r   r   r     s   r   c               @   s   e Zd ZdZdZdZdS )z+TestEnum.test_extending2.<locals>.MoreColorr\   re   r   N)r   r   r   rC  rD  rE  r   r   r   r   rF    s   rF  )r   r   r   )r<   r  r   rF  r   r   r   test_extending2  s    zTestEnum.test_extending2c             C   sF   G dd dt }G dd d|}G dd d|}| |j d d S )Nc               @   s   e Zd Zdd ZdS )z'TestEnum.test_extending3.<locals>.Shadec             S   s   | j S )N)r|   )r<   r   r   r   r    s    z-TestEnum.test_extending3.<locals>.Shade.shadeN)r   r   r   r  r   r   r   r   r    s   r  c               @   s   e Zd Zdd ZdS )z'TestEnum.test_extending3.<locals>.Colorc             S   s
   d| j  S )Nz%s hexlified!)r}   )r<   r   r   r   r    s    z+TestEnum.test_extending3.<locals>.Color.hexN)r   r   r   r  r   r   r   r   r     s   r   c               @   s   e Zd ZdZdZdZdS )z+TestEnum.test_extending3.<locals>.MoreColorr\   re   r   N)r   r   r   rC  rD  rE  r   r   r   r   rF    s   rF  z5 hexlified!)r   rx   rD  r  )r<   r  r   rF  r   r   r   test_extending3  s    zTestEnum.test_extending3c             C   s6   G dd dt }G dd d|}| t|j| d S )Nc               @   s   e Zd Zdd ZdS )z3TestEnum.test_subclass_duplicate_name.<locals>.Basec             S   s   d S )Nr   )r<   r   r   r   r     s    z8TestEnum.test_subclass_duplicate_name.<locals>.Base.testN)r   r   r   r   r   r   r   r   Base   s   r  c               @   s   e Zd ZdZdS )z3TestEnum.test_subclass_duplicate_name.<locals>.Testr   N)r   r   r   r   r   r   r   r   r     s   r   )r   r   r   r   )r<   r  r   r   r   r   test_subclass_duplicate_name  s    z%TestEnum.test_subclass_duplicate_namec                sD   ddl m  G  fdddt}G dd d|}| |jjd d S )Nr   )DynamicClassAttributec                   s   e Zd Z dd ZdS )z;TestEnum.test_subclass_duplicate_name_dynamic.<locals>.Basec             S   s   dS )Ndynamicr   )r<   r   r   r   r   
  s    z@TestEnum.test_subclass_duplicate_name_dynamic.<locals>.Base.testN)r   r   r   r   r   )r  r   r   r  	  s   r  c               @   s   e Zd ZdZdS )z;TestEnum.test_subclass_duplicate_name_dynamic.<locals>.Testr   N)r   r   r   r   r   r   r   r   r     s   r   r  )typesr  r   rx   r   )r<   r  r   r   )r  r   $test_subclass_duplicate_name_dynamic  s    z-TestEnum.test_subclass_duplicate_name_dynamicc          	   C   sJ   G dd dt }G dd d|}| t G dd d|}W d Q R X d S )Nc               @   s   e Zd Zdd ZdS )z/TestEnum.test_no_duplicates.<locals>.UniqueEnumc                sB    j }t fdd|D r> j}| jj}td||f d S )Nc             3   s   | ]} j |j kV  qd S )N)r}   )r   r   )r<   r   r   	<genexpr>  s    zKTestEnum.test_no_duplicates.<locals>.UniqueEnum.__init__.<locals>.<genexpr>z-aliases not allowed in UniqueEnum:  %r --> %r)rv   anyr|   r}   r   )r<   r  r   r@   r   r   )r<   r   rX     s    z8TestEnum.test_no_duplicates.<locals>.UniqueEnum.__init__N)r   r   r   rX   r   r   r   r   
UniqueEnum  s   r  c               @   s   e Zd ZdZdZdZdS )z*TestEnum.test_no_duplicates.<locals>.Colorr   r   r   N)r   r   r   r   r   r   r   r   r   r   r     s   r   c               @   s   e Zd ZdZdZdZdZdS )z*TestEnum.test_no_duplicates.<locals>.Colorr   r   r   N)r   r   r   r   r   r   Zgrener   r   r   r   r   !  s   )r   r   r   )r<   r  r   r   r   r   test_no_duplicates  s    
zTestEnum.test_no_duplicatesc             C   s:   G dd dt }| t|jjdd | |jjd d S )Nc               @   s@   e Zd ZdZdZdZdZdZdZdZ	dZ
d	d
 Zedd ZdS )z"TestEnum.test_init.<locals>.Planet)gITf|Dg    
BA)gQX4Eg    WA)goEg    TXA)g	Dg    (IA)gcEg   A)g[\h}Eg    ，A)g#'?TQEg   _xA)gJ-UEg    wAc             S   s   || _ || _d S )N)massradius)r<   r  r  r   r   r   rX   1  s    z+TestEnum.test_init.<locals>.Planet.__init__c             S   s   d}|| j  | j| j  S )NgyдW=)r  r  )r<   Gr   r   r   surface_gravity4  s    z2TestEnum.test_init.<locals>.Planet.surface_gravityN)r   r   r   ZMERCURYZVENUSEARTHZMARSZJUPITERZSATURNZURANUSZNEPTUNErX   r   r  r   r   r   r   Planet(  s   r  r   g#@)goEg    TXA)r   rx   roundr  r  r}   )r<   r  r   r   r   	test_init'  s    zTestEnum.test_initc             C   s|   G dd dt t}| t|d | t|d | t|d | t|jt  | |j|jk | |j	|j
k d S )Nc               @   s   e Zd Zdd ZdZe Zx$edD ]Zed dfede < q$W x$edD ]Zed	 d
fede < qJW x edD ]Zedfede < qpW e	Z
eZeZdS )z$TestEnum.test_ignore.<locals>.Periodc             S   s   t | |}||_||_|S )N)r   rv  r   period)r   r}   r  r0   r   r   r   rv  A  s    z,TestEnum.test_ignore.<locals>.Period.__new__zPeriod i   r=  r2  zmonth_%d5   r   Zweekzweek_%d    Zdayzday_%dN)r   r   r   rv  _ignore_varsr'  r+   r   day_1ZOneDayZweek_1ZOneWeekmonth_1ZOneMonthr   r   r   r   r'  =  s   r'  r  r   )r   r   r7   r   r;   r  r  r  Zday_30Zweek_4Zday_28)r<   r'  r   r   r   test_ignore<  s    zTestEnum.test_ignorec             C   s   G dd dt }G dd d|}| t||j|j|jg xDt|tdD ]2\}}|d7 }| |j|g | 	||g| qLW d S )Nc               @   s   e Zd Zdd ZdS )z6TestEnum.test_nonhash_value.<locals>.AutoNumberInAListc             S   s$   t | jd g}t| }||_|S )Nr   )r   rw   rj  rv  r   )r   r}   r0   r   r   r   rv  Z  s    
z>TestEnum.test_nonhash_value.<locals>.AutoNumberInAList.__new__N)r   r   r   rv  r   r   r   r   AutoNumberInAListY  s   r  c               @   s   e Zd ZdZdZdZdS )z1TestEnum.test_nonhash_value.<locals>.ColorInAListr   N)r   r   r   r   r   r   r   r   r   r   ColorInAList_  s   r  r   r   )
r   rx   r   r   r   r   zipr+   r}   r   )r<   r  r  r8   r}   r   r   r   test_nonhash_valueX  s    zTestEnum.test_nonhash_valuec             C   s^   G dd dt t}G dd d|}| t||j|jg | |jd | |d|j d S )Nc               @   s   e Zd Zdd ZdS )zHTestEnum.test_conflicting_types_resolved_in_new.<locals>.LabelledIntEnumc             W   s$   |\}}t | |}||_||_|S )N)r   rv  labelr   )r   r  r}   r  r0   r   r   r   rv  k  s
    zPTestEnum.test_conflicting_types_resolved_in_new.<locals>.LabelledIntEnum.__new__N)r   r   r   rv  r   r   r   r   LabelledIntEnumj  s   r  c               @   s   e Zd ZdZdZdS )zETestEnum.test_conflicting_types_resolved_in_new.<locals>.LabelledList)r   ZUnprocessed)r   zPayment CompleteN)r   r   r   unprocessedpayment_completer   r   r   r   LabelledListr  s   r  r   )r   r   rx   r   r  r  )r<   r  r  r   r   r   &test_conflicting_types_resolved_in_newi  s
    z/TestEnum.test_conflicting_types_resolved_in_newc             C   s`   G dd dt }| t||j|j|jg | |jjd | |jjd | |jjd d S )Nc               @   s   e Zd Ze Ze Ze ZdS )z(TestEnum.test_auto_number.<locals>.ColorN)r   r   r   r	   r   r   r   r   r   r   r   r   {  s   r   r   r   r   )r   rx   r   r   r   r   r}   )r<   r   r   r   r   test_auto_numberz  s
    zTestEnum.test_auto_numberc             C   s`   G dd dt }| t||j|j|jg | |jjd | |jjd | |jjd d S )Nc               @   s&   e Zd Zdd Ze Ze Ze ZdS )z&TestEnum.test_auto_name.<locals>.Colorc             S   s   | S )Nr   )r|   r5  countlastr   r   r   _generate_next_value_  s    z<TestEnum.test_auto_name.<locals>.Color._generate_next_value_N)r   r   r   r  r	   r   r   r   r   r   r   r   r     s   r   r   r   r   )r   rx   r   r   r   r   r}   )r<   r   r   r   r   test_auto_name  s
    zTestEnum.test_auto_namec             C   sp   G dd dt }G dd d|}| t||j|j|jg | |jjd | |jjd | |jjd d S )Nc               @   s   e Zd Zdd ZdS )z5TestEnum.test_auto_name_inherit.<locals>.AutoNameEnumc             S   s   | S )Nr   )r|   r5  r  r  r   r   r   r    s    zKTestEnum.test_auto_name_inherit.<locals>.AutoNameEnum._generate_next_value_N)r   r   r   r  r   r   r   r   AutoNameEnum  s   r  c               @   s   e Zd Ze Ze Ze ZdS )z.TestEnum.test_auto_name_inherit.<locals>.ColorN)r   r   r   r	   r   r   r   r   r   r   r   r     s   r   r   r   r   )r   rx   r   r   r   r   r}   )r<   r  r   r   r   r   test_auto_name_inherit  s    zTestEnum.test_auto_name_inheritc             C   s$   G dd dt }| |jjd d S )Nc               @   s   e Zd ZdZe ZdS )z)TestEnum.test_auto_garbage.<locals>.Colorr   N)r   r   r   r   r	   r   r   r   r   r   r     s   r   r   )r   rx   r   r}   )r<   r   r   r   r   test_auto_garbage  s    zTestEnum.test_auto_garbagec             C   s`   G dd dt }| t||j|j|jg | |jjd | |jjd | |jjd d S )Nc               @   s   e Zd ZdZdZe ZdS )z3TestEnum.test_auto_garbage_corrected.<locals>.Colorr   r   N)r   r   r   r   r   r	   r   r   r   r   r   r     s   r   r   r   r   )r   rx   r   r   r   r   r}   )r<   r   r   r   r   test_auto_garbage_corrected  s
    z$TestEnum.test_auto_garbage_correctedc             C   s0   G dd dt }| |j|j|jgt| d S )Nc               @   s"   e Zd Ze  ZZe Ze ZdS )z+TestEnum.test_duplicate_auto.<locals>.DupesN)r   r   r   r	   r  primeror  r  r   r   r   r   Dupes  s   
r  )r   rx   r  r  r  r   )r<   r  r   r   r   test_duplicate_auto  s    zTestEnum.test_duplicate_autoc          
   C   s   G dd dt }| |d|j | t|d y|d W n4 tk
rp } z| t|jt W d d }~X Y n
X t	dy|d W n4 t
k
r } z| t|jt W d d }~X Y n
X t	dd S )Nc               @   s$   e Zd ZdZdZdZedd ZdS )z$TestEnum.test_missing.<locals>.Colorr   r   r   c             S   s0   |dkr| j S |dkrdS |dkr(tnd S d S )NrL  z
bad returnre   z	error out)r   ZeroDivisionError)r   itemr   r   r   	_missing_  s    z.TestEnum.test_missing.<locals>.Color._missing_N)r   r   r   r   r   r   classmethodr  r   r   r   r   r     s   r   rL  r   z
bad returnzException not raised.z	error out)r   r   r   r   r   r   r;   r  __context__r  r  )r<   r   excr   r   r   test_missing  s    $$zTestEnum.test_missingc             C   s  G dd d}G dd d}G dd dt }G dd dt }G d	d
 d
|t }| |jjd | |jjd | |jjd | |jd | t|jd G dd
 d
||t }| |jjd | |jjd | |jjd | |jd | t|jd G dd
 d
||t }| |jjd | |jjd | |jjd | |jd | t|jd G dd d||t }| |jjd | |jjd | |jjd | t|jd | |j d G dd d||t }| |jjd | |jjd | |jjd | t|jd | |j d | |j	 d G dd d|||}| |jjd | |jjd | |jjd | t|jd | |j d | |j	 d G dd d|||}	| |	jjd | |	jjd | |	jjd | t|	jd | |	j d | |	j	 d G dd d|t
||}
| |
jjd | |
jjd | |
jjd | t|
jd | |
j d | |	j	 d | t|
t d S )Nc               @   s   e Zd Zedd ZdS )z.TestEnum.test_multiple_mixin.<locals>.MaxMixinc             S   s   t | }|| _|S )N)r   MAX)r   maxr   r   r   r    s    z2TestEnum.test_multiple_mixin.<locals>.MaxMixin.MAXN)r   r   r   rR   r  r   r   r   r   MaxMixin  s   r  c               @   s   e Zd Zdd ZdS )z.TestEnum.test_multiple_mixin.<locals>.StrMixinc             S   s
   | j  S )N)r  lower)r<   r   r   r   r    s    z6TestEnum.test_multiple_mixin.<locals>.StrMixin.__str__N)r   r   r   r  r   r   r   r   StrMixin  s   r  c               @   s   e Zd Zdd ZdS )z.TestEnum.test_multiple_mixin.<locals>.SomeEnumc             S   s   dS )Nbooyahr   )r<   r   r   r   behavior  s    z7TestEnum.test_multiple_mixin.<locals>.SomeEnum.behaviorN)r   r   r   r  r   r   r   r   SomeEnum  s   r  c               @   s   e Zd Zdd Zdd ZdS )z1TestEnum.test_multiple_mixin.<locals>.AnotherEnumc             S   s   dS )Nznuhuh!r   )r<   r   r   r   r    s    z:TestEnum.test_multiple_mixin.<locals>.AnotherEnum.behaviorc             S   s   dS )Nz
what's up?r   )r<   r   r   r   social  s    z8TestEnum.test_multiple_mixin.<locals>.AnotherEnum.socialN)r   r   r   r  r  r   r   r   r   AnotherEnum  s   r  c               @   s   e Zd Ze Ze Ze ZdS )z+TestEnum.test_multiple_mixin.<locals>.ColorN)r   r   r   r	   REDGREENBLUEr   r   r   r   r     s   r   r   r   r   z
Color.BLUEc               @   s   e Zd Ze Ze Ze ZdS )z+TestEnum.test_multiple_mixin.<locals>.ColorN)r   r   r   r	   r  r  r  r   r   r   r   r     s   r   c               @   s   e Zd Ze Ze Ze ZdS )z+TestEnum.test_multiple_mixin.<locals>.ColorN)r   r   r   r	   r  r  r  r   r   r   r   r     s   c               @   s   e Zd Ze Ze Ze ZdS )z/TestEnum.test_multiple_mixin.<locals>.CoolColorN)r   r   r   r	   r  r  r  r   r   r   r   	CoolColor  s   r  r  c               @   s   e Zd Ze Ze Ze ZdS )z1TestEnum.test_multiple_mixin.<locals>.CoolerColorN)r   r   r   r	   r  r  r  r   r   r   r   CoolerColor  s   r  znuhuh!z
what's up?c               @   s   e Zd Ze Ze Ze ZdS )z2TestEnum.test_multiple_mixin.<locals>.CoolestColorN)r   r   r   r	   r  r  r  r   r   r   r   CoolestColor  s   r  c               @   s   e Zd Ze Ze Ze ZdS )z3TestEnum.test_multiple_mixin.<locals>.ConfusedColorN)r   r   r   r	   r  r  r  r   r   r   r   ConfusedColor"  s   r  c               @   s   e Zd Ze Ze Ze ZdS )z3TestEnum.test_multiple_mixin.<locals>.ReformedColorN)r   r   r   r	   r  r  r  r   r   r   r   ReformedColor,  s   r   )r   rx   r  r}   r  r  r  rs   r  r  r   r;   
issubclassr   )r<   r  r  r  r  r   r  r  r  r  r   r   r   r   test_multiple_mixin  sr    zTestEnum.test_multiple_mixinc             C   sN   G dd dt t}tG dd d|}G dd d|}tG dd d|}d S )	Nc               @   s   e Zd Zdd ZdS )z7TestEnum.test_multiple_inherited_mixin.<locals>.StrEnumc             _   s@   x,|D ]$}t |tstd|t|jf qW tj| f||S )Nz%Enumeration '%s' (%s) is not a string)r  rs   r   r   r   rv  )r   r  kwargsr@   r   r   r   rv  :  s
    

z?TestEnum.test_multiple_inherited_mixin.<locals>.StrEnum.__new__N)r   r   r   rv  r   r   r   r   r    9  s   r    c               @   s   e Zd ZdZdZdZdS )z9TestEnum.test_multiple_inherited_mixin.<locals>.Decision1REVERT
REVERT_ALLRETRYN)r   r   r   r  r  r  r   r   r   r   	Decision1@  s   r  c               @   s   e Zd ZdS )z6TestEnum.test_multiple_inherited_mixin.<locals>.MyEnumN)r   r   r   r   r   r   r   rp  E  s   rp  c               @   s   e Zd ZdZdZdZdS )z9TestEnum.test_multiple_inherited_mixin.<locals>.Decision2r  r  r  N)r   r   r   r  r  r  r   r   r   r   	Decision2G  s   r  )rs   r   r   )r<   r    r  rp  r  r   r   r   test_multiple_inherited_mixin8  s    z&TestEnum.test_multiple_inherited_mixinc             C   s(   d}t |dd}i }i }t||| d S )Nz8from enum import Enum; Enum('Animal', 'ANT BEE CAT DOG')z<string>exec)compiler
  )r<   codeZ	global_nsZlocal_lsr   r   r   test_empty_globalsM  s
    zTestEnum.test_empty_globalsN)qr   r   r   ru   r{   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r
  r  r  r  r  r  r  r  r  r   r#  r(  r*  r+  r-  r3  r6  r7  r9  r:  r;  r<  r>  r?  rA  rB  rG  rJ  rK  rR  rY  rZ  r[  r\  ra  rk  rm  ro  rr  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[      s   #				
	
					


$999957	
 `r[   c               @   sD   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dS )	TestOrderc             C   s   G dd dt }d S )Nc               @   s   e Zd ZdZdZdZdZdS )z*TestOrder.test_same_members.<locals>.Colorzred green bluer   r   r   N)r   r   r   _order_r   r   r   r   r   r   r   r   Z  s   r   )r   )r<   r   r   r   r   test_same_membersY  s    zTestOrder.test_same_membersc             C   s   G dd dt }d S )Nc               @   s    e Zd ZdZdZdZdZeZdS )z7TestOrder.test_same_members_with_aliases.<locals>.Colorzred green bluer   r   r   N)r   r   r   r  r   r   r   verder   r   r   r   r   a  s
   r   )r   )r<   r   r   r   r   test_same_members_with_aliases`  s    z(TestOrder.test_same_members_with_aliasesc          	   C   s,   |  td G dd dt}W d Q R X d S )Nz#member order does not match _order_c               @   s   e Zd ZdZdZdZdZdS )z6TestOrder.test_same_members_wrong_order.<locals>.Colorzred green bluer   r   r   N)r   r   r   r  r   r   r   r   r   r   r   r   j  s   r   )assertRaisesRegexr   r   )r<   r   r   r   r   test_same_members_wrong_orderh  s    z'TestOrder.test_same_members_wrong_orderc          	   C   s,   |  td G dd dt}W d Q R X d S )Nz#member order does not match _order_c               @   s   e Zd ZdZdZdZdZdS )z5TestOrder.test_order_has_extra_members.<locals>.Colorzred green blue purpler   r   r   N)r   r   r   r  r   r   r   r   r   r   r   r   r  s   r   )r  r   r   )r<   r   r   r   r   test_order_has_extra_membersp  s    z&TestOrder.test_order_has_extra_membersc          	   C   s,   |  td G dd dt}W d Q R X d S )Nz#member order does not match _order_c               @   s    e Zd ZdZdZdZdZeZdS )zBTestOrder.test_order_has_extra_members_with_aliases.<locals>.Colorzred green blue purpler   r   r   N)r   r   r   r  r   r   r   r  r   r   r   r   r   z  s
   r   )r  r   r   )r<   r   r   r   r   )test_order_has_extra_members_with_aliasesx  s    z3TestOrder.test_order_has_extra_members_with_aliasesc          	   C   s,   |  td G dd dt}W d Q R X d S )Nz#member order does not match _order_c               @   s    e Zd ZdZdZdZdZdZdS )z4TestOrder.test_enum_has_extra_members.<locals>.Colorzred green bluer   r   r   r\   N)r   r   r   r  r   r   r   purpler   r   r   r   r     s
   r   )r  r   r   )r<   r   r   r   r   test_enum_has_extra_members  s    z%TestOrder.test_enum_has_extra_membersc          	   C   s,   |  td G dd dt}W d Q R X d S )Nz#member order does not match _order_c               @   s$   e Zd ZdZdZdZdZdZeZdS )zATestOrder.test_enum_has_extra_members_with_aliases.<locals>.Colorzred green bluer   r   r   r\   N)	r   r   r   r  r   r   r   r  r  r   r   r   r   r     s   r   )r  r   r   )r<   r   r   r   r   (test_enum_has_extra_members_with_aliases  s    z2TestOrder.test_enum_has_extra_members_with_aliasesN)
r   r   r   r  r  r  r  r  r  r  r   r   r   r   r  W  s   		r  c               @   s   e Zd ZG dd deZG dd deZG dd deZdd Zd	d
 Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zejd1d2 Zd3S )4TestFlagc               @   s   e Zd Zd\ZZZdS )zTestFlag.Perm)r\   r   r   N)r   r   r   RWXr   r   r   r   Perm  s   r  c               @   s$   e Zd ZdZdZdZdZeeB ZdS )zTestFlag.Colorr   r   r   r\   N)r   r   r   BLACKr  r  r  PURPLEr   r   r   r   r     s
   r   c               @   s    e Zd ZdZdZdZdZdZdS )zTestFlag.Openr   r   r   r   i   N)r   r   r   ROWORWACCEr   r   r   r   Open  s
   r&  c             C   s  | j }| t|jd | t|jd | t|jd | t|j|jB d | t|j|jB |jB d | t|dd | t|j d | t|j d	 | t|j d | t|j|jB  d | t|j|jB |jB  d | t|d
d | j}| t|jd | t|jd | t|j	d | t|j|j
B d | t|j|j
B d | t|j d | t|j d | t|j	 d | t|j|j
B  d | t|j|j
B  d d S )NzPerm.RzPerm.WzPerm.XzPerm.R|Wz
Perm.R|W|Xr   zPerm.0zPerm.W|XzPerm.R|XzOpen.ROzOpen.WOzOpen.ACzOpen.CEz
Open.CE|WOzOpen.CE|AC|RW|WOz
Open.CE|RWzOpen.RW)r  rx   rs   r  r  r  r&  r!  r"  r$  r%  )r<   r  r&  r   r   r   test_str  s0     zTestFlag.test_strc             C   s  | j }| t|jd | t|jd | t|jd | t|j|jB d | t|j|jB |jB d | t|dd | t|j d | t|j d	 | t|j d | t|j|jB  d | t|j|jB |jB  d | t|d
d | j}| t|jd | t|jd | t|j	d | t|j|j
B d | t|j|j
B d | t|j d | t|j d | t|j	 d | t|j|j
B  d | t|j|j
B  d d S )Nz<Perm.R: 4>z<Perm.W: 2>z<Perm.X: 1>z<Perm.R|W: 6>z<Perm.R|W|X: 7>r   z<Perm.0: 0>z<Perm.W|X: 3>z<Perm.R|X: 5>r'  z<Open.RO: 0>z<Open.WO: 1>z<Open.AC: 3>z<Open.CE: 524288>z<Open.CE|WO: 524289>z<Open.CE|AC|RW|WO: 524291>z<Open.CE|RW: 524290>z<Open.RW: 2>)r  rx   r   r  r  r  r&  r!  r"  r$  r%  )r<   r  r&  r   r   r   	test_repr  s0     zTestFlag.test_reprc             C   s   | j }xd|D ]\}xV|D ]N}| ||B ||j|jB  | ||B j|j|jB  | t||B | qW qW x|D ]}| ||B | qrW | j}| |j|jB |j d S )N)r  rx   r}   r   r   r&  r!  r%  )r<   r  r   jr&  r   r   r   test_or  s    


zTestFlag.test_orc       
      C   s   | j }|j|jB }|j|jB }|j|jB }|j|jB |jB }t||||||dg }xH|D ]@}x:|D ]2}| ||@ j|j|j@  | t||@ | qfW q\W x<|D ]4}| ||@ | | ||@ | | ||@ | qW | j	}	| |	j
|	j@ |	j
 d S )Nr   )r  r  r  r  r   rx   r}   r   r   r&  r!  r%  )
r<   r  r#  RXWXRWXvaluesr   r*  r&  r   r   r   test_and  s     


zTestFlag.test_andc             C   s   | j }xH|D ]@}x:|D ]2}| ||A j|j|jA  | t||A | qW qW x4|D ],}| ||dA | | |d|A | qVW | j}| |j|jA |j | |j|jA |j d S )Nr   )r  rx   r}   r   r   r&  r!  r%  )r<   r  r   r*  r&  r   r   r   test_xor  s    


zTestFlag.test_xorc       	      C   s   | j }|j|jB }|j|jB }|j|jB }|j|jB |jB }t||||||dg }x.|D ]&}| t| | | |  | q\W x|D ]}| |  | qW | j}| |j	|j	 @ |j
 | |j	|jB |j	 @ |j d S )Nr   )r  r  r  r  r   r   r   rx   r&  r"  r!  r%  )	r<   r  r#  r,  r-  r.  r/  r   r&  r   r   r   test_invert
  s    

zTestFlag.test_invertc             C   sL   | j }x|D ]}| | qW | j}x"|D ]}| t|jt| q*W d S )N)r  r;   r&  rx   r   r}   )r<   r  fr&  r   r   r   r     s    

zTestFlag.test_boolc             C   s   t dd}t|}| t|t| | t|d| | ||j|j|jg xrtd D ]b\}}d|> }||}| |j	| | t
|j	t | |j| | || | t
|| q^W d S )Nr  zR W Xr   r   )r   r   rx   r   r  r  r  r   r   r}   r   r   r|   r   r   )r<   r  r   r   nr   r   r   r   r    test_programatic_function_string"  s    
z)TestFlag.test_programatic_function_stringc             C   s   t dddd}t|}| t|t| | t|d| | ||j|j|jg xrtd D ]b\}}d|> }||}| |j	| | t
|j	t | |j| | || | t
|| qbW d S )Nr  zR W Xr   )r5  r   )r   r   rx   r   r  r  r  r   r   r}   r   r   r|   r   r   )r<   r  r   r   r4  r   r   r   r   r   +test_programatic_function_string_with_start1  s    z4TestFlag.test_programatic_function_string_with_startc             C   s   t ddddg}t|}| t|t| | t|d| | ||j|j|jg xrtd D ]b\}}d|> }||}| |j	| | t
|j	t | |j| | || | t
|| qdW d S )Nr  r  r  r  r   zR W Xr   )r   r   rx   r   r  r  r  r   r   r}   r   r   r|   r   r   )r<   r  r   r   r4  r   r   r   r   r   %test_programatic_function_string_list@  s    z.TestFlag.test_programatic_function_string_listc             C   s   t dd}t|}| t|t| | t|d| | ||j|j|jg xztd D ]j\}}dd| d > }||}| |j	| | t
|j	t | |j| | || | t
|| q^W d S )Nr  ))r  r   )r  r   )r  r  r   zR W Xr   r   )r   r   rx   r   r  r  r  r   r   r}   r   r   r|   r   r   )r<   r  r   r   r4  r   r   r   r   r   "test_programatic_function_iterableO  s    
z+TestFlag.test_programatic_function_iterablec             C   s   t dtd}t|}| t|t| | t|d| | ||j|j|jg xztd	 D ]j\}}dd| d > }||}| |j
| | t|j
t | |j| | || | t|| qbW d S )Nr  ))r  r   )r  r   )r  r  r   zR W Xr   r   )r   r   r   rx   r   r  r  r  r   r   r}   r   r   r|   r   r   )r<   r  r   r   r4  r   r   r   r   r   #test_programatic_function_from_dict^  s    z,TestFlag.test_programatic_function_from_dictc             C   s2   t ttrtt| jtjtjB  t| jt d S )N)r  r   r  r/   r   r   r   )r<   r   r   r   test_picklem  s    
zTestFlag.test_picklec          	   C   s   | j }| j}| |j|k | |j|k | t | d|k W d Q R X | t | d|k W d Q R X | t | d|k W d Q R X | t | d|k W d Q R X d S )Nr  r!  r   )r&  r   r7   r  r!  r   r   )r<   r&  r   r   r   r   r   s  s    zTestFlag.test_containsc       	      C   s   | j }|\}}}||B }||B }||B }||B |B }| ||k | ||k | ||k | ||k | ||k | ||k | ||k | ||k | ||k | ||k | ||k | ||k d S )N)r  r;   r7   )	r<   r  r  r  r  r#  r,  r-  r.  r   r   r   r     s$    
zTestFlag.test_member_containsc             C   s`   G dd dt }| t||j|j|jg | |jjd | |jjd | |jjd d S )Nc               @   s   e Zd Ze Ze Ze ZdS )z(TestFlag.test_auto_number.<locals>.ColorN)r   r   r   r	   r   r   r   r   r   r   r   r     s   r   r   r   r\   )r   rx   r   r   r   r   r}   )r<   r   r   r   r   r    s
    zTestFlag.test_auto_numberc          	   C   s,   |  td G dd dt}W d Q R X d S )Nz Invalid Flag value: .not an int.c               @   s   e Zd ZdZe ZdS )z0TestFlag.test_auto_number_garbage.<locals>.Colorz
not an intN)r   r   r   r   r	   r   r   r   r   r   r     s   r   )r  r   r   )r<   r   r   r   r   test_auto_number_garbage  s    z!TestFlag.test_auto_number_garbagec             C   st   G dd dt }| td|d | td|d | td|d | td|d | td|d | td|d d S )	Nc               @   s   e Zd ZdZdZdZdS )z0TestFlag.test_cascading_failure.<locals>.Bizarrer   r\   r   N)r   r   r   r   dr3  r   r   r   r   Bizarre  s   r=  z5 is not a valid Bizarrere   z2 is not a valid Bizarrer   z1 is not a valid Bizarrer   )r   r  r   )r<   r=  r   r   r   test_cascading_failure  s    zTestFlag.test_cascading_failurec             C   s0   G dd dt }| |j|j|jgt| d S )Nc               @   s"   e Zd Ze  ZZe Ze ZdS )z+TestFlag.test_duplicate_auto.<locals>.DupesN)r   r   r   r	   r  r  r  r  r   r   r   r   r    s   
r  )r   rx   r  r  r  r   )r<   r  r   r   r   r    s    zTestFlag.test_duplicate_autoc             C   s(   G dd dt }| t|dd d S )Nc               @   s   e Zd ZdZdZdZdS )z&TestFlag.test_bizarre.<locals>.Bizarrer   r\   r   N)r   r   r   r   r   r<  r   r   r   r   r=    s   r=  r   z<Bizarre.d|c|b: 7>)r   rx   r   )r<   r=  r   r   r   test_bizarre  s    zTestFlag.test_bizarrec             C   sP  G dd d}G dd d}G dd d|t }| |jjd | |jjd | |jjd	 | |jjd
 | t|jd G dd d||t }| |jjd | |jjd | |jjd	 | |jjd
 | t|jd G dd d||t }| |jjd | |jjd | |jjd	 | |jjd
 | t|jd d S )Nc               @   s   e Zd Zedd ZdS )z.TestFlag.test_multiple_mixin.<locals>.AllMixinc             S   s@   t | }d }|r6|d }x|dd  D ]}||O }q&W || _|S )Nr   r   )r   ALL)r   members	all_valuer   r   r   r   r@    s    z2TestFlag.test_multiple_mixin.<locals>.AllMixin.ALLN)r   r   r   rR   r@  r   r   r   r   AllMixin  s   rC  c               @   s   e Zd Zdd ZdS )z.TestFlag.test_multiple_mixin.<locals>.StrMixinc             S   s
   | j  S )N)r  r  )r<   r   r   r   r    s    z6TestFlag.test_multiple_mixin.<locals>.StrMixin.__str__N)r   r   r   r  r   r   r   r   r    s   r  c               @   s   e Zd Ze Ze Ze ZdS )z+TestFlag.test_multiple_mixin.<locals>.ColorN)r   r   r   r	   r  r  r  r   r   r   r   r     s   r   r   r   r\   r   z
Color.BLUEc               @   s   e Zd Ze Ze Ze ZdS )z+TestFlag.test_multiple_mixin.<locals>.ColorN)r   r   r   r	   r  r  r  r   r   r   r   r     s   r   c               @   s   e Zd Ze Ze Ze ZdS )z+TestFlag.test_multiple_mixin.<locals>.ColorN)r   r   r   r	   r  r  r  r   r   r   r   r     s   )r   rx   r  r}   r  r  r@  rs   )r<   rC  r  r   r   r   r   r    s(    zTestFlag.test_multiple_mixinc          	      sx   G dd dt  t d fddfddtdD }t| W d Q R X | d	 | d
td d S )Nc               @   sL   e Zd Ze Ze Ze Ze Ze Ze Z	e Z
e Zdd Zdd ZdS )z0TestFlag.test_unique_composite.<locals>.TestFlagc             S   s   | |kS )Nr   )r<   r  r   r   r   r)    s    z7TestFlag.test_unique_composite.<locals>.TestFlag.__eq__c             S   s
   t | jS )N)hashr   )r<   r   r   r   __hash__  s    z9TestFlag.test_unique_composite.<locals>.TestFlag.__hash__N)r   r   r   r	   r   r   rL  fourfivesixseveneightr)  rE  r   r   r   r   r    s   r  Fc                 sB   y$xt dD ]}  |  qW W n tk
r<   dY nX d S )N   T)r+   addr  )r   )r  failedseenr   r   
cycle_enum  s
    z2TestFlag.test_unique_composite.<locals>.cycle_enumc                s   g | ]}t j d qS ))r.   )	threadingThread)r   rH   )rO  r   r   r   	  s   z2TestFlag.test_unique_composite.<locals>.<listcomp>r   z;at least one thread failed while creating composite membersrK  z"too many composite members created)r   ry   r+   r   start_threadsr7   rx   r   )r<   threadsr   )r  rO  rM  rN  r   test_unique_composite  s    

zTestFlag.test_unique_compositeN)r   r   r   r   r  r   r&  r(  r)  r+  r0  r1  r2  r   r5  r6  r7  r8  r9  r:  r   r   r  r;  r>  r  r?  r  r   reap_threadsrT  r   r   r   r   r    s2   +r  c               @   s   e Zd ZG dd deZG dd deZG dd deZdd Zd	d
 Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zejd+d, Zd-S ).TestIntFlagc               @   s   e Zd ZdZdZdZdS )zTestIntFlag.Permr   r   r\   N)r   r   r   r  r  r  r   r   r   r   r  	  s   r  c               @   s$   e Zd ZdZdZdZdZeeB ZdS )zTestIntFlag.Colorr   r   r   r\   N)r   r   r   r  r  r  r  r   r   r   r   r   r   	  s
   r   c               @   s    e Zd ZdZdZdZdZdZdS )zTestIntFlag.Openr   r   r   r   i   N)r   r   r   r!  r"  r#  r$  r%  r   r   r   r   r&  "	  s
   r&  c             C   s   | j }| j}x*|D ]"}| t|| | ||j qW | t|j|jB | | |j|jB d x*|D ]"}| t|| | ||j qjW | t|j|j	B | | |j|j	B d d S )Nr   )
r  r&  r;   r  rx   r}   r  r  r"  r#  )r<   r  r&  r3  r   r   r   	test_type)	  s    

zTestIntFlag.test_typec             C   sn  | j }| t|jd | t|jd | t|jd | t|j|jB d | t|j|jB |jB d | t|jdB d | t|dd	 | t|dd
 | t|j d | t|j d | t|j d | t|j|jB  d | t|j|jB |jB  d | t|jdB  d | t|dd | t|dd | j}| t|jd | t|jd | t|j	d | t|j|j
B d | t|j|j
B d | t|dd | t|j d | t|j d | t|j	 d | t|j|j
B  d | t|j|j
B  d | t|dd d S )NzPerm.RzPerm.WzPerm.XzPerm.R|Wz
Perm.R|W|Xr   zPerm.8|Rr   zPerm.0zPerm.8zPerm.W|XzPerm.R|XzPerm.-8r'  izOpen.ROzOpen.WOzOpen.ACzOpen.CEz
Open.CE|WOr\   zOpen.4zOpen.CE|AC|RW|WOz
Open.CE|RWzOpen.AC|RW|WOzOpen.RW)r  rx   rs   r  r  r  r&  r!  r"  r$  r%  )r<   r  r&  r   r   r   r(  8	  s<     zTestIntFlag.test_strc             C   sn  | j }| t|jd | t|jd | t|jd | t|j|jB d | t|j|jB |jB d | t|jdB d | t|dd	 | t|dd
 | t|j d | t|j d | t|j d | t|j|jB  d | t|j|jB |jB  d | t|jdB  d | t|dd | t|dd | j}| t|jd | t|jd | t|j	d | t|j|j
B d | t|j|j
B d | t|dd | t|j d | t|j d | t|j	 d | t|j|j
B  d | t|j|j
B  d  | t|d!d" d S )#Nz<Perm.R: 4>z<Perm.W: 2>z<Perm.X: 1>z<Perm.R|W: 6>z<Perm.R|W|X: 7>r   z<Perm.8|R: 12>r   z<Perm.0: 0>z<Perm.8: 8>z<Perm.W|X: -5>z<Perm.R|X: -3>z<Perm.R|W: -2>z<Perm.X: -7>z<Perm.-8: -8>z<Perm.W|X: -13>r'  z<Perm.R|W|X: -1>iz<Perm.R|W|X: -9>z<Open.RO: 0>z<Open.WO: 1>z<Open.AC: 3>z<Open.CE: 524288>z<Open.CE|WO: 524289>r\   z<Open.4: 4>z<Open.CE|AC|RW|WO: -1>z<Open.CE|RW: -2>z<Open.CE: -4>z<Open.AC|RW|WO: -524289>z<Open.RW: -524290>rX  z<Open.CE|AC|RW|WO: -5>)r  rx   r   r  r  r  r&  r!  r"  r$  r%  )r<   r  r&  r   r   r   r)  Y	  s<     zTestIntFlag.test_reprc             C   s^  | j }x|D ]}xR|D ]J}| ||B |j|jB  | ||B j|j|jB  | t||B | qW xtdD ]}| ||B |j|B  | ||B j|j|B  | t||B | | ||B ||jB  | ||B j||jB  | t||B | qnW qW x>|D ]6}| ||B | | |dB | | d|B | qW | j}| |j|jB |j d S )Nr   r   )	r  rx   r}   r   r   r+   r&  r!  r%  )r<   r  r   r*  r&  r   r   r   r+  z	  s&    


zTestIntFlag.test_orc       
   	   C   s  | j }|j|jB }|j|jB }|j|jB }|j|jB |jB }t||||||dg }x|D ]}xp|D ]h}| ||@ |j|j@ d||f  | ||@ j|j|j@ d||f  | t||@ |d||f  qjW xt	dD ]}| ||@ |j|@  | ||@ j|j|@  | t||@ | | ||@ ||j@  | ||@ j||j@  | t||@ | qW q^W x>|D ]6}| ||@ | | |d@ | | d|@ | qvW | j
}	| |	j|	j@ |	j d S )Nr   zi is %r, j is %rr   r   )r  r  r  r  r   rx   r}   r   r   r+   r&  r!  r%  )
r<   r  r#  r,  r-  r.  r/  r   r*  r&  r   r   r   r0  	  s0    
"$"
zTestIntFlag.test_andc             C   sd  | j }x|D ]}xR|D ]J}| ||A |j|jA  | ||A j|j|jA  | t||A | qW xtdD ]}| ||A |j|A  | ||A j|j|A  | t||A | | ||A ||jA  | ||A j||jA  | t||A | qnW qW x.|D ]&}| |dA | | d|A | qW | j}| |j|jA |j | |j|jA |j d S )Nr   r   )	r  rx   r}   r   r   r+   r&  r!  r%  )r<   r  r   r*  r&  r   r   r   r1  	  s&    


zTestIntFlag.test_xorc       	      C   s
  | j }|j|jB }|j|jB }|j|jB }|j|jB |jB }t||||||dg }xT|D ]L}| | |j  | | j|j  | t| | | |  | q\W x|D ]}| |  | qW | j	}| |j
|j
 @ |j | |j
|jB |j
 @ |j d S )Nr   )r  r  r  r  r   rx   r}   r   r   r&  r"  r!  r%  )	r<   r  r#  r,  r-  r.  r/  r   r&  r   r   r   r2  	  s     

zTestIntFlag.test_invertc             C   s   t dd}t|}| t|t| | t|d| | ||j|j|jg x~td D ]n\}}d|> }||}| |j	| | t
|j	t | || | |j| | || | t
|| q^W d S )Nr  zR W Xr   r   )r   r   rx   r   r  r  r  r   r   r}   r   r   r|   r   r   )r<   r  r   r   r4  r   r   r   r   r   r5  	  s    
z,TestIntFlag.test_programatic_function_stringc             C   s   t dddd}t|}| t|t| | t|d| | ||j|j|jg x~td D ]n\}}d|> }||}| |j	| | t
|j	t | || | |j| | || | t
|| qbW d S )Nr  zR W Xr   )r5  r   )r   r   rx   r   r  r  r  r   r   r}   r   r   r|   r   r   )r<   r  r   r   r4  r   r   r   r   r   r6  	  s    z7TestIntFlag.test_programatic_function_string_with_startc             C   s   t ddddg}t|}| t|t| | t|d| | ||j|j|jg x~td D ]n\}}d|> }||}| |j	| | t
|j	t | || | |j| | || | t
|| qdW d S )Nr  r  r  r  r   zR W Xr   )r   r   rx   r   r  r  r  r   r   r}   r   r   r|   r   r   )r<   r  r   r   r4  r   r   r   r   r   r7  	  s    z1TestIntFlag.test_programatic_function_string_listc             C   s   t dd}t|}| t|t| | t|d| | ||j|j|jg xtd D ]v\}}dd| d > }||}| |j	| | t
|j	t | || | |j| | || | t
|| q^W d S )Nr  ))r  r   )r  r   )r  r  r   zR W Xr   r   )r   r   rx   r   r  r  r  r   r   r}   r   r   r|   r   r   )r<   r  r   r   r4  r   r   r   r   r   r8   
  s    
z.TestIntFlag.test_programatic_function_iterablec             C   s   t dtd}t|}| t|t| | t|d| | ||j|j|jg xtd	 D ]v\}}dd| d > }||}| |j
| | t|j
t | || | |j| | || | t|| qbW d S )Nr  ))r  r   )r  r   )r  r  r   zR W Xr   r   )r   r   r   rx   r   r  r  r  r   r   r}   r   r   r|   r   r   )r<   r  r   r   r4  r   r   r   r   r   r9  
  s    z/TestIntFlag.test_programatic_function_from_dictc             C   sx   t dg }t|}| t|t| | t|d| t dg }t|}| t|t| | t|d| d S )Nr  r   Thing)r8   r   r   rx   r   r   )r<   r  r   rY  r   r   r   )test_programatic_function_from_empty_list!
  s    z5TestIntFlag.test_programatic_function_from_empty_listc             C   sp   t dd}t|}| t|t| | t|d| t dd}| t|t| | t|d| d S )Nr  r   r   rY  )r8   r   r   rx   r   r   )r<   r  r   rY  r   r   r   *test_programatic_function_from_empty_tuple,
  s    z6TestIntFlag.test_programatic_function_from_empty_tuplec          	   C   s   | j }| j}| |j|k | |j|k | |j|k | |j|k | t | d|k W d Q R X | t | d|k W d Q R X | t | d|k W d Q R X | t | d|k W d Q R X d S )Nr  r#  r   )r   r&  r;   r  r#  r7   r   r   )r<   r   r&  r   r   r   r   5
  s    zTestIntFlag.test_containsc       	   	   C   s  | j }|\}}}||B }||B }||B }||B |B }| ||k | ||k | ||k | ||k | ||k | ||k | ||k | ||k | ||k | ||k | ||k | ||k | t | d|k W d Q R X d S )NZswallow)r  r;   r7   r   r   )	r<   r  r  r  r  r#  r,  r-  r.  r   r   r   r   E
  s(    
z TestIntFlag.test_member_containsc             C   sL   | j }x|D ]}| | qW | j}x"|D ]}| t|jt| q*W d S )N)r  r;   r&  rx   r   r}   )r<   r  r3  r&  r   r   r   r   [
  s    

zTestIntFlag.test_boolc             C   sP  G dd d}G dd d}G dd d|t }| |jjd | |jjd | |jjd	 | |jjd
 | t|jd G dd d||t }| |jjd | |jjd | |jjd	 | |jjd
 | t|jd G dd d||t }| |jjd | |jjd | |jjd	 | |jjd
 | t|jd d S )Nc               @   s   e Zd Zedd ZdS )z1TestIntFlag.test_multiple_mixin.<locals>.AllMixinc             S   s@   t | }d }|r6|d }x|dd  D ]}||O }q&W || _|S )Nr   r   )r   r@  )r   rA  rB  r   r   r   r   r@  e
  s    z5TestIntFlag.test_multiple_mixin.<locals>.AllMixin.ALLN)r   r   r   rR   r@  r   r   r   r   rC  d
  s   rC  c               @   s   e Zd Zdd ZdS )z1TestIntFlag.test_multiple_mixin.<locals>.StrMixinc             S   s
   | j  S )N)r  r  )r<   r   r   r   r  p
  s    z9TestIntFlag.test_multiple_mixin.<locals>.StrMixin.__str__N)r   r   r   r  r   r   r   r   r  o
  s   r  c               @   s   e Zd Ze Ze Ze ZdS )z.TestIntFlag.test_multiple_mixin.<locals>.ColorN)r   r   r   r	   r  r  r  r   r   r   r   r   r
  s   r   r   r   r\   r   z
Color.BLUEc               @   s   e Zd Ze Ze Ze ZdS )z.TestIntFlag.test_multiple_mixin.<locals>.ColorN)r   r   r   r	   r  r  r  r   r   r   r   r   {
  s   r   c               @   s   e Zd Ze Ze Ze ZdS )z.TestIntFlag.test_multiple_mixin.<locals>.ColorN)r   r   r   r	   r  r  r  r   r   r   r   r   
  s   )r   rx   r  r}   r  r  r@  rs   )r<   rC  r  r   r   r   r   r  c
  s(    zTestIntFlag.test_multiple_mixinc          	      sx   G dd dt  t d fddfddtdD }t| W d Q R X | d	 | d
td d S )Nc               @   sL   e Zd Ze Ze Ze Ze Ze Ze Z	e Z
e Zdd Zdd ZdS )z3TestIntFlag.test_unique_composite.<locals>.TestFlagc             S   s   | |kS )Nr   )r<   r  r   r   r   r)  
  s    z:TestIntFlag.test_unique_composite.<locals>.TestFlag.__eq__c             S   s
   t | jS )N)rD  r   )r<   r   r   r   rE  
  s    z<TestIntFlag.test_unique_composite.<locals>.TestFlag.__hash__N)r   r   r   r	   r   r   rL  rF  rG  rH  rI  rJ  r)  rE  r   r   r   r   r  
  s   r  Fc                 sB   y$xt dD ]}  |  qW W n tk
r<   dY nX d S )NrK  T)r+   rL  r  )r   )r  rM  rN  r   r   rO  
  s
    z5TestIntFlag.test_unique_composite.<locals>.cycle_enumc                s   g | ]}t j d qS ))r.   )rP  rQ  )r   rH   )rO  r   r   r   
  s   z5TestIntFlag.test_unique_composite.<locals>.<listcomp>r   z;at least one thread failed while creating composite membersrK  z"too many composite members created)r   ry   r+   r   rR  r7   rx   r   )r<   rS  r   )r  rO  rM  rN  r   rT  
  s    

z!TestIntFlag.test_unique_compositeN)r   r   r   r   r  r   r&  rW  r(  r)  r+  r0  r1  r2  r5  r6  r7  r8  r9  rZ  r[  r   r   r   r  r   rU  rT  r   r   r   r   rV  	  s,   !!	+rV  c               @   s$   e Zd Zdd Zdd Zdd ZdS )TestEmptyAndNonLatinStringsc          	   C   s$   |  t tdd}W d Q R X d S )N	empty_abc) rg   rh   )r   r   r   )r<   r]  r   r   r   test_empty_string
  s    z-TestEmptyAndNonLatinStrings.test_empty_stringc             C   s&   t dd}t|d}| |jd d S )N	greek_abc)u   αrg   rh   u   αr   )r   r   rx   r}   )r<   r`  r  r   r   r   test_non_latin_character_string
  s    

z;TestEmptyAndNonLatinStrings.test_non_latin_character_stringc             C   s&   t dd}t|d}| |jd d S )N
hebrew_123)u   א23u   אr   )r   r   rx   r}   )r<   rb  r  r   r   r   test_non_latin_number_string
  s    

z8TestEmptyAndNonLatinStrings.test_non_latin_number_stringN)r   r   r   r_  ra  re  r   r   r   r   r\  
  s   r\  c               @   s$   e Zd Zdd Zdd Zdd ZdS )
TestUniquec             C   s,   t G dd dt}t G dd dt}d S )Nc               @   s   e Zd ZdZdZdZdS )z+TestUnique.test_unique_clean.<locals>.Cleanr   rO  g      @N)r   r   r   r   r   rP  r   r   r   r   Clean
  s   rg  c               @   s   e Zd ZdZdZdZdS )z-TestUnique.test_unique_clean.<locals>.Cleanerr   r   r   N)r   r   r   singledoubletripler   r   r   r   Cleaner
  s   rk  )r   r   r   )r<   rg  rk  r   r   r   test_unique_clean
  s    zTestUnique.test_unique_cleanc          	   C   s\   |  td tG dd dt}W d Q R X |  td tG dd dt}W d Q R X d S )Nz	tres.*onec               @   s   e Zd ZdZdZdZdS )z+TestUnique.test_unique_dirty.<locals>.Dirtyr   rO  N)r   r   r   r   r   rP  r   r   r   r   Dirty
  s   rm  zdouble.*single.*turkey.*triplec               @   s   e Zd ZdZdZdZdZdS )z-TestUnique.test_unique_dirty.<locals>.Dirtierr   r   N)r   r   r   rh  ri  rj  Zturkeyr   r   r   r   Dirtier
  s   rn  )r  r   r   r   r   )r<   rm  rn  r   r   r   test_unique_dirty
  s    zTestUnique.test_unique_dirtyc             C   s,   t G dd dt}t G dd dt}d S )Nc               @   s   e Zd ZdZdZdZdS )z/TestUnique.test_unique_with_name.<locals>.Sillyr   rO  r   N)r   r   r   r   r   r|   r   r   r   r   Silly
  s   rp  c               @   s   e Zd ZdZdZdZdZdS )z1TestUnique.test_unique_with_name.<locals>.Sillierr   r   r   r\   N)r   r   r   rh  r|   rj  r}   r   r   r   r   Sillier
  s   rq  )r   r   r   )r<   rp  rq  r   r   r   test_unique_with_name
  s    z TestUnique.test_unique_with_nameN)r   r   r   rl  ro  rr  r   r   r   r   rf  
  s   rf  a  Help on class Color in module %s:

class Color(enum.Enum)
 |  Color(value, names=None, *, module=None, qualname=None, type=None, start=1)
 |  
 |  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.a  Help on class Color in module %s:

class Color(enum.Enum)
 |  Color(value, names=None, *, module=None, qualname=None, type=None, start=1)
 |  
 |  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               @   s8   e Zd ZdZG dd deZdd Zdd Zdd	 ZdS )

TestStdLibNc               @   s   e Zd ZdZdZdZdS )zTestStdLib.Colorr   r   r   N)r   r   r   r   r   r   r   r   r   r   r   ?  s   r   c             C   sT   t jd krtt }ntt }t }tj|d}|| j |	 
 }| || d S )N)output)r    rV   !expected_help_output_without_docsr   expected_help_output_with_docsr
   pydocZHelperr   getvaluestriprx   )r<   Zexpected_textrt  helperresultr   r   r   
test_pydocD  s    


zTestStdLib.test_pydocc             C   s   t dtfdd| jjfdtfd| jjfd| jjfdtjd fd| jj	fd	tjd	 ff	}t t
| j}| | |  d
}xL| D ]@}|| || krt  tdd||| || df dd d}qW |r| d d S )Nrv   )rV   zAn enumeration.rw   r   r   r   r|   r   r}   Fz.
%s
     key: %s
  result: %s
expected: %s
%s
zK===========================================================================r^  )sepTz/result does not equal expected, see print above)dictr   r   rw   r   r   r   r   __dict__r   inspectZ
getmembersrx   keysr  fail)r<   r/  r{  rM  r   r   r   r   test_inspect_getmembersP  s*    



z"TestStdLib.test_inspect_getmembersc             C   s6  ddl m} |ddttd|dd| jdd|dd	ttjd|d
d| jtd|dd| j| jjd|dd| j| jjd|dd| j| jj	d|ddt
t
jd d|ddt
t
jd dg	}|jdd d tt | j}|jdd d d}x:t||D ],\}}||krtdd||df dd d}qW |r2| d d S )Nr   )	Attributerv   data)r|   kindZdefining_classrj  rV   zAn enumeration.rw   r   r   r   r   r   r|   r}   c             S   s   | j S )N)r|   )r  r   r   r   r     r   z>TestStdLib.test_inspect_classify_class_attrs.<locals>.<lambda>)keyc             S   s   | j S )N)r|   )r  r   r   r   r     r   Fz
%s
%s
%s
%s
zK===========================================================================r^  )r}  Tz/result does not equal expected, see print above)r  r  rj  r   r   rw   r   r   r   r   r   r  sortr   Zclassify_class_attrsr  r  r  )r<   r  r/  r{  rM  r   rr   r   r   !test_inspect_classify_class_attrsh  s:    


z,TestStdLib.test_inspect_classify_class_attrs)	r   r   r   ZmaxDiffr   r   r|  r  r  r   r   r   r   rs  ;  s
   rs  c               @   s   e Zd Zdd ZdS )MiscTestCasec             C   s   t | t d S )N)r   Zcheck__all__r8   )r<   r   r   r   test__all__  s    zMiscTestCase.test__all__N)r   r   r   r  r   r   r   r   r    s   r  re   c               @   s   e Zd Zdd Zdd ZdS )TestIntEnumConvertc             C   s4   t jjddtdk dd d}| |djd d S )	NUnittestConvert)ztest.test_enum__main__r  c             S   s
   |  dS )NCONVERT_TEST_)
startswith)r  r   r   r   r     r   zGTestIntEnumConvert.test_convert_value_lookup_priority.<locals>.<lambda>)filterre   CONVERT_TEST_NAME_A)r8   r   _convertr   rx   r|   )r<   rW  r   r   r   "test_convert_value_lookup_priority  s
    
z5TestIntEnumConvert.test_convert_value_lookup_priorityc             C   s   t jjddtdk dd d}| |j|j | |jd | |jd | |j	d | |j
d | jdd	 t|D g d
d d S )Nr  )ztest.test_enumr  r  c             S   s
   |  dS )Nr  )r  )r  r   r   r   r     r   z1TestIntEnumConvert.test_convert.<locals>.<lambda>)r  re   c             S   s    g | ]}|d d dkr|qS )r   r   )ZCOrI   r   )r   r|   r   r   r   r     s    z3TestIntEnumConvert.test_convert.<locals>.<listcomp>z&Names other than CONVERT_TEST_* found.)msg)r8   r   r  r   rx   CONVERT_TEST_NAME_Fr  CONVERT_TEST_NAME_BCONVERT_TEST_NAME_CCONVERT_TEST_NAME_DCONVERT_TEST_NAME_Erz   )r<   rW  r   r   r   test_convert  s    
zTestIntEnumConvert.test_convertN)r   r   r   r  r  r   r   r   r   r    s   
r  r  )N)Ar8   r  rw  ZunittestrP  collectionsr   r   r   r   r   r   r   r	   ior
   pickler   r   r   r   r   r   rt   r   ImportErrorr   r  r  r   r   rr   r   r   rs   r    r!   r   r#   r%   r&   r)   r/   r1   ZTestCaser2   rR   r[   r  r  rV  r\  rf  rv  ru  rs  r  r  r  r  r  r  r  r  mainr   r   r   r   <module>   s   $

             W>      %TP
