HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_dataclasses.cpython-37.opt-2.pyc
B

��g���@s�ddlTddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZddlmZmZmZddlmZddlZddlZGdd	�d	e�ZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�Z Gdd�dej�Z!Gdd�dej�Z"Gdd�dej�Z#Gdd�dej�Z$Gd d!�d!ej�Z%Gd"d#�d#ej�Z&Gd$d%�d%ej�Z'e(d&k�r�e�)�dS)'�)�*N)�Mock)	�ClassVar�Any�List�Union�Tuple�Dict�Generic�TypeVar�Optional)�get_type_hints)�deque�OrderedDict�
namedtuple)�total_orderingc@seZdZdS)�CustomErrorN)�__name__�
__module__�__qualname__�rr�1/usr/local/lib/python3.7/test/test_dataclasses.pyrsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAd@�Z"dBdC�Z#dDdE�Z$dFdG�Z%dHdI�Z&dJdK�Z'dLdM�Z(dNdO�Z)dPdQ�Z*dRdS�Z+dTdU�Z,dVdW�Z-dXdY�Z.dZd[�Z/d\d]�Z0d^d_�Z1d`da�Z2dbdc�Z3ddde�Z4dfdg�Z5dhdi�Z6djdk�Z7dldm�Z8dndo�Z9dpdq�Z:drds�Z;dtdu�Z<dvdw�Z=dxdy�Z>dzd{�Z?d|d}�Z@d~d�ZAd�d��ZBd�d��ZCd�d��ZDd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZd�d��Z[d�S)��TestCasecCs0tGdd�d��}|�}|�tt|��d�dS)Nc@seZdZdS)z"TestCase.test_no_fields.<locals>.CN)rrrrrrr�Csrr)�	dataclass�assertEqual�len�fields)�selfr�orrr�test_no_fieldsszTestCase.test_no_fieldscCs0tGdd�d��}|�}|�tt|��d�dS)Nc@seZdZdZdS)z6TestCase.test_no_fields_but_member_variable.<locals>.CrN)rrr�irrrrr!srr)rrrr)rrrrrr�"test_no_fields_but_member_variable sz+TestCase.test_no_fields_but_member_variablecCs,tGdd�d��}|d�}|�|jd�dS)Nc@seZdZUeed<dS)z-TestCase.test_one_field_no_default.<locals>.C�xN)rrr�int�__annotations__rrrrr)s
r�*)rrr#)rrrrrr�test_one_field_no_default(sz"TestCase.test_one_field_no_defaultc	Cs2d}|�t|��tGdd�d��}WdQRXdS)Nz/cannot specify both default and default_factoryc@s"eZdZUeded�Zeed<dS)z<TestCase.test_field_default_default_factory_error.<locals>.C�)�default�default_factoryr#N)rrr�fieldr$r#r%rrrrr3s
r)�assertRaisesRegex�
ValueErrorr)r�msgrrrr�(test_field_default_default_factory_error0sz1TestCase.test_field_default_default_factory_errorcCs8tdddd�}d|_t|�}dt�d�}|�||�dS)Nr(TF)r)�init�repr�idz4Field(name='id',type=None,default=1,default_factory=zX,init=True,repr=False,hash=None,compare=True,metadata=mappingproxy({}),_field_type=None))r+�namer1�MISSINGr)rZ	int_fieldZrepr_outputZexpected_outputrrr�test_field_repr7s
zTestCase.test_field_reprcCs.tGdd�d��}|dd�}|�|jd�dS)Nc@seZdZUeed<dS)z*TestCase.test_named_init_params.<locals>.Cr#N)rrrr$r%rrrrrDs
r� )r#)rrr#)rrrrrr�test_named_init_paramsCs
zTestCase.test_named_init_paramsc	Cs�tGdd�d��}|d�}|�|j|jfd�|�td��tGdd�d��}WdQRX|�td��,tGdd�d��}tGd	d�d|��}WdQRX|�td��,tGd
d�d��}tGdd�d|��}WdQRXdS)Nc@s"eZdZUeed<dZeed<dS)z/TestCase.test_two_fields_one_default.<locals>.Cr#r�yN)rrrr$r%r8rrrrrLs
r�)r9rz1non-default argument 'y' follows default argumentc@s"eZdZUdZeed<eed<dS)z/TestCase.test_two_fields_one_default.<locals>.Crr#r8N)rrrr#r$r%rrrrrXs
c@seZdZUdZeed<dS)z/TestCase.test_two_fields_one_default.<locals>.Brr#N)rrrr#r$r%rrrr�Bas
r:c@seZdZUeed<dS)z/TestCase.test_two_fields_one_default.<locals>.Cr8N)rrrr$r%rrrrres
c@seZdZUeed<eed<dS)z/TestCase.test_two_fields_one_default.<locals>.Br#r8N)rrrr$r%rrrrr:ns
c@seZdZUdZeed<dS)z/TestCase.test_two_fields_one_default.<locals>.Crr#N)rrrr#r$r%rrrrrss
)rrr#r8r,�	TypeError)rrrr:rrr�test_two_fields_one_defaultKs z$TestCase.test_two_fields_one_defaultc	Cs�tdd�Gdd�d��}|�t|d��d�tdd�Gdd�d��}|�t|d��td��|�td	��tdd
�Gdd�d��}WdQRXtdd
�Gdd�d��}|�t|d
��td��|�td	��tdd
�Gdd�d��}WdQRXdS)NT)�frozenc@seZdZUeed<dd�ZdS)z'TestCase.test_overwrite_hash.<locals>.Cr#cSsdS)Ni-r)rrrr�__hash__}sz0TestCase.test_overwrite_hash.<locals>.C.__hash__N)rrrr$r%r>rrrrrzs
r�di-c@seZdZUeed<dd�ZdS)z'TestCase.test_overwrite_hash.<locals>.Cr#cSsdS)NFr)r�otherrrr�__eq__�sz.TestCase.test_overwrite_hash.<locals>.C.__eq__N)rrrr$r%rArrrrr�s
)r?z#Cannot overwrite attribute __hash__)�unsafe_hashc@seZdZdd�ZdS)z'TestCase.test_overwrite_hash.<locals>.CcSsdS)Nr)rrrrr>�sz0TestCase.test_overwrite_hash.<locals>.C.__hash__N)rrrr>rrrrr�sc@seZdZUeed<dd�ZdS)z'TestCase.test_overwrite_hash.<locals>.Cr#cSsdS)Nr)rrrrrA�sz.TestCase.test_overwrite_hash.<locals>.C.__eq__N)rrrr$r%rArrrrr�s
�
)rCc@s&eZdZUeed<dd�Zdd�ZdS)z'TestCase.test_overwrite_hash.<locals>.Cr#cSsdS)Nr)rrrrrA�sz.TestCase.test_overwrite_hash.<locals>.C.__eq__cSsdS)Nr)rrrrr>�sz0TestCase.test_overwrite_hash.<locals>.C.__hash__N)rrrr$r%rAr>rrrrr�s
)rr�hashr,r;)rrrrr�test_overwrite_hashws"	zTestCase.test_overwrite_hashcCsptGdd�d��}tGdd�d|��}|�}|�t|�d�|�}|�t|�d�|dd�}|�t|�d	�dS)
Nc@s&eZdZUdZeed<dZeed<dS)z=TestCase.test_overwrite_fields_in_derived_class.<locals>.Baseg.@r#rr8N)rrrr#rr%r8r$rrrr�Base�s
rFc@s&eZdZUdZeed<dZeed<dS)z;TestCase.test_overwrite_fields_in_derived_class.<locals>.C1rC�z�r#N)rrrrGr$r%r#rrrr�C1�s
rIzJTestCase.test_overwrite_fields_in_derived_class.<locals>.Base(x=15.0, y=0)zLTestCase.test_overwrite_fields_in_derived_class.<locals>.C1(x=15, y=0, z=10)�)r#zKTestCase.test_overwrite_fields_in_derived_class.<locals>.C1(x=5, y=0, z=10))rrr1)rrFrIrrrr�&test_overwrite_fields_in_derived_class�s
z/TestCase.test_overwrite_fields_in_derived_classcCs�tGdd�d��}|d�}|�|jd�t�|j�}tt|j��}|�	d|�tGdd�d��}t�|j�}tt|j��}|�d|�dS)Nc@seZdZUeed<dS)z)TestCase.test_field_named_self.<locals>.CrN)rrr�strr%rrrrr�s
r�foorc@seZdZUeed<dS)z)TestCase.test_field_named_self.<locals>.CZselfxN)rrrrLr%rrrrr�s
)
rrr�inspect�	signature�__init__�next�iter�
parameters�assertNotEqual)rr�cZsig�firstrrr�test_field_named_self�szTestCase.test_field_named_selfcCs,tGdd�d��}|d�}|�|jd�dS)Nc@seZdZUeed<dS)z+TestCase.test_field_named_object.<locals>.C�objectN)rrrrLr%rrrrr�s
rrM)rrrX)rrrUrrr�test_field_named_object�sz TestCase.test_field_named_objectcCs2tdd�Gdd�d��}|d�}|�|jd�dS)NT)r=c@seZdZUeed<dS)z2TestCase.test_field_named_object_frozen.<locals>.CrXN)rrrrLr%rrrrr�s
rrM)rrrX)rrrUrrr�test_field_named_object_frozen�sz'TestCase.test_field_named_object_frozencstdddh�t�fdd�tj��D��}dd�|D�}td|�}|d	d�|D��}x|D]}|�t||�|�qVWdS)
N�None�True�Falsec3s$|]}|�d�s|�kr|VqdS)�__N)�
startswith)�.0�b)�
exclusionsrr�	<genexpr>�sz9TestCase.test_field_named_like_builtin.<locals>.<genexpr>cSsg|]}|tf�qSr)rL)r`r3rrr�
<listcomp>�sz:TestCase.test_field_named_like_builtin.<locals>.<listcomp>rcSsg|]}|�qSrr)r`r3rrrrd�s)�sorted�builtins�__dict__�keys�make_dataclassr�getattr)r�builtins_names�
attributesrrUr3r)rbr�test_field_named_like_builtin�s


z&TestCase.test_field_named_like_builtincsxdddh�t�fdd�tj��D��}dd�|D�}td|d	d
�}|dd�|D��}x|D]}|�t||�|�qZWdS)Nr[r\r]c3s$|]}|�d�s|�kr|VqdS)r^N)r_)r`ra)rbrrrc�sz@TestCase.test_field_named_like_builtin_frozen.<locals>.<genexpr>cSsg|]}|tf�qSr)rL)r`r3rrrrdszATestCase.test_field_named_like_builtin_frozen.<locals>.<listcomp>rT)r=cSsg|]}|�qSrr)r`r3rrrrds)rerfrgrhrirrj)rrkrlrrUr3r)rbr�$test_field_named_like_builtin_frozen�s

z-TestCase.test_field_named_like_builtin_frozenc
CstGdd�d��}tdd�Gdd�d��}x�||gD]�}|j|d���|�|�|��x|tdd	�d
d	�dd	�dd	�g�D]X\}}|j|d
��>|�td|j�d|j�d���||�|��WdQRXWdQRXqxWWdQRXq4Wtdd�Gdd�d��}|�|�|��|�|�|��dS)Nc@seZdZdS)z)TestCase.test_0_field_compare.<locals>.C0N)rrrrrrr�C0sroF)�orderc@seZdZdS)z)TestCase.test_0_field_compare.<locals>.C1N)rrrrrrrrIsrI)�clscSs||kS)Nr)�ararrr�<lambda>�z/TestCase.test_0_field_compare.<locals>.<lambda>cSs||kS)Nr)rrrarrrrsrtcSs||kS)Nr)rrrarrrrsrtcSs||kS)Nr)rrrarrrrsrt)�idxz$not supported between instances of 'z' and '�'Tc@seZdZdS)z(TestCase.test_0_field_compare.<locals>.CN)rrrrrrrrsr)	r�subTestr�	enumerater,r;r�assertLessEqual�assertGreaterEqual)rrorIrqru�fnrrrr�test_0_field_compare	s 
4zTestCase.test_0_field_comparec
Cs�tGdd�d��}tdd�Gdd�d��}x�||gD]�}|j|d���|�|d�|d��|�|d	�|d��x�td
d�dd�d
d�dd�g�D]\\}}|j|d��B|�td|j�d|j�d���||d	�|d	��WdQRXWdQRXq�WWdQRXq4Wtdd�Gdd�d��}|�|d	�|d��|�	|d	�|d��|�	|d�|d��|�
|d�|d	��|�|d�|d	��|�|d�|d��dS)Nc@seZdZUeed<dS)z)TestCase.test_1_field_compare.<locals>.C0r#N)rrrr$r%rrrrro's
roF)rpc@seZdZUeed<dS)z)TestCase.test_1_field_compare.<locals>.C1r#N)rrrr$r%rrrrrI+s
rI)rqr(rcSs||kS)Nr)rrrarrrrs3rtz/TestCase.test_1_field_compare.<locals>.<lambda>cSs||kS)Nr)rrrarrrrs4rtcSs||kS)Nr)rrrarrrrs5rtcSs||kS)Nr)rrrarrrrs6rt)ruz$not supported between instances of 'z' and 'rvTc@seZdZUeed<dS)z(TestCase.test_1_field_compare.<locals>.Cr#N)rrrr$r%rrrrr<s
r)rrwrrTrxr,r;r�
assertLessry�
assertGreaterrz)rrorIrqrur{rrrr�test_1_field_compare%s*
8zTestCase.test_1_field_comparec
Cs�tGdd�d��}tdd�Gdd�d��}�x||gD�]}|j|d���|�|dd�|dd��|�|d	d
�|d	d
��|�|d	d�|dd��|�|d	d�|d	d	��x�tdd�d
d�dd�dd�g�D]`\}}|j|d��F|�td|j�d|j�d���||dd�|dd��WdQRXWdQRXq�WWdQRXq6Wtdd�Gdd�d��}x\tdd�dd�dd�g�D]>\}}|j|d��"|�||dd�|dd���WdQRX�qrWx�tdd�dd�dd�g�D]v\}}|j|d��Z|�||dd�|dd	���|�||dd	�|d	d���|�||d	d�|d	d	���WdQRX�q�Wx�tdd�dd�dd�g�D]v\}}|j|d��Z|�||dd	�|dd���|�||d	d�|dd	���|�||d	d	�|d	d���WdQRX�qfWdS) Nc@seZdZUeed<eed<dS)z(TestCase.test_simple_compare.<locals>.C0r#r8N)rrrr$r%rrrrroHs
roF)rpc@seZdZUeed<eed<dS)z(TestCase.test_simple_compare.<locals>.C1r#r8N)rrrr$r%rrrrrIMs
rI)rqrr(�cSs||kS)Nr)rrrarrrrsXrtz.TestCase.test_simple_compare.<locals>.<lambda>cSs||kS)Nr)rrrarrrrsYrtcSs||kS)Nr)rrrarrrrsZrtcSs||kS)Nr)rrrarrrrs[rt)ruz$not supported between instances of 'z' and 'rvTc@seZdZUeed<eed<dS)z'TestCase.test_simple_compare.<locals>.Cr#r8N)rrrr$r%rrrrras
rcSs||kS)Nr)rrrarrrrsfrtcSs||kS)Nr)rrrarrrrsgrtcSs||kS)Nr)rrrarrrrshrtcSs||kS)Nr)rrrarrrrslrtcSs||kS)Nr)rrrarrrrsmrtcSs||kS)Nr)rrrarrrrsnrtcSs||kS)Nr)rrrarrrrstrtcSs||kS)Nr)rrrarrrrsurtcSs||kS)Nr)rrrarrrrsvrt)	rrwrrTrxr,r;r�
assertTrue)rrorIrqrur{rrrr�test_simple_compareFsH
<
,
,
zTestCase.test_simple_comparecCs�tGdd�d��}tGdd�d|��}x^tdd�dfdd�d	fg�D]>\}\}}|j|d
�� |�||d�|d��|�WdQRXqDWxntdd�d
d�dd�dd�g�D]J\}}|j|d
��0|�td��||d�|d��WdQRXWdQRXq�WdS)Nc@seZdZUeed<dS)z+TestCase.test_compare_subclasses.<locals>.Br!N)rrrr$r%rrrrr:s
r:c@seZdZdS)z+TestCase.test_compare_subclasses.<locals>.CN)rrrrrrrr�srcSs||kS)Nr)rrrarrrrs�rtz2TestCase.test_compare_subclasses.<locals>.<lambda>FcSs||kS)Nr)rrrarrrrs�rtT)rurcSs||kS)Nr)rrrarrrrs�rtcSs||kS)Nr)rrrarrrrs�rtcSs||kS)Nr)rrrarrrrs�rtcSs||kS)Nr)rrrarrrrs�rtz.not supported between instances of 'B' and 'C')rrxrwrr,r;)rr:rrur{�expectedrrr�test_compare_subclasses|s(
z TestCase.test_compare_subclassescCs��x|dD�]r\}}}|j||d���R|dkrd|�td�� t||d�Gdd�d��}WdQRX�nt||d�Gdd�d��}|dkr�|�d	|j�|�d
|j�|�d|j�|�d|j�|�d
|j�n�|dk�r |�d	|j�|�d
|j�|�d|j�|�d|j�|�d
|j�nR|dk�rr|�d	|j�|�d
|j�|�d|j�|�d|j�|�d
|j�nWdQRXqWdS)N))FF�neither)FT�	exception)TF�eq_only)TT�both)�eqrpr�z eq must be true if order is truec@seZdZdS)z!TestCase.test_eq_order.<locals>.CN)rrrrrrrr�src@seZdZdS)z!TestCase.test_eq_order.<locals>.CN)rrrrrrrr�sr�rA�__lt__�__le__�__gt__�__ge__r�r�)rwr,r-r�assertNotInrg�assertIn)rr�rp�resultrrrr�
test_eq_order�s2(

zTestCase.test_eq_orderc	CsFtGdd�d��}|�|d�jd�|�td��|�WdQRXdS)Nc@seZdZUe�Zeed<dS)z)TestCase.test_field_no_default.<locals>.Cr#N)rrrr+r#r$r%rrrrr�s
rrJz8__init__\(\) missing 1 required positional argument: 'x')rrr#r,r;)rrrrr�test_field_no_default�s
zTestCase.test_field_no_defaultcsft��tG�fdd�d��}|�|j��|d�}|�|jd�|`|�|j��|�|�j��dS)Ncs eZdZUe�d�Zeed<dS)z&TestCase.test_field_default.<locals>.C)r)r#N)rrrr+r#rXr%r)r)rrr�s
rrC)rXr�assertIsr#r)rrrUr)r)r�test_field_default�szTestCase.test_field_defaultc	CsvtGdd�d��}|�t��|�WdQRX|d�}|�t|�d�tGdd�d��}|dd�}|�t|�d�dS)Nc@s eZdZUedd�Zeed<dS)z$TestCase.test_not_in_repr.<locals>.CF)r1r#N)rrrr+r#r$r%rrrrr�s
rrCz&TestCase.test_not_in_repr.<locals>.C()c@s(eZdZUedd�Zeed<eed<dS)z$TestCase.test_not_in_repr.<locals>.CF)r1r#r8N)rrrr+r#r$r%rrrrr�s
�z*TestCase.test_not_in_repr.<locals>.C(y=20))r�assertRaisesr;rr1)rrrUrrr�test_not_in_repr�s
zTestCase.test_not_in_reprcCsptGdd�d��}|�|�|dd��|�|dd�|dd��|�|d�|dd��|�|dd�|dd��dS)	Nc@s.eZdZUdZeed<eddd�Zeed<dS)z'TestCase.test_not_in_compare.<locals>.Crr#F�)�comparer)r8N)rrrr#r$r%r+r8rrrrr�s
rrr�r(rCr9r�)rrrT)rrrrr�test_not_in_compare�s
zTestCase.test_not_in_comparec
s�x�dD]�\��}|j��d��htdd�G��fdd�d��}|dkr`|�t|d��td	��n"|d
kr�|�t|d��td��nWdQRXqWdS)N))TFr+)TTr+)FF�absent)FTr�)NFr�)NTr+)rDr�T)rBcs$eZdZUe��dd�Zeed<dS)z)TestCase.test_hash_field_rules.<locals>.CrJ)r�rDr)r#N)rrrr+r#r$r%r)r��hash_rrrs
rr+rJ)rJr�r)rwrrrD)rr�rr)r�r�r�test_hash_field_rules�szTestCase.test_hash_field_rulescCsftGdd�d��}|�d|�j�tGdd�d��}|�d|d�j�|�t|d��dddd	��dS)
Nc@s eZdZUedd�Zeed<dS)z.TestCase.test_init_false_no_default.<locals>.CF)r0r#N)rrrr+r#r$r%rrrrrs
rr#c@s@eZdZUeed<dZeed<edd�Zeed<dZeed<d	S)
z.TestCase.test_init_false_no_default.<locals>.Cr#rr8F)r0rGrC�tN)	rrrr$r%r8r+rGr�rrrrrs
rGrrJrC)r�r#r8)rr�rgr�vars)rrrrr�test_init_false_no_defaults
z#TestCase.test_init_false_no_defaultcCsdtGdd�d��}t|�}|�|t�x,|D]$}|�t|�t�|�|j|j	�q,W|�
t|�d�|�
|djd�|�
|djt�|�
t|d��|�|dj�|�|dj�|�
|djd�|�
|djt�|�t|d��|�
|dj�|�|dj�|�
|djd	�|�
|djt�|�
t|d	��|�|dj�|�
|dj�dS)
Nc@s<eZdZUeed<eddd�Zeed<edd�Zeed<dS)z%TestCase.test_class_marker.<locals>.Cr#FN)r0r)r8)r1rG)	rrrr$r%r+r8rLrGrrrrr#s
rr9rr#r(r8r�rG)rr�assertIsInstance�tupler��typeZFieldr�r3r%rrr$�assertFalse�hasattrr�r0r1rL�assertIsNonerj)rrZ
the_fields�frrr�test_class_marker"s,
zTestCase.test_class_markercCs�tGdd�d��}tGdd�d|��}|�dd�t|�D�ddd	g�tGd
d�d|��}|�dd�t|�D�dd
dg�tGdd�d|��}|�dd�t|�D�dd
ddg�dS)Nc@s2eZdZUdZeed<dZeed<dZeed<dS)z$TestCase.test_field_order.<locals>.BzB:arrzB:brazB:crUN)rrrrrrLr%rarUrrrrr:Ds
r:c@seZdZUdZeed<dS)z$TestCase.test_field_order.<locals>.CzC:braN)rrrrarLr%rrrrrJs
rcSsg|]}|j|jf�qSr)r3r))r`r�rrrrdNsz-TestCase.test_field_order.<locals>.<listcomp>)rrzB:a)razC:b)rUzB:cc@seZdZUdZeed<dS)z$TestCase.test_field_order.<locals>.DzD:crUN)rrrrUrLr%rrrr�DSs
r�cSsg|]}|j|jf�qSr)r3r))r`r�rrrrdWs)razB:b)rUzD:cc@s&eZdZUdZeed<dZeed<dS)z$TestCase.test_field_order.<locals>.EzE:arrzE:d�dN)rrrrrrLr%r�rrrr�E\s
r�cSsg|]}|j|jf�qSr)r3r))r`r�rrrrdas)rrzE:a)r�zE:d)rrr)rr:rr�r�rrr�test_field_orderCs(zTestCase.test_field_ordercs\t��tG�fdd�d��}|�t|d��|�t|d��|�|j��|�|jd�dS)NcsFeZdZUeed<edd�Zeed<�Zeed<edd�Z	eed<d	S)
z$TestCase.test_class_attrs.<locals>.Cr#F)r1r8rGr?)r)r�N)
rrrr$r%r+r8rGrXr�r)r)rrrks
rr#r8r?)rXrr�r�r�rGrr�)rrr)r)r�test_class_attrsgszTestCase.test_class_attrscs8�x0tgdgftiddiftt�tdg�fgD�]\���|j�d���|�td��d���tG��fdd�d��}WdQRX|�td��d���tG��fd	d�d��}WdQRXGd
d�d���|�td��tG��fd
d�d��}WdQRXtG�fdd�d��}tG��fdd�d��}WdQRXq.WdS)Nr(r)�typzmutable default z for field x is not allowedcseZdZU�Z�ed<dS)z8TestCase.test_disallowed_mutable_defaults.<locals>.Pointr#N)rrrr#r%r)�emptyr�rr�Point�s
r�z for field y is not allowedcseZdZU�Z�ed<dS)z8TestCase.test_disallowed_mutable_defaults.<locals>.Pointr8N)rrrr8r%r)�	non_emptyr�rrr��s
c@seZdZdS)z;TestCase.test_disallowed_mutable_defaults.<locals>.SubclassN)rrrrrrr�Subclass�sr�z7mutable default .*Subclass'> for field z is not allowedcseZdZU��Z�ed<dS)z8TestCase.test_disallowed_mutable_defaults.<locals>.PointrGN)rrrrGr%r)r�r�rrr��s
cs eZdZU��Ze�ed<dS)z4TestCase.test_disallowed_mutable_defaults.<locals>.CrGN)rrrrGrr%r)r�rrr�s
rcs eZdZU��Ze�ed<dS)z4TestCase.test_disallowed_mutable_defaults.<locals>.Cr#N)rrrr#rr%r)r�r�rrr�s
)�list�dict�setrwr,r-r)rr�rr)r�r�r�r�r� test_disallowed_mutable_defaultsws  """z)TestCase.test_disallowed_mutable_defaultscs�Gdd�d��tG�fdd�d��}��}||�}||�}|�||�|jj�ddg�|�||�|�|jjddg�|�|j|j�dS)Nc@seZdZdd�ZdS)z<TestCase.test_deliberately_mutable_defaults.<locals>.MutablecSs
g|_dS)N)�l)rrrrrP�szETestCase.test_deliberately_mutable_defaults.<locals>.Mutable.__init__N)rrrrPrrrr�Mutable�sr�cseZdZU�ed<dS)z6TestCase.test_deliberately_mutable_defaults.<locals>.Cr#N)rrrr%r)r�rrr�s
rr(r�)rrr#r��extendr�)rr�lstZo1Zo2r)r�r�"test_deliberately_mutable_defaults�sz+TestCase.test_deliberately_mutable_defaultscCs*t�Gdd�d��}|�|d�jd�dS)Nc@seZdZUeed<dS)z#TestCase.test_no_options.<locals>.Cr#N)rrrr$r%rrrrr�s
rr&)rrr#)rrrrr�test_no_options�szTestCase.test_no_optionscCsRtGdd�d��}|�|dd�d�tGdd�d��}|�|dd�|dd��dS)	Nc@seZdZUeed<eed<dS)z&TestCase.test_not_tuple.<locals>.Pointr#r8N)rrrr$r%rrrrr��s
r�r(r�)r(r�c@seZdZUeed<eed<dS)z"TestCase.test_not_tuple.<locals>.Cr#r8N)rrrr$r%rrrrr�s
rr9)rrT)rr�rrrr�test_not_tuple�szTestCase.test_not_tuplec	Cs�tGdd�d��}tGdd�d��}|�|ddd�|ddd��|�|dd	d�d
�|�td��|dd
d�\}}}WdQRXtGdd�d��}|�|ddd�|��dS)Nc@s&eZdZUeed<eed<eed<dS)z(TestCase.test_not_tuple.<locals>.Point3Dr#r8rGN)rrrr$r%rrrr�Point3D�s
r�c@s&eZdZUeed<eed<eed<dS)z%TestCase.test_not_tuple.<locals>.DateZyearZmonthZdayN)rrrr$r%rrrr�Date�s
r�i��r9r(r�)r(r�r9�unpackr�rJc@s2eZdZUdZeed<dZeed<dZeed<dS)z*TestCase.test_not_tuple.<locals>.Point3Dv1rr#r8rGN)rrrr#r$r%r8rGrrrr�	Point3Dv1�s
r�r)rrTr,r;)rr�r�r#r8rGr�rrrr��scsnGdd�d�������fdd�}tG��fdd�d��}||�tddd�G��fd	d�d��}||�dS)
Nc@seZdZdS)z-TestCase.test_function_annotations.<locals>.FN)rrrrrrr�F�sr�cs���|jdt���|jdt���|jd����|jdt���|jdt�t�|j�}��	|j
d�t|j�
��}t|�}��|jd�t|�}��|jd���	|jt���|jtjj���|jtjj�t|�}��|jd���	|jt���|jtjj���|jtjj�t|�}��|jd���	|j����|jtjj�t|�}��|jd���	|jt���|jtjj���tt|�dS)Nr!�j�kr�rGr)rr%r$rL�float�complexrNrOrPr�Zreturn_annotationrRrS�valuesrQr3Z
annotationr)Z	Parameterr��kindZPOSITIONAL_OR_KEYWORDr��
StopIteration)rqrO�paramsZparam)r�rrr�validate_class�s:z:TestCase.test_function_annotations.<locals>.validate_classcsPeZdZUeed<eed<�Z�ed<edd�Ze	ed<eddd	�Z
eed
<dS)z-TestCase.test_function_annotations.<locals>.Cr!r�r�N)r)r�y@@F)r)r0rG)rrrr$r%rLr�r+r�r�rGr�r)r�r�rrr s

rT)r=rBcsPeZdZUeed<eed<�Z�ed<edd�Ze	ed<eddd	�Z
eed
<dS)z-TestCase.test_function_annotations.<locals>.Cr!r�r�N)r)r�y@@F)r)r0rG)rrrr$r%rLr�r+r�r�rGr�r)r�r�rrr+s

)r)rr�rr)r�r�rr�test_function_annotations�s+ z"TestCase.test_function_annotationsc	Cs�tGdd�d��}|�td��|�WdQRX|�d|j�tGdd�d��}|�td��|�WdQRX|�d|j�dS)Nc@s eZdZUeed�Zeed<dS)z(TestCase.test_missing_default.<locals>.C)r)r#N)rrrr+r4r#r$r%rrrrr8s
rz3__init__\(\) missing 1 required positional argumentr#c@seZdZUeed<dS)z(TestCase.test_missing_default.<locals>.Dr#N)rrrr$r%rrrrr�As
r�)rr,r;r�rg)rrr�rrr�test_missing_default5szTestCase.test_missing_defaultc	Cs�tGdd�d��}|�td��|�WdQRX|�d|j�tGdd�d��}|�td��|�WdQRX|�d|j�dS)Nc@s eZdZUeed�Zeed<dS)z0TestCase.test_missing_default_factory.<locals>.C)r*r#N)rrrr+r4r#r$r%rrrrrNs
rz3__init__\(\) missing 1 required positional argumentr#c@s"eZdZUeeed�Zeed<dS)z0TestCase.test_missing_default_factory.<locals>.D)r)r*r#N)rrrr+r4r#r$r%rrrrr�Ws
r�)rr,r;r�rg)rrr�rrr�test_missing_default_factoryJsz%TestCase.test_missing_default_factorycCs|�dtt��dS)NzMISSING_TYPE object)r�r1r4)rrrr�test_missing_repr`szTestCase.test_missing_reprcCsbtGdd�d��}|�t|j�dg�|�|d���d�|�|d�jd�|�|d�jd�dS)Nc@s6eZdZUeed<ed�dd�Zeed�dd��ZdS)z7TestCase.test_dont_include_other_annotations.<locals>.Cr!)�returncSsdS)Nr�r)rrrrrMgsz;TestCase.test_dont_include_other_annotations.<locals>.C.foocSsdS)NrJr)rrrr�barisz;TestCase.test_dont_include_other_annotations.<locals>.C.barN)rrrr$r%rM�propertyr�rrrrrds
rr!rCr�rJ)rrr�r%rMr�r!)rrrrr�#test_dont_include_other_annotationscs
z,TestCase.test_dont_include_other_annotationsc	Cs�tGdd�d��}|�t��|�WdQRXtGdd�d��}|�t��|�WdQRX|d�tdd�Gdd�d��}|�tGdd�d��}|�|�jd	�|�|d
�jd�tdd
�Gdd�d��}|�t��|�WdQRXdS)Nc@seZdZdd�ZdS)z"TestCase.test_post_init.<locals>.CcSs
t��dS)N)r)rrrr�
__post_init__usz0TestCase.test_post_init.<locals>.C.__post_init__N)rrrr�rrrrrssrc@s"eZdZUdZeed<dd�ZdS)z"TestCase.test_post_init.<locals>.CrCr!cSs|jdkrt��dS)NrC)r!r)rrrrr�}s
z0TestCase.test_post_init.<locals>.C.__post_init__N)rrrr!r$r%r�rrrrrzs
rJF)r0c@seZdZdd�ZdS)z"TestCase.test_post_init.<locals>.CcSs
t��dS)N)r)rrrrr��sz0TestCase.test_post_init.<locals>.C.__post_init__N)rrrr�rrrrr�sc@s"eZdZUdZeed<dd�ZdS)z"TestCase.test_post_init.<locals>.Crr#cSs|jd9_dS)Nr�)r#)rrrrr��sz0TestCase.test_post_init.<locals>.C.__post_init__N)rrrr#r$r%r�rrrrr�s
rr�r�T)r=c@s"eZdZUdZeed<dd�ZdS)z"TestCase.test_post_init.<locals>.Crr#cSs|jd9_dS)Nr�)r#)rrrrr��sz0TestCase.test_post_init.<locals>.C.__post_init__N)rrrr#r$r%r�rrrrr�s
)rr�rrr#�FrozenInstanceError)rrrrr�test_post_initqszTestCase.test_post_initc	Cs�Gdd�d�}tGdd�d|��}|�|�jd�tGdd�d|��}|�t��|�WdQRXtGdd�d|��}|�t��|�WdQRXdS)Nc@seZdZdd�ZdS)z(TestCase.test_post_init_super.<locals>.BcSs
t��dS)N)r)rrrrr��sz6TestCase.test_post_init_super.<locals>.B.__post_init__N)rrrr�rrrrr:�sr:c@seZdZdd�ZdS)z(TestCase.test_post_init_super.<locals>.CcSs
d|_dS)NrJ)r#)rrrrr��sz6TestCase.test_post_init_super.<locals>.C.__post_init__N)rrrr�rrrrr�srrJcseZdZ�fdd�Z�ZS)z(TestCase.test_post_init_super.<locals>.Ccst���dS)N)�superr�)r)�	__class__rrr��sz6TestCase.test_post_init_super.<locals>.C.__post_init__)rrrr��
__classcell__rr)r�rr�sc@seZdZdS)z(TestCase.test_post_init_super.<locals>.CN)rrrrrrrr�s)rrr#r�r)rr:rrrr�test_post_init_super�szTestCase.test_post_init_supercsPd�tG�fdd�d��}|���|dd�}|�|j|jfd�|���dS)NFcs.eZdZUeed<eed<e�fdd��ZdS)z/TestCase.test_post_init_staticmethod.<locals>.Cr#r8csd�dS)NTrr)�flagrrr��sz=TestCase.test_post_init_staticmethod.<locals>.C.__post_init__N)rrrr$r%�staticmethodr�r)r�rrr�s
rr9r�)r9r�)rr�rr#r8r�)rrrUr)r�r�test_post_init_staticmethod�s	

z$TestCase.test_post_init_staticmethodcCsLtGdd�d��}|�|j�|dd�}|�|j|jfd�|�|j�dS)Nc@s.eZdZUdZeed<eed<edd��ZdS)z.TestCase.test_post_init_classmethod.<locals>.CFr#r8cSs
d|_dS)NT)r�)rqrrrr��sz<TestCase.test_post_init_classmethod.<locals>.C.__post_init__N)rrrr�r$r%�classmethodr�rrrrr�s
rr9r�)r9r�)rr�r�rr#r8r�)rrrUrrr�test_post_init_classmethod�s
	
z#TestCase.test_post_init_classmethodcCs�tGdd�d��}|d�}|�t|�d�|�tt|��d�|�t|j�d�|�|jd�|�|jd�|�|jd	�|�|j	d
�|jd7_|�|jd�|d
�}|�|j
|jfd�|�|jd�|�|jd�|�|jd	�|�|j	d
�dS)Nc@s^eZdZUeed<dZeed<dZeeed<dZeeed<dZ	eeed	<d
Z
eed<dS)
z"TestCase.test_class_var.<locals>.Cr#rCr8i�rGi��wi�r�i��sN)rrrr$r%r8rGrr�r�r�rrrrr�s
rrJz-TestCase.test_class_var.<locals>.C(x=5, y=10)r�r�i�i�i�i�r(i�r�)r�rC)rrr1rrr%rGr�r�r�r#r8)rrrUrrr�test_class_var�s"	zTestCase.test_class_varcCs$tGdd�d��}|�d|j�dS)Nc@seZdZUeeed<dS)z-TestCase.test_class_var_no_default.<locals>.Cr#N)rrrrr$r%rrrrr�s
rr#)rr�rg)rrrrr�test_class_var_no_default�sz"TestCase.test_class_var_no_defaultc	Cs<|�td��&tGdd�d��}|�d|j�WdQRXdS)Nzcannot have a default factoryc@s$eZdZUeed�Zeeed<dS)z2TestCase.test_class_var_default_factory.<locals>.C)r*r#N)rrrr+r$r#rr%rrrrrs
rr#)r,r;rr�rg)rrrrr�test_class_var_default_factorysz'TestCase.test_class_var_default_factorycCsDtGdd�d��}|�|jd�tGdd�d��}|�|jd�dS)Nc@seZdZUdZeeed<dS)z/TestCase.test_class_var_with_default.<locals>.CrCr#N)rrrr#rr$r%rrrrrs
rrCc@s$eZdZUedd�Zeeed<dS)z/TestCase.test_class_var_with_default.<locals>.CrC)r)r#N)rrrr+r#rr$r%rrrrrs
)rrr#)rrrrr�test_class_var_with_default
sz$TestCase.test_class_var_with_defaultcCs�tdd�Gdd�d��}|d�}|�t|d��d�|�tt|��d�|�t|j�d�|�|jd�|�|jd	�|�|jd
�|jd7_|�|jd�|d
�}|�|j	|j
fd�|�|jd�|�|jd	�|�|jd
�dS)NT)r=c@sReZdZUeed<dZeed<dZeeed<dZeeed<dZ	eeed	<d
S)z)TestCase.test_class_var_frozen.<locals>.Cr#rCr8i�rGi�r�i�r�N)
rrrr$r%r8rGrr�r�rrrrrs

rrJz4TestCase.test_class_var_frozen.<locals>.C(x=5, y=10)r�i�i�i�r(i�r�)r�rC)rrr1rrr%rGr�r�r#r8)rrrUrrr�test_class_var_frozenszTestCase.test_class_var_frozencCs$tGdd�d��}|�d|j�dS)Nc@seZdZUeeed<dS)z,TestCase.test_init_var_no_default.<locals>.Cr#N)rrr�InitVarr$r%rrrrr6s
rr#)rr�rg)rrrrr�test_init_var_no_default4sz!TestCase.test_init_var_no_defaultc	Cs<|�td��&tGdd�d��}|�d|j�WdQRXdS)Nzcannot have a default factoryc@s$eZdZUeed�Zeeed<dS)z1TestCase.test_init_var_default_factory.<locals>.C)r*r#N)rrrr+r$r#r�r%rrrrrAs
rr#)r,r;rr�rg)rrrrr�test_init_var_default_factory<sz&TestCase.test_init_var_default_factorycCsDtGdd�d��}|�|jd�tGdd�d��}|�|jd�dS)Nc@seZdZUdZeeed<dS)z.TestCase.test_init_var_with_default.<locals>.CrCr#N)rrrr#r�r$r%rrrrrIs
rrCc@s$eZdZUedd�Zeeed<dS)z.TestCase.test_init_var_with_default.<locals>.CrC)r)r#N)rrrr+r#r�r$r%rrrrrNs
)rrr#)rrrrr�test_init_var_with_defaultGsz#TestCase.test_init_var_with_defaultcCs.tGdd�d��}|dd�}|�|jd�dS)Nc@s2eZdZUdZeed<dZeeed<dd�ZdS)z!TestCase.test_init_var.<locals>.CNr#�
init_paramcSs|jdkr|d|_dS)Nr�)r#)rr�rrrr�Ys
z/TestCase.test_init_var.<locals>.C.__post_init__)	rrrr#r$r%r�r�r�rrrrrTs
rrC)r�r�)rrr#)rrrUrrr�
test_init_varSs	
zTestCase.test_init_varcCsltGdd�d��}|dd�}|�t|�ddi�tGdd�d|��}|ddd	d
�}|�t|�ddd
��dS)Nc@s"eZdZUeed<eeed<dS)z0TestCase.test_init_var_inheritance.<locals>.Baser#�	init_baseN)rrrr$r%r�rrrrrFds
rFrrCr#c@s*eZdZUeed<eeed<dd�ZdS)z-TestCase.test_init_var_inheritance.<locals>.Cr8�init_derivedcSs|j||_|j||_dS)N)r#r8)rr�r�rrrr�ssz;TestCase.test_init_var_inheritance.<locals>.C.__post_init__N)rrrr$r%r�r�rrrrrns
r��2�3��e)r#r8)rrr�)rrFrarrUrrr�test_init_var_inheritance`s
z"TestCase.test_init_var_inheritancecs�tGdd�d��}|d�}|d�}|�|jd�|�|jg�|�||�|�|j|j�|�t|ddg��ddgf�g�tG�fdd�d��}|d�}|d�}|�|jd�|�|jg�|�||�|�|j|j�|�t|ddg��ddgf�tGdd�d��}|�t|��d�|�|�jg�td	d
�Gdd�d��}|�t|��gf�|�t|��td��tGd
d�d��}|�t|��gf�tGdd�d��}|�|�|dg��dS)Nc@s(eZdZUeed<eed�Zeed<dS)z(TestCase.test_default_factory.<locals>.Cr#)r*r8N)rrrr$r%r+r�r8rrrrr|s
rr9rJr(cs0eZdZUeed<e�fdd�d�Zeed<dS)z(TestCase.test_default_factory.<locals>.Cr#cs�S)Nrr)r�rrrs�rtz1TestCase.test_default_factory.<locals>.C.<lambda>)r*r8N)rrrr$r%r+r8r�r)r�rrr�s
c@s"eZdZUeedd�Zeed<dS)z(TestCase.test_default_factory.<locals>.CF)r*r1r#N)rrrr+r�r#r%rrrrr�s
z*TestCase.test_default_factory.<locals>.C()T)rBc@s"eZdZUeedd�Zeed<dS)z(TestCase.test_default_factory.<locals>.CF)r*rDr#N)rrrr+r�r#r%rrrrr�s
rc@s"eZdZUeedd�Zeed<dS)z(TestCase.test_default_factory.<locals>.CF)r*r0r#N)rrrr+r�r#r%rrrrr�s
c@s"eZdZUeedd�Zeed<dS)z(TestCase.test_default_factory.<locals>.CF)r*r�r#N)rrrr+r�r#r%rrrrr�s
)	rrr#r8�assertIsNot�astupler�r1rD)rrZc0�c1r)r�r�test_default_factoryzs6zTestCase.test_default_factorycsLt��tG�fdd�d��}|�j|��jd�|�j|��jd�dS)Ncs"eZdZUe�dd�Zeed<dS)z5TestCase.test_default_factory_with_no_init.<locals>.CF)r*r0r#N)rrrr+r#r�r%r)�factoryrrr�s
rr(r�)rrr#r�
call_count)rrr)r�r�!test_default_factory_with_no_init�sz*TestCase.test_default_factory_with_no_initcslt��tG�fdd�d��}|�j|��jd�|�|d�jd�|��jd�|�j|��jd�dS)Ncs eZdZUe�d�Zeed<dS)zBTestCase.test_default_factory_not_called_if_value_given.<locals>.C)r*r#N)rrrr+r#r$r%r)r�rrr�s
rr(rCr�)rrr#rr�)rrr)r�r�.test_default_factory_not_called_if_value_given�sz7TestCase.test_default_factory_not_called_if_value_givencCs~tGdd�d��}tGdd�d|��}|�|�ji�|�|�ji�|�|�jd�tGdd�d|��}|�|�ji�dS)Nc@s eZdZUeed�Zeed<dS)z2TestCase.test_default_factory_derived.<locals>.Foo)r*r#N)rrrr+r�r#r%rrrr�Foo�s
r�c@seZdZUdZeed<dS)z2TestCase.test_default_factory_derived.<locals>.Barr(r8N)rrrr8r$r%rrrr�Bar�s
r�r(c@seZdZdS)z2TestCase.test_default_factory_derived.<locals>.BazN)rrrrrrr�Baz�sr)rrr#r8)rr�r�rrrr�test_default_factory_derived�sz%TestCase.test_default_factory_derivedc	Cs�tGdd�d��}Gdd�d|�}tGdd�d|��}|dd�}|�|j|jfd	�|�td
��|jWdQRXGdd�d|�}|d
d�}|�|j|jfd�dS)Nc@seZdZUeed<dS)z3TestCase.test_intermediate_non_dataclass.<locals>.Ar#N)rrrr$r%rrrr�A�s
rc@seZdZUeed<dS)z3TestCase.test_intermediate_non_dataclass.<locals>.Br8N)rrrr$r%rrrrr:�s
r:c@seZdZUeed<dS)z3TestCase.test_intermediate_non_dataclass.<locals>.CrGN)rrrr$r%rrrrr�s
rr(r9)r(r9zobject has no attributec@seZdZUeed<dS)z3TestCase.test_intermediate_non_dataclass.<locals>.Dr�N)rrrr$r%rrrrr��s
r�r�rJ)r�rJ)rrr#rGr,�AttributeErrorr8)rrr:rrUr�r�rrr�test_intermediate_non_dataclass�s

z(TestCase.test_intermediate_non_dataclassc	Cs.|�td��tGdd�d��}WdQRXdS)Nzcannot have a default factoryc@s$eZdZUeed�Zeeed<dS)z1TestCase.test_classvar_default_factory.<locals>.C)r*r#N)rrrr+r$r#rr%rrrrrs
r)r,r;r)rrrrr�test_classvar_default_factorysz&TestCase.test_classvar_default_factorycs�Gdd�d�}|�td��|�tt��|�t|��|�t|���tGdd�d���tG�fdd�d��}�d�}||d	�}|�t���|�t|��|�t|j��|�t|j��|�t|j��dS)
Nc@seZdZdS)z0TestCase.test_is_dataclass.<locals>.NotDataClassN)rrrrrrr�NotDataClasssrrc@seZdZUeed<dS)z%TestCase.test_is_dataclass.<locals>.Cr#N)rrrr$r%rrrrrs
rcseZdZU�ed<eed<dS)z%TestCase.test_is_dataclass.<locals>.Dr��eN)rrrr%r$r)rrrr�s
r�rCr�)r��is_dataclassr$rr�r#r�r)rrr�rUr�r)rr�test_is_dataclass
s
zTestCase.test_is_dataclasscCs�Gdd�d�}|�t|��|�}Gdd�d�}|�}g|_x�||fD]�}|j|d��x|�t|��|�td��t|�WdQRX|�td��t|�WdQRX|�td��t|dd�WdQRXWdQRXqFWdS)	Nc@seZdZdd�ZdS)zATestCase.test_is_dataclass_when_getattr_always_returns.<locals>.AcSsdS)Nrr)r�keyrrr�__getattr__(szMTestCase.test_is_dataclass_when_getattr_always_returns.<locals>.A.__getattr__N)rrrrrrrrr'src@seZdZdS)zATestCase.test_is_dataclass_when_getattr_always_returns.<locals>.BN)rrrrrrrr:.sr:)�objz'should be called on dataclass instancesr)r#)	r�rZ__dataclass_fields__rwr,r;�asdictr��replace)rrrrr:rarrrr�-test_is_dataclass_when_getattr_always_returns%sz6TestCase.test_is_dataclass_when_getattr_always_returnscCs0tGdd�d��}|�t|�t|dd���dS)Nc@seZdZUeed<eed<dS)z:TestCase.test_helper_fields_with_class_instance.<locals>.Cr#r8N)rrrr$r%r�rrrrrBs
rrg)rrr)rrrrr�&test_helper_fields_with_class_instance?sz/TestCase.test_helper_fields_with_class_instancec	Cst|�td��td�WdQRXGdd�d�}|�td��t|�WdQRX|�td��t|��WdQRXdS)Nzdataclass type or instancerc@seZdZdS)z0TestCase.test_helper_fields_exception.<locals>.CN)rrrrrrrrOsr)r,r;r)rrrrr�test_helper_fields_exceptionIsz%TestCase.test_helper_fields_exceptioncCs�tGdd�d��}|dd�}|�t|�ddd��|�t|�t|��|�t|�t|��d|_|�t|�ddd��|�tt|��t�dS)Nc@seZdZUeed<eed<dS)z&TestCase.test_helper_asdict.<locals>.Cr#r8N)rrrr$r%rrrrrWs
rr(r�)r#r8r&)rrr
r�r#r�r�r�)rrrUrrr�test_helper_asdictUs
zTestCase.test_helper_asdictc	CsVtGdd�d��}|�td��t|�WdQRX|�td��tt�WdQRXdS)Nc@seZdZUeed<eed<dS)z8TestCase.test_helper_asdict_raises_on_classes.<locals>.Cr#r8N)rrrr$r%rrrrrfs
rzdataclass instance)rr,r;r
r$)rrrrr�$test_helper_asdict_raises_on_classesds
z-TestCase.test_helper_asdict_raises_on_classescCsxtGdd�d��}g}|d|�}t|�}|�|d|�|�|d|�|d�}t|�}|d�d�|�|jg�dS)Nc@s,eZdZUeed<eed�Zeeed<dS)z2TestCase.test_helper_asdict_copy_values.<locals>.Cr#)r*r8N)	rrrr$r%r+r�r8rrrrrrps
rr(r8)rr
rr��appendr8)rr�initialrUr�rrr�test_helper_asdict_copy_valuesos
z'TestCase.test_helper_asdict_copy_valuescs�tGdd�d���tG�fdd�d��}|d�dd��}t|�}|�|dddd�d	��|�t|�t|��d
|j_|�t|�ddd
d�d	��dS)Nc@seZdZUeed<eed<dS)z2TestCase.test_helper_asdict_nested.<locals>.UserId�token�groupN)rrrr$r%rrrr�UserIds
rcseZdZUeed<�ed<dS)z0TestCase.test_helper_asdict_nested.<locals>.Userr3r2N)rrrrLr%r)rrr�User�s
r�Joe�{r()rr)r3r2r�)rr
rr�r2r)rr�ur�r)rr�test_helper_asdict_nested~sz"TestCase.test_helper_asdict_nestedc	stGdd�d���tG�fdd�d��}tG�fdd�d��}tG�fdd�d��}�d	d
�}�dd�}|d
||g�}|d
||f�}|d
||d��}|�t|�d
d	d
d�ddd�gd��|�t|�d
d	d
d�ddd�fd��|�t|�d
d	d
d�ddd�d�d��dS)Nc@seZdZUeed<eed<dS)z<TestCase.test_helper_asdict_builtin_containers.<locals>.Userr3r2N)rrrrLr%r$rrrrr�s
rcs"eZdZUeed<e�ed<dS)zATestCase.test_helper_asdict_builtin_containers.<locals>.GroupListr2�usersN)rrrr$r%rr)rrr�	GroupList�s
r cs&eZdZUeed<e�dfed<dS)zBTestCase.test_helper_asdict_builtin_containers.<locals>.GroupTupler2.rN)rrrr$r%rr)rrr�
GroupTuple�s
r!cs&eZdZUeed<ee�fed<dS)zATestCase.test_helper_asdict_builtin_containers.<locals>.GroupDictr2rN)rrrr$r%r	rLr)rrr�	GroupDict�s
r"�Alicer(�Bobr�r)rV�second)r3r2)r2r)rrr
)	rr r!r"rrra�gl�gt�gdr)rr�%test_helper_asdict_builtin_containers�s

z.TestCase.test_helper_asdict_builtin_containerscsxtGdd�d���tG�fdd�d��}|�t|�dg���dddgii�|�t|�ddi���ddddiii�dS)	Nc@seZdZUeed<dS)z=TestCase.test_helper_asdict_builtin_containers.<locals>.Childr�N)rrrrXr%rrrr�Child�s
r*cseZdZU�ed<dS)z>TestCase.test_helper_asdict_builtin_containers.<locals>.Parent�childN)rrrr%r)r*rr�Parent�s
r,r(r+r�r�)rrr
)rr,r)r*rr)�s$cCs�tGdd�d��}|dd�}t|td�}|�|tddg��|�|t|td��d|_t|td�}|�|td	dg��|�t|�t�dS)
Nc@seZdZUeed<eed<dS)z.TestCase.test_helper_asdict_factory.<locals>.Cr#r8N)rrrr$r%rrrrr�s
rr(r�)�dict_factory)r#r()r8r�r&)r#r&)rr
rrr�r#r�r�)rrrUr�rrr�test_helper_asdict_factory�s
z#TestCase.test_helper_asdict_factorycs�tdd��tG�fdd�d��}|d�d|d�dd	d
��d��}t|�}|�|d�dd�dd	d
�d�d�d��t|td
�}|�|d�dd�dd	d
�d�d�d��|�t|�t�|�t|dd�t�dS)N�Tza b ccseZdZUeed<�ed<dS)z1TestCase.test_helper_asdict_namedtuple.<locals>.Cr#r8N)rrrrLr%r)r/rrr�s
r�outerr(�innerr���
r�)r#r8)r-r8)rrr
rrr�r�)rrrUr�r)r/r�test_helper_asdict_namedtuple�s"
 z&TestCase.test_helper_asdict_namedtuplecCsNtGdd�d��}tdd�}||d�di�}|�t|�d|dd�dii�dS)	Nc@seZdZUeed<dS)z5TestCase.test_helper_asdict_namedtuple_key.<locals>.Cr�N)rrrr�r%rrrrr�s
rr/rrzan arr�)rr)rrrr
)rrr/rUrrr�!test_helper_asdict_namedtuple_key�s
z*TestCase.test_helper_asdict_namedtuple_keycs�Gdd�dtdd���tG�fdd�d��}�d�}||�}t|�}|�|d�dd	�i�|�|d|�|�|d��d�dS)
Nc@seZdZdd�ZdS)z9TestCase.test_helper_asdict_namedtuple_derived.<locals>.TcSs|jS)N)rr)rrrr�my_a�sz>TestCase.test_helper_asdict_namedtuple_derived.<locals>.T.my_aN)rrrr6rrrrr/�sr/ZTbaserrcseZdZU�ed<dS)z9TestCase.test_helper_asdict_namedtuple_derived.<locals>.Cr�N)rrrr%r)r/rrr�s
rr�r�)rr)rrr
rr�r6)rrr�rUr�r)r/r�%test_helper_asdict_namedtuple_derived�sz.TestCase.test_helper_asdict_namedtuple_derivedcCs�tGdd�d��}|d�}|�t|�d�|�t|�t|��|�t|�t|��d|_|�t|�d�|�tt|��t�dS)Nc@s"eZdZUeed<dZeed<dS)z'TestCase.test_helper_astuple.<locals>.Cr#rr8N)rrrr$r%r8rrrrrs
rr()r(rr&)r(r&)rrr�r�r8r�r�r�)rrrUrrr�test_helper_astupleszTestCase.test_helper_astuplec	CsVtGdd�d��}|�td��t|�WdQRX|�td��tt�WdQRXdS)Nc@seZdZUeed<eed<dS)z9TestCase.test_helper_astuple_raises_on_classes.<locals>.Cr#r8N)rrrr$r%rrrrrs
rzdataclass instance)rr,r;r�r$)rrrrr�%test_helper_astuple_raises_on_classess
z.TestCase.test_helper_astuple_raises_on_classescCsxtGdd�d��}g}|d|�}t|�}|�|d|�|�|d|�|d�}t|�}|d�d�|�|jg�dS)Nc@s,eZdZUeed<eed�Zeeed<dS)z3TestCase.test_helper_astuple_copy_values.<locals>.Cr#)r*r8N)	rrrr$r%r+r�r8rrrrrr!s
rr()rr�rr�rr8)rrrrUr�rrr�test_helper_astuple_copy_values s
z(TestCase.test_helper_astuple_copy_valuescs|tGdd�d���tG�fdd�d��}|d�dd��}t|�}|�|d�|�t|�t|��d	|j_|�t|�d
�dS)Nc@seZdZUeed<eed<dS)z3TestCase.test_helper_astuple_nested.<locals>.UserIdrrN)rrrr$r%rrrrr0s
rcseZdZUeed<�ed<dS)z1TestCase.test_helper_astuple_nested.<locals>.Userr3r2N)rrrrLr%r)rrrr4s
rrrr()r)rr(r�)r)rr�)rr�rr�r2r)rrrr�r)rr�test_helper_astuple_nested/sz#TestCase.test_helper_astuple_nestedc	s�tGdd�d���tG�fdd�d��}tG�fdd�d��}tG�fdd�d��}�d	d
�}�dd�}|d
||g�}|d
||f�}|d
||d��}|�t|�d
ddgf�|�t|�d�|�t|�d
ddd�f�dS)Nc@seZdZUeed<eed<dS)z=TestCase.test_helper_astuple_builtin_containers.<locals>.Userr3r2N)rrrrLr%r$rrrrr@s
rcs"eZdZUeed<e�ed<dS)zBTestCase.test_helper_astuple_builtin_containers.<locals>.GroupListr2rN)rrrr$r%rr)rrrr Ds
r cs&eZdZUeed<e�dfed<dS)zCTestCase.test_helper_astuple_builtin_containers.<locals>.GroupTupler2.rN)rrrr$r%rr)rrrr!Hs
r!cs&eZdZUeed<ee�fed<dS)zBTestCase.test_helper_astuple_builtin_containers.<locals>.GroupDictr2rN)rrrr$r%r	rLr)rrrr"Ls
r"r#r(r$r�r)rVr%)r#r()r$r�)r))r#r()r$r�)rrr�)	rr r!r"rrrar&r'r(r)rr�&test_helper_astuple_builtin_containers?s

z/TestCase.test_helper_astuple_builtin_containerscsptGdd�d���tG�fdd�d��}|�t|�dg���dgff�|�t|�ddi���ddiff�dS)Nc@seZdZUeed<dS)z>TestCase.test_helper_astuple_builtin_containers.<locals>.Childr�N)rrrrXr%rrrrr*Zs
r*cseZdZU�ed<dS)z?TestCase.test_helper_astuple_builtin_containers.<locals>.Parentr+N)rrrr%r)r*rrr,^s
r,r(r�)rrr�)rr,r)r*rr<Ys cs�tGdd�d��}tdd���fdd�}|dd�}t||d	�}|�|�dd��|�|t||d	��d
|_t||d	�}|�|�d
d��|�t|���dS)Nc@seZdZUeed<eed<dS)z/TestCase.test_helper_astuple_factory.<locals>.Cr#r8N)rrrr$r%rrrrrfs
r�NTzx ycs�|�S)Nr)r�)r=rr�ntksz0TestCase.test_helper_astuple_factory.<locals>.ntr(r�)�
tuple_factoryr&)rrr�rr�r#r�r�)rrr>rUr�r)r=r�test_helper_astuple_factoryes

z$TestCase.test_helper_astuple_factorycs�tdd��tG�fdd�d��}|d�d|d�dd	d
��d��}t|�}|�|d�ddd�f�t|td
�}|�|d�dd�dd	d
�gd�g�dS)Nr/za b ccseZdZUeed<�ed<dS)z2TestCase.test_helper_astuple_namedtuple.<locals>.Cr#r8N)rrrrLr%r)r/rrrxs
rr0r(r1r�r2r3r�)r1)r�r2r3)r?)rrr�rr�)rrrUr�r)r/r�test_helper_astuple_namedtuplevs
 z'TestCase.test_helper_astuple_namedtuplecCsNdttd�i}tdd|�}t|�}|�||�|�t|dd��ddd��dS)Nr%)r#r8rrr(r�)r$r�rrr
)r�cls_dictrq�cls1rrr�test_dynamic_class_creation�s
z$TestCase.test_dynamic_class_creationcCsTttd�tdd�d�}tdd|�}t|�}|�||�|�t|d��ddd��dS)N)r#r8rJ)r))r%r8rrr()r$r+r�rrr
)rrBrqrCrrr�'test_dynamic_class_creation_using_field�sz0TestCase.test_dynamic_class_creation_using_fieldcs�tGdd�d��}g��fdd�}||_|dd�}|�d�d�|�d�d�|�d	gf�d
�|�dgf�d�|�d
��|�d�d�dS)Nc@sjeZdZUeed<e�Zeed<eedd�Zeed<eed�Z	eed<eddd	�Z
eed
<dZeed<dS)
z&TestCase.test_init_in_order.<locals>.CrrraF)r*r0rU)r*r�r�)r)r0rr�N)rrrr$r%r+rar�rUr�rr�rrrrr�s
rcs��||f�dS)N)r)rr3�value)�callsrr�setattr�sz,TestCase.test_init_in_order.<locals>.setattrrr()rrr)rar(rUr�r�r9)rr�)r�r�r�)r�__setattr__rr�)rrrHrUr)rGr�test_init_in_order�s	
zTestCase.test_init_in_ordercCs�tGdd�d��}|d�}|�d|j�|�d|j�|�d|j�|�d|j�|�|jd�|�d	|j�|�|jd�|�d|j�|�|jd�|�d|j�|�|jg�|�d|j�|�|j	g�|�d|j�|�d	|j�|�|jd�dS)
Nc@s\eZdZUeed<eedd�Zeed<eed�Zeed<eddd�Z	eed	<d
Z
eed<dS)
z'TestCase.test_items_in_dicts.<locals>.CrrF)r*r0ra)r*rUr�)r)r0r�rrN)rrrr$r%r+r�rarUr�rrrrrr�s

rrrrrarUr�r�r)
rr�rgr�rr�rrrrarU)rrrUrrr�test_items_in_dicts�s$zTestCase.test_items_in_dictscCs*tGdd�d��}|�|�d�jd�dS)Nc@s"eZdZUeed<edd��ZdS)z:TestCase.test_alternate_classmethod_constructor.<locals>.Cr#cSsd}||�S)Nr�r)rq�filenameZ
value_in_filerrr�	from_file�szDTestCase.test_alternate_classmethod_constructor.<locals>.C.from_fileN)rrrr$r%r�rMrrrrr�s
rrLr�)rrrMr#)rrrrr�&test_alternate_classmethod_constructor�s
z/TestCase.test_alternate_classmethod_constructorc	CsntGdd�d��}|�t|�dj�|�tt|�dj�d�|�td��dt|�djd<WdQRXdS)Nc@seZdZUeed<dS)z/TestCase.test_field_metadata_default.<locals>.Cr!N)rrrr$r%rrrrr�s
rrz does not support item assignmentr9�test)rr�r�metadatarrr,r;)rrrrr�test_field_metadata_default�sz$TestCase.test_field_metadata_defaultc	s�|�t��tGdd�d��}WdQRXi�tG�fdd�d��}|�t|�dj�|�tt|�dj�d�d�d<|�tt|�dj�d�|�t|�djdd�|�td��dt|�djd	<WdQRXd
ddd
��tG�fdd�d��}|�tt|�dj�d�|�t|�djd	d
�|�t|�djdd�|�t|�djdd�d�d<|�tt|�dj�d�|�t|�djdd�|�t	��t|�djdWdQRX|�td��dt|�djd	<WdQRXdS)Nc@s eZdZUedd�Zeed<dS)z/TestCase.test_field_metadata_mapping.<locals>.Cr)rPr!N)rrrr+r!r$r%rrrrr�s
rcs eZdZUe�d�Zeed<dS)z/TestCase.test_field_metadata_mapping.<locals>.C)rPr!N)rrrr+r!r$r%r)r�rrr�s
rr(rMz does not support item assignmentr9rOrCZ42Zthree)rOr�r9cs eZdZUe�d�Zeed<dS)z/TestCase.test_field_metadata_mapping.<locals>.C)rPr!N)rrrr+r!r$r%r)r�rrr
s
r�r�Zbaz)
r�r;rr�rrPrrr,�KeyError)rrr)r�r�test_field_metadata_mapping�s4z$TestCase.test_field_metadata_mappingc	s�Gdd�d��tG�fdd�d��}|�tt|�dj�d�|�t|�djdd�|�t��t|�djd	WdQRX|�t|�djd
d�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)zDTestCase.test_field_metadata_custom_mapping.<locals>.SimpleNameSpacec[s|j�|�dS)N)rg�update)r�kwrrrrPszMTestCase.test_field_metadata_custom_mapping.<locals>.SimpleNameSpace.__init__cSs|dkrdSt||�S)N�xyzzy�plugh)rj)r�itemrrr�__getitem__"szPTestCase.test_field_metadata_custom_mapping.<locals>.SimpleNameSpace.__getitem__cSs
|j��S)N)rg�__len__)rrrrrZ'szLTestCase.test_field_metadata_custom_mapping.<locals>.SimpleNameSpace.__len__N)rrrrPrYrZrrrr�SimpleNameSpacesr[cs&eZdZUe�dd�d�Zeed<dS)z6TestCase.test_field_metadata_custom_mapping.<locals>.CrC)rr)rPr!N)rrrr+r!r$r%r)r[rrr*s
rrr(rrrCrarVrW)rrrrrPr�r)rrr)r[r�"test_field_metadata_custom_mappingsz+TestCase.test_field_metadata_custom_mappingcsXtd��tG�fdd�dt���}|d�}|�|jd�|�|jd�t|t}dS)Nr/cs"eZdZU�ed<dZeed<dS)z5TestCase.test_generic_dataclasses.<locals>.LabeledBox�contentz	<unknown>�labelN)rrrr%r^rLr)r/rr�
LabeledBox8s
r_r&z	<unknown>)rrr
rr]r^rr$)rr_Zbox�Aliasr)r/r�test_generic_dataclasses5sz!TestCase.test_generic_dataclassescs�td��td��tG��fdd�dt��f��}tGdd�d|t�f��}|t}|ddd	�}|�t|�d
�Gdd�d|t�f�}|t}|d
d�}|�|��d�dS)N�Sr/cseZdZU�ed<�ed<dS)z-TestCase.test_generic_extending.<locals>.Baser#r8N)rrrr%r)rbr/rrrFHs
rFc@seZdZUeed<dS)z4TestCase.test_generic_extending.<locals>.DataDerivedZ	new_fieldN)rrrrLr%rrrr�DataDerivedMs
rcr�test1�test2)rrdrec@seZdZdd�ZdS)z7TestCase.test_generic_extending.<locals>.NonDataDerivedcSs|jS)N)r8)rrrr�
new_methodUszBTestCase.test_generic_extending.<locals>.NonDataDerived.new_methodN)rrrrfrrrr�NonDataDerivedTsrgrCg�?)	rrr
r$rLrr�r�rf)rrFrcr`rUrgr)rbr/r�test_generic_extendingDs
zTestCase.test_generic_extendingcs�td��tG�fdd�dt���}tdd�fdt�dfg|tt�fddid	�}|�|td
d�jd�|�|td
dd�jd�|�|td
dd�j	d�|�}|�|td
d�j
d
�|�|j||ttf�dS)
Nr/cseZdZU�ed<dS)z-TestCase.test_generic_dynamic.<locals>.Parentr#N)rrrr%r)r/rrr,^s
r,r*r8rGr@r&)�bases�	namespacer(r�r9)
rrr
rirr$r�rGrr@r#�__mro__rX)rr,r*r`r)r/r�test_generic_dynamic[szTestCase.test_generic_dynamiccCs,tGdd�d��atGdd�d��atGdd�d��atd�}d|_td�tdd�td�|td�tddd	d
g�g}x�|D]�}x�ttjd�D]�}|j||d��|t�	t�
||��}|�|j|j�|�|j|j�|�
||�d|_t�	t�
||��}|�|j|j�|�|j|j�WdQRXq�WqxWdS)
Nc@s"eZdZUeed<dZeed<dS)�Pr#rr8N)rrrr$r%r8rrrrrmns
rmc@s*eZdZUeed<eddd�Zeed<dS)�Qr#rF)r)r0r8N)rrrr$r%r+r8rrrrrnrs
rnc@s,eZdZUeed<eed�Zeeed<dS)�Rr#)r*r8N)	rrrr$r%r+r�r8rrrrrrovs
ror(r�r9r�)�sample�protor&)rrmrnror8�range�pickleZHIGHEST_PROTOCOLrw�loads�dumpsrr#r�)r�qZsamplesrprqZ
new_sampleZanother_new_samplerrr�test_dataclassses_pickleablels".
z%TestCase.test_dataclassses_pickleableN)\rrrr r"r'r/r5r7r<rErKrWrYrZrmrnr|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�rrrr	rrrrrrrr)r.r4r5r7r8r9r:r;r<r@rArDrErJrKrNrQrSr\rarhrlrwrrrrrs�,5!6(!$-F/
9
!


+rc@s$eZdZdd�Zdd�Zdd�ZdS)�TestFieldNoAnnotationc	Cs.|�td��tGdd�d��}WdQRXdS)Nz)'f' is a field but has no type annotationc@seZdZe�ZdS)z>TestFieldNoAnnotation.test_field_without_annotation.<locals>.CN)rrrr+r�rrrrr�sr)r,r;r)rrrrr�test_field_without_annotation�sz3TestFieldNoAnnotation.test_field_without_annotationc	CsBtGdd�d��}|�td��tGdd�d|��}WdQRXdS)Nc@seZdZUeed<dS)zUTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_base.<locals>.Br�N)rrrr$r%rrrrr:�s
r:z)'f' is a field but has no type annotationc@seZdZe�ZdS)zUTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_base.<locals>.CN)rrrr+r�rrrrr�sr)rr,r;)rr:rrrr�4test_field_without_annotation_but_annotation_in_base�s
zJTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_basec	Cs>Gdd�d�}|�td��tGdd�d|��}WdQRXdS)Nc@seZdZUeed<dS)zcTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_base_not_dataclass.<locals>.Br�N)rrrr$r%rrrrr:�s
r:z)'f' is a field but has no type annotationc@seZdZe�ZdS)zcTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_base_not_dataclass.<locals>.CN)rrrr+r�rrrrr�sr)r,r;r)rr:rrrr�Btest_field_without_annotation_but_annotation_in_base_not_dataclass�s
zXTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_base_not_dataclassN)rrrryrzr{rrrrrx�s
rxc@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�
TestDocStringcCs |�|�dd�|�dd��dS)N� �)rr)rrrrarrr�assertDocStrEqual�szTestDocString.assertDocStrEqualcCs$tGdd�d��}|�|jd�dS)Nc@seZdZUeed<dS)z?TestDocString.test_existing_docstring_not_overridden.<locals>.Cr#N)rrrr$r%rrrrr�s
rzLorem ipsum)rr�__doc__)rrrrr�&test_existing_docstring_not_overridden�sz4TestDocString.test_existing_docstring_not_overriddencCs$tGdd�d��}|�|jd�dS)Nc@seZdZdS)z1TestDocString.test_docstring_no_fields.<locals>.CN)rrrrrrrr�srzC())rrr�)rrrrr�test_docstring_no_fields�sz&TestDocString.test_docstring_no_fieldscCs$tGdd�d��}|�|jd�dS)Nc@seZdZUeed<dS)z1TestDocString.test_docstring_one_field.<locals>.Cr#N)rrrr$r%rrrrr�s
rzC(x:int))rrr�)rrrrr�test_docstring_one_field�sz&TestDocString.test_docstring_one_fieldcCs$tGdd�d��}|�|jd�dS)Nc@seZdZUeed<eed<dS)z2TestDocString.test_docstring_two_fields.<locals>.Cr#r8N)rrrr$r%rrrrr�s
rzC(x:int, y:int))rrr�)rrrrr�test_docstring_two_fields�sz'TestDocString.test_docstring_two_fieldscCs$tGdd�d��}|�|jd�dS)Nc@s&eZdZUeed<eed<eed<dS)z4TestDocString.test_docstring_three_fields.<locals>.Cr#r8rGN)rrrr$r%rLrrrrr�s
rzC(x:int, y:int, z:str))rrr�)rrrrr�test_docstring_three_fields�sz)TestDocString.test_docstring_three_fieldscCs$tGdd�d��}|�|jd�dS)Nc@seZdZUdZeed<dS)z>TestDocString.test_docstring_one_field_with_default.<locals>.Cr9r#N)rrrr#r$r%rrrrr�s
rz
C(x:int=3))rrr�)rrrrr�%test_docstring_one_field_with_default�sz3TestDocString.test_docstring_one_field_with_defaultcCs$tGdd�d��}|�|jd�dS)Nc@s&eZdZUdZeeed�fed<dS)zCTestDocString.test_docstring_one_field_with_default_none.<locals>.CNr#)rrrr#rr$r�r%rrrrr�s
rzC(x:Union[int, NoneType]=None))rrr�)rrrrr�*test_docstring_one_field_with_default_none�sz8TestDocString.test_docstring_one_field_with_default_nonecCs$tGdd�d��}|�|jd�dS)Nc@seZdZUeeed<dS)z2TestDocString.test_docstring_list_field.<locals>.Cr#N)rrrrr$r%rrrrr�s
rzC(x:List[int]))rrr�)rrrrr�test_docstring_list_field�sz'TestDocString.test_docstring_list_fieldcCs$tGdd�d��}|�|jd�dS)Nc@s$eZdZUeed�Zeeed<dS)zGTestDocString.test_docstring_list_field_with_default_factory.<locals>.C)r*r#N)	rrrr+r�r#rr$r%rrrrr�s
rzC(x:List[int]=<factory>))rrr�)rrrrr�.test_docstring_list_field_with_default_factory�sz<TestDocString.test_docstring_list_field_with_default_factorycCs$tGdd�d��}|�|jd�dS)Nc@seZdZUeed<dS)z3TestDocString.test_docstring_deque_field.<locals>.Cr#N)rrrrr%rrrrr�s
rzC(x:collections.deque))rrr�)rrrrr�test_docstring_deque_field�sz(TestDocString.test_docstring_deque_fieldcCs$tGdd�d��}|�|jd�dS)Nc@s eZdZUeed�Zeed<dS)zHTestDocString.test_docstring_deque_field_with_default_factory.<locals>.C)r*r#N)rrrr+rr#r%rrrrr�s
rz C(x:collections.deque=<factory>))rrr�)rrrrr�/test_docstring_deque_field_with_default_factory�sz=TestDocString.test_docstring_deque_field_with_default_factoryN)rrrrr�r�r�r�r�r�r�r�r�r�r�rrrrr|�s	r|c@s$eZdZdd�Zdd�Zdd�ZdS)�TestInitcCs�Gdd�d�}tGdd�d|��}|d�}|�|jd�|�dt|��tdd�Gd	d�d|��}|�}|�|jd�|�|jd
�dS)Nc@seZdZdd�ZdS)z&TestInit.test_base_has_init.<locals>.BcSs
d|_dS)Nr?)rG)rrrrrP	sz/TestInit.test_base_has_init.<locals>.B.__init__N)rrrrPrrrrr:sr:c@seZdZUdZeed<dS)z&TestInit.test_base_has_init.<locals>.Crr#N)rrrr#r$r%rrrrrs
rrCrGF)r0c@seZdZUdZeed<dS)z&TestInit.test_base_has_init.<locals>.CrCr#N)rrrr#r$r%rrrrrs
r?)rrr#r�r�rG)rr:rrUrrr�test_base_has_inits	zTestInit.test_base_has_initcCsTtdd�Gdd�d�}|�|�jd�tdd�Gdd�d�}|�|�jd�dS)NF)r0c@seZdZUdZeed<dS)z TestInit.test_no_init.<locals>.Crr!N)rrrr!r$r%rrrrr#s
rrc@s"eZdZUdZeed<dd�ZdS)z TestInit.test_no_init.<locals>.Cr�r!cSs
d|_dS)Nr9)r!)rrrrrP*sz)TestInit.test_no_init.<locals>.C.__init__N)rrrr!r$r%rPrrrrr(s
r9)rrr!)rrrrr�test_no_init!s

zTestInit.test_no_initcCs|tGdd�d��}|�|d�jd�tdd�Gdd�d��}|�|d�jd	�td
d�Gdd�d��}|�|d�jd
�dS)Nc@seZdZUeed<dd�ZdS)z)TestInit.test_overwriting_init.<locals>.Cr#cSsd||_dS)Nr�)r#)rr#rrrrP5sz2TestInit.test_overwriting_init.<locals>.C.__init__N)rrrr$r%rPrrrrr2s
rr9r�T)r0c@seZdZUeed<dd�ZdS)z)TestInit.test_overwriting_init.<locals>.Cr#cSsd||_dS)Nr�)r#)rr#rrrrP<sz2TestInit.test_overwriting_init.<locals>.C.__init__N)rrrr$r%rPrrrrr9s
r��Fc@seZdZUeed<dd�ZdS)z)TestInit.test_overwriting_init.<locals>.Cr#cSsd||_dS)Nr�)r#)rr#rrrrPCsz2TestInit.test_overwriting_init.<locals>.C.__init__N)rrrr$r%rPrrrrr@s
rJrC)rrr#)rrrrr�test_overwriting_init.szTestInit.test_overwriting_initN)rrrr�r�r�rrrrr�s
r�c@s$eZdZdd�Zdd�Zdd�ZdS)�TestReprcCs�tGdd�d��}tGdd�d|��}|d�}|�t|�d�tGdd�d|��}|�t|��d	�tGd
d�d��}|�t|�d��d�|�t|���d
�dS)Nc@seZdZUeed<dS)zTestRepr.test_repr.<locals>.Br#N)rrrr$r%rrrrr:Js
r:c@seZdZUdZeed<dS)zTestRepr.test_repr.<locals>.CrCr8N)rrrr8r$r%rrrrrNs
rr�z(TestRepr.test_repr.<locals>.C(x=4, y=10)c@seZdZUdZeed<dS)zTestRepr.test_repr.<locals>.Dr�r#N)rrrr#r$r%rrrrr�Us
r�z)TestRepr.test_repr.<locals>.D(x=20, y=10)c@s0eZdZeGdd�d��ZeGdd�d��ZdS)zTestRepr.test_repr.<locals>.Cc@seZdZUeed<dS)zTestRepr.test_repr.<locals>.C.Dr!N)rrrr$r%rrrrr�\s
r�c@seZdZdS)zTestRepr.test_repr.<locals>.C.EN)rrrrrrrr�_sr�N)rrrrr�r�rrrrrZsrz$TestRepr.test_repr.<locals>.C.D(i=0)z!TestRepr.test_repr.<locals>.C.E())rrr1r�r�)rr:rrr�rrr�	test_reprIszTestRepr.test_reprcCsbtdd�Gdd�d��}|�t�d�t|d���tdd�Gdd�d��}|�t|d��d�dS)	NF)r1c@seZdZUeed<dS)z TestRepr.test_no_repr.<locals>.Cr#N)rrrr$r%rrrrrgs
rz+.TestRepr.test_no_repr.<locals>.C object atr9c@seZdZUeed<dd�ZdS)z TestRepr.test_no_repr.<locals>.Cr#cSsdS)NzC-classr)rrrr�__repr__qsz)TestRepr.test_no_repr.<locals>.C.__repr__N)rrrr$r%r�rrrrrns
zC-class)rr�rr1r)rrrrr�test_no_repres
zTestRepr.test_no_reprcCs�tGdd�d��}|�t|d��d�tdd�Gdd�d��}|�t|d��d�tdd�Gd	d�d��}|�t|d��d�dS)
Nc@seZdZUeed<dd�ZdS)z)TestRepr.test_overwriting_repr.<locals>.Cr#cSsdS)Nr#r)rrrrr�|sz2TestRepr.test_overwriting_repr.<locals>.C.__repr__N)rrrr$r%r�rrrrrys
rrr#T)r1c@seZdZUeed<dd�ZdS)z)TestRepr.test_overwriting_repr.<locals>.Cr#cSsdS)Nr#r)rrrrr��sz2TestRepr.test_overwriting_repr.<locals>.C.__repr__N)rrrr$r%r�rrrrr�s
Fc@seZdZUeed<dd�ZdS)z)TestRepr.test_overwriting_repr.<locals>.Cr#cSsdS)Nr#r)rrrrr��sz2TestRepr.test_overwriting_repr.<locals>.C.__repr__N)rrrr$r%r�rrrrr�s
)rrr1)rrrrr�test_overwriting_repruszTestRepr.test_overwriting_reprN)rrrr�r�r�rrrrr�Hsr�c@seZdZdd�Zdd�ZdS)�TestEqcCsltdd�Gdd�d��}|�|d�|d��|d�}|�||�tdd�Gdd�d��}|�|d�d�dS)	NF)r�c@seZdZUeed<dS)zTestEq.test_no_eq.<locals>.Cr#N)rrrr$r%rrrrr�s
rrr9c@seZdZUeed<dd�ZdS)zTestEq.test_no_eq.<locals>.Cr#cSs|dkS)NrCr)rr@rrrrA�sz#TestEq.test_no_eq.<locals>.C.__eq__N)rrrr$r%rArrrrr�s
rC)rrTr)rrrUrrr�
test_no_eq�szTestEq.test_no_eqcCs�tGdd�d��}|�|d�d�|�|d�d�tdd�Gdd�d��}|�|d�d�|�|d�d�td	d�Gd
d�d��}|�|d�d�|�|d�d�dS)Nc@seZdZUeed<dd�ZdS)z%TestEq.test_overwriting_eq.<locals>.Cr#cSs|dkS)Nr9r)rr@rrrrA�sz,TestEq.test_overwriting_eq.<locals>.C.__eq__N)rrrr$r%rArrrrr�s
rr(r9T)r�c@seZdZUeed<dd�ZdS)z%TestEq.test_overwriting_eq.<locals>.Cr#cSs|dkS)Nr�r)rr@rrrrA�sz,TestEq.test_overwriting_eq.<locals>.C.__eq__N)rrrr$r%rArrrrr�s
r�Fc@seZdZUeed<dd�ZdS)z%TestEq.test_overwriting_eq.<locals>.Cr#cSs|dkS)NrJr)rr@rrrrA�sz,TestEq.test_overwriting_eq.<locals>.C.__eq__N)rrrr$r%rArrrrr�s
rJ)rrrT)rrrrr�test_overwriting_eq�szTestEq.test_overwriting_eqN)rrrr�r�rrrrr��sr�c@s$eZdZdd�Zdd�Zdd�ZdS)�TestOrderingcCsZttGdd�d���}|�|d�d�|�|d�d�|�|d�d�|�|d�d�dS)Nc@seZdZUeed<dd�ZdS)z5TestOrdering.test_functools_total_ordering.<locals>.Cr#cSs
|j|kS)N)r#)rr@rrrr��sz<TestOrdering.test_functools_total_ordering.<locals>.C.__lt__N)rrrr$r%r�rrrrr�s
rr���r()rrr}ryr~rz)rrrrr�test_functools_total_ordering�sz*TestOrdering.test_functools_total_orderingcCs�tdd�Gdd�d��}|�d|j�|�d|j�|�d|j�|�d|j�tdd�Gd	d�d��}|�d|j�|�d|j�|�d|j�dS)
NF)rpc@seZdZUeed<dS)z%TestOrdering.test_no_order.<locals>.Cr#N)rrrr$r%rrrrr�s
rr�r�r�r�c@seZdZUeed<dd�ZdS)z%TestOrdering.test_no_order.<locals>.Cr#cSsdS)NFr)rr@rrrr��sz,TestOrdering.test_no_order.<locals>.C.__lt__N)rrrr$r%r�rrrrr�s
)rr�rg)rrrrr�
test_no_order�szTestOrdering.test_no_orderc	Cs�|�td��tdd�Gdd�d��}WdQRX|�td��tdd�Gdd�d��}WdQRX|�td��tdd�Gd	d�d��}WdQRX|�td
��tdd�Gdd�d��}WdQRXdS)NzACannot overwrite attribute __lt__.*using functools.total_orderingT)rpc@seZdZUeed<dd�ZdS)z.TestOrdering.test_overwriting_order.<locals>.Cr#cSsdS)Nr)rrrrr��sz5TestOrdering.test_overwriting_order.<locals>.C.__lt__N)rrrr$r%r�rrrrr�s
rzACannot overwrite attribute __le__.*using functools.total_orderingc@seZdZUeed<dd�ZdS)z.TestOrdering.test_overwriting_order.<locals>.Cr#cSsdS)Nr)rrrrr��sz5TestOrdering.test_overwriting_order.<locals>.C.__le__N)rrrr$r%r�rrrrr�s
zACannot overwrite attribute __gt__.*using functools.total_orderingc@seZdZUeed<dd�ZdS)z.TestOrdering.test_overwriting_order.<locals>.Cr#cSsdS)Nr)rrrrr��sz5TestOrdering.test_overwriting_order.<locals>.C.__gt__N)rrrr$r%r�rrrrr�s
zACannot overwrite attribute __ge__.*using functools.total_orderingc@seZdZUeed<dd�ZdS)z.TestOrdering.test_overwriting_order.<locals>.Cr#cSsdS)Nr)rrrrr�	sz5TestOrdering.test_overwriting_order.<locals>.C.__ge__N)rrrr$r%r�rrrrr	s
)r,r;r)rrrrr�test_overwriting_order�s"""z#TestOrdering.test_overwriting_orderN)rrrr�r�r�rrrrr��sr�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�TestHashcCs6tdd�Gdd�d��}|�t|dd��td��dS)NT)rBc@seZdZUeed<eed<dS)z$TestHash.test_unsafe_hash.<locals>.Cr#r8N)rrrr$r%rLrrrrr	s
rr(rM)r(rM)rrrD)rrrrr�test_unsafe_hash	szTestHash.test_unsafe_hashc		s�dd�}�fdd�}x�tddddd	d
ddgd
�D]r\}\}}}}}|||||d|�|||||d|�||||�||�||�d|�||||�||�||�d|�q0WdS)NcSs|dkrdS|rdSdS)N)r9rr)rFrrr�non_bool	s
z*TestHash.test_hash_rules.<locals>.non_boolc
s�j||||d���|dkrZ|r>t|||d�Gdd�d��}nt|||d�Gdd�d��}|dkr���d|j���|jd�n�|d	kr�|s���d|j�nh|d
krƈ�d|j���|jd�n@|dk�r��td��"t|||d�Gdd�d��}WdQRXnWdQRXdS)
N)�caserBr�r=r�)rBr�r=c@seZdZdd�ZdS)z1TestHash.test_hash_rules.<locals>.test.<locals>.CcSsdS)Nrr)rrrrr>"	sz:TestHash.test_hash_rules.<locals>.test.<locals>.C.__hash__N)rrrr>rrrrr 	src@seZdZdS)z1TestHash.test_hash_rules.<locals>.test.<locals>.CN)rrrrrrrr%	sr{r>r~�nonez#Cannot overwrite attribute __hash__c@seZdZdd�ZdS)z1TestHash.test_hash_rules.<locals>.test.<locals>.CcSsdS)Nrr)rrrrr>@	sz:TestHash.test_hash_rules.<locals>.test.<locals>.C.__hash__N)rrrr>rrrrr>	s)	rwrr�rgZassertIsNotNoner�r�r,r;)r�rBr�r=Z	with_hashr�r)rrrrO	s&


(z&TestHash.test_hash_rules.<locals>.test)FFFr~r~)FFTr~r~)FTFr�r~)FTTr{r~)TFFr{r�)TFTr{r�)TTFr{r�)TTTr{r�r(FT)rx)	rr�rOr�rBr�r=Zres_no_defined_hashZres_defined_hashr)rr�test_hash_rules	s 1zTestHash.test_hash_rulescCs�tGdd�d��}|�|d�|d��|�|d�|d��tdd�Gdd�d��}|�|d�|d��|�t|d��t|d���tddd	�Gd
d�d��}|�|d�|d��|�|d�|d��|�t|d��t|d���dS)Nc@seZdZUeed<dd�ZdS)z TestHash.test_eq_only.<locals>.Cr!cSs|j|jkS)N)r!)rr@rrrrAi	sz'TestHash.test_eq_only.<locals>.C.__eq__N)rrrr$r%rArrrrrf	s
rr(r�T)rBc@seZdZUeed<dd�ZdS)z TestHash.test_eq_only.<locals>.Cr!cSs|j|jkS)N)r!)rr@rrrrAs	sz'TestHash.test_eq_only.<locals>.C.__eq__N)rrrr$r%rArrrrrp	s
g�?)rBr�c@seZdZUeed<dd�ZdS)z TestHash.test_eq_only.<locals>.Cr!cSs|jdko|j|jkS)Nr9)r!)rr@rrrrA}	sz'TestHash.test_eq_only.<locals>.C.__eq__N)rrrr$r%rArrrrrz	s
r9)rrrTrD)rrrrr�test_eq_only`	szTestHash.test_eq_onlycCs`tdd�Gdd�d��}|�t|��td��tdd�Gdd�d��}|�t|��td��dS)NT)r=c@seZdZdS)z%TestHash.test_0_field_hash.<locals>.CN)rrrrrrrr�	srr)rBc@seZdZdS)z%TestHash.test_0_field_hash.<locals>.CN)rrrrrrrr�	s)rrrD)rrrrr�test_0_field_hash�	szTestHash.test_0_field_hashcCs�tdd�Gdd�d��}|�t|d��td��|�t|d��td��tdd	�Gd
d�d��}|�t|d��td��|�t|d��td��dS)NT)r=c@seZdZUeed<dS)z%TestHash.test_1_field_hash.<locals>.Cr#N)rrrr$r%rrrrr�	s
rr�)r�r&)r&)rBc@seZdZUeed<dS)z%TestHash.test_1_field_hash.<locals>.Cr#N)rrrr$r%rrrrr�	s
)rrrD)rrrrr�test_1_field_hash�	szTestHash.test_1_field_hashcCs&Gdd�d�}�xddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfgD�]R\}}}}|j||||d	���,|dk�r|dk�rtGd
d�d|��}nh|dk�r>t|d�Gd
d�d|��}nB|dk�rdt|d�Gdd�d|��}nt||d�Gdd�d|��}|dk�r�|d�}|�td��t|�WdQRXn`|dk�r�|�t|d��d�n@|dk�r�|�|jtj�n$|dk�r|�t|d��td��nWdQRXq�WdS)Nc@seZdZdd�ZdS)z(TestHash.test_hash_no_args.<locals>.BasecSsdS)Ni-r)rrrrr>�	sz1TestHash.test_hash_no_args.<locals>.Base.__hash__N)rrrr>rrrrrF�	srFZ
unhashableFrX�baseTr�)r=r�r�r�c@seZdZUeed<dS)z%TestHash.test_hash_no_args.<locals>.Cr!N)rrrr$r%rrrrr�	s
r)r�c@seZdZUeed<dS)z%TestHash.test_hash_no_args.<locals>.Cr!N)rrrr$r%rrrrr�	s
)r=c@seZdZUeed<dS)z%TestHash.test_hash_no_args.<locals>.Cr!N)rrrr$r%rrrrr�	s
)r=r�c@seZdZUeed<dS)z%TestHash.test_hash_no_args.<locals>.Cr!N)rrrr$r%rrrrr�	s
rCzunhashable typei-r&)r&)	rXrwrr,r;rDrr�r>)rrFr=r�r�r�rrUrrr�test_hash_no_args�	sV

























zTestHash.test_hash_no_argsN)	rrrr�r�r�r�r�r�rrrrr�
	sN#
r�c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�
TestFrozenc	Cs\tdd�Gdd�d��}|d�}|�|jd�|�t��d|_WdQRX|�|jd�dS)NT)r=c@seZdZUeed<dS)z!TestFrozen.test_frozen.<locals>.Cr!N)rrrr$r%rrrrr�	s
rrCrJ)rrr!r�r�)rrrUrrr�test_frozen�	szTestFrozen.test_frozenc	Cs�tdd�Gdd�d��}tdd�Gdd�d|��}|dd�}|�t��d	|_WdQRX|�t��d
|_WdQRX|�|jd�|�|jd�dS)NT)r=c@seZdZUeed<dS)z"TestFrozen.test_inherit.<locals>.Cr!N)rrrr$r%rrrrr�	s
rc@seZdZUeed<dS)z"TestFrozen.test_inherit.<locals>.Dr�N)rrrr$r%rrrrr��	s
r�rrCrJr�)rr�r�r!r�r)rrr�r�rrr�test_inherit�	s
zTestFrozen.test_inheritcCs�x�dD]z}|j|d��dtdd�Gdd�d��}|rFGdd�d|�}n|}|�td	��tGd
d�d|��}WdQRXWdQRXqWdS)N)TF)�intermediate_classT)r=c@seZdZUeed<dS)z8TestFrozen.test_inherit_nonfrozen_from_frozen.<locals>.Cr!N)rrrr$r%rrrrr
s
rc@seZdZdS)z8TestFrozen.test_inherit_nonfrozen_from_frozen.<locals>.IN)rrrrrrr�I
sr�z5cannot inherit non-frozen dataclass from a frozen onec@seZdZdS)z8TestFrozen.test_inherit_nonfrozen_from_frozen.<locals>.DN)rrrrrrrr�
sr�)rwrr,r;)rr�rr�r�rrr�"test_inherit_nonfrozen_from_frozen
s
z-TestFrozen.test_inherit_nonfrozen_from_frozencCs�x�dD]z}|j|d��dtGdd�d��}|r@Gdd�d|�}n|}|�td�� tdd	�Gd
d�d|��}WdQRXWdQRXqWdS)N)TF)r�c@seZdZUeed<dS)z8TestFrozen.test_inherit_frozen_from_nonfrozen.<locals>.Cr!N)rrrr$r%rrrrr
s
rc@seZdZdS)z8TestFrozen.test_inherit_frozen_from_nonfrozen.<locals>.IN)rrrrrrrr�
sr�z5cannot inherit frozen dataclass from a non-frozen oneT)r=c@seZdZdS)z8TestFrozen.test_inherit_frozen_from_nonfrozen.<locals>.DN)rrrrrrrr�%
sr�)rwrr,r;)rr�rr�r�rrr�"test_inherit_frozen_from_nonfrozen
s
z-TestFrozen.test_inherit_frozen_from_nonfrozenc
Cs�x�dD]�}|j|d��HGdd�d�}|r<Gdd�d|�}n|}tdd�Gd	d
�d
|��}WdQRX|d�}|�t��d|_WdQRXqWdS)
N)TF)r�c@seZdZdS)z4TestFrozen.test_inherit_from_normal_class.<locals>.CN)rrrrrrrr,
src@seZdZdS)z4TestFrozen.test_inherit_from_normal_class.<locals>.IN)rrrrrrrr�0
sr�T)r=c@seZdZUeed<dS)z4TestFrozen.test_inherit_from_normal_class.<locals>.Dr!N)rrrr$r%rrrrr�4
s
r�rCrJ)rwrr�r�r!)rr�rr�r�r�rrr�test_inherit_from_normal_class)
s
z)TestFrozen.test_inherit_from_normal_classc	Cs�tdd�Gdd�d��}Gdd�d|�}|d�}|�|jd�|�|jd�d|_|�t��d	|_WdQRX|�t��d	|_WdQRX|�|jd�|�|jd�|�|jd�dS)
NT)r=c@s"eZdZUeed<dZeed<dS)z4TestFrozen.test_non_frozen_normal_derived.<locals>.Dr#rCr8N)rrrr$r%r8rrrrr�?
s
r�c@seZdZdS)z4TestFrozen.test_non_frozen_normal_derived.<locals>.SN)rrrrrrrrbD
srbr9rCrJ)rrr#r8�cachedr�r�)rr�rbr�rrr�test_non_frozen_normal_derived<
sz)TestFrozen.test_non_frozen_normal_derivedc	Cs�|�td��tdd�Gdd�d��}WdQRX|�td��tdd�Gdd�d��}WdQRXtdd�Gd	d�d��}|�|d
�jd�dS)Nz&Cannot overwrite attribute __setattr__T)r=c@seZdZUeed<dd�ZdS)z-TestFrozen.test_overwriting_frozen.<locals>.Cr#cSsdS)Nr)rrrrrI\
sz9TestFrozen.test_overwriting_frozen.<locals>.C.__setattr__N)rrrr$r%rIrrrrrY
s
rz&Cannot overwrite attribute __delattr__c@seZdZUeed<dd�ZdS)z-TestFrozen.test_overwriting_frozen.<locals>.Cr#cSsdS)Nr)rrrr�__delattr__d
sz9TestFrozen.test_overwriting_frozen.<locals>.C.__delattr__N)rrrr$r%r�rrrrra
s
Fc@seZdZUeed<dd�ZdS)z-TestFrozen.test_overwriting_frozen.<locals>.Cr#cSs|d|jd<dS)Nr�r#)rg)rr3rFrrrrIj
sz9TestFrozen.test_overwriting_frozen.<locals>.C.__setattr__N)rrrr$r%rIrrrrrg
s
rCr�)r,r;rrr#)rrrrr�test_overwriting_frozenU
s""z"TestFrozen.test_overwriting_frozenc	CsLtdd�Gdd�d��}t|d��|�td��t|i��WdQRXdS)NT)r=c@seZdZUeed<dS)z&TestFrozen.test_frozen_hash.<locals>.Cr#N)rrrrr%rrrrro
s
rr9zunhashable type)rrDr,r;)rrrrr�test_frozen_hashn
szTestFrozen.test_frozen_hashN)rrrr�r�r�r�r�r�r�r�rrrrr��	sr�c@seZdZdd�Zdd�ZdS)�	TestSlotsc	Cs|tGdd�d��}|�td��|�WdQRX|d�}|�|jd�d|_|�|jd�|�td��d|_WdQRXdS)Nc@seZdZUdZeed<dS)z TestSlots.test_simple.<locals>.C)r#r#N)rrr�	__slots__rr%rrrrr~
s
rz8__init__\(\) missing 1 required positional argument: 'x'rCrJz'C' object has no attribute 'y')rr,r;rr#rr8)rrrUrrr�test_simple}
szTestSlots.test_simplecCsNtGdd�d��}tGdd�d|��}|dd�}|�|j|jfd�d|_dS)	Nc@seZdZUdZeed<dS)z0TestSlots.test_derived_added_field.<locals>.Base)r#r#N)rrrr�rr%rrrrrF�
s
rFc@seZdZUeed<eed<dS)z3TestSlots.test_derived_added_field.<locals>.Derivedr#r8N)rrrr$r%rrrr�Derived�
s
r�r(r�)r(r�rC)rrr#r8rG)rrFr�r�rrr�test_derived_added_field�
s
z"TestSlots.test_derived_added_fieldN)rrrr�r�rrrrr�|
sr�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestDescriptorscsnGdd�d��tG�fdd�d��}|�|jjd�tG�fdd�d��}|�|jjd�|�|�jd�dS)Nc@seZdZdd�Zdd�ZdS)z(TestDescriptors.test_set_name.<locals>.DcSs|d|_dS)Nr#)r3)r�ownerr3rrr�__set_name__�
sz5TestDescriptors.test_set_name.<locals>.D.__set_name__cSs|dk	rdS|S)Nr(r)r�instancer�rrr�__get__�
sz0TestDescriptors.test_set_name.<locals>.D.__get__N)rrrr�r�rrrrr��
sr�cseZdZU��Zeed<dS)z(TestDescriptors.test_set_name.<locals>.CrUN)rrrrUr$r%r)r�rrr�
s
r�cxcs$eZdZUe��dd�Zeed<dS)z(TestDescriptors.test_set_name.<locals>.CF)r)r0rUN)rrrr+rUr$r%r)r�rrr�
s
r()rrrUr3)rrr)r�r�
test_set_name�
s
zTestDescriptors.test_set_namecs8Gdd�d��tG�fdd�d��}|�|jjd�dS)Nc@seZdZdd�ZdS)z.TestDescriptors.test_non_descriptor.<locals>.DcSs|d|_dS)Nr#)r3)rr�r3rrrr��
sz;TestDescriptors.test_non_descriptor.<locals>.D.__set_name__N)rrrr�rrrrr��
sr�cs$eZdZUe��dd�Zeed<dS)z.TestDescriptors.test_non_descriptor.<locals>.CF)r)r0rUN)rrrr+rUr$r%r)r�rrr�
s
rr�)rrrUr3)rrr)r�r�test_non_descriptor�
sz#TestDescriptors.test_non_descriptorcsFGdd�d�}|��t��_tG�fdd�d��}|��jjd�dS)Nc@seZdZdS)z2TestDescriptors.test_lookup_on_instance.<locals>.DN)rrrrrrrr��
sr�cs"eZdZUe�dd�Zeed<dS)z2TestDescriptors.test_lookup_on_instance.<locals>.CF)r)r0r!N)rrrr+r!r$r%r)r�rrr�
s
rr)rr�rrr�)rr�rr)r�r�test_lookup_on_instance�
s
z'TestDescriptors.test_lookup_on_instancecs@Gdd�d��t��_tG�fdd�d��}|��jjd�dS)Nc@seZdZdS)z/TestDescriptors.test_lookup_on_class.<locals>.DN)rrrrrrrr��
sr�cs$eZdZUe��dd�Zeed<dS)z/TestDescriptors.test_lookup_on_class.<locals>.CF)r)r0r!N)rrrr+r!r$r%r)r�rrr�
s
rr()rr�rrr�)rrr)r�r�test_lookup_on_class�
sz$TestDescriptors.test_lookup_on_classN)rrrr�r�r�r�rrrrr��
s
r�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�TestStringAnnotationsc
sTxNdD]F�|j�d��0tG�fdd�d��}|�|�d|j�WdQRXqWdS)N)
z
ClassVar[int]zClassVar [int] ClassVar [int]rz
 ClassVar ztyping.ClassVar[int]ztyping.ClassVar[str]z typing.ClassVar[str]ztyping .ClassVar[str]ztyping. ClassVar[str]ztyping.ClassVar [str]ztyping.ClassVar [ str]ztyping.ClassVar.[int]ztyping.ClassVar+)�typestrcseZdZU�ed<dS)z.TestStringAnnotations.test_classvar.<locals>.Cr#N)rrrr%r)r�rrrs
rr#)rwrr�rg)rrr)r�r�
test_classvar�
s

z#TestStringAnnotations.test_classvarc
sRxLdD]D�|j�d��.tG�fdd�d��}|�|d�jd�WdQRXqWdS)N)
�CVz
t.ClassVarzt.ClassVar[int]ztyping..ClassVar[int]ZClassvarz
Classvar[int]ztyping.ClassVarx[int]ztypong.ClassVar[int]zdataclasses.ClassVar[int]ztypingxClassVar[str])r�cseZdZU�ed<dS)z3TestStringAnnotations.test_isnt_classvar.<locals>.Cr#N)rrrr%r)r�rrr s
rrC)rwrrr#)rrr)r�r�test_isnt_classvars
z(TestStringAnnotations.test_isnt_classvarcsbx\dD]T�|j�d��>tG�fdd�d��}|�td��|d�jWdQRXWdQRXqWdS)N)
zInitVar[int]zInitVar [int] InitVar [int]r�z	 InitVar zdataclasses.InitVar[int]zdataclasses.InitVar[str]z dataclasses.InitVar[str]zdataclasses .InitVar[str]zdataclasses. InitVar[str]zdataclasses.InitVar [str]zdataclasses.InitVar [ str]zdataclasses.InitVar.[int]zdataclasses.InitVar+)r�cseZdZU�ed<dS)z-TestStringAnnotations.test_initvar.<locals>.Cr#N)rrrr%r)r�rrr=s
rzobject has no attribute 'x'r()rwrr,rr#)rrr)r�r�test_initvar's
z"TestStringAnnotations.test_initvarc
sRxLdD]D�|j�d��.tG�fdd�d��}|�|d�jd�WdQRXqWdS)N)�IVz
dc.InitVarzxdataclasses.xInitVarztyping.xInitVar[int])r�cseZdZU�ed<dS)z2TestStringAnnotations.test_isnt_initvar.<locals>.Cr#N)rrrr%r)r�rrrMs
rrC)rwrrr#)rrr)r�r�test_isnt_initvarFs
z'TestStringAnnotations.test_isnt_initvarc
Csddlm}ddlm}ddlm}ddlm}x�||||fD]�}|j|d���|jrb|�d�}n|��}|�|j	d�|�
dd	d
dd�}xNd
D]F}|j|d��0|�td|�d���t
||�WdQRXWdQRXq�W|jr�|�d|j�|�|jd�n|�d|j�WdQRXq>WdS)Nr)�dataclass_module_1)�dataclass_module_1_str)�dataclass_module_2)�dataclass_module_2_str)�mrCr�r(r�r9r�)Ziv0Ziv1Ziv2Ziv3)�
field_namezobject has no attribute 'rv�not_iv4)rOr�r�r�r�rwZ
USING_STRINGSr�rZcv0r�r,rrjr�rgr�r�)rr�r�r�r�r�rUr�rrr�!test_classvar_module_level_importTs(
"z7TestStringAnnotations.test_classvar_module_level_importcCsHddlm}|�t|j�d|ji�|�t|jj�|jtd�d��dS)Nr)�dataclass_textannorM)rMr�)rOr�rr
r�r�rPr�)rr�rrr�test_text_annotations}s
z+TestStringAnnotations.test_text_annotationsN)	rrrr�r�r�r�r�r�rrrrr��
s$)r�c@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�TestMakeDataclasscCsZtddtfdttdd�fgddd�id	�}|d
�}|�|j|jfd�|�|��d�dS)
Nrr#r8rJ)r)�add_onecSs
|jdS)Nr()r#)rrrrrs�rtz/TestMakeDataclass.test_simple.<locals>.<lambda>)rjrC)rCrJr�)rir$r+rr#r8r�)rrrUrrrr��szTestMakeDataclass.test_simplecCs6i}tddtfdttdd�fg|d�}|�|i�dS)Nrr#r8rJ)r))rj)rir$r+r)r�nsrrrr�test_no_mutate_namespace�sz*TestMakeDataclass.test_no_mutate_namespacecCsdGdd�d�}Gdd�d�}tddtfg||fd�}|d�}|�||�|�||�|�||�dS)	Nc@seZdZdS)z*TestMakeDataclass.test_base.<locals>.Base1N)rrrrrrr�Base1�sr�c@seZdZdS)z*TestMakeDataclass.test_base.<locals>.Base2N)rrrrrrr�Base2�sr�rr#)rir�)rir$r�)rr�r�rrUrrr�	test_base�szTestMakeDataclass.test_basec	Cs�tGdd�d��}Gdd�d�}tddtfg||fd�}|�td��|d	�}WdQRX|d
d	�}|�||�|�||�|�||�|�|j|jfd�dS)Nc@seZdZUeed<dS)z4TestMakeDataclass.test_base_dataclass.<locals>.Base1r#N)rrrr$r%rrrrr��s
r�c@seZdZdS)z4TestMakeDataclass.test_base_dataclass.<locals>.Base2N)rrrrrrrr��sr�rr8)rizrequired positionalr�r()r(r�)	rrir$r,r;r�rr#r8)rr�r�rrUrrr�test_base_dataclass�s
z%TestMakeDataclass.test_base_dataclasscCs`dd�}tddtfdttfgd|id�}|dd	�}|�t|�dd
i�|�tt|��d�dS)NcSs|j|9_dS)N)r#)rr8rrr�	post_init�sz2TestMakeDataclass.test_init_var.<locals>.post_initrr#r8r�)rjr�r9r�r()rir$r�rr�rr)rr�rrUrrrr��s
zTestMakeDataclass.test_init_varc	Cs~tddtfdttdfdtttdd�fg�}|d�}|�t|�ddi�|�tt|��d�|�|jd�|�|j	d�dS)	Nrr#r8rCrGr�)r)r()
rir$rr+rr�rrr8rG)rrrUrrrr��sz TestMakeDataclass.test_class_varc	Cs|tddtfdttdfdtttdd�fgdd	�}|�d
t|��|�dt|��|�td��tdgdd
�}WdQRXdS)Nrr#r8rCrGr�)r)F)r0rPr�zunexpected keyword argument)Zxxinit)	rir$rr+r�r�r�r,r;)rrrrr�test_other_params�sz#TestMakeDataclass.test_other_paramscCs�tddddg�}|ddd�}|�t|�dddd��|�|jd	d	d	d��tdddtfdg�}|ddd�}|�t|�dddd��|�|jd	td	d��dS)
Nr�r#r8rGr(r�r9)r#r8rGz
typing.Any)rirr�r%r$)rrrUrrr�
test_no_types�s


zTestMakeDataclass.test_no_typescCs�xJdD]B}|j|d��,|�td��tdd|g�WdQRXWdQRXqWxRtdd�gD]B}|j|d��,|�td��tdd|g�WdQRXWdQRXqZWdS)	N)r)r(r�r9r�)�	bad_fieldzInvalid field: rrrcSs|S)Nr)r#rrrrsrtzCTestMakeDataclass.test_invalid_type_specification.<locals>.<lambda>zhas no len\(\))rwr,r;rir�)rr�rrr�test_invalid_type_specification�s
&z1TestMakeDataclass.test_invalid_type_specificationcCsRxLdD]D}|j|d��.|�td��td|d|g�WdQRXWdQRXqWdS)N)rrZab)r+zField name duplicatedrrr)rwr,r;ri)rr+rrr�test_duplicate_field_namess
z,TestMakeDataclass.test_duplicate_field_namescCs�x�dD]�}|j|d��v|�td��tdd|g�WdQRX|�td��td|g�WdQRX|�td��td|dg�WdQRXWdQRXqWdS)N)�for�async�await�as)r+zmust not be keywordsrrr)rwr,r;ri)rr+rrr�test_keyword_field_namess
z*TestMakeDataclass.test_keyword_field_namescCs�x�dD]�}|j|d��v|�td��tdd|g�WdQRX|�td��td|g�WdQRX|�td��td|dg�WdQRXWdQRXqWdS)N)z()zx,yrz2@3r~zlittle johnny tables)r+zmust be valid identifiersrrr)rwr,r;ri)rr+rrr�test_non_identifier_field_namess
z1TestMakeDataclass.test_non_identifier_field_namescCstdddddg�dS)Nr�_Z_aZa_aZa_)ri)rrrr�test_underscore_field_names sz-TestMakeDataclass.test_underscore_field_namesc
CsFx@dD]8}|j|d��"t|ddg�}|�|j|�WdQRXqWdS)N)z()zx,yrz2@3r~)�	classnamerrra)rwrirr)rr�rrrr�test_funny_class_names_names%s
z.TestMakeDataclass.test_funny_class_names_namesN)rrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s
	


r�c@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�TestReplacecCsNtdd�Gdd�d��}|dd�}t|dd�}|�|jd�|�|jd�dS)	NT)r=c@seZdZUeed<eed<dS)zTestReplace.test.<locals>.Cr#r8N)rrrr$r%rrrrr/s
rr(r�r9)r#)rrrr#r8)rrrUr�rrrrO.s

zTestReplace.testc	Cs
tdd�Gdd�d��}|dd�}t|dd�}|�|j|j|j|jfd	�|�|j|j|j|jfd
�|�td��t|ddd
d�WdQRX|�td��"t|dd�t|ddd
d�WdQRX|�t	d��d|_WdQRX|�t
d��t|ddd�}WdQRXdS)NT)r=c@sFeZdZUeed<eed<eddd�Zeed<eddd�Zeed<d	S)
z"TestReplace.test_frozen.<locals>.Cr#r8FrC)r0r)rGr?r�N)rrrr$r%r+rGr�rrrrr:s
rr(r�r9)r#)r(r�rCr?)r9r�rCr?z
init=Falser�r�)r#rGr�)rGzcannot assign to field 'x'z3__init__\(\) got an unexpected keyword argument 'a'rJ)r#rr)rrrr#r8rGr�r,r-r�r;)rrrUr�rrrr�9s
zTestReplace.test_frozenc	CsJtdd�Gdd�d��}|dd�}|�td��t|dd	�}WdQRXdS)
NT)r=c@seZdZUeed<eed<dS)z.TestReplace.test_invalid_field_name.<locals>.Cr#r8N)rrrr$r%rrrrrZs
rr(r�z3__init__\(\) got an unexpected keyword argument 'z'r9)rG)rr,r;r)rrrUr�rrr�test_invalid_field_nameYs
z#TestReplace.test_invalid_field_namec	Csdtdd�Gdd�d��}|�td��t|dd�WdQRX|�td��tddd�WdQRXdS)	NT)r=c@seZdZUeed<eed<dS)z*TestReplace.test_invalid_object.<locals>.Cr#r8N)rrrr$r%rrrrres
rzdataclass instancer9)r#r)rr,r;r)rrrrr�test_invalid_objectds
zTestReplace.test_invalid_objectc	Cs�tGdd�d��}|d�}d|_t|dd�}|�|j|jfd�|�td��t|d	d
d�WdQRX|�td��t|d
d�WdQRXdS)
Nc@s*eZdZUeed<eddd�Zeed<dS)z#TestReplace.test_no_init.<locals>.Cr#FrC)r0r)r8N)rrrr$r%r+r8rrrrrqs
rr(r�rJ)r#)rJrCz
init=Falser��)r#r8)r8)rr8rrr#r,r-)rrrUr�rrrr�pszTestReplace.test_no_initc	CsttGdd�d��}|d�}|d�}|�|j|j�|�|jd�|�td��t|dd�WdQRXt|d	d
�dS)Nc@s&eZdZUeed<dZeeed<dS)z$TestReplace.test_classvar.<locals>.Cr#i�r8N)rrrr$r%r8rrrrrr�s
rr(r�i�z3__init__\(\) got an unexpected keyword argument 'y'r�)r8rJ)r#)rr�r8rr,r;r)rrrUr�rrrr��szTestReplace.test_classvarc	CsntGdd�d��}|dd�}|�|jd�|�td��t|dd�WdQRXt|ddd	�}|�|jd
�dS)Nc@s*eZdZUeed<eeed<dd�ZdS)z0TestReplace.test_initvar_is_specified.<locals>.Cr#r8cSs|j|9_dS)N)r#)rr8rrrr��sz>TestReplace.test_initvar_is_specified.<locals>.C.__post_init__N)rrrr$r%r�r�rrrrr�s
rr(rCz,InitVar 'y' must be specified with replace()r9)r#rJ)r#r8rH)rrr#r,r-r)rrrUrrr�test_initvar_is_specified�s
z%TestReplace.test_initvar_is_specifiedcCs4tGdd�d��}|d�}||_|�t|�d�dS)Nc@seZdZUded<dS)z*TestReplace.test_recursive_repr.<locals>.Crr�N)rrrr%rrrrr�s
rz1TestReplace.test_recursive_repr.<locals>.C(f=...))rr�rr1)rrrUrrr�test_recursive_repr�szTestReplace.test_recursive_reprcCs<tGdd�d��}|dd�}||_||_|�t|�d�dS)Nc@seZdZUded<ded<dS)z4TestReplace.test_recursive_repr_two_attrs.<locals>.Crr��gN)rrrr%rrrrr�s
rzBTestReplace.test_recursive_repr_two_attrs.<locals>.C(f=..., g=...))rr�r�rr1)rrrUrrr�test_recursive_repr_two_attrs�s

z)TestReplace.test_recursive_repr_two_attrscCsTtGdd�d��}tGdd�d��}|d�}|d�}||_||_|�t|�d�dS)Nc@seZdZUded<dS)z6TestReplace.test_recursive_repr_indirection.<locals>.Cr�r�N)rrrr%rrrrr�s
rc@seZdZUded<dS)z6TestReplace.test_recursive_repr_indirection.<locals>.Drr�N)rrrr%rrrrr��s
r�zwTestReplace.test_recursive_repr_indirection.<locals>.C(f=TestReplace.test_recursive_repr_indirection.<locals>.D(f=...)))rr�rr1)rrr�rUr�rrr�test_recursive_repr_indirection�sz+TestReplace.test_recursive_repr_indirectioncCsttGdd�d��}tGdd�d��}tGdd�d��}|d�}|d�}|d�}||_||_||_|�t|�d�dS)Nc@seZdZUded<dS)z:TestReplace.test_recursive_repr_indirection_two.<locals>.Cr�r�N)rrrr%rrrrr�s
rc@seZdZUded<dS)z:TestReplace.test_recursive_repr_indirection_two.<locals>.Dr�r�N)rrrr%rrrrr��s
r�c@seZdZUded<dS)z:TestReplace.test_recursive_repr_indirection_two.<locals>.Err�N)rrrr%rrrrr��s
r�z�TestReplace.test_recursive_repr_indirection_two.<locals>.C(f=TestReplace.test_recursive_repr_indirection_two.<locals>.D(f=TestReplace.test_recursive_repr_indirection_two.<locals>.E(f=...))))rr�rr1)rrr�r�rUr�rrrr�#test_recursive_repr_indirection_two�sz/TestReplace.test_recursive_repr_indirection_twocCs<tGdd�d��}|dd�}||_||_|�t|�d�dS)Nc@seZdZUded<ded<dS)z4TestReplace.test_recursive_repr_two_attrs.<locals>.Crr�r�N)rrrr%rrrrr�s
rzBTestReplace.test_recursive_repr_two_attrs.<locals>.C(f=..., g=...))rr�r�rr1)rrrUrrrr��s

cCs6tGdd�d��}|dd�}||_|�t|�d�dS)Nc@seZdZUded<eed<dS)z5TestReplace.test_recursive_repr_misc_attrs.<locals>.Crr�r�N)rrrr%r$rrrrr�s
rr(zATestReplace.test_recursive_repr_misc_attrs.<locals>.C(f=..., g=1))rr�rr1)rrrUrrr�test_recursive_repr_misc_attrs�s
z*TestReplace.test_recursive_repr_misc_attrsN)rrrrOr�r�r�r�r�r�r�r�r�r�r�rrrrr�-s 	r��__main__)*ZdataclassesrsrNrfZunittestZ
unittest.mockr�typingrrrrrr	r
rrr
�collectionsrrr�	functoolsr�	Exceptionrrrxr|r�r�r�r�r�r�r�r�r�r�r�r�mainrrrr�<module>s`,#YBG/L]*H%`