a
    dO7                 	   @   s  d dl mZmZmZmZmZmZmZmZm	Z	 d dl m
Z
mZmZmZmZmZmZ d dl mZmZmZmZmZmZmZ d dlmZmZmZmZmZmZ d dl mZm Z m!Z!m"Z"m#Z#m$Z$m%Z% d dl m&Z&m'Z' ddl(m)Z) dd	l*m+Z+ dd
l,m-Z-m.Z.m/Z/m0Z0 ddl1m2Z2m3Z3 ddl4Z4ddl5Z5ddl6Z6ddl7Z7ddl1Z1zddl8Z8W n e9e:fyX   dZ8Y n0 ze; W n e<yz   e=Z;Y n0 G dd de2Z>G dd de2Z?G dd de2Z@G dd de2ZAG dd de2ZBG dd de2ZCeDdkre=ddS )   )	EnumMetaEnumIntEnumFlagIntFlagStrEnum
UniqueEnumAutoEnumAddValueEnum)
NamedTuple	TupleSize
MagicValueAddValueNoAliasUnique
MultiValue)AutoNumberEnumMultiValueEnumOrderedEnumuniqueskipextend_enumauto)StdlibEnumMeta
StdlibEnumStdlibIntEnum
StdlibFlagStdlibIntFlagStdlibStrEnum)pyverPY3_3PY3_4PY3_5PY3_6PY3_7PY3_11)add_stdlib_integrationremove_stdlib_integration    )OrderedDict)	timedelta)dumpsloadsPicklingErrorHIGHEST_PROTOCOL)TestCasemainNc                   @   sF  e Zd Zdd Zeeddd Zeeddd Zee	e
kd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 Z0dUdV Z1dWdX Z2dYdZ Z3d[d\ Z4d]d^ Z5d_d` Z6dadb Z7dcdd Z8dedf Z9dgdh Z:didj Z;dkdl Z<e	e=krdmdn Z>dodp Z?dqdr Z@e	eAkrdsdt ZBne	e
kr dudt ZBe	eAkr:dvdw ZCdxdy ZDdzd{ ZEd|S )}
TestEnumV3c                 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 TestEnumV3.setUp.<locals>.Seasonr            N)__name__
__module____qualname__SPRINGSUMMERAUTUMNWINTER r<   r<   V/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/aenum/test_v3.pySeason!   s   r>   c                   @   s   e Zd ZdZdZde ZdS )z#TestEnumV3.setUp.<locals>.KonstantsgB
@gJM!	@r2   N)r5   r6   r7   EPIZTAUr<   r<   r<   r=   	Konstants(   s   rA   c                   @   s    e Zd ZdZdZdZdZdZdS )z TestEnumV3.setUp.<locals>.Grades   r4   r3   r2   r(   N)r5   r6   r7   ABCDFr<   r<   r<   r=   Grades.   s
   rH   c                   @   s   e Zd ZdZdZdZdZdS )z%TestEnumV3.setUp.<locals>.DirectionalZeastZwestZnorthZsouthN)r5   r6   r7   EASTWESTNORTHSOUTHr<   r<   r<   r=   Directional6   s   rM   r(   )datec                   @   s   e Zd ZdZdZdS )z!TestEnumV3.setUp.<locals>.Holiday)  r   r   )rO   r3      N)r5   r6   r7   ZNEW_YEARZIDES_OF_MARCHr<   r<   r<   r=   Holiday>   s   rQ   )r   r>   floatrA   r   rH   strrM   datetimerN   rQ   )selfr>   rA   rH   rM   rN   rQ   r<   r<   r=   setUp    s    zTestEnumV3.setUpzStdlib enum not availablec                 C   s  |  t| jt |  t| jjt |  t| jt | t| jt |  t| jj	t | t| jj	t t
tkrFG dd dt}|  t|t |  t|jt |  t|t |  t|jt G dd dt}|  t|t |  t|jt |  t|t |  t|jt | t|t | t|jt t
tkrG dd dt}|  t|t |  t|jt | t|t | t|jt d S )Nc                   @   s   e Zd ZdZdS )z1TestEnumV3.test_stdlib_inheritence.<locals>.AFlagr   Nr5   r6   r7   oner<   r<   r<   r=   AFlagN   s   rY   c                   @   s   e Zd ZdZdS )z5TestEnumV3.test_stdlib_inheritence.<locals>.AnIntFlagr   NrW   r<   r<   r<   r=   	AnIntFlagU   s   rZ   c                   @   s   e Zd ZdZdS )z4TestEnumV3.test_stdlib_inheritence.<locals>.AStrEnum1NrW   r<   r<   r<   r=   AStrEnum_   s   r\   )
assertTrue
issubclassr>   r   
isinstancer8   rH   assertFalser   rC   r   r#   r   rX   r   r   r   r%   r   r   )rU   rY   rZ   r\   r<   r<   r=   test_stdlib_inheritenceC   s2    

z"TestEnumV3.test_stdlib_inheritencec                 C   s   zpt   G dd dt}| td4 G dd dt}G dd d||d}W d    n1 s^0    Y  W t  nt  0 G d	d
 d
t|d}d S )Nc                       s   e Zd Z fddZ  ZS )z<TestEnumV3.test_stdlib_bad_getattribute.<locals>.BadEnumTypec                    s"   t  |}t|| r|  |S N)super__getattribute__r_   Z	deprecate)clsnameobj	__class__r<   r=   rd   k   s    
zMTestEnumV3.test_stdlib_bad_getattribute.<locals>.BadEnumType.__getattribute__)r5   r6   r7   rd   __classcell__r<   r<   rh   r=   BadEnumTypej   s   rk   zendless recursionc                   @   s   e Zd ZdS )z9TestEnumV3.test_stdlib_bad_getattribute.<locals>.BaseEnumNr5   r6   r7   r<   r<   r<   r=   BaseEnumq   s   rm   c                   @   s   e Zd ZdZdS )z8TestEnumV3.test_stdlib_bad_getattribute.<locals>.BadEnumbarNr5   r6   r7   ZFOOr<   r<   r<   r=   BadEnums   s   rp   	metaclassc                   @   s   e Zd ZdZdS )z9TestEnumV3.test_stdlib_bad_getattribute.<locals>.OkayEnumrn   Nro   r<   r<   r<   r=   OkayEnumx   s   rs   )r&   r   assertRaisesRegexRecursionErrorr   r'   )rU   rk   rm   rp   rs   r<   r<   r=   test_stdlib_bad_getattributef   s    4z'TestEnumV3.test_stdlib_bad_getattributez+__qualname__ requires python 3.5 or greaterc                 C   s6   t dddd}|t d< t| j|j t| j| d S )NTheoryzrule law suppositionZspanish_inquisition)qualname)r   globalstest_pickle_dump_loadr]   Zrule)rU   rw   r<   r<   r=   'test_pickle_enum_function_with_qualname{   s    
z2TestEnumV3.test_pickle_enum_function_with_qualnamec                 C   s>   G dd dt dd}| t|jjdd | |jjd d S )Nc                   @   s8   e Zd ZdZdZdZdZdZdZdZ	dZ
ed	d
 ZdS )z)TestEnumV3.test_auto_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}|| j  | j| j  S )NgyдW=)ZmassZradius)rU   Gr<   r<   r=   surface_gravity   s    z9TestEnumV3.test_auto_init.<locals>.Planet.surface_gravityN)r5   r6   r7   ZMERCURYZVENUSEARTHZMARSZJUPITERZSATURNZURANUSZNEPTUNEpropertyr~   r<   r<   r<   r=   Planet   s   r   zmass radiusinitr2   g#@r|   )r   assertEqualroundr   r~   value)rU   r   r<   r<   r=   test_auto_init   s    zTestEnumV3.test_auto_initc                 C   sx   G dd dt dd}| |jjd | |jjd | |jjd | |jjd | |jjd	 | |jjd
 d S )Nc                   @   s   e Zd ZdZdZdZdS )z3TestEnumV3.test_auto_init_with_value.<locals>.Color)r   r   r(   r(   )r2   r(   r   r(   )r3   r(   r(   r   N)r5   r6   r7   REDBLUEGREENr<   r<   r<   r=   Color   s   r   z
value, rgbr   r   r2   r3   r   r   r   )r   r   r   r   r   r   ZrgbrU   r   r<   r<   r=   test_auto_init_with_value   s    z$TestEnumV3.test_auto_init_with_valuec                 C   s   |  t$ G dd dttd}W d    n1 s40    Y  |  t$ G dd dttd}W d    n1 sr0    Y  d S )Nc                   @   s$   e Zd Ze e e dd Ze dS )-TestEnumV3.test_auto_turns_off.<locals>.Colorc                 S   s   t d| j  d S )NzHello!  My serial is %s.)printr   rU   r<   r<   r=   hello   s    z3TestEnumV3.test_auto_turns_off.<locals>.Color.helloN)r5   r6   r7   redgreenbluer   roser<   r<   r<   r=   r      s
   r   settingsc                   @   s$   e Zd Ze e e dd Ze dS )r   c                 W   s   d S rb   r<   )rU   argsr<   r<   r=   __init__   s    z6TestEnumV3.test_auto_turns_off.<locals>.Color.__init__N)r5   r6   r7   r   r   r   r   r   r<   r<   r<   r=   r      s
   )assertRaises	NameErrorr   r   r   r<   r<   r=   test_auto_turns_off   s    2zTestEnumV3.test_auto_turns_offc                 C   sD   G dd dt td}| t||j|j|jg | |jjd d S )Nc                   @   s   e Zd Zeeef dS )z$TestEnumV3.test_magic.<locals>.ColorNr5   r6   r7   r   r   r   r<   r<   r<   r=   r      s   r   r   r   r   r   r   listr   r   r   r   r   r<   r<   r=   
test_magic   s    zTestEnumV3.test_magicc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )Nzobject is not callablec                   @   s    e Zd ZdZeZedd ZdS )z4TestEnumV3.test_ignore_not_overridden.<locals>.ColorZ
irreleventc                 S   s   t d| j  d S )Nz
I am light)r   rf   lowerr   r<   r<   r=   shade   s    z:TestEnumV3.test_ignore_not_overridden.<locals>.Color.shadeN)r5   r6   r7   _ignore_r   
_settings_r   r   r<   r<   r<   r=   r      s   r   rt   	TypeErrorr   r   r<   r<   r=   test_ignore_not_overridden   s    z%TestEnumV3.test_ignore_not_overriddenc                 C   sF   G dd dt tdd}| t||j|j|jg | |jjd d S )Nc                   @   s   e Zd Zeeef dS )z*TestEnumV3.test_magic_start.<locals>.ColorNr   r<   r<   r<   r=   r      s   r   r(   r   startr   r   r<   r<   r=   test_magic_start   s    zTestEnumV3.test_magic_startc                 C   s&   | j }| tt|tg d d S )N)ri   __doc____members__r6   r8   r9   r:   r;   __init_subclass__r5   __getitem____len____contains____iter__r7   )r>   r   setdirrU   r>   r<   r<   r=   test_dir_on_class   s
    

zTestEnumV3.test_dir_on_classc                 C   s(   | j }| tt|jtg d d S )N)ri   r   __eq____hash__r6   rf   r   values)r>   r   r   r   r;   r   r<   r<   r=   test_dir_on_item   s
    
zTestEnumV3.test_dir_on_itemc                 C   sN   G dd dt }| tt|tg d | tt|jtg d d S )Nc                   @   s   e Zd ZdZdZdd ZdS )z5TestEnumV3.test_dir_with_added_behavior.<locals>.TestthatZthosec                 S   s
   d| j  S )NzWowser! I'm %s!rf   r   r<   r<   r=   wowser   s    z<TestEnumV3.test_dir_with_added_behavior.<locals>.Test.wowserN)r5   r6   r7   thistheser   r<   r<   r<   r=   Test   s   r   )ri   r   r   r6   r   r   r   r5   r   r   r   r   r7   )	ri   r   r   r   r6   rf   r   r   r   )r   r   r   r   r   )rU   r   r<   r<   r=   test_dir_with_added_behavior   s    


z'TestEnumV3.test_dir_with_added_behaviorc                 C   sB   G dd dt }G dd d|}| tt|jtg d d S )Nc                   @   s   e Zd Zdd ZdS )zDTestEnumV3.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    zNTestEnumV3.test_dir_on_sub_with_behavior_on_super.<locals>.SuperEnum.invisibleN)r5   r6   r7   r   r<   r<   r<   r=   	SuperEnum   s   r   c                   @   s   e Zd ZdZdS )zBTestEnumV3.test_dir_on_sub_with_behavior_on_super.<locals>.SubEnumrB   N)r5   r6   r7   sampler<   r<   r<   r=   SubEnum   s   r   )	ri   r   r   r   r6   rf   r   r   r   )r   r   r   r   r   )rU   r   r   r<   r<   r=   &test_dir_on_sub_with_behavior_on_super   s    
z1TestEnumV3.test_dir_on_sub_with_behavior_on_superc                 C   s(   G dd dt }| t|jtu  d S )Nc                   @   s   e Zd ZdZdZdZdS )zATestEnumV3.test_members_are_always_ordered.<locals>.AlwaysOrderedr   r2   r3   N)r5   r6   r7   firstsecondthirdr<   r<   r<   r=   AlwaysOrdered   s   r   )r   r]   typer   r)   )rU   r   r<   r<   r=   test_members_are_always_ordered   s    z*TestEnumV3.test_members_are_always_orderedc                    sj   fdd}| j | jd | t| G dd dt | j j  fdd}| t| d S )Nc                      s    j dk d S )Nr4   )r8   r<   )r>   r<   r=   bad_compare   s    z0TestEnumV3.test_comparisons.<locals>.bad_comparer   c                   @   s   e Zd ZdZdZdZdS )z)TestEnumV3.test_comparisons.<locals>.Partr   r2   r3   N)r5   r6   r7   r8   CLIPZBARRELr<   r<   r<   r=   Part  s   r   c                      s   j  jk  d S rb   )r8   r   r<   r   r>   r<   r=   r   
  s    )r>   ZassertNotEqualr8   r   r   r   )rU   r   r<   r   r=   test_comparisons   s    zTestEnumV3.test_comparisonsc                 C   s   |  t  G dd dt}W d    n1 s00    Y  |  t  G dd dt}W d    n1 sj0    Y  |  t  G dd dt}W d    n1 s0    Y  d S )Nc                   @   s   e Zd ZdZdZdZdZdS )z.TestEnumV3.test_duplicate_name.<locals>.Color1r   r2   r3   r4   Nr   r<   r<   r<   r=   Color1  s   r   c                   @   s    e Zd ZdZdZdZdd ZdS )z.TestEnumV3.test_duplicate_name.<locals>.Color2r   r2   r3   c                 S   s   dS )Nr   r<   r   r<   r<   r=   r     s    z2TestEnumV3.test_duplicate_name.<locals>.Color2.redNr   r<   r<   r<   r=   Color2  s   r   c                   @   s$   e Zd Zedd ZdZdZdZdS )z.TestEnumV3.test_duplicate_name.<locals>.Color3c                 S   s   dS )NZredderr<   r   r<   r<   r=   r      s    z2TestEnumV3.test_duplicate_name.<locals>.Color3.redr   r2   r3   N)r5   r6   r7   r   r   r   r   r<   r<   r<   r=   Color3  s
   
r   )r   r   r   )rU   r   r   r   r<   r<   r=   test_duplicate_name  s    ..zTestEnumV3.test_duplicate_namec                 C   sB   |  t$ G dd dttd}W d    n1 s40    Y  d S )Nc                   @   s   e Zd ZdZdZdZdZdS )z:TestEnumV3.test_duplicate_value_with_unique.<locals>.Colorr   r2   r3   Nr5   r6   r7   r   r   r   rojor<   r<   r<   r=   r   )  s   r   r   )r   
ValueErrorr   r   r   r<   r<   r=    test_duplicate_value_with_unique'  s    z+TestEnumV3.test_duplicate_value_with_uniquec                 C   sz   G dd dt td}| |j|ju  | |jjd | |jjd | t|d | 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;TestEnumV3.test_duplicate_value_with_noalias.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r   0  s   r   r   r   r4   )r   r   r`   r   r   r   r   lenr   r   r   r   r<   r<   r=   !test_duplicate_value_with_noalias/  s    z,TestEnumV3.test_duplicate_value_with_noaliasc                 C   s&   G dd dt td}| t|d d S )Nc                   @   s   e Zd ZdZdZdZdZdS )z3TestEnumV3.test_noalias_value_lookup.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r   <  s   r   r   r2   )r   r   r   r   r   r<   r<   r=   test_noalias_value_lookup;  s    z$TestEnumV3.test_noalias_value_lookupc                 C   sJ   G dd dt td}| |jjd | |d|j | |jjd d S )Nc                   @   s   e Zd ZdZdZdZdS )z)TestEnumV3.test_multivalue.<locals>.Colorr   r   r2   r   r3   r   Nr   r<   r<   r<   r=   r   D  s   r   r   r   r   r   )	r   r   r   r   r   assertIsr   r   r   r   r<   r<   r=   test_multivalueC  s    zTestEnumV3.test_multivaluec                 C   sB   |  t$ G dd dttd}W d    n1 s40    Y  d S )Nc                   @   s   e Zd ZdZdZdZdS )z?TestEnumV3.test_multivalue_with_duplicate_values.<locals>.Colorr   r   r3   r   r   Nr   r<   r<   r<   r=   r   N  s   r   r   )r   r   r   r   r   r<   r<   r=   %test_multivalue_with_duplicate_valuesL  s    z0TestEnumV3.test_multivalue_with_duplicate_valuesc                 C   sF   |  t( G dd dtttfd}W d    n1 s80    Y  d S )Nc                   @   s   e Zd ZdZdZdZdS )zKTestEnumV3.test_multivalue_with_duplicate_values_and_noalias.<locals>.Colorr   r   r   Nr   r<   r<   r<   r=   r   U  s   r   r   )r   r   r   r   r   r   r<   r<   r=   1test_multivalue_with_duplicate_values_and_noaliasS  s    z<TestEnumV3.test_multivalue_with_duplicate_values_and_noaliasc                 C   sH   |  td( G dd dtttfd}W d    n1 s:0    Y  d S )Nz0MultiValue and MagicValue are mutually exclusivec                   @   s   e Zd Ze dZe dS )z2TestEnumV3.test_multivalue_and_auto.<locals>.Color)r3   r   Nr   r<   r<   r<   r=   r   \  s   r   r   )rt   r   r   r   r   r   r<   r<   r=   test_multivalue_and_autoZ  s    z#TestEnumV3.test_multivalue_and_autoc                 C   sf   G dd dt tdd}| |jd | |jd | |jjd | |jjd | t|d	 d S )
Nc                   @   s   e Zd ZdZdZdS )z2TestEnumV3.test_autonumber_and_init.<locals>.FieldChar, Date, Logical, etc.Field offset in recordNr5   r6   r7   TYPESTARTr<   r<   r<   r=   Fieldb  s   r   r   r   r   r   r2   r   r   _order_)r   r   r   r   r   r   r`   hasattrrU   r   r<   r<   r=   test_autonumber_and_inita  s    z#TestEnumV3.test_autonumber_and_initc                 C   s6   G dd dt dd}| |jd | |jjd d S )Nc                   @   s   e Zd ZdZdZdS )z1TestEnumV3.test_autovalue_and_init.<locals>.Fieldr   r   Nr   r<   r<   r<   r=   r   l  s   r   value __doc__r   r   r   )r   r   r   r   r   r   r<   r<   r=   test_autovalue_and_initk  s    z"TestEnumV3.test_autovalue_and_initc                 C   sX   G dd dt dtdd}| |jd | |jd | |jjd | |jjd d S )	Nc                   @   s   e Zd ZdZdZdS )z3TestEnumV3.test_autonumber_and_start.<locals>.Fieldr   r   Nr   r<   r<   r<   r=   r   s  s   r   r   r(   )r   r   r   r   r   r   )r   r   r   r   r   r   r   r<   r<   r=   test_autonumber_and_startr  s
    z$TestEnumV3.test_autonumber_and_startc                 C   s   G dd dt dd}| |jd | |jd | |jd | |jd | |jjd	 | |jjd
 | |jjd | |jjd d S )Nc                   @   s   e Zd ZdZdZdZdZdS )zBTestEnumV3.test_autonumber_and_init_and_some_values.<locals>.Fieldr   r   )rB   	test blah
test belchN)r5   r6   r7   r   r   BLAHBELCHr<   r<   r<   r=   r   |  s   r   r   r   r   r2   rB      r   r   r   r   )r   r   r   r   r   r   r   r   r<   r<   r=   (test_autonumber_and_init_and_some_values{  s    z3TestEnumV3.test_autonumber_and_init_and_some_valuesc                 C   s   G dd dt dd}| |jjd | |jjd | |jjd | |jjd | |jjd	 | |jjd
 | td$ G dd dt dd}W d    n1 s0    Y  G dd dt dd}| 	|j
jd | |jjd | 	|jjd d S )Nc                   @   s   e Zd ZdZdZdS )?TestEnumV3.test_autonumber_with_irregular_values.<locals>.Point   	   )      Nr5   r6   r7   r   r   r<   r<   r<   r=   Point  s   r  zx yr   r   r   r   r2   r   r  zI.*number of fields provided do not match init ...x., .y.. != .3, 11, 13..c                   @   s   e Zd ZdZdZdS )r   r   )r3   r   r  Nr  r<   r<   r<   r=   r    s   c                   @   s   e Zd ZdZdZdZdS )z?TestEnumV3.test_autonumber_with_irregular_values.<locals>.Colorr<   r   Nr   r<   r<   r<   r=   r     s   r   r   r   )r   r   r   r   xyr   rt   r   r]   r   r   r   r   )rU   r  r   r<   r<   r=   %test_autonumber_with_irregular_values  s    2z0TestEnumV3.test_autonumber_with_irregular_valuesc                 C   s>   |  t  G dd dt}W d    n1 s00    Y  d S )Nc                   @   s.   e Zd ZdZdZdZdZeedddZ	dS )z6TestEnumV3.test_autonumber_and_property.<locals>.Colorr<   returnc                 S   s
   | j  S rb   rf   titler   r<   r<   r=   cap_name  s    z?TestEnumV3.test_autonumber_and_property.<locals>.Color.cap_nameN
r5   r6   r7   r   r   r   r   r   rS   r  r<   r<   r<   r=   r     s   r   r   r   r	   r   r<   r<   r=   test_autonumber_and_property  s    z'TestEnumV3.test_autonumber_and_propertyc                 C   sd   G dd dt }| t||j|j|jg | dd |D g d | dd |D g d d S )Nc                   @   s   e Zd Ze e e dS )z'TestEnumV3.test_autoenum.<locals>.ColorNr   r<   r<   r<   r=   r     s   r   c                 S   s   g | ]
}|j qS r<   r   .0mr<   r<   r=   
<listcomp>      z,TestEnumV3.test_autoenum.<locals>.<listcomp>)r   r2   r3   c                 S   s   g | ]
}|j qS r<   r   r  r<   r<   r=   r    r  r   r   r   r	   r   r   r   r   r   r   r<   r<   r=   test_autoenum  s    zTestEnumV3.test_autoenumc                 C   sd   G dd dt }| t||j|j|jg | dd |D g d | dd |D g d d S )Nc                   @   s    e Zd Zdd Ze e e dS )z0TestEnumV3.test_autoenum_with_str.<locals>.Colorc                 S   s   | S rb   r<   )rf   r   countlast_valuesr<   r<   r=   _generate_next_value_  s    zFTestEnumV3.test_autoenum_with_str.<locals>.Color._generate_next_value_N)r5   r6   r7   r  r   r   r   r<   r<   r<   r=   r     s   r   c                 S   s   g | ]
}|j qS r<   r  r  r<   r<   r=   r    r  z5TestEnumV3.test_autoenum_with_str.<locals>.<listcomp>r  c                 S   s   g | ]
}|j qS r<   r   r  r<   r<   r=   r    r  r  r   r<   r<   r=   test_autoenum_with_str  s    z!TestEnumV3.test_autoenum_with_strc                 C   s$   G dd dt }| |jjd d S )Nc                   @   s$   e Zd Ze e e edd ZdS )z:TestEnumV3.test_autoenum_and_default_ignore.<locals>.Colorc                 S   s
   | j  S rb   r	  r   r<   r<   r=   r    s    zCTestEnumV3.test_autoenum_and_default_ignore.<locals>.Color.cap_nameN)r5   r6   r7   r   r   r   r   r  r<   r<   r<   r=   r     s
   r   ZBluer	   r   r   r  r   r<   r<   r=    test_autoenum_and_default_ignore  s    z+TestEnumV3.test_autoenum_and_default_ignorec                 C   s>   |  t  G dd dt}W d    n1 s00    Y  d S )Nc                   @   s.   e Zd ZdZe e e eedddZ	dS )z?TestEnumV3.test_autonumber_and_overridden_ignore.<locals>.Colorstaticmethodr  c                 S   s
   | j  S rb   r	  r   r<   r<   r=   r    s    zHTestEnumV3.test_autonumber_and_overridden_ignore.<locals>.Color.cap_nameNr  r<   r<   r<   r=   r     s   r   r  r   r<   r<   r=   %test_autonumber_and_overridden_ignore  s    z0TestEnumV3.test_autonumber_and_overridden_ignorec                 C   s$   G dd dt }| |jjd d S )Nc                   @   s.   e Zd ZdZe e eZee	dddZ
dS )zATestEnumV3.test_autonumber_and_multiple_assignment.<locals>.Colorr   r  c                 S   s
   | j  S rb   r	  r   r<   r<   r=   r    s    zJTestEnumV3.test_autonumber_and_multiple_assignment.<locals>.Color.cap_nameN)r5   r6   r7   r   r   r   cyanr   r   rS   r  r<   r<   r<   r=   r     s   r   ZCyanr  r   r<   r<   r=   'test_autonumber_and_multiple_assignment  s    z2TestEnumV3.test_autonumber_and_multiple_assignmentc                 C   sZ   G dd dt tttfdd}|}| |jd | |j|d  u oN|du n   d S )Nc                   @   s   e Zd ZdZdZdZdS )zHTestEnumV3.test_multivalue_and_autonumber_inherited.<locals>.Measurement201107212012091120110518Nr5   r6   r7   rX   twothreer<   r<   r<   r=   Measurement  s   r(  r(   r   r"  )intr   r   r   r   rX   r]   )rU   r(  Mr<   r<   r=   (test_multivalue_and_autonumber_inherited  s    z3TestEnumV3.test_multivalue_and_autonumber_inheritedc                 C   sV   G dd dt td}| t$ G dd d|td}W d    n1 sH0    Y  d S )Nc                   @   s   e Zd ZdS )zDTestEnumV3.test_combine_new_settings_with_old_settings.<locals>.AutoNrl   r<   r<   r<   r=   Auto  s   r,  r   c                   @   s   e Zd Ze e dZdS )zJTestEnumV3.test_combine_new_settings_with_old_settings.<locals>.AutoUniquer   N)r5   r6   r7   r   ZBLUHZICKr<   r<   r<   r=   
AutoUnique  s   r-  )r   r   r   r   r   )rU   r,  r-  r<   r<   r=   +test_combine_new_settings_with_old_settings  s    z6TestEnumV3.test_combine_new_settings_with_old_settingsc                 C   sX   G dd dt t}| t|d | t|d | t|d | t|jt  d S )Nc                   @   s   e Zd ZdZdZeZdZe Z	e
dD ]Zedfe	de < q&e
dD ]Zed d	fe	d
e < qDe
dD ]Zed dfe	de < qfeZeZdS )z)TestEnumV3.test_timedelta.<locals>.Periodz3
            different lengths of time
            zvalue periodzPeriod i   dayzday_%drP   r   weekzweek_%d      monthzmonth_%dN)r5   r6   r7   r   _init_r   r   r   varsPeriodrangeiday_1ZOneDayZweek_1ZOneWeekr<   r<   r<   r=   r7    s   r7  r   r9  )r*   r   r`   r   r]   r_   r:  )rU   r7  r<   r<   r=   test_timedelta  s
    zTestEnumV3.test_timedeltac                 C   s`   G dd dt }t|dd | |jjd | |jjd | |j|v  | t|d d S )Nc                   @   s   e Zd ZdZdZdZdS )z0TestEnumV3.test_extend_enum_plain.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r   	  s   r   brownr4   )r   r   r   r<  rf   r   r]   r   r   r<   r<   r=   test_extend_enum_plain  s    z!TestEnumV3.test_extend_enum_plainc                 C   sp   G dd dt }t|dd | |jjd | |jjd | |j|v  | t|d | |jjd d S )Nc                   @   s   e Zd ZdZdZdZdS )z1TestEnumV3.test_extend_enum_shadow.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   r   r4   r   )r   r   r   r   rf   r]   r   r   r   r<   r<   r=   test_extend_enum_shadow  s    z"TestEnumV3.test_extend_enum_shadowc                 C   sN   G dd dt }t|d | |jjd | |jjd | |jjd d S )Nc                   @   s   e Zd Zdd Ze e dS )z1TestEnumV3.test_extend_enum_generate.<locals>.Fooc                 _   s   | S rb   r<   )rf   r   r  r   r   kwdsr<   r<   r=   r  !  s    zGTestEnumV3.test_extend_enum_generate.<locals>.Foo._generate_next_value_N)r5   r6   r7   r  abr<   r<   r<   r=   Foo   s   rB  cr@  rA  )r	   r   r   r@  r   rA  rC  )rU   rB  r<   r<   r=   test_extend_enum_generate  s
    
z$TestEnumV3.test_extend_enum_generatec                 C   sN   |  t0 G dd dttd}t|dd W d    n1 s@0    Y  d S )Nc                   @   s   e Zd ZdZdZdZdS )z@TestEnumV3.test_extend_enum_unique_with_duplicate.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r   -  s   r   r   r   r   )r   r   r   r   r   r   r<   r<   r=   &test_extend_enum_unique_with_duplicate+  s    z1TestEnumV3.test_extend_enum_unique_with_duplicatec                 C   sN   |  t0 G dd dttd}t|dd W d    n1 s@0    Y  d S )Nc                   @   s   e Zd ZdZdZdZdS )zDTestEnumV3.test_extend_enum_multivalue_with_duplicate.<locals>.Color)r   r   )r2   verde)r3   ZazulNr   r<   r<   r<   r=   r   5  s   r   r   r   r2   )r   r   r   r   r   r   r<   r<   r=   *test_extend_enum_multivalue_with_duplicate3  s    z5TestEnumV3.test_extend_enum_multivalue_with_duplicatec                 C   sT   G dd dt td}t|dd | t|d | |j|ju  | |jjd d S )Nc                   @   s   e Zd ZdZdZdZdS )zATestEnumV3.test_extend_enum_noalias_with_duplicate.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r   <  s   r   r   r   r3   )	r   r   r   r   r   r`   r   r   r]   r   r<   r<   r=   'test_extend_enum_noalias_with_duplicate;  s
    z2TestEnumV3.test_extend_enum_noalias_with_duplicatec                 C   s   dd }|  t| d S )Nc                  S   s$   G dd dt } G dd dt } d S )Nc                   @   s   e Zd ZdZdZdZdS zDTestEnumV3.test_no_duplicates.<locals>.bad_duplicates.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r   G  s   r   c                   @   s   e Zd ZdZdZdZdZdS rI  )r5   r6   r7   r   r   r   Zgrener<   r<   r<   r=   r   K  s   )r   r   r<   r<   r=   bad_duplicatesF  s    z5TestEnumV3.test_no_duplicates.<locals>.bad_duplicates)r   r   )rU   rK  r<   r<   r=   test_no_duplicatesE  s    
zTestEnumV3.test_no_duplicatesc                 C   s&   G dd dt }G dd dtt }d S )Nc                   @   s   e Zd ZdZdZdZdS )z2TestEnumV3.test_no_duplicates_kinda.<locals>.Sillyr   dosr3   N)r5   r6   r7   rX   r&  rf   r<   r<   r<   r=   SillyS  s   rN  c                   @   s   e Zd ZdZdZdZdZdS )z4TestEnumV3.test_no_duplicates_kinda.<locals>.Sillierr   r2   r3   r4   N)r5   r6   r7   singlerf   Ztripler   r<   r<   r<   r=   SillierW  s   rP  )r   r   )rU   rN  rP  r<   r<   r=   test_no_duplicates_kindaR  s    z#TestEnumV3.test_no_duplicates_kindac                 C   sd   G dd dt td}| t||j|j|jg | |jjd | |jjd | |jjd d S )Nc                   @   s   e Zd Ze e e dS )z*TestEnumV3.test_auto_number.<locals>.ColorNr5   r6   r7   r   r   r   r<   r<   r<   r=   r   ^  s   r   r   r   r2   r3   r   r   r   r   r   r   r   r   r   r<   r<   r=   test_auto_number]  s
    zTestEnumV3.test_auto_numberc                 C   sd   G dd dt t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e e e dS )z(TestEnumV3.test_auto_name.<locals>.Colorc                 S   s   | S rb   r<   rf   r   r  lastr<   r<   r=   r  j  s    z>TestEnumV3.test_auto_name.<locals>.Color._generate_next_value_N)r5   r6   r7   r  r   r   r   r<   r<   r<   r=   r   i  s   r   r   r   r   r   rS  r   r<   r<   r=   test_auto_nameh  s
    zTestEnumV3.test_auto_namec                 C   st   G dd dt }G dd d|t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 )z7TestEnumV3.test_auto_name_inherit.<locals>.AutoNameEnumc                 S   s   | S rb   r<   rU  r<   r<   r=   r  w  s    zMTestEnumV3.test_auto_name_inherit.<locals>.AutoNameEnum._generate_next_value_N)r5   r6   r7   r  r<   r<   r<   r=   AutoNameEnumv  s   rX  c                   @   s   e Zd Ze e e dS )z0TestEnumV3.test_auto_name_inherit.<locals>.ColorNrR  r<   r<   r<   r=   r   y  s   r   r   r   r   r   rS  )rU   rX  r   r<   r<   r=   test_auto_name_inheritu  s    z!TestEnumV3.test_auto_name_inheritc                 C   s$   G dd dt }| |jjd d S )Nc                   @   s   e Zd ZeZdZe dS )z+TestEnumV3.test_auto_garbage.<locals>.Colorr   N)r5   r6   r7   r   r   r   r   r<   r<   r<   r=   r     s   r   r   )r   r   r   r   r   r<   r<   r=   test_auto_garbage  s    zTestEnumV3.test_auto_garbagec                 C   sd   G dd dt td}| 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 dS )z5TestEnumV3.test_auto_garbage_corrected.<locals>.Colorr   r2   NrR  r<   r<   r<   r=   r     s   r   r   r   r2   r3   rS  r   r<   r<   r=   test_auto_garbage_corrected  s
    z&TestEnumV3.test_auto_garbage_correctedc                 C   s4   G dd dt td}| |j|j|jgt| d S )Nc                   @   s   e Zd ZeZe e dS )z-TestEnumV3.test_duplicate_auto.<locals>.DupesN)r5   r6   r7   Zprimeror   r   r   r<   r<   r<   r=   Dupes  s   r\  r   )r   r   r   r   r   r   r   )rU   r\  r<   r<   r=   test_duplicate_auto  s    zTestEnumV3.test_duplicate_autoc                 C   sZ  G dd dt }t|D ]\}}| ||j q|}| |jjd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd	 | |jjd
 | |jjd | |j	jd | |j	jd | |j	jd | |j
jd | |j
jd | |j
jd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd | |jjd  | |jjd! | |jjd" | |jjd# G d$d dt }t|D ]\}}| ||jd  q\|}| |jjd | |jjd% | |jjd | |jjd& | |jjd	 | |jjd' | |j	jd | |j	jd( | |j
jd | |j
jd) | |jjd | |jjd* | |jjd | |jjd+ | |jjd | |jjd, | |jjd | |jjd- | |jjd | |jjd. | |jjd! | |jjd/ | t  G d0d dt }W d    n1 s0    Y  | t  G d1d dt }W d    n1 sL0    Y  d S )2Nc                   @   sD   e Zd ZdZdd ZdZdZdZdZdZ	d	Z
d
ZdZdZdZdZdS )7TestEnumV3.test_order_as_function.<locals>.TestSequencezvalue, sequencec                 S   s   | j S rb   sequencememberr<   r<   r=   <lambda>  r  @TestEnumV3.test_order_as_function.<locals>.TestSequence.<lambda>An$(1,6)r(   An$(7,2)r   An$(9,4)r2   	Hn$(13,6)r3   	Cn$(19,3)r4   Zn$(1,1)rB   Bn(2,1)r   Fnr   Rn$(5,1)   Sn$(6,1)r   Qn$(7,2)
   Nr5   r6   r7   r5  r   item_id
company_idwarehouse_nocompanykey_type	availablecontract_itemsales_categorygl_categorywarehouse_category	inv_unitsr<   r<   r<   r=   TestSequence  s   r  r~  rf  r(   r  rh  r   r  rj  r2   r  rl  r3   r  rn  r4   r  rp  rB   r  rr  r   r  rt  r   r  rv  rw  r  ry  r   r  r{  r|  c                   @   s@   e Zd Zdd ZdZdZdZdZdZdZ	d	Z
d
ZdZdZdZdS )r^  c                 S   s
   | j d S )Nr   r  ra  r<   r<   r=   rc    r  rd  re  rg  ri  rk  rm  ro  rq  rs  ru  rx  rz  N)r5   r6   r7   r   r~  r  r  r  r  r  r  r  r  r  r  r<   r<   r<   r=   r    s   re  rg  ri  rk  rm  ro  rq  rs  ru  rx  rz  c                   @   sD   e Zd ZdZdd ZdZdZdZdZdZ	d	Z
d
ZdZdZdZdZdS )r^  r`  c                 S   s   | j S rb   r_  ra  r<   r<   r=   rc    r  rd  re  rg  ri  rk  rm  ro  rq  rs  ru  rx  rz  Nr}  r<   r<   r<   r=   r    s   c                   @   sD   e Zd ZdZdd ZdZdZdZdZdZ	d	Z
d
ZdZdZdZdZdS )r^  r`  c                 S   s   | j S rb   r_  ra  r<   r<   r=   rc    r  rd  re  ri  rk  rg  rz  ro  rq  rs  rm  ru  rx  N)r5   r6   r7   r5  r   r~  r  r  r  r  r  r  r  r  r  r  r<   r<   r<   r=   r  	  s   )r   	enumerater   r`  r~  rf   r   r  r  r  r  r  r  r  r  r  r  r   r   )rU   r  r9  rb  tsr<   r<   r=   test_order_as_function  s    0z!TestEnumV3.test_order_as_functionc                 C   sT   G dd dt }| |d|j | td|d | td|d | t|d d S )	Nc                   @   s$   e Zd ZdZdZdZedd ZdS )z&TestEnumV3.test_missing.<locals>.Colorr   r2   r3   c                 S   s0   |dkr| j S |dkrdS |dkr(tnd S d S )Nr'  
bad returnrB   	error out)r   ZeroDivisionError)re   itemr<   r<   r=   	_missing_  s    z0TestEnumV3.test_missing.<locals>.Color._missing_N)r5   r6   r7   r   r   r   classmethodr  r<   r<   r<   r=   r     s
   r   r'  z7 is not a valid Colorr   zerror in .*_missing_r  r  )r   r   r   rt   r   r   r   r  r   r<   r<   r=   test_missing  s
    zTestEnumV3.test_missingc                    s   G dd dt }| |jjt | |jjt | |jjt G dd dG dd d G  fdddt }| |j	j | |j
j  G d	d
 d
G fdddt }| |jj dS )z2Support using Enum to refer to types deliberately.c                   @   s   e Zd ZeZeZeZdS )z.TestEnumV3.test_enum_of_types.<locals>.MyTypesN)	r5   r6   r7   r)  r9  rR   frS   sr<   r<   r<   r=   MyTypes1  s   r  c                   @   s   e Zd ZdS )z*TestEnumV3.test_enum_of_types.<locals>.FooNrl   r<   r<   r<   r=   rB  8  s   rB  c                   @   s   e Zd ZdS )z*TestEnumV3.test_enum_of_types.<locals>.BarNrl   r<   r<   r<   r=   Bar:  s   r  c                       s   e Zd ZZ ZdS )z/TestEnumV3.test_enum_of_types.<locals>.MyTypes2N)r5   r6   r7   r@  rA  r<   )r  rB  r<   r=   MyTypes2<  s   r  c                   @   s   e Zd ZdS )z7TestEnumV3.test_enum_of_types.<locals>.SpamEnumNotInnerNrl   r<   r<   r<   r=   SpamEnumNotInnerA  s   r  c                       s   e Zd Z ZdS )z/TestEnumV3.test_enum_of_types.<locals>.SpamEnumN)r5   r6   r7   spamr<   )r  r<   r=   SpamEnumC  s   r  N)r   r   r9  r   r)  r  rR   r  rS   r@  rA  r  )rU   r  r  r  r<   )r  rB  r  r=   test_enum_of_types/  s    zTestEnumV3.test_enum_of_typesc                 C   s~   G dd dt }| t|jt | |jjd | |jjjd | t	|j|jj|jj
g | t	||j|jg dS )z'Support locally-defined nested classes.c                   @   s(   e Zd ZdZdZdZG dd deZdS )zKTestEnumV3.test_nested_classes_in_enum_do_not_create_members.<locals>.OuterOuterr   r2   c                   @   s   e Zd ZdZdZdZdS )zQTestEnumV3.test_nested_classes_in_enum_do_not_create_members.<locals>.Outer.InnerzOuter.Innerr|  r   N)r5   r6   r7   foorn   r<   r<   r<   r=   InnerN  s   r  N)r5   r6   r7   r@  rA  r   r  r<   r<   r<   r=   r  J  s   r  r   r|  N)r   r]   r_   r  r   r   r@  r   r  r   rn   rA  )rU   r  r<   r<   r=   1test_nested_classes_in_enum_do_not_create_membersG  s    
z<TestEnumV3.test_nested_classes_in_enum_do_not_create_membersc                 C   sZ   G dd dt }|| j_d| jj | j_t| jt| jjdd t	| j
| jjdtfd d S )Nc                   @   s   e Zd ZdZdZdS zNTestEnumV3.test_class_nested_enum_and_pickle_protocol_four.<locals>.NestedEnumcommonZrareNr5   r6   r7   twigsZshinyr<   r<   r<   r=   
NestedEnuma  s   r  %s.NestedEnum)r(   r3   protocolr4   )r   ri   r  r5   r7   Ztest_pickle_exceptionr   r-   r  rz   r]   r.   rU   r  r<   r<   r=   /test_class_nested_enum_and_pickle_protocol_four_  s    z:TestEnumV3.test_class_nested_enum_and_pickle_protocol_fourc                 C   sD   G dd dt }|| j_d| jj | j_t| j| jjdtfd d S )Nc                   @   s   e Zd ZdZdZdS r  r  r<   r<   r<   r=   r  p  s   r  r  r(   r  )	r   ri   r  r5   r7   rz   r]   r  r.   r  r<   r<   r=   r  n  s    c                    sP   G  fdddt  |  j jgt  |  jjd |  jjd d S )Nc                       s,   e Zd ZdZ ddZ ddZdd ZdS )	z-TestEnumV3.test_enum_injection.<locals>.ColorzBLACK WHITEblackz#000Zwhite#fffc                 S   s   || _ || _d S rb   )labelhex)rU   r  r  r<   r<   r=   r     s    z6TestEnumV3.test_enum_injection.<locals>.Color.__init__N)r5   r6   r7   r   BLACKWHITEr   r<   rJ  r<   r=   r   {  s   

r   r  r  )r   r   r  r  r   r  r  r   r<   rJ  r=   test_enum_injectionz  s    	zTestEnumV3.test_enum_injectionc                    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dt
fd	 | |jjd
 t	| j|jdt
fd	 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?TestEnumV3.test_subclasses_with_getnewargs_ex.<locals>.NamedIntNamedIntc                 W   sP   |}t |dk rtd|d |dd   }}tj| g|R  }||_||_|S )Nr2   z name and value must be specifiedr(   r   )r   r   r)  __new___intname_args)re   r   r  rf   rU   r<   r<   r=   r    s    zGTestEnumV3.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__new__c                 S   s
   | j i fS rb   )r  r   r<   r<   r=   __getnewargs_ex__  s    zQTestEnumV3.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__getnewargs_ex__c                 S   s   | j S rb   )r  r   r<   r<   r=   r5     s    zHTestEnumV3.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__name__c                 S   s   d t| j| jt| S )Nz{}({!r}, {}))formatr   r5   r)  __repr__r   r<   r<   r=   r    s    zHTestEnumV3.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__repr__c                 S   s&   t }|j}|jtu r|| S || S rb   )r)  __str____objclass__objectr  )rU   baseZbase_strr<   r<   r=   r    s
    

zGTestEnumV3.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  r5   )rU   othertempr  r<   r=   __add__  s    zGTestEnumV3.test_subclasses_with_getnewargs_ex.<locals>.NamedInt.__add__N)	r5   r6   r7   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:TestEnumV3.test_subclasses_with_getnewargs_ex.<locals>.NEINEI)zthe-xr   )zthe-yr2   N)r5   r6   r7   r  r  r<   r<   r<   r=   r    s   r  zNamedInt('(the-x + the-y)', 3)testrB   r4   r  r2   )r)  r   r   r  r   reprr  r  ry   rz   r.   r   r]   )rU   r  ZNI5r<   r  r=   "test_subclasses_with_getnewargs_ex  s    '


z-TestEnumV3.test_subclasses_with_getnewargs_exc                 C   s:   G dd dt d}G dd d|t}| t|jd d S )Nc                   @   s   e Zd ZdS )zCTestEnumV3.test_multiple_superclasses_repr.<locals>._EnumSuperClassNrl   r<   r<   r<   r=   _EnumSuperClass  s   r  rq   c                   @   s   e Zd ZdZdS )z5TestEnumV3.test_multiple_superclasses_repr.<locals>.Er   N)r5   r6   r7   rC   r<   r<   r<   r=   r?     s   r?   z<E.A: 1>)r   r   r   r  rC   )rU   r  r?   r<   r<   r=   test_multiple_superclasses_repr  s    z*TestEnumV3.test_multiple_superclasses_reprN)Fr5   r6   r7   rV   unittest
skipUnlessr   ra   rv   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>  rD  rE  rG  rH  rL  rQ  rT  rW  rY  rZ  r[  r]  r  r    r  r  r  r!   r  r  r  r  r<   r<   r<   r=   r1      s   #

"


	
	
		
		
|




8r1   c                   @   s   e Zd 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S )TestOrderV3z5
    Test definition order versus _order_ order.
    c                 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,TestOrderV3.test_same_members.<locals>.Colorred green bluer   r2   r3   Nr5   r6   r7   r   r   r   r   r<   r<   r<   r=   r     s   r   r   r   r<   r<   r=   test_same_members  s    zTestOrderV3.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 )z9TestOrderV3.test_same_members_with_aliases.<locals>.Colorr  r   r2   r3   Nr5   r6   r7   r   r   r   r   rF  r<   r<   r<   r=   r     s
   r   r  r   r<   r<   r=   test_same_members_with_aliases  s    z*TestOrderV3.test_same_members_with_aliasesc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )N#member order does not match _order_c                   @   s   e Zd ZdZdZdZdZdS )z8TestOrderV3.test_same_members_wrong_order.<locals>.Colorr  r   r3   r2   Nr5   r6   r7   r   r   r   r   r<   r<   r<   r=   r     s   r   rt   r   r   r   r<   r<   r=   test_same_members_wrong_order  s    z)TestOrderV3.test_same_members_wrong_orderc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )Nr  c                   @   s   e Zd ZdZdZdZdZdS )z7TestOrderV3.test_order_has_extra_members.<locals>.Colorred green blue purpler   r2   r3   Nr  r<   r<   r<   r=   r     s   r   r  r   r<   r<   r=   test_order_has_extra_members  s    z(TestOrderV3.test_order_has_extra_membersc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )Nr  c                   @   s    e Zd ZdZdZdZdZeZdS )zDTestOrderV3.test_order_has_extra_members_with_aliases.<locals>.Colorr  r   r2   r3   Nr  r<   r<   r<   r=   r     s
   r   r  r   r<   r<   r=   )test_order_has_extra_members_with_aliases  s    z5TestOrderV3.test_order_has_extra_members_with_aliasesc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )Nr  c                   @   s    e Zd ZdZdZdZdZdZdS )z6TestOrderV3.test_enum_has_extra_members.<locals>.Colorr  r   r2   r3   r4   Nr5   r6   r7   r   r   r   r   purpler<   r<   r<   r=   r     s
   r   r  r   r<   r<   r=   test_enum_has_extra_members  s    z'TestOrderV3.test_enum_has_extra_membersc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )Nr  c                   @   s$   e Zd ZdZdZdZdZdZeZdS )zCTestOrderV3.test_enum_has_extra_members_with_aliases.<locals>.Colorr  r   r2   r3   r4   N	r5   r6   r7   r   r   r   r   r  rF  r<   r<   r<   r=   r      s   r   r  r   r<   r<   r=   (test_enum_has_extra_members_with_aliases  s    z4TestOrderV3.test_enum_has_extra_members_with_aliasesc                 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 )z1TestOrderV3.test_same_members_flag.<locals>.Colorr  r   r2   r4   Nr  r<   r<   r<   r=   r   	  s   r   r   r   r<   r<   r=   test_same_members_flag  s    z"TestOrderV3.test_same_members_flagc                 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 )z>TestOrderV3.test_same_members_with_aliases_flag.<locals>.Colorr  r   r2   r4   Nr  r<   r<   r<   r=   r     s
   r   r  r   r<   r<   r=   #test_same_members_with_aliases_flag  s    z/TestOrderV3.test_same_members_with_aliases_flagc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )Nr  c                   @   s   e Zd ZdZdZdZdZdS )z=TestOrderV3.test_same_members_wrong_order_falg.<locals>.Colorr  r   r4   r2   Nr  r<   r<   r<   r=   r     s   r   r   r   r<   r<   r=   "test_same_members_wrong_order_falg  s    z.TestOrderV3.test_same_members_wrong_order_falgc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )Nr  c                   @   s   e Zd ZdZdZdZdZdS )z<TestOrderV3.test_order_has_extra_members_flag.<locals>.Colorr  r   r2   r4   Nr  r<   r<   r<   r=   r   !  s   r   r   r   r<   r<   r=   !test_order_has_extra_members_flag  s    z-TestOrderV3.test_order_has_extra_members_flagc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )Nr  c                   @   s    e Zd ZdZdZdZdZeZdS )zITestOrderV3.test_order_has_extra_members_with_aliases_flag.<locals>.Colorr  r   r2   r4   Nr  r<   r<   r<   r=   r   )  s
   r   r   r   r<   r<   r=   .test_order_has_extra_members_with_aliases_flag'  s    z:TestOrderV3.test_order_has_extra_members_with_aliases_flagc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )Nr  c                   @   s    e Zd ZdZdZdZdZdZdS )z;TestOrderV3.test_enum_has_extra_members_flag.<locals>.Colorr  r   r2   r4   rw  Nr  r<   r<   r<   r=   r   2  s
   r   r   r   r<   r<   r=    test_enum_has_extra_members_flag0  s    z,TestOrderV3.test_enum_has_extra_members_flagc                 C   s@   |  td  G dd dt}W d    n1 s20    Y  d S )Nr  c                   @   s$   e Zd ZdZdZdZdZdZeZdS )zHTestOrderV3.test_enum_has_extra_members_with_aliases_flag.<locals>.Colorr  r   r2   r4   rw  Nr  r<   r<   r<   r=   r   ;  s   r   r   r   r<   r<   r=   -test_enum_has_extra_members_with_aliases_flag9  s    z9TestOrderV3.test_enum_has_extra_members_with_aliases_flagN)r5   r6   r7   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r<   r<   r<   r=   r    s   		
		r  c                   @   s$   e Zd Zdd Zdd Zdd ZdS )TestNamedTupleV3c                 C   s   G dd dt tjd}|ddd}| d|v  | d|v  | d|v  | |jd | |jd | t|dd | t|d d S )Nc                   @   s   e Zd ZdZdZdZdS )z.TestNamedTupleV3.test_fixed_size.<locals>.Bookr(   r   r2   Nr5   r6   r7   r
  authorgenrer<   r<   r<   r=   BookG  s   r  sizeTecklaSteven Brustfantasy)	r   r   fixedr]   r   r
  r  r   r   rU   r  rA  r<   r<   r=   test_fixed_sizeF  s    z TestNamedTupleV3.test_fixed_sizec                 C   s   G dd dt tjd}|ddd}| d|v  | d|v  | d|v  | |jd | |jd | |d d |dd}| d|v  | d|v  | |jd | |jd | t|d d S )Nc                   @   s   e Zd ZdZdZdS )z0TestNamedTupleV3.test_minimum_size.<locals>.Bookr(   r   N)r5   r6   r7   r
  r  r<   r<   r<   r=   r  U  s   r  r  r  r  r  r2   )	r   r   Zminimumr]   r   r
  r  r   r   r  r<   r<   r=   test_minimum_sizeT  s    
z"TestNamedTupleV3.test_minimum_sizec                 C   s   G dd dt tjd}|ddd}| d|v  | d|v  | d|v  | |jd | |jd | |jd |dd}| d|v  | d|v  | |jd | |jd | t	t
|d | jt|ddd | jt|dd	 d S )
Nc                   @   s   e Zd ZdZdZdZdS )z1TestNamedTupleV3.test_variable_size.<locals>.Bookr(   r   r2   Nr  r<   r<   r<   r=   r  g  s   r  r  r  r  r  r  )r
  r  )r  )r   r   variabler]   r   r
  r  r  r   AttributeErrorgetattrr   r  r<   r<   r=   test_variable_sizef  s     
z#TestNamedTupleV3.test_variable_sizeN)r5   r6   r7   r  r  r  r<   r<   r<   r=   r  D  s   r  c                   @   s@   e Zd Zdd Zdd Zdd Zdd Zee	d	d
d Z
dS )TestStackoverflowAnswersV3c                 C   sP   G dd dt }|}| |jjd | |jj|ju  | |jj|ju  d S )Nc                   @   s$   e Zd ZdZdZdZdZdd ZdS )zOTestStackoverflowAnswersV3.test_self_referential_directions.<locals>.Directionsr   r(   )r(   r   )r(   )r(   r  c                 S   sN   || _ || _t| jrJt| j}|d |d  }}|| _|| _| |_| |_d S Nr(   r  )r  r  r   ri   r   leftright)rU   r  r  allr  r  r<   r<   r=   r     s    

zXTestStackoverflowAnswersV3.test_self_referential_directions.<locals>.Directions.__init__N)r5   r6   r7   rK   rJ   rL   rI   r   r<   r<   r<   r=   
Directions  s
   r  r  )	r   r   rK   r   r]   r  rJ   rL   r  )rU   r  rF   r<   r<   r=    test_self_referential_directions  s
    z;TestStackoverflowAnswersV3.test_self_referential_directionsc                 C   sP   G dd dt }| |jj|ju  | |jj|ju  | |jj|ju  d S )Nc                   @   s    e Zd ZdZdZdZdd ZdS )zQTestStackoverflowAnswersV3.test_self_referential_rock_paper_scissors.<locals>.RPSZrockZpaperZscissorsc                 S   s6   t | jr2t| j}|d |d  }}| |_|| _d S r  )r   ri   r   beats)rU   r   r  r   previousr<   r<   r=   r     s
    

zZTestStackoverflowAnswersV3.test_self_referential_rock_paper_scissors.<locals>.RPS.__init__N)r5   r6   r7   RockPaperScissorsr   r<   r<   r<   r=   RPS  s   r  )r   r]   r  r  r  r  )rU   r  r<   r<   r=   )test_self_referential_rock_paper_scissors  s    zDTestStackoverflowAnswersV3.test_self_referential_rock_paper_scissorsc                 C   sp   G dd dt }G dd d|}ttjtd}| }W d    n1 sP0    Y  | t	d| d S )Nc                   @   s   e Zd Zdd ZdS )z@TestStackoverflowAnswersV3.test_arduino_headers.<locals>.CHeaderc                 [   sl   | j }t| d| }t|d:}|d | D ]}|d|j|jf  q.W d    n1 s^0    Y  d S )Nz_%s__headerwzinitial header stuff here
z#define %s %r
)r5   r  openwriterf   r   )re   r?  cls_nameZheader_pathfhenumr<   r<   r=   r     s    
zRTestStackoverflowAnswersV3.test_arduino_headers.<locals>.CHeader.__init_subclass__N)r5   r6   r7   r   r<   r<   r<   r=   CHeader  s   r  c                   @   s"   e Zd ZejedZdZdZ	dS )z@TestStackoverflowAnswersV3.test_arduino_headers.<locals>.Arduino	arduino.hr   r2   N)
r5   r6   r7   ospathjointempdirZ_Arduino__headerONETWOr<   r<   r<   r=   Arduino  s   r  r  zv                initial header stuff here
                #define ONE 1
                #define TWO 2
                )
r   r  r  r  r  r  readr   textwrapdedent)rU   r  r  r
  datar<   r<   r=   test_arduino_headers  s    	&z/TestStackoverflowAnswersV3.test_arduino_headersc                 C   sz   G dd dt tdd}| |jjd | |jjd | |jjd | |jjd | |jjd | |j	jd	 d S )
Nc                   @   sX   e Zd Ze e e e e dZe	 e
 e dZe e e dZe e e e e dS )z>TestStackoverflowAnswersV3.test_create_C_like_Enum.<locals>.Id   i   i   N)r5   r6   r7   NONEZ	HEARTBEATZFLUID_TRANSFER_REQUESTZFLUID_TRANSFER_STATUS_MSGFLUID_TRANSFER_ERROR_MSGSTART_SENDING_PICTURESZSTOP_SENDING_PICTURESZSTART_RECORDING_VIDEO_REQSTOP_RECORDING_VIDEO_REQZVOLUME_REQUEST	START_CALZCLI_COMMAND_REQUESTZCLI_COMMAND_RESPONSEZNEW_DELIVERY_REQZGET_DELIVERY_FILE_REQZGET_FILE_REQZACK_NACKZRESPONSELAST_IDr<   r<   r<   r=   Id  s&   r!  r(   r   r4   r  i  i  i  )
r   r   r   r  r   r  r  r  r  r   )rU   r!  r<   r<   r=   test_create_C_like_Enum  s     z2TestStackoverflowAnswersV3.test_create_C_like_Enumzpyparsing not installedc                    s  t tjtdd}|d W d    n1 s40    Y  ddlmmm	m
m ddlmmm	 d  G  	f
dddtG d	d
 d
td G dd d }G dd d }| t||j|j|j|j|j|j|jg | |jjd | |jjd | |jjd | |jjd | t||j|j|j|jg | |jjd | |jjd | |jjd | |jjd d S )Nc_plus_plus.hr  a]  
                    stuff before
                    enum hello {
                        Zero,
                        One,
                        Two,
                        Three,
                        Five=5,
                        Six,
                        Ten=10
                        };
                    in the middle
                    enum blah
                        {
                        alpha,
                        beta,
                        gamma = 10 ,
                        zeta = 50
                        };
                    at the end
                    r(   )GroupOptionalSuppressWord
ZeroOrMore)alphas	alphanumsnumsc                       sJ   e Zd Zedd Z fddZ 	
fddZ  ZS )zETestStackoverflowAnswersV3.test_c_header_scanner.<locals>.CPPEnumTypec                 [   s   i S rb   r<   )metaclsclsnamebasesr?  r<   r<   r=   __prepare__  s    zQTestStackoverflowAnswersV3.test_c_header_scanner.<locals>.CPPEnumType.__prepare__c                    s   t  | j|  d S rb   )rc   r   )r-  r   r?  )CPPEnumTyperi   r<   r=   r     s    zNTestStackoverflowAnswersV3.test_c_header_scanner.<locals>.CPPEnumType.__init__c                    s$   d u rJt | j||fi |}|| t | j| |||fi |S g }z|d}W n tyv   tdY n0 |d| }t|}	|		 }
W d    n1 s0    Y  t
d\}}}}d}	d }
}|d||d  }|||  }||d | |d	 | }||
D ]`\}}}|j|krXq>d
}|jD ]8}|jdkr|t|j}||j |f |d7 }qbq>t | j||fi |}t| }|jdd d |D ]\}}|||< q|D ]\}}|||< qt | j| |||fi |S )N_filez_file not specified_namez{}=,r  _rf   r   namesr(    r   c                 S   s   | d d dkrdnd| fS )Nr(   r3  r   r<   )pr<   r<   r=   rc  @  r  z_TestStackoverflowAnswersV3.test_c_header_scanner.<locals>.CPPEnumType.__new__.<locals>.<lambda>)key)rc   r/  updater  popKeyErrorr   r   r  r  map
scanStringr  r4  r   r)  appendrf   upperr   itemssort)r,  r-  r.  Zclsdictr?  	enum_dictmembersfileZcpp_enum_namer
  file_contentsLBRACERBRACEZEQCOMMA_enum
identifierintegerZ	enumValueZenumListr  r  r   stopidentryr?  rf   r   )CPPEnumr0  r$  r%  r&  r'  r(  ri   r*  r)  r+  r<   r=   r    sH    

&

zMTestStackoverflowAnswersV3.test_c_header_scanner.<locals>.CPPEnumType.__new__)r5   r6   r7   r  r/  r   r  rj   r<   
rN  r0  r$  r%  r&  r'  r(  r*  r)  r+  rh   r=   r0    s   
r0  c                   @   s   e Zd ZdS )zATestStackoverflowAnswersV3.test_c_header_scanner.<locals>.CPPEnumNrl   r<   r<   r<   r=   rN  H  s   rN  rq   c                   @   s   e Zd ZejedZdS )z?TestStackoverflowAnswersV3.test_c_header_scanner.<locals>.Hellor#  N)r5   r6   r7   r  r  r  r  r1  r<   r<   r<   r=   HelloK  s   rP  c                   @   s   e Zd ZejedZdZdS )z>TestStackoverflowAnswersV3.test_c_header_scanner.<locals>.Blahr#  ZblahN)	r5   r6   r7   r  r  r  r  r1  r2  r<   r<   r<   r=   BlahN  s   rQ  r3   r   r|  r   2   )r  r  r  r  r  r  	pyparsingr$  r%  r&  r'  r(  r)  r*  r+  r   r   r   r   ZZEROr  r  ZTHREEZFIVEZSIXZTENr   ZALPHAZBETAZGAMMAZZETA)rU   r
  rP  rQ  r<   rO  r=   test_c_header_scanner  s2    (&;z0TestStackoverflowAnswersV3.test_c_header_scannerN)r5   r6   r7   r  r  r  r"  r  r  rS  rT  r<   r<   r<   r=   r  }  s   *
r  c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	TestIssuesV3z.
    Problems that were stated in issues.
    c                 C   s   G dd dt ttdd}| dd |D g d | dd |D g d	 | |d|j | |d
|j | |d|j | |d|j | |d|j | |d|j d S )Nc                   @   s   e Zd ZdZdZdZdS )z7TestIssuesV3.test_auto_multi_int_1.<locals>.Measurementr"  r#  r$  Nr%  r<   r<   r<   r=   r(  j  s   r(  r(   )r   c                 S   s   g | ]
}|j qS r<   r  r  r<   r<   r=   r  n  r  z6TestIssuesV3.test_auto_multi_int_1.<locals>.<listcomp>r(   r   r2   c                 S   s   g | ]
}|j qS r<   r   r  r<   r<   r=   r  o  r  rX   r&  r'  r"  r   r#  r2   r$  )r)  r
   r   r   r   rX   r&  r'  rU   r(  r<   r<   r=   test_auto_multi_int_1i  s    z"TestIssuesV3.test_auto_multi_int_1c                 C   s   G dd dt tttfdd}| dd |D g d | dd |D g d	 | |d|j | |d
|j | |d|j | |d|j | |d|j | |d|j d S )Nc                   @   s   e Zd ZdZdZdZdS )z7TestIssuesV3.test_auto_multi_int_2.<locals>.Measurementr"  r#  r$  Nr%  r<   r<   r<   r=   r(  x  s   r(  r(   r   c                 S   s   g | ]
}|j qS r<   r  r  r<   r<   r=   r  |  r  z6TestIssuesV3.test_auto_multi_int_2.<locals>.<listcomp>rV  c                 S   s   g | ]
}|j qS r<   r   r  r<   r<   r=   r  }  r  rW  r"  r   r#  r2   r$  )	r)  r   r   r   r   r   rX   r&  r'  rX  r<   r<   r=   test_auto_multi_int_2w  s    z"TestIssuesV3.test_auto_multi_int_2c                 C   s   G dd dt tdd}| |jjd | |jjd | |jjd t|ddd	 | t||j|j	|j
|jg | |jjd | |jjd | |d|ju  | |d	|ju  d S )
Nc                   @   s   e Zd ZdZdZdZdS )z6TestIssuesV3.test_extend_enum_with_init.<locals>.Color)r[   yes)2no)3maybeNr   r<   r<   r<   r=   r     s   r   zfoo barr   r[   r[  opacity4never)r   r   r   r   r   r  rn   r   r   r   r   r`  rf   r]   r   r<   r<   r=   test_extend_enum_with_init  s     z'TestIssuesV3.test_extend_enum_with_initN)r5   r6   r7   r   rY  rZ  rc  r<   r<   r<   r=   rU  d  s   rU  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eedd d! Zeedd"d# Zeedd$d% Zeedd&d' Zeedd(d) Zeed*d+d, Zeed*d-d. Zeed/d0d1 Zeeo0ee k d/d2d3 Z!eeoNee kd/d4d3 Z!ee"d5d6d7 Z#ee"d5d8d9 Z$ee%d:d;d< Z&d=S )>TestExtendEnumV3c                 C   s  G dd dt }| tdt|dd t|dd | |jjd | |jjd | |j|v  | |d|j | |d |j | t	|d t|d | |j
jd | |j
jd | |j
|v  | |d|j
 | |d |j
 | t	|d d S )	Nc                   @   s   e Zd ZdZdZdZdS )z6TestExtendEnumV3.test_extend_enum_plain.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   z(.blue. already in use as .Color.blue: 3.r   rB   r<  r4   mauve)r   rt   r   r   r   r<  rf   r   r]   r   re  r   r<   r<   r=   r=    s     
z'TestExtendEnumV3.test_extend_enum_plainc                 C   s   G dd dt }t|dd | |jjd | |jjd | |j|v  | |d|j | |d |j | t|d d S )Nc                   @   s   e Zd ZdZdZdZdS )z6TestExtendEnumV3.test_extend_enum_alias.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   r   r   r   r3   )	r   r   r   r   rf   r   r]   r   r   r   r<   r<   r=   test_extend_enum_alias  s    z'TestExtendEnumV3.test_extend_enum_aliasc                 C   s  G dd dt }| tdt|dd | |jjd | |jjd | |j|v  | |d|j | |d |j | |j	jd | |j	jd | |j	|v  | |d|j	 | |d	 |j
 | |j
jd	 | |j
jd
 | |j
|v  | |d
|j
 | t|d
 t|dd | |jjd | |jjd | |j|v  | |d|j | |d |j | t|d | tdt|dd t|d | |jjd | |jjd | |j|v  | |d|j | |d |j | t|d d S )Nc                   @   s   e Zd ZdZdZdZdS )z7TestExtendEnumV3.test_extend_enum_unique.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   z0<Color.rojo: 1> is a duplicate of <Color.red: 1>r   r   r   r   r2   r   r3   r<  r4   z3<Color.verde: 2> is a duplicate of <Color.green: 2>rF  re  rB   )r   rt   r   r   r   r   rf   r   r]   r   r   r   r<  re  r   r<   r<   r=   test_extend_enum_unique  s@    
z(TestExtendEnumV3.test_extend_enum_uniquec                 C   s   G dd dt }t|dd | |jjd | |jjd | |j|v  | |d|j | |d |j | t|d | |jjd d S )Nc                   @   s   e Zd ZdZdZdZdS )z@TestExtendEnumV3.test_extend_enum_shadow_property.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   r   r4   r   )r   r   r   r   rf   r]   r   r   r   r<   r<   r=    test_extend_enum_shadow_property  s    z1TestExtendEnumV3.test_extend_enum_shadow_propertyc                 C   sf   G dd dt }G dd d|t}| tdt|dd | t|d | t||j|j	|j
g d S )	Nc                   @   s   e Zd Zdd ZdS )z<TestExtendEnumV3.test_extend_enum_shadow_base.<locals>.hohumc                 S   s   | j S zcyanize a colorr  r   r<   r<   r=   r     s    zATestExtendEnumV3.test_extend_enum_shadow_base.<locals>.hohum.cyanNr5   r6   r7   r   r<   r<   r<   r=   hohum  s   rk  c                   @   s   e Zd ZdZdZdZdS )z<TestExtendEnumV3.test_extend_enum_shadow_base.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   already in use in superclassr   r4   r3   )r  r   rt   r   r   r   r   r   r   r   r   rU   rk  r   r<   r<   r=   test_extend_enum_shadow_base  s
    z-TestExtendEnumV3.test_extend_enum_shadow_basec                 C   s   G dd dt }t|ddd | |jjd | |jjd | |j|v  | |d|j | |d|j | |d |j | t|d | t	dt|d d S )	Nc                   @   s   e Zd ZdZdZdZdS )z;TestExtendEnumV3.test_extend_enum_multivalue.<locals>.Colorr   r4   r   r2   rB   rw  r3   r   r   Nr   r<   r<   r<   r=   r      s   r   r<  r|     r4   z'no values specified for MultiValue enumre  )
r   r   r   r<  rf   r   r]   r   rt   r   r   r<   r<   r=   test_extend_enum_multivalue  s    z,TestExtendEnumV3.test_extend_enum_multivaluec                 C   s  G dd dt }| tdt|dd | |jjd | |jjd | |j|v  | |d|j | |d|j | |d|j | |d |j | |j	jd	 | |j	jd
 | |j	|v  | |d
|j	 | |d|j	 | |d|j	 | |d |j
 | |j
jd | |j
jd | |j
|v  | |d|j
 | |d|j
 | |d|j
 | t|d d S )Nc                   @   s   e Zd ZdZdZdZdS )zATestExtendEnumV3.test_extend_enum_multivalue_alias.<locals>.Colorro  rp  rq  Nr   r<   r<   r<   r=   r     s   r   z0<Color.rojo: 7> is a duplicate of <Color.red: 1>r   r   r   r   r4   r   r2   rB   rw  r   r3   r   r   )r   rt   r   r   r   r   rf   r   r]   r   r   r   r   r<   r<   r=   !test_extend_enum_multivalue_alias  s.    z2TestExtendEnumV3.test_extend_enum_multivalue_aliasc                 C   s   G dd dt t}| |jt u  t|ddd | t||j|j|j	|j
g | |d|j
u  | |d|j
u  | |j
jdk | |j
jdk d S )Nc                   @   s   e Zd ZdZdZdZdS )z;TestExtendEnumV3.test_extend_enum_multivalue_str.<locals>.M)Zvalue_1VALUE_1)Zvalue_2VALUE_2)Zvalue_3VALUE_3N)r5   r6   r7   ru  rv  rw  r<   r<   r<   r=   r*  ,  s   r*  VALUE_4Zvalue_4)rS   r   r]   _member_type_r   r   r   ru  rv  rw  rx  rf   r   )rU   r*  r<   r<   r=   test_extend_enum_multivalue_str+  s     z0TestExtendEnumV3.test_extend_enum_multivalue_strc                 C   s   G dd dt }dD ]\}}t||| q| t|d | t||j|j|j|j|j	g | |jj
d | |jj
d d S )Nc                   @   s   e Zd ZdZdZdS )z3TestExtendEnumV3.test_extend_intenum.<locals>.Index     Nr5   r6   r7   
DeviceTypeErrorRegisterr<   r<   r<   r=   Index9  s   r  )ControlWordi@`  )
StatusWordA`  )OperationModei``  rB   r{  r  )r   r   r   r   r   r~  r  r  r  r  r   rU   r  rf   r   r<   r<   r=   test_extend_intenum8  s    $z$TestExtendEnumV3.test_extend_intenumc                 C   s   G dd dt }d}t|dddd t|dd	d
d | t||d  | t|dd  |j|jg | |jjd | |jjd | |jj	d | |jj
d | |jjd	 | |jjd | |jj	d
 | |jj
d d S )Nc                   @   s    e Zd Zdd ZdZdZdZdS )z;TestExtendEnumV3.test_extend_multi_init.<locals>.HTTPStatusc                 S   s"   t | |}||_||_||_|S rb   r)  r  _value_phrasedescriptionre   r   r  r  rg   r<   r<   r=   r  K  s
    zCTestExtendEnumV3.test_extend_multi_init.<locals>.HTTPStatus.__new__d   Continuez!Request received, please continuee   zSwitching Protocolsz.Switching to new protocol; obey Upgrade headerf   
Processingr5  Nr5   r6   r7   r  CONTINUESWITCHING_PROTOCOLS
PROCESSINGr<   r<   r<   r=   
HTTPStatusJ  s   r  r3   BAD_SPAM  
Too greasyfor a trainBAD_EGGS  	Too greenr5  r2   )r   r   r   r   r   r  r  r   rf   r  r  rU   r  lengthr<   r<   r=   test_extend_multi_initI  s"    
z'TestExtendEnumV3.test_extend_multi_initc                 C   s   G dd dt }t|d | |d|ju  | t|j| | |jjd t|dd | |d|ju  | t|j| | |jjd | t|t  d S )Nc                   @   s   e Zd ZdZdZdZdZdS )z0TestExtendEnumV3.test_extend_flag.<locals>.Colorr(   r   r2   r4   Nr5   r6   r7   r  r   r   r   r<   r<   r<   r=   r   g  s   r   MAGENTArw  PURPLEr   )	r   r   r]   r  r_   r   r   r  r^   r   r<   r<   r=   test_extend_flagf  s    
z!TestExtendEnumV3.test_extend_flagc                 C   s  G dd dt }t|dd | |d|ju  | t|j| | |jjd | t|t  t|d | |d|ju  | t|j| | |jjd t|d | |j	j
d | |j	jd | |j	|v  | |d|j	 | |d |j	 | t|d	 d S )
Nc                   @   s   e Zd ZdZdZdZdZdS )z:TestExtendEnumV3.test_extend_flag_backwards.<locals>.Colorr(   r   r2   r4   Nr  r<   r<   r<   r=   r   w  s   r   r  r   r  rw  re     rB   )r   r   r]   r  r_   r   r   r^   r  re  rf   r   r   r<   r<   r=   test_extend_flag_backwardsv  s"    

z+TestExtendEnumV3.test_extend_flag_backwardsc                 C   s  G dd dt }t|d | |d|ju  | t|j| | |jjd t|dd | |d|ju  | t|j| | |jjd | t|t	 t|d | |j
jd | |j
jd | |j
|v  | |d|j
 | |d |j
 | t|d	 d S )
Nc                   @   s   e Zd ZdZdZdZdZdS )z3TestExtendEnumV3.test_extend_intflag.<locals>.Colorr(   r   r2   r4   Nr  r<   r<   r<   r=   r     s   r   r  rw  r  r   re  r  rB   )r   r   r]   r  r_   r   r   r  r^   r   re  rf   r   r   r<   r<   r=   test_extend_intflag  s"    

z$TestExtendEnumV3.test_extend_intflagc                 C   s  G dd dt }t|dd | |d|ju  | t|j| | |jjd | t|t t|d | |d|j	u  | t|j	| | |j	jd t|d | |j
jd | |j
jd | |j
|v  | |d|j
 | |d |j
 | t|d	 d S )
Nc                   @   s   e Zd ZdZdZdZdZdS )z=TestExtendEnumV3.test_extend_intflag_backwards.<locals>.Colorr(   r   r2   r4   Nr  r<   r<   r<   r=   r     s   r   r  r   r  rw  re  r  rB   )r   r   r]   r  r_   r   r   r^   r   r  re  rf   r   r   r<   r<   r=   test_extend_intflag_backwards  s"    

z.TestExtendEnumV3.test_extend_intflag_backwardsc                 C   sN   G dd dt }t|d | |jjd | |jjd | t|d d S )Nc                   @   s   e Zd Ze Ze Ze ZdS )z3TestExtendEnumV3.test_extend_strenum.<locals>.ColorNr5   r6   r7   r   r   r   r   r<   r<   r<   r=   r     s   r   r  r  r4   r   r   r   r  rf   r   r   r   r<   r<   r=   test_extend_strenum  s
    
z$TestExtendEnumV3.test_extend_strenumzStdlib Enum not availablec                 C   s   G dd dt }| t|jdd d  t|dd | |jjd | |jjd | |j|v  | |d|j | |d |j | t	|d d S )Nc                   @   s   e Zd ZdZdZdZdS )z7TestExtendEnumV3.test_extend_enum_stdlib.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   Z_values_r<  r4   )
r   r   r  r   r   r<  rf   r   r]   r   r   r<   r<   r=   test_extend_enum_stdlib  s    z(TestExtendEnumV3.test_extend_enum_stdlibc                 C   s@  G dd dt }| tdt|dd t|dd | |jjd | |jjd | |j|v  | |d|j | |d |j | t	|d | t
||j|j|j|jg | dd	 |D g d
 t|d | |jjd | |jjd | |j|v  | |d|j | |d |j | t	|d d S )Nc                   @   s   e Zd ZdZdZdZdS )z=TestExtendEnumV3.test_extend_enum_plain_stdlib.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   zalready in use asr   rB   r<  r4   c                 S   s   g | ]
}|j qS r<   r  )r  rC  r<   r<   r=   r    r  zBTestExtendEnumV3.test_extend_enum_plain_stdlib.<locals>.<listcomp>)r   r2   r3   r4   re  )r   rt   r   r   r   r<  rf   r   r]   r   r   r   r   r   re  r   r<   r<   r=   test_extend_enum_plain_stdlib  s$     
z.TestExtendEnumV3.test_extend_enum_plain_stdlibc                 C   s   G dd dt }t|dd | |jjd | |jjd | |j|v  | |d|j | |d |j | t|d d S )Nc                   @   s   e Zd ZdZdZdZdS )z=TestExtendEnumV3.test_extend_enum_alias_stdlib.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   r   r   r   r3   )	r   r   r   r   rf   r   r]   r   r   r   r<   r<   r=   test_extend_enum_alias_stdlib  s    z.TestExtendEnumV3.test_extend_enum_alias_stdlibc                 C   s   G dd dt }t|dd | |jjd | |jjd | |j|v  | |d|j | |d |j | t|d | |jjd d S )Nc                   @   s   e Zd ZdZdZdZdS )zGTestExtendEnumV3.test_extend_enum_shadow_property_stdlib.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   r   r4   r   )r   r   r   r   rf   r]   r   r   r   r<   r<   r=   'test_extend_enum_shadow_property_stdlib  s    z8TestExtendEnumV3.test_extend_enum_shadow_property_stdlibc                 C   sf   G dd dt }G dd d|t}| tdt|dd | t|d | t||j|j	|j
g d S )	Nc                   @   s   e Zd Zdd ZdS )zCTestExtendEnumV3.test_extend_enum_shadow_base_stdlib.<locals>.hohumc                 S   s   | j S ri  r  r   r<   r<   r=   r     s    zHTestExtendEnumV3.test_extend_enum_shadow_base_stdlib.<locals>.hohum.cyanNrj  r<   r<   r<   r=   rk    s   rk  c                   @   s   e Zd ZdZdZdZdS )zCTestExtendEnumV3.test_extend_enum_shadow_base_stdlib.<locals>.Colorr   r2   r3   Nr   r<   r<   r<   r=   r     s   r   rl  r   r4   r3   )r  r   rt   r   r   r   r   r   r   r   r   rm  r<   r<   r=   #test_extend_enum_shadow_base_stdlib  s
    z4TestExtendEnumV3.test_extend_enum_shadow_base_stdlibzStdlib IntEnum not availablec                 C   s   G dd dt }dD ]\}}t||| q| t|d | t||j|j|j|j|j	g | |jj
d | |jj
d d S )Nc                   @   s   e Zd ZdZdZdS )z:TestExtendEnumV3.test_extend_intenum_stdlib.<locals>.Indexr{  r|  Nr}  r<   r<   r<   r=   r     s   r  r  rB   r{  r  )r   r   r   r   r   r~  r  r  r  r  r   r  r<   r<   r=   test_extend_intenum_stdlib  s    $z+TestExtendEnumV3.test_extend_intenum_stdlibc                 C   s   G dd dt }d}t|dddd t|dd	d
d | t||d  | t|dd  |j|jg | |jjd | |jjd | |jj	d | |jj
d | |jjd	 | |jjd | |jj	d
 | |jj
d d S )Nc                   @   s    e Zd Zdd ZdZdZdZdS )zBTestExtendEnumV3.test_extend_multi_init_stdlib.<locals>.HTTPStatusc                 S   s"   t | |}||_||_||_|S rb   r  r  r<   r<   r=   r  3  s
    zJTestExtendEnumV3.test_extend_multi_init_stdlib.<locals>.HTTPStatus.__new__r  r  r  Nr  r<   r<   r<   r=   r  2  s   r  r3   r  r  r  r  r  r  r  r5  r2   r  )r   r   r   r   r   r  r  r   rf   r  r  r  r<   r<   r=   test_extend_multi_init_stdlib0  s"    
z.TestExtendEnumV3.test_extend_multi_init_stdlibzStdlib Flag not availablec                 C   s   G dd dt }t|d | |d|ju  | t|j| | |jjd t|dd | |d|ju  | t|j| | |jjd | t|t  d S )Nc                   @   s   e Zd ZdZdZdZdZdS )z7TestExtendEnumV3.test_extend_flag_stdlib.<locals>.Colorr(   r   r2   r4   Nr  r<   r<   r<   r=   r   P  s   r   r  rw  r  r   )	r   r   r]   r  r_   r   r   r  r^   r   r<   r<   r=   test_extend_flag_stdlibN  s    
z(TestExtendEnumV3.test_extend_flag_stdlibc                 C   s  G dd dt }t|dd | |d|ju  | t|j| | |jjd | t|t  t|d | |d|ju  | t|j| | |jjd t|d | |j	j
d | |j	jd | |j	|v  | |d|j	 | |d |j	 d S )	Nc                   @   s   e Zd ZdZdZdZdZdS zATestExtendEnumV3.test_extend_flag_backwards_stdlib.<locals>.Colorr(   r   r2   r4   Nr  r<   r<   r<   r=   r   a  s   r   r  r   r  r  re      r   r   r]   r  r_   r   r   r^   r  re  rf   r   r<   r<   r=   !test_extend_flag_backwards_stdlib_  s     

z2TestExtendEnumV3.test_extend_flag_backwards_stdlibc                 C   s  G dd dt }t|dd | |d|ju  | t|j| | |jjd | t|t  t|d | |d|ju  | t|j| | |jjd t|d | |j	j
d | |j	jd | |j	|v  | |d|j	 | |d |j	 d S )	Nc                   @   s   e Zd ZdZdZdZdZdS r  r  r<   r<   r<   r=   r   z  s   r   r  r   r  rw  re  r  r  r   r<   r<   r=   r  x  s     

zStdlib IntFlag not availablec                 C   s  G dd dt }t|d | |d|ju  | t|j| | |jjd t|dd | |d|ju  | t|j| | |jjd | t|t	 t|d | |j
jd | |j
jd | |j
|v  | |d|j
 | |d |j
 d S )	Nc                   @   s   e Zd ZdZdZdZdZdS )z:TestExtendEnumV3.test_extend_intflag_stdlib.<locals>.Colorr(   r   r2   r4   Nr  r<   r<   r<   r=   r     s   r   r  rw  r  r   re  r  )r   r   r]   r  r_   r   r   r  r^   r   re  rf   r   r<   r<   r=   test_extend_intflag_stdlib  s     

z+TestExtendEnumV3.test_extend_intflag_stdlibc                 C   s<  G dd dt }ttkr&d}d}d}nd}d}d}t|dd	 | |d	|ju  | t|j| | |jjd	 | t	|t
 t|d
 | |||ju  | t|j| | |jj| t|d | |jjd | |jj| | |j|v  | |||j | |d |j | t||t| d S )Nc                   @   s   e Zd ZdZdZdZdZdS )zDTestExtendEnumV3.test_extend_intflag_backwards_stdlib.<locals>.Colorr(   r   r2   r4   Nr  r<   r<   r<   r=   r     s   r   rB   rw  r  r   r  r  r   r  re  )r   r   r%   r   r]   r  r_   r   r   r^   r   r  re  rf   r   r   )rU   r   r  r  re  r<   r<   r=   $test_extend_intflag_backwards_stdlib  s0    

z5TestExtendEnumV3.test_extend_intflag_backwards_stdlibzStdlib StrEnum not availablec                 C   sN   G dd dt }t|d | |jjd | |jjd | t|d d S )Nc                   @   s   e Zd Ze Ze Ze ZdS )z:TestExtendEnumV3.test_extend_strenum_stdlib.<locals>.ColorNr  r<   r<   r<   r=   r     s   r   r  r  r4   r  r   r<   r<   r=   test_extend_strenum_stdlib  s
    
z+TestExtendEnumV3.test_extend_strenum_stdlibN)'r5   r6   r7   r=  rf  rg  rh  rn  rs  rt  rz  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=   rd    sR   *






















"
rd  __main__zD'test_v3.py' should not be run by itself; it's included in 'test.py')Er5  r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rH  r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   collectionsr)   rT   r*   pickler+   r,   r-   r.   r  r/   r0   r  systempfiler  rS  ImportErrorSyntaxErrorru   r   RuntimeErrorr1   r  r  r  rU  rd  r5   r<   r<   r<   r=   <module>   sT   ,$$ $

       1|9 h0    H
