Your IP : 216.73.216.60


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/test_typing.cpython-39.pyc

a

XC?h0�
@s�ddlZddlZddlZddlZddlZddlmZmZmZm	Z	ddl
m
Z
mZddlm
Z
mZddlmZmZddlmZmZmZddlmZmZmZddlmZmZmZmZdd	lmZdd
lmZmZmZmZm Z ddlm!Z!m"Z"ddlm#Z#dd
lm$Z$m%Z%ddlm&Z&m'Z'ddlm(Z(ddlm)Z)ddlm*Z*m+Z+ddlm,Z,m-Z-m.Z.ddlm/Z/m0Z0ddlm1Z1m2Z2ddl3Z3ddlZddl4Z4ddl5Z5ddl6m7Z7ddl6m8Z8Gdd�de�Z9Gdd�d�Z:Gdd�de:�Z;Gdd�de:�Z<Gdd �d e;e<�Z=Gd!d"�d"e9�Z>Gd#d$�d$e9�Z?Gd%d&�d&e9�Z@Gd'd(�d(e9�ZAGd)d*�d*e9�ZBGd+d,�d,e9�ZCGd-d.�d.e9�ZDed/eEeF�ZGed0�ZHGd1d2�d2eeGeHf�ZIGd3d4�d4eIeGeHf�ZJGd5d6�d6e �ZKe"Gd7d8�d8eKe ��ZLGd9d:�d:�ZMGd;d<�d<e �ZNGd=d>�d>e �ZOe"Gd?d@�d@eNeOe ��ZPe"GdAdB�dBe ��ZQGdCdD�dDeQ�ZRGdEdF�dF�ZSGdGdH�dHe*�ZTe"GdIdJ�dJe ��ZUGdKdL�dLe9�ZVGdMdN�dNe9�ZWGdOdP�dPe9�ZXGdQdR�dRe9�ZYGdSdT�dTe9�ZZGdUdV�dVe9�Z[GdWdX�dXe9�Z\dYZ]ze^e]�Wne_�ydZZ`Yn0d[Z`dd\l6maZambZbmcZcmdZdmeZedd]lmfZfGd^d_�d_�ZgGd`da�daeg�ZhGdbdc�dceh�ZiGddde�deee�ZjGdfdg�dg�ZkGdhdi�di�ZlGdjdk�dke*�ZmGdldm�dme*�ZnGdndo�doe*�ZoGdpdq�dqe*�Zpe+drdseEfg�ZqGdtdu�due+�ZrGdvdw�dwe8jsdZdx�ZtGdydz�dzereq�ZuGd{d|�d|e+dZdx�ZvGd}d~�d~e7jg�Zwefexd�d�d��Zyzeyez���{d�Wn:e|�y�Z}z e}j~dd�k�s�J�WYdZ}[}n
dZ}[}00e#ZGd�d��d��Z�Gd�d��d�e9�Z�Gd�d��d�e�Z�Gd�d��d�e9�Z�Gd�d��d�e9�Z�Gd�d��d�e9�Z�Gd�d��d�e9�Z�Gd�d��d�e9�Z�Gd�d��d�e9�Z�Gd�d��d�e9�Z�Gd�d��d�e9�Z�Gd�d��d�e9�Z�Gd�d��d�e9�Z�e�d�k�r�e�dS)��N)�TestCase�main�
skipUnless�skip)�copy�deepcopy)�Any�NoReturn)�TypeVar�AnyStr)�T�KT�VT)�Union�Optional�Literal)�Tuple�List�Dict�MutableMapping)�Callable)�Generic�ClassVar�Final�final�Protocol)�cast�runtime_checkable)�get_type_hints)�
get_origin�get_args)�
no_type_check�no_type_check_decorator��Type)�NewType)�
NamedTuple�	TypedDict��IO�TextIO�BinaryIO)�Pattern�Match)�	Annotated�
ForwardRef)�mod_generics_cache)�_typed_dict_helperc@s(eZdZddd�Zd	dd�Zdd�ZdS)
�BaseTestCaseNcCs8t||�s4d||f}|dur*|d|7}|�|��dS)Nz%r is not a subclass of %r� : %s��
issubclassZfailureException��self�clsZclass_or_tuple�msg�message�r;�5/opt/alt/python39/lib64/python3.9/test/test_typing.py�assertIsSubclass%s

zBaseTestCase.assertIsSubclasscCs8t||�r4d||f}|dur*|d|7}|�|��dS)Nz%r is a subclass of %rr3r4r6r;r;r<�assertNotIsSubclass,s

z BaseTestCase.assertNotIsSubclasscCstjD]
}|�qdS�N)�typing�	_cleanups�r7�fr;r;r<�clear_caches3s
zBaseTestCase.clear_caches)N)N)�__name__�
__module__�__qualname__r=r>rDr;r;r;r<r2#s

r2c@seZdZdS)�EmployeeN�rErFrGr;r;r;r<rH8srHc@seZdZdS)�ManagerNrIr;r;r;r<rJ<srJc@seZdZdS)�FounderNrIr;r;r;r<rK@srKc@seZdZdS)�ManagingFounderNrIr;r;r;r<rLDsrLc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�AnyTestscCs8|�t��tdt�Wd�n1s*0YdS�N�*)�assertRaises�	TypeError�
isinstancer�r7r;r;r<�test_any_instance_type_errorJsz%AnyTests.test_any_instance_type_errorcCsl|�t��ttt�Wd�n1s*0Y|�t��ttt�Wd�n1s^0YdSr?)rPrQr5rHrrSr;r;r<�test_any_subclass_type_errorNs(z%AnyTests.test_any_subclass_type_errorcCs|�tt�d�dS)Nz
typing.Any)�assertEqual�reprrrSr;r;r<�	test_reprTszAnyTests.test_reprcCsj|�t��tdt�Wd�n1s*0Y|�t��ttWd�n1s\0YdSrN)rPrQr5r�intrSr;r;r<�test_errorsWs(zAnyTests.test_errorscCs||�t�� Gdd�dt�}Wd�n1s00Y|�t��$Gdd�dtt��}Wd�n1sn0YdS)Nc@seZdZdS�z(AnyTests.test_cannot_subclass.<locals>.ANrIr;r;r;r<�A_sr\c@seZdZdSr[rIr;r;r;r<r\bs�rPrQr�type�r7r\r;r;r<�test_cannot_subclass]s.zAnyTests.test_cannot_subclasscCsh|�t��t�Wd�n1s&0Y|�t��tt��Wd�n1sZ0YdSr?r]rSr;r;r<�test_cannot_instantiatees$z AnyTests.test_cannot_instantiatecCs"tjttjttjtdSr?)r@r-rr,r)rSr;r;r<�test_any_works_with_aliasks

z"AnyTests.test_any_works_with_aliasN)
rErFrGrTrUrXrZr`rarbr;r;r;r<rMHsrMc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
NoReturnTestscCs8|�t��tdt�Wd�n1s*0YdSrN)rPrQrRr	rSr;r;r<�!test_noreturn_instance_type_errortsz/NoReturnTests.test_noreturn_instance_type_errorcCsl|�t��ttt�Wd�n1s*0Y|�t��ttt�Wd�n1s^0YdSr?)rPrQr5rHr	rSr;r;r<�!test_noreturn_subclass_type_errorxs(z/NoReturnTests.test_noreturn_subclass_type_errorcCs|�tt�d�dS)Nztyping.NoReturn)rVrWr	rSr;r;r<rX~szNoReturnTests.test_reprcCs6|�t��ttWd�n1s(0YdSr?)rPrQr	rYrSr;r;r<�test_not_generic�szNoReturnTests.test_not_genericcCs||�t�� Gdd�dt�}Wd�n1s00Y|�t��$Gdd�dtt��}Wd�n1sn0YdS)Nc@seZdZdS�z-NoReturnTests.test_cannot_subclass.<locals>.ANrIr;r;r;r<r\�sr\c@seZdZdSrgrIr;r;r;r<r\�s�rPrQr	r^r_r;r;r<r`�s.z"NoReturnTests.test_cannot_subclasscCsh|�t��t�Wd�n1s&0Y|�t��tt��Wd�n1sZ0YdSr?rhrSr;r;r<ra�s$z%NoReturnTests.test_cannot_instantiateN)	rErFrGrdrerXrfr`rar;r;r;r<rcrsrcc@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�TypeVarTestscCs$td�}|�||�|�|t�dS�Nr)r
rV�assertIsInstance�r7rr;r;r<�test_basic_plain�szTypeVarTests.test_basic_plaincCs@td�}|�t��td|�Wd�n1s20YdS)NrrO)r
rPrQrRrlr;r;r<� test_typevar_instance_type_error�sz-TypeVarTests.test_typevar_instance_type_errorcCsttd�}|�t��tt|�Wd�n1s20Y|�t��t|t�Wd�n1sf0YdSrj)r
rPrQr5rYrlr;r;r<� test_typevar_subclass_type_error�s
(z-TypeVarTests.test_typevar_subclass_type_errorcCs<|�t��tdt�}|Wd�n1s.0YdS)N�X)rPrQr
rY�r7rpr;r;r<�test_constrained_error�s
z#TypeVarTests.test_constrained_errorcCs�td�}td�}|�||�|�t||�|�t|t||f�|�t||f|�|�t|tft|�|�t|tftt�|�t|tfj|tf�|�t|tfj|f�|�t|tfjt�dS)Nrp�Y)	r
�assertNotEqualrVrrY�__args__�__parameters__�assertIs�
__origin__)r7rprsr;r;r<�test_union_unique�szTypeVarTests.test_union_uniquecCs(tdtt�}|�t|tft|�dS�Nr\)r
�str�bytesrtrr_r;r;r<�test_union_constrained�sz#TypeVarTests.test_union_constrainedcCs||�tt�d�|�tt�d�|�tt�d�|�tt�d�tddd�}|�t|�d�td	dd
�}|�t|�d�dS)Nz~Tz~KTz~VTz~AnyStr�T_coT��	covariantz+T_co�T_contra)�
contravariantz	-T_contra)rVrWrr
rrr
)r7r~r�r;r;r<rX�szTypeVarTests.test_reprcCs4|�td�td��|�tdtt�tdtt��dSrj)rtr
rYr{rSr;r;r<�test_no_redefinition�sz!TypeVarTests.test_no_redefinitioncCsB|�t��$Gdd�dtd��}Wd�n1s40YdS)Nc@seZdZdS)z1TypeVarTests.test_cannot_subclass_vars.<locals>.VNrIr;r;r;r<�V�sr�r�rPrQr
�r7r�r;r;r<�test_cannot_subclass_vars�sz&TypeVarTests.test_cannot_subclass_varscCs>|�t�� Gdd�dt�}Wd�n1s00YdS)Nc@seZdZdS)z7TypeVarTests.test_cannot_subclass_var_itself.<locals>.VNrIr;r;r;r<r��sr�r�r�r;r;r<�test_cannot_subclass_var_itself�sz,TypeVarTests.test_cannot_subclass_var_itselfcCs8|�t��td��Wd�n1s*0YdSrzr�rSr;r;r<�test_cannot_instantiate_vars�sz)TypeVarTests.test_cannot_instantiate_varscCst|�t��tddd�Wd�n1s,0Y|�t�� tdtttd�Wd�n1sf0YdS)NrprO��bound)rPrQr
r{�floatrHrSr;r;r<�test_bound_errors�s*zTypeVarTests.test_bound_errorscCsd}t|i�dS)Nz&import typing
T = typing.TypeVar('T')
)�exec)r7�coder;r;r<�test_missing__name__�sz!TypeVarTests.test_missing__name__cCs<|�t��tdddd�Wd�n1s.0YdS)NrT)r�r�)rP�
ValueErrorr
rSr;r;r<�test_no_bivariant�szTypeVarTests.test_no_bivariantN)rErFrGrmrnrorrryr}rXr�r�r�r�r�r�r�r;r;r;r<ri�s

ric@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)S)*�
UnionTestscCstttf}|�|t�dSr?)rrYr�rt�r7�ur;r;r<�test_basics�szUnionTests.test_basicscCs�|�t��ttt�Wd�n1s*0Y|�t��ttt�Wd�n1s^0Y|�t��"tttttf�Wd�n1s�0Y|�t��"ttttft�Wd�n1s�0YdSr?)rPrQr5rYrr{rSr;r;r<�test_subclass_error�s((0zUnionTests.test_subclass_errorcCsltt}|�|t�tttf}tttf}tttf}|�||�|�|t�|�|t�|�|t�dSr?)rrrVrY�objectrt)r7r��u1�u2Zu3r;r;r<�test_union_any�szUnionTests.test_union_anycCsTtt}|�|t�tttf}tttf}|�||�|�|t�|�|t�dSr?)rr�rVrYrt)r7r�r�r�r;r;r<�test_union_objectszUnionTests.test_union_objectcCs(tttf}tttf}|�||�dSr?)rrYr�rV)r7r�r�r;r;r<�test_unorderedszUnionTests.test_unorderedcCstt}|�|t�dSr?)rrHrw)r7�tr;r;r<�test_single_class_disappearssz'UnionTests.test_single_class_disappearscCs8tttf}|�|t�|�t|j�|�t|j�dSr?)rrHrJrt�assertInrur�r;r;r<�test_base_class_keptszUnionTests.test_base_class_keptcCs2tttf}t|tf}|�|ttttf�dSr?)rrYr�rHrV)r7r��vr;r;r<�test_union_union szUnionTests.test_union_unioncCs6|�tt�d�tttf}|�t|�dt�tttf}|�t|�dt�td�}t|tft}|�t|�tt��ttttf}|�t|�d�tttt	t
tff}|�t|�d�tdt
f}|�t|�d�tt
df}|�t|�d�tdt
tf}|�t|�d�tt
}|�t|�d�dS)	Nztyping.Unionztyping.Union[%s.Employee, int]ztyping.Union[int, %s.Employee]rz#typing.Union[typing.List[int], int]z)typing.Union[list[int], dict[str, float]]ztyping.Optional[str]z typing.Union[NoneType, str, int])
rVrWrrHrYrEr
r�list�dictr{r�r)r7r�rr;r;r<rX%s(zUnionTests.test_reprcCs�|�t�� Gdd�dt�}Wd�n1s00Y|�t��$Gdd�dtt��}Wd�n1sn0Y|�t��(Gdd�dtttf�}Wd�n1s�0YdS)Nc@seZdZdS�z*UnionTests.test_cannot_subclass.<locals>.CNrIr;r;r;r<�C>sr�c@seZdZdSr�rIr;r;r;r<r�Asc@seZdZdSr�rIr;r;r;r<r�Ds)rPrQrr^rYr{�r7r�r;r;r<r`<s.2zUnionTests.test_cannot_subclasscCs�|�t��t�Wd�n1s&0Y|�t��tt��Wd�n1sZ0Ytttf}|�t��|�Wd�n1s�0Y|�t��t|��Wd�n1s�0YdSr?)rPrQrr^rYr�r�r;r;r<raGs$($z"UnionTests.test_cannot_instantiatecCs�|�tttjtftk�|�tttjtftjtk�|�ttttjtfj�|�tjttttjtfj�dSr?)�assertFalserr{r@�IterablerYr�rurSr;r;r<�test_union_generalizationRs"z$UnionTests.test_union_generalizationcCsb|�tt�|�tt�|�tt�|�tt�|�dgt�|�ttj�|�ttjt�dSr?)	rtrr�rrrr@�MappingrrSr;r;r<�test_union_compare_otherXsz#UnionTests.test_union_compare_othercCs$tt}ttdf}|�||�dSr?)rrYrrV)r7�or�r;r;r<�
test_optionalaszUnionTests.test_optionalcCs6|�t��tdWd�n1s(0YdS�Nr;)rPrQrrSr;r;r<�
test_emptyfszUnionTests.test_emptycCs@|�t��"tdtttf�Wd�n1s20YdSrN)rPrQrRrrYr{rSr;r;r<�test_union_instance_type_errorjsz)UnionTests.test_union_instance_type_errorcCs2tttf}|d�dd�}|�t|�d|�dS)N��xcSsdSr?r;r�r;r;r<rCp�z(UnionTests.test_no_eval_union.<locals>.fr�)rrYr{rwr)r7r�rCr;r;r<�test_no_eval_unionnszUnionTests.test_no_eval_unioncCs*td�dd�}|�tt|tf�d�dS)N��returncSsdSr?r;r;r;r;r<�funtr�z0UnionTests.test_function_repr_union.<locals>.funztyping.Union[fun, int])rYrVrWr)r7r�r;r;r<�test_function_repr_unionssz#UnionTests.test_function_repr_unioncCstttf}|dSr?)rr{r,r_r;r;r<�test_union_str_patternwsz!UnionTests.test_union_str_patterncs4ddlm�t�tf�fdd�}t|tfdS)Nr��Elementcs�|�Sr?r;)�argsr�r;r<�Elem�sz#UnionTests.test_etree.<locals>.Elem)Zxml.etree.ElementTreer�rr{)r7r�r;r�r<�
test_etree|szUnionTests.test_etreeN)rErFrGr�r�r�r�r�r�r�r�rXr`rar�r�r�r�r�r�r�r�r�r;r;r;r<r��s(
		r�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
TupleTestscCs�|�t��"tttttf�Wd�n1s20Y|�t��"tttttf�Wd�n1sn0YGdd�dt�}|�ttt��|�t|t��dS)Nc@seZdZdS)z"TupleTests.test_basics.<locals>.TPNrIr;r;r;r<�TP�r�r�)rPrQr5rrYr{�tuple�
assertTrue)r7r�r;r;r<r��s00zTupleTests.test_basicscCsd|�tttt�|�ttdfttdf�|�tttttf�|�ttttdf�dS�N.)rVrrYrtrSr;r;r<�
test_equality�szTupleTests.test_equalitycCs$Gdd�dt�}|�t|t��dS)Nc@seZdZdS)z/TupleTests.test_tuple_subclass.<locals>.MyTupleNrIr;r;r;r<�MyTuple�sr�)r�r�r5r)r7r�r;r;r<�test_tuple_subclass�szTupleTests.test_tuple_subclasscCsL|�t��"tdtttf�Wd�n1s20Y|�dt�dS)N)rr)rPrQrRrrYrkrSr;r;r<�test_tuple_instance_type_error�s0z)TupleTests.test_tuple_instance_type_errorcCsp|�tt�d�|�ttd�d�|�ttttf�d�|�tttdf�d�|�tttt�d�dS)Nztyping.Tupler;ztyping.Tuple[()]ztyping.Tuple[int, float].ztyping.Tuple[int, ...]ztyping.Tuple[list[int]])rVrWrrYr�r�rSr;r;r<rX�s
zTupleTests.test_reprcCsp|�t��tdt�Wd�n1s*0Y|�t��tdtt�Wd�n1sb0YdSrN)rPrQr5rrYrSr;r;r<rZ�s(zTupleTests.test_errorsN)	rErFrGr�r�r�r�rXrZr;r;r;r<r��s
r�c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�
CallableTestscCsh|�t��2|�ttdd��ttgtf��Wd�n1sB0Y|�ttdd��t��dS)NcSs|Sr?r;r�r;r;r<�<lambda>�r�z2CallableTests.test_self_subclass.<locals>.<lambda>cSs|Sr?r;r�r;r;r<r��r�)rPrQr�r5r^rrYrSr;r;r<�test_self_subclass�s@z CallableTests.test_self_subclasscCs�|�ttgtfttgtf�|�tttgtfttgtfh�d�|�ttgtfttgtf�|�ttgtfttgtf�|�ttgtftttgtf�|�ttgtftgtf�|�ttgtft�dS�N�)rVrrY�lenrtr{rSr;r;r<�test_eq_hash�s (  "zCallableTests.test_eq_hashcCs�|�t��t�Wd�n1s&0Y|�t��tt��Wd�n1sZ0Yttgtf}|�t��|�Wd�n1s�0Y|�t��t|��Wd�n1s�0YdSr?)rPrQrr^rYr{)r7�cr;r;r<ra�s$($z%CallableTests.test_cannot_instantiatecCs6|�t��ttWd�n1s(0YdSr?)rPrQrrYrSr;r;r<�test_callable_wrong_forms�sz'CallableTests.test_callable_wrong_formscCs$dd�}|�|t�|�dt�dS)NcSsdSr?r;r;r;r;r<rC�sz5CallableTests.test_callable_instance_works.<locals>.f)rkr�assertNotIsInstancerBr;r;r<�test_callable_instance_works�sz*CallableTests.test_callable_instance_workscCsdd�}|�t��$|�|tgdf�Wd�n1s<0Y|�t��$|�|tgtf�Wd�n1sz0Y|�t��$|�dtgdf�Wd�n1s�0Y|�t��$|�dtgtf�Wd�n1s�0YdS)NcSsdSr?r;r;r;r;r<rC�sz:CallableTests.test_callable_instance_type_error.<locals>.f)rPrQrkrrr�rBr;r;r<�!test_callable_instance_type_error�s222z/CallableTests.test_callable_instance_type_errorcCs�tgtf}|�t|�d�tttgtf}|�t|�d�tdtf}|�t|�d�tttgttf}|�t|�d�dS)Nztyping.Callable[[], bool]z"typing.Callable[[str, float], int].ztyping.Callable[..., str]z(typing.Callable[[str, float], list[int]])r�boolrVrWr{r�rYr�)r7Zct0Zct2ZctvZct3r;r;r<rX�szCallableTests.test_reprcCs>tdtfd�dd�}|�t|t�t��dtdtfi�dS)N.��acSsdSr?r;r�r;r;r<�foo�sz6CallableTests.test_callable_with_ellipsis.<locals>.foor�)rrrVr�globals�locals�r7r�r;r;r<�test_callable_with_ellipsis�s�z)CallableTests.test_callable_with_ellipsiscCstjtdtfdSr�)r@rrr{rSr;r;r<�test_ellipsis_in_generic�sz&CallableTests.test_ellipsis_in_genericN)rErFrGr�r�rar�r�r�rXr�r�r;r;r;r<r��s	
r�c@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�LiteralTestscCsPtdtdtdtdtdtdttdtdftddS)	Nr��r���)r��y�zT)r��2F�r�r����)sfoo�bar)rrSr;r;r<r��szLiteralTests.test_basicscCs*tttdtddd�ttdS)N)y@@.r;r�r��r�r�)rrYrrSr;r;r<�3test_illegal_parameters_do_not_raise_runtime_errorssz@LiteralTests.test_illegal_parameters_do_not_raise_runtime_errorscCsttdttddS)Nr�)r�r��baz)rrrSr;r;r<� test_literals_inside_other_typessz-LiteralTests.test_literals_inside_other_typescCsx|�ttd�d�|�ttd�d�|�ttt�d�|�tt�d�|�ttd�d�|�ttd�d	�dS)
Nr�ztyping.Literal[1])r�Tr�ztyping.Literal[1, True, 'foo']ztyping.Literal[int]ztyping.Literalztyping.Literal[None]�r�r�r�r�ztyping.Literal[1, 2, 3])rVrWrrYrSr;r;r<rXszLiteralTests.test_reprcCs�|�t��t�Wd�n1s&0Y|�t��td�Wd�n1sZ0Y|�t��tt��Wd�n1s�0Y|�t��ttd��Wd�n1s�0YdSr�)rPrQrr^rSr;r;r<�test_cannot_inits$((zLiteralTests.test_cannot_initcCs�|�t��tdtd�Wd�n1s.0Y|�t��tttd�Wd�n1sf0Y|�t��tdtd�Wd�n1s�0Y|�t��tttd�Wd�n1s�0YdSr�)rPrQrRrrYr5rSr;r;r<� test_no_isinstance_or_issubclass%s,,,z-LiteralTests.test_no_isinstance_or_issubclasscCs||�t��$Gdd�dtd�}Wd�n1s40Y|�t�� Gdd�dt�}Wd�n1sn0YdS)Nc@seZdZdS)z-LiteralTests.test_no_subclassing.<locals>.FooNrIr;r;r;r<�Foo1r�r�r�c@seZdZdS)z-LiteralTests.test_no_subclassing.<locals>.BarNrIr;r;r;r<�Bar3r�r��rPrQr)r7r�r�r;r;r<�test_no_subclassing/s2z LiteralTests.test_no_subclassingcCs:|�t��tddWd�n1s,0YdSr�r�rSr;r;r<�test_no_multiple_subscripts5sz(LiteralTests.test_no_multiple_subscriptscCs�|�tdtd�|�tdtd�|�tdtd�|�tdtd�|�tdtd�|�tdtd	�|�tdtd�|�tdtd
�|�tdtd�dS)
NrFTr�r�)r�T)r�r�r�)Tr��r�r�r�r�)rtrrVrSr;r;r<�
test_equal9szLiteralTests.test_equalcCsX|�ttd�ttd��|�ttd�ttd��|�ttd�ttd��dS)Nr�r�r�r�r�)rV�hashrrSr;r;r<�	test_hashDszLiteralTests.test_hashcCsb|�tdjd�|�tdjd�|�tdtdtdfjd�|�tggfjggf�dS)Nr�r�r�r�)r�r�)r�r�r�r�)rVrrurSr;r;r<�	test_argsIs zLiteralTests.test_argscCshttdtdtdf}ttddf}ttd}|||fD]"}|�|td�|�|jd�q@dS)Nr�r�r�r�r�)rrVru)r7�l1�l2�l3�lr;r;r<�test_flattenPszLiteralTests.test_flattenN)rErFrGr�r�r�rXr�r�r�r�r�r�r�rr;r;r;r<r��s

r��XK�XVc@s@eZdZeed�dd�Zeed�dd�Zdeeed�d	d
�ZdS)�
SimpleMapping)�keyr�cCsdSr?r;�r7rr;r;r<�__getitem___szSimpleMapping.__getitem__)r�valuecCsdSr?r;�r7rrr;r;r<�__setitem__bszSimpleMapping.__setitem__N)r�defaultr�cCsdSr?r;�r7rr
r;r;r<�geteszSimpleMapping.get)N)rErFrGrrrr	rr;r;r;r<r]src@s@eZdZdd�Zed�dd�Zed�dd�Zded�d	d
�ZdS)�MySimpleMappingcCs
i|_dSr?��storerSr;r;r<�__init__kszMySimpleMapping.__init__)rcCs
|j|Sr?rrr;r;r<rnszMySimpleMapping.__getitem__cCs||j|<dSr?rrr;r;r<r	qszMySimpleMapping.__setitem__NcCs(z|j|WSty"|YS0dSr?)r�KeyErrorrr;r;r<rtszMySimpleMapping.get)N)rErFrGrr{rr	rr;r;r;r<r
isr
c@seZdZUeed<eed<dS)�
Coordinater�r�N�rErFrGrY�__annotations__r;r;r;r<r{s
rc@seZdZUeed<dS)�Point�labelN�rErFrGr{rr;r;r;r<rs
rc@s&eZdZUeed<eed<eed<dS)�MyPointr�r�rN�rErFrGrYrr{r;r;r;r<r�s
rc@seZdZUeed<dS)�XAxisr�Nrr;r;r;r<r�s
rc@seZdZUeed<dS)�YAxisr�Nrr;r;r;r<r�s
rc@seZdZdS)�PositionNrIr;r;r;r<r�src@s&eZdZUeed<eed�dd�ZdS)�Proto�attr��argr�cCsdSr?r;�r7r r;r;r<�meth�sz
Proto.methN)rErFrGrYrr{r"r;r;r;r<r�s
rc@seZdZdS)�ConcreteNrIr;r;r;r<r#�sr#c@s*eZdZUdZeed<eed�dd�ZdS)�Otherr�rrcCs|dkrdSdS)N�thisr�rr;r!r;r;r<r"�sz
Other.methN)rErFrGrrYrr{r"r;r;r;r<r$�s
r$c@seZdZUeed<eed<dS)�NTr�r�Nrr;r;r;r<r&�s
r&c@seZdZUejed<dS)�HasCallProtocol�__call__N)rErFrGr@rrr;r;r;r<r'�s
r'c@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[S)\�
ProtocolTestscCs�tGdd�dt��}Gdd�d�}Gdd�d�}dd�}|�||�|�|�|�|�||�|�|�|�|�tj|�|�||�dS)	Nc@seZdZdd�ZdS)z,ProtocolTests.test_basic_protocol.<locals>.PcSsdSr?r;rSr;r;r<r"�sz1ProtocolTests.test_basic_protocol.<locals>.P.methN�rErFrGr"r;r;r;r<�P�sr+c@seZdZdS)z,ProtocolTests.test_basic_protocol.<locals>.CNrIr;r;r;r<r��r�r�c@seZdZdd�ZdS)z,ProtocolTests.test_basic_protocol.<locals>.DcSsdSr?r;rSr;r;r<r"�sz1ProtocolTests.test_basic_protocol.<locals>.D.methNr*r;r;r;r<�D�sr,cSsdSr?r;r;r;r;r<rC�sz,ProtocolTests.test_basic_protocol.<locals>.f)rrr=rkr>r��types�FunctionType)r7r+r�r,rCr;r;r<�test_basic_protocol�sz!ProtocolTests.test_basic_protocolcCsrtGdd�dt��}Gdd�d�}dd�}ttt|tjfD]}|�||�q:t�ddt|fD]}|�	||�q\dS)	Nc@seZdZdS)zFProtocolTests.test_everything_implements_empty_protocol.<locals>.EmptyNrIr;r;r;r<�Empty�sr0c@seZdZdS)zBProtocolTests.test_everything_implements_empty_protocol.<locals>.CNrIr;r;r;r<r��sr�cSsdSr?r;r;r;r;r<rC�szBProtocolTests.test_everything_implements_empty_protocol.<locals>.fr�r;)
rrr�r^r�r-r.r=r@rk)r7r0r�rC�thingr;r;r<�)test_everything_implements_empty_protocol�sz7ProtocolTests.test_everything_implements_empty_protocolcCsdd�}|�|t�dS)NcSsdSr?r;r;r;r;r<rC�sz:ProtocolTests.test_function_implements_protocol.<locals>.f)rkr'rBr;r;r<�!test_function_implements_protocol�sz/ProtocolTests.test_function_implements_protocolcCsGdd�d�}Gdd�dt�}|�t��"Gdd�d|t�}Wd�n1sP0Y|�t��"Gdd�dt|�}Wd�n1s�0Y|�t��$Gdd�d||t�}Wd�n1s�0YGd	d
�d
||�}Gdd�d||�}|�|�|�|�|�|�dS)
Nc@seZdZdS)z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.CNrIr;r;r;r<r��r�r�c@seZdZdS)z:ProtocolTests.test_no_inheritance_from_nominal.<locals>.BPNrIr;r;r;r<�BP�r�r4c@seZdZdS�z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.PNrIr;r;r;r<r+�sr+c@seZdZdSr5rIr;r;r;r<r+�sc@seZdZdSr5rIr;r;r;r<r+�sc@seZdZdS)z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.DNrIr;r;r;r<r,�r�r,c@seZdZdS)z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.ENrIr;r;r;r<�E�r�r6)rrPrQr�)r7r�r4r+r,r6r;r;r<� test_no_inheritance_from_nominal�s002z.ProtocolTests.test_no_inheritance_from_nominalcCs�Gdd�dt�}|�t��|�Wd�n1s60YGdd�d|�}|�|�|�|�t��|d�Wd�n1s�0Ytd�}Gdd�dt|�}|�t��|�Wd�n1s�0Y|�t��|t�Wd�n1�s0Y|�t��||�Wd�n1�s>0YGd	d
�d
||�}|�|t�|�|�t��|td�Wd�n1�s�0YdS)Nc@seZdZdS)z.ProtocolTests.test_no_instantiation.<locals>.PNrIr;r;r;r<r+�r�r+c@seZdZdS)z.ProtocolTests.test_no_instantiation.<locals>.CNrIr;r;r;r<r��r�r�rOrc@seZdZdS)z/ProtocolTests.test_no_instantiation.<locals>.PGNrIr;r;r;r<�PG�r�r8c@seZdZdS)z/ProtocolTests.test_no_instantiation.<locals>.CGNrIr;r;r;r<�CGr�r9)rrPrQrkr
rY)r7r+r�rr8r9r;r;r<�test_no_instantiation�s&$&$**z#ProtocolTests.test_no_instantiationcCsvtGdd�dt��}Gdd�d|�}Gdd�d|�}|�t��|�Wd�n1sZ0Y|�|�|�dS)Nc@s eZdZejed�dd��ZdS)z9ProtocolTests.test_cannot_instantiate_abstract.<locals>.Pr�cSst�dSr?)�NotImplementedErrorrSr;r;r<�amethsz?ProtocolTests.test_cannot_instantiate_abstract.<locals>.P.amethN)rErFrG�abc�abstractmethodrYr<r;r;r;r<r+sr+c@seZdZdS)z9ProtocolTests.test_cannot_instantiate_abstract.<locals>.BNrIr;r;r;r<�Bsr?c@seZdZed�dd�ZdS)z9ProtocolTests.test_cannot_instantiate_abstract.<locals>.Cr�cSsdS)N�r;rSr;r;r<r<sz?ProtocolTests.test_cannot_instantiate_abstract.<locals>.C.amethN)rErFrGrYr<r;r;r;r<r�sr�)rrrPrQrk)r7r+r?r�r;r;r<� test_cannot_instantiate_abstracts$z.ProtocolTests.test_cannot_instantiate_abstractcCs�Gdd�dt�}tGdd�d|t��}Gdd�d�}Gdd�d�}Gd	d
�d
�}|�|�|�|�|�|�|�||�|�||�|�|�|�|�||�dS)Nc@seZdZdd�ZdS)z5ProtocolTests.test_subprotocols_extending.<locals>.P1cSsdSr?r;rSr;r;r<�meth1sz;ProtocolTests.test_subprotocols_extending.<locals>.P1.meth1N�rErFrGrBr;r;r;r<�P1srDc@seZdZdd�ZdS)z5ProtocolTests.test_subprotocols_extending.<locals>.P2cSsdSr?r;rSr;r;r<�meth2$sz;ProtocolTests.test_subprotocols_extending.<locals>.P2.meth2N�rErFrGrEr;r;r;r<�P2"srGc@seZdZdd�Zdd�ZdS)z4ProtocolTests.test_subprotocols_extending.<locals>.CcSsdSr?r;rSr;r;r<rB(sz:ProtocolTests.test_subprotocols_extending.<locals>.C.meth1cSsdSr?r;rSr;r;r<rE+sz:ProtocolTests.test_subprotocols_extending.<locals>.C.meth2N�rErFrGrBrEr;r;r;r<r�'sr�c@seZdZdd�ZdS)z5ProtocolTests.test_subprotocols_extending.<locals>.C1cSsdSr?r;rSr;r;r<rB/sz;ProtocolTests.test_subprotocols_extending.<locals>.C1.meth1NrCr;r;r;r<�C1.srIc@seZdZdd�ZdS)z5ProtocolTests.test_subprotocols_extending.<locals>.C2cSsdSr?r;rSr;r;r<rE3sz;ProtocolTests.test_subprotocols_extending.<locals>.C2.meth2NrFr;r;r;r<�C22srJ�rrr�r>rkr=)r7rDrGr�rIrJr;r;r<�test_subprotocols_extendingsz)ProtocolTests.test_subprotocols_extendingcCs�Gdd�dt�}Gdd�dt�}tGdd�d||t��}Gdd�d�}Gd	d
�d
�}Gdd�d�}|�|�|�|�|�|�|�||�|�||�|�|�|�|�||�dS)
Nc@seZdZdd�ZdS)z3ProtocolTests.test_subprotocols_merging.<locals>.P1cSsdSr?r;rSr;r;r<rB?sz9ProtocolTests.test_subprotocols_merging.<locals>.P1.meth1NrCr;r;r;r<rD>srDc@seZdZdd�ZdS)z3ProtocolTests.test_subprotocols_merging.<locals>.P2cSsdSr?r;rSr;r;r<rECsz9ProtocolTests.test_subprotocols_merging.<locals>.P2.meth2NrFr;r;r;r<rGBsrGc@seZdZdS)z2ProtocolTests.test_subprotocols_merging.<locals>.PNrIr;r;r;r<r+Fsr+c@seZdZdd�Zdd�ZdS)z2ProtocolTests.test_subprotocols_merging.<locals>.CcSsdSr?r;rSr;r;r<rBKsz8ProtocolTests.test_subprotocols_merging.<locals>.C.meth1cSsdSr?r;rSr;r;r<rENsz8ProtocolTests.test_subprotocols_merging.<locals>.C.meth2NrHr;r;r;r<r�Jsr�c@seZdZdd�ZdS)z3ProtocolTests.test_subprotocols_merging.<locals>.C1cSsdSr?r;rSr;r;r<rBRsz9ProtocolTests.test_subprotocols_merging.<locals>.C1.meth1NrCr;r;r;r<rIQsrIc@seZdZdd�ZdS)z3ProtocolTests.test_subprotocols_merging.<locals>.C2cSsdSr?r;rSr;r;r<rEVsz9ProtocolTests.test_subprotocols_merging.<locals>.C2.meth2NrFr;r;r;r<rJUsrJrK)r7rDrGr+r�rIrJr;r;r<�test_subprotocols_merging=sz'ProtocolTests.test_subprotocols_mergingcCs�td�}tGdd�dt��}tGdd�dt|��}Gdd�dt�}Gdd	�d	t|�}Gd
d�d�}|�||�|�||�|�||�|�t��t|||�Wd�n1s�0Y|�t��t|||�Wd�n1s�0Y|�t��t||�Wd�n1�s&0Y|�t��t||�Wd�n1�s\0Y|�t��t|||�Wd�n1�s�0Y|�t��t||t�Wd�n1�s�0YdS)Nrc@seZdZdd�ZdS)z2ProtocolTests.test_protocols_issubclass.<locals>.PcSsdSr?r;rSr;r;r<r�er�z4ProtocolTests.test_protocols_issubclass.<locals>.P.xN�rErFrGr�r;r;r;r<r+csr+c@seZdZdd�ZdS)z3ProtocolTests.test_protocols_issubclass.<locals>.PGcSsdSr?r;rSr;r;r<r�ir�z5ProtocolTests.test_protocols_issubclass.<locals>.PG.xNrNr;r;r;r<r8gsr8c@seZdZdd�ZdS)z5ProtocolTests.test_protocols_issubclass.<locals>.BadPcSsdSr?r;rSr;r;r<r�lr�z7ProtocolTests.test_protocols_issubclass.<locals>.BadP.xNrNr;r;r;r<�BadPksrOc@seZdZdd�ZdS)z6ProtocolTests.test_protocols_issubclass.<locals>.BadPGcSsdSr?r;rSr;r;r<r�or�z8ProtocolTests.test_protocols_issubclass.<locals>.BadPG.xNrNr;r;r;r<�BadPGnsrPc@seZdZdd�ZdS)z2ProtocolTests.test_protocols_issubclass.<locals>.CcSsdSr?r;rSr;r;r<r�rr�z4ProtocolTests.test_protocols_issubclass.<locals>.C.xNrNr;r;r;r<r�qsr�)r
rrr=rPrQr5rY�r7rr+r8rOrPr�r;r;r<�test_protocols_issubclass`s.,,**.z'ProtocolTests.test_protocols_issubclasscCs8Gdd�d�}tGdd�dt��}|�t��t||�Wd�n1sL0Y|�|�|�|�|�|�t��t||�Wd�n1s�0Y|�|�|�Gdd�d|�}|�||�|�|�|�|�|�|�	||�|�|�|�|�t��t||�Wd�n1�s*0YdS)Nc@seZdZdZdS)z?ProtocolTests.test_protocols_issubclass_non_callable.<locals>.Cr�NrNr;r;r;r<r��sr�c@seZdZdZdS)zFProtocolTests.test_protocols_issubclass_non_callable.<locals>.PNonCallr�NrNr;r;r;r<�PNonCall�srSc@seZdZdS)z?ProtocolTests.test_protocols_issubclass_non_callable.<locals>.DNrIr;r;r;r<r,�r�r,)
rrrPrQr5rk�registerr>r�r=)r7r�rSr,r;r;r<�&test_protocols_issubclass_non_callable�s$(
(
z4ProtocolTests.test_protocols_issubclass_non_callablecCsjtd�}tGdd�dt��}tGdd�dt|��}Gdd�dt�}Gdd	�d	t|�}Gd
d�d�}|�|�|�|�|�|�|�t�� t|�||�Wd�n1s�0Y|�t�� t|�||�Wd�n1s�0Y|�t��t|�|�Wd�n1�s$0Y|�t��t|�|�Wd�n1�s\0YdS)Nrc@seZdZdd�ZdS)z2ProtocolTests.test_protocols_isinstance.<locals>.PcSsdSr?r;r�r;r;r<r"�r�z7ProtocolTests.test_protocols_isinstance.<locals>.P.methNr*r;r;r;r<r+�sr+c@seZdZdd�ZdS)z3ProtocolTests.test_protocols_isinstance.<locals>.PGcSsdSr?r;r�r;r;r<r"�r�z8ProtocolTests.test_protocols_isinstance.<locals>.PG.methNr*r;r;r;r<r8�sr8c@seZdZdd�ZdS)z5ProtocolTests.test_protocols_isinstance.<locals>.BadPcSsdSr?r;r�r;r;r<r"�r�z:ProtocolTests.test_protocols_isinstance.<locals>.BadP.methNr*r;r;r;r<rO�srOc@seZdZdd�ZdS)z6ProtocolTests.test_protocols_isinstance.<locals>.BadPGcSsdSr?r;r�r;r;r<r"�r�z;ProtocolTests.test_protocols_isinstance.<locals>.BadPG.methNr*r;r;r;r<rP�srPc@seZdZdd�ZdS)z2ProtocolTests.test_protocols_isinstance.<locals>.CcSsdSr?r;r�r;r;r<r"�r�z7ProtocolTests.test_protocols_isinstance.<locals>.C.methNr*r;r;r;r<r��sr�)r
rrrkrPrQrRrQr;r;r<�test_protocols_isinstance�s$..,z'ProtocolTests.test_protocols_isinstancecCsGdd�d�}Gdd�d�}Gdd�d�}Gdd�d�}|�|d	d
d�t�|�|d	d
�t�|�t�t�|�|d	d
�t�|�t�t�|�t�t�|�|d�t�|�|�t�|�|�t�|�|�t�|�|�t�|�t�t�|�td	d
�t�dS)
Nc@seZdZdd�ZdS)z<ProtocolTests.test_protocols_isinstance_py36.<locals>.APointcSs||_||_||_dSr?�r�r�r)r7r�r�rr;r;r<r�szEProtocolTests.test_protocols_isinstance_py36.<locals>.APoint.__init__N�rErFrGrr;r;r;r<�APoint�srYc@seZdZdZdd�ZdS)z<ProtocolTests.test_protocols_isinstance_py36.<locals>.BPointr?cSs||_||_dSr?�r�r�)r7r�r�r;r;r<r�szEProtocolTests.test_protocols_isinstance_py36.<locals>.BPoint.__init__N)rErFrGrrr;r;r;r<�BPoint�sr[c@seZdZdd�Zdd�ZdS)z7ProtocolTests.test_protocols_isinstance_py36.<locals>.CcSs
||_dSr?�r�r7rr;r;r<r�sz@ProtocolTests.test_protocols_isinstance_py36.<locals>.C.__init__cSsdS�Nrr;r!r;r;r<r"�sz<ProtocolTests.test_protocols_isinstance_py36.<locals>.C.methN)rErFrGrr"r;r;r;r<r��sr�c@seZdZdS)z9ProtocolTests.test_protocols_isinstance_py36.<locals>.BadNrIr;r;r;r<�Bad�r�r_r�r�r\rO)	rkrr�rrr$rr#r&)r7rYr[r�r_r;r;r<�test_protocols_isinstance_py36�s"z,ProtocolTests.test_protocols_isinstance_py36cCsftd�}tGdd�dt��}tGdd�dt|��}Gdd�d�}|�|d�|�|�|d�|�dS)	Nrc@seZdZdZdS)z7ProtocolTests.test_protocols_isinstance_init.<locals>.Pr�NrNr;r;r;r<r+�sr+c@seZdZdZdS)z8ProtocolTests.test_protocols_isinstance_init.<locals>.PGr�NrNr;r;r;r<r8�sr8c@seZdZdd�ZdS)z7ProtocolTests.test_protocols_isinstance_init.<locals>.CcSs
||_dSr?r��r7r�r;r;r<r�sz@ProtocolTests.test_protocols_isinstance_init.<locals>.C.__init__NrXr;r;r;r<r��sr�r�)r
rrrk)r7rr+r8r�r;r;r<�test_protocols_isinstance_init�sz,ProtocolTests.test_protocols_isinstance_initc	Cs�Gdd�dtt�}Gdd�d|t�}Gdd�d�}Gdd�d�}|t}|�|�|�|�||�Gd	d
�d
|t�}Gdd�d|t�}|t}|�|�|�|�||�dS)
Nc@seZdZdS)z=ProtocolTests.test_protocol_checks_after_subscript.<locals>.PNrIr;r;r;r<r+�r�r+c@seZdZdS)z=ProtocolTests.test_protocol_checks_after_subscript.<locals>.CNrIr;r;r;r<r��r�r�c@seZdZdS)zBProtocolTests.test_protocol_checks_after_subscript.<locals>.Other1NrIr;r;r;r<�Other1�r�rcc@seZdZdS)zBProtocolTests.test_protocol_checks_after_subscript.<locals>.Other2NrIr;r;r;r<�Other2�r�rdc@seZdZdS)z>ProtocolTests.test_protocol_checks_after_subscript.<locals>.D1NrIr;r;r;r<�D1r�rec@seZdZdS)z>ProtocolTests.test_protocol_checks_after_subscript.<locals>.D2NrIr;r;r;r<�D2r�rf)rrrr�r>rYrkr=)	r7r+r�rcrdZCArerf�CIr;r;r<�$test_protocol_checks_after_subscript�sz2ProtocolTests.test_protocol_checks_after_subscriptcCsvtGdd�dt��}Gdd�dt�}Gdd�d|�}Gdd�d�}|�|�|�|�|�|�|�|�|�|�dS)	Nc@seZdZdZdS)z8ProtocolTests.test_protocols_support_register.<locals>.Pr�NrNr;r;r;r<r+sr+c@seZdZdd�ZdS)z9ProtocolTests.test_protocols_support_register.<locals>.PMcSsdSr?r;rSr;r;r<r"
r�z>ProtocolTests.test_protocols_support_register.<locals>.PM.methNr*r;r;r;r<�PMsric@seZdZdS)z8ProtocolTests.test_protocols_support_register.<locals>.DNrIr;r;r;r<r,r�r,c@seZdZdS)z8ProtocolTests.test_protocols_support_register.<locals>.CNrIr;r;r;r<r�r�r�)rrrTrk)r7r+rir,r�r;r;r<�test_protocols_support_registers

z-ProtocolTests.test_protocols_support_registercCs`tGdd�dt��}Gdd�d�}Gdd�d|�}Gdd�d�}|�|�|�|�|�|�dS)	Nc@seZdZdZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.Pr�NrNr;r;r;r<r+sr+c@seZdZdZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.Ar�NrNr;r;r;r<r\sr\c@seZdZdZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.BNrNr;r;r;r<r? sr?c@seZdZdd�ZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.CcSs
d|_dSr?r�rSr;r;r<r$szWProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.C.__init__NrXr;r;r;r<r�#sr�)rrrk�r7r+r\r?r�r;r;r<�5test_none_on_non_callable_doesnt_block_implementationszCProtocolTests.test_none_on_non_callable_doesnt_block_implementationcCs`tGdd�dt��}Gdd�d�}Gdd�d|�}Gdd�d�}|�|�|�|�|�|�dS)	Nc@seZdZdd�ZdS)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.PcSsdSr?r;rSr;r;r<r�-r�zFProtocolTests.test_none_on_callable_blocks_implementation.<locals>.P.xNrNr;r;r;r<r++sr+c@seZdZdd�ZdS)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.AcSsdSr?r;rSr;r;r<r�0r�zFProtocolTests.test_none_on_callable_blocks_implementation.<locals>.A.xNrNr;r;r;r<r\/sr\c@seZdZdZdS)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.BNrNr;r;r;r<r?2sr?c@seZdZdd�ZdS)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.CcSs
d|_dSr?r�rSr;r;r<r6szMProtocolTests.test_none_on_callable_blocks_implementation.<locals>.C.__init__NrXr;r;r;r<r�5sr�)rrr�rkr;r;r<�+test_none_on_callable_blocks_implementation*sz9ProtocolTests.test_none_on_callable_blocks_implementationcCs�Gdd�dt�}tGdd�dt��}Gdd�d|�}Gdd�d|�}Gd	d
�d
�}Gdd�d�}|�|�|�|�|�|�|�||�|�||�|�|�|�|�||�dS)
Nc@seZdZdZdS)z5ProtocolTests.test_non_protocol_subclasses.<locals>.Pr�NrNr;r;r;r<r+=sr+c@seZdZdd�ZdS)z6ProtocolTests.test_non_protocol_subclasses.<locals>.PRcSsdSr?r;rSr;r;r<r"Br�z;ProtocolTests.test_non_protocol_subclasses.<locals>.PR.methNr*r;r;r;r<�PR@srnc@seZdZdZdS)z8ProtocolTests.test_non_protocol_subclasses.<locals>.NonPr�NrNr;r;r;r<�NonPDsroc@seZdZdS)z9ProtocolTests.test_non_protocol_subclasses.<locals>.NonPRNrIr;r;r;r<�NonPRGr�rpc@seZdZdZdS)z5ProtocolTests.test_non_protocol_subclasses.<locals>.Cr�NrNr;r;r;r<r�Isr�c@seZdZdd�ZdS)z5ProtocolTests.test_non_protocol_subclasses.<locals>.DcSsdSr?r;rSr;r;r<r"Mr�z:ProtocolTests.test_non_protocol_subclasses.<locals>.D.methNr*r;r;r;r<r,Lsr,rK)r7r+rnrorpr�r,r;r;r<�test_non_protocol_subclasses<sz*ProtocolTests.test_non_protocol_subclassescCstGdd�dt�}Gdd�d�}Gdd�d�}Gdd�d|�}|�|�|�|�|�|�|�||�|�||�dS)	Nc@seZdZdZdS)z1ProtocolTests.test_custom_subclasshook.<locals>.Pr�NrNr;r;r;r<r+Wsr+c@seZdZdS)z7ProtocolTests.test_custom_subclasshook.<locals>.OKClassNrIr;r;r;r<�OKClassZr�rrc@seZdZdZdS)z8ProtocolTests.test_custom_subclasshook.<locals>.BadClassr�NrNr;r;r;r<�BadClass\srsc@seZdZedd��ZdS)z1ProtocolTests.test_custom_subclasshook.<locals>.CcSs|j�d�S�N�OK)rE�
startswith�r8�otherr;r;r<�__subclasshook__`szBProtocolTests.test_custom_subclasshook.<locals>.C.__subclasshook__N�rErFrG�classmethodryr;r;r;r<r�_sr�)rrkr�r=r>)r7r+rrrsr�r;r;r<�test_custom_subclasshookVsz&ProtocolTests.test_custom_subclasshookcCs\tGdd�dt��}Gdd�d�}|�t��t|�|�Wd�n1sN0YdS)Nc@seZdZdZdS)z8ProtocolTests.test_issubclass_fails_correctly.<locals>.Pr�NrNr;r;r;r<r+jsr+c@seZdZdS)z8ProtocolTests.test_issubclass_fails_correctly.<locals>.CNrIr;r;r;r<r�nr�r�)rrrPrQr5)r7r+r�r;r;r<�test_issubclass_fails_correctlyis
z-ProtocolTests.test_issubclass_fails_correctlycCsNtd�}td�}tGdd�dt||f��}Gdd�d|t|ft|�}|�t��|tWd�n1sr0Y|�t��|ttfWd�n1s�0Y|�t��|tdfWd�n1s�0Y|�t��|ttfWd�n1�s0YGdd	�d	|t|f�}|�|t�|�dS)
Nr�Sc@seZdZdd�ZdS)z9ProtocolTests.test_defining_generic_protocols.<locals>.PRcSsdSr?r;rSr;r;r<r"yr�z>ProtocolTests.test_defining_generic_protocols.<locals>.PR.methNr*r;r;r;r<rnwsrnc@seZdZdZdS)z8ProtocolTests.test_defining_generic_protocols.<locals>.Pr�N�rErFrGr�r;r;r;r<r+{sr+r�c@seZdZdS)z8ProtocolTests.test_defining_generic_protocols.<locals>.CNrIr;r;r;r<r��r�r�)	r
rrrYrPrQr{rrk)r7rr~rnr+r�r;r;r<�test_defining_generic_protocolsss&**,z-ProtocolTests.test_defining_generic_protocolscs�td��td�}tGdd�dtt�|f��}Gdd�d|ttft�}|�t��"t|ttf|�Wd�n1sz0Y|�	||�|�t��|tWd�n1s�0Y|�t��|tdfWd�n1s�0YG�fdd	�d	tt��}G�fd
d�dt�t�}tGdd
�d
|tt��}Gdd�d�}|�
|�|�|�t��|ttfWd�n1�s�0YdS)Nrr~c@seZdZdd�ZdS)zCProtocolTests.test_defining_generic_protocols_old_style.<locals>.PRcSsdSr?r;rSr;r;r<r"�r�zHProtocolTests.test_defining_generic_protocols_old_style.<locals>.PR.methNr*r;r;r;r<rn�srnc@seZdZdZdS)zBProtocolTests.test_defining_generic_protocols_old_style.<locals>.Pr�Nrr;r;r;r<r+�sr+r�cseZdZ�ed�dd�ZdS)zCProtocolTests.test_defining_generic_protocols_old_style.<locals>.P1�r�r�cSsdSr?r;rar;r;r<r��r�zGProtocolTests.test_defining_generic_protocols_old_style.<locals>.P1.barN�rErFrGr{r�r;�rr;r<rD�srDcseZdZ�ed�dd�ZdS)zCProtocolTests.test_defining_generic_protocols_old_style.<locals>.P2r�cSsdSr?r;rar;r;r<r��r�zGProtocolTests.test_defining_generic_protocols_old_style.<locals>.P2.barNr�r;r�r;r<rG�srGc@seZdZdZdS)zEProtocolTests.test_defining_generic_protocols_old_style.<locals>.PSubr�NrNr;r;r;r<�PSub�sr�c@s eZdZdZeed�dd�ZdS)zEProtocolTests.test_defining_generic_protocols_old_style.<locals>.Testr�r�cSs|Sr?r;rar;r;r<r��szIProtocolTests.test_defining_generic_protocols_old_style.<locals>.Test.barN)rErFrGr�r{r�r;r;r;r<�Test�sr�)r
rrrrYr{rPrQr5r=rkr)r7r~rnr+rDrGr�r�r;r�r<�)test_defining_generic_protocols_old_style�s(0&*z7ProtocolTests.test_defining_generic_protocols_old_stylecCs�td�}Gdd�dt|�}Gdd�d||�}|�|t�jd�Gdd�d�}Gd	d
�d
|||�}|�|t�jd�Gdd�d|||�}|�|t�jd�dS)
Nrc@seZdZdS)z)ProtocolTests.test_init_called.<locals>.PNrIr;r;r;r<r+�r�r+c@seZdZdd�ZdS)z)ProtocolTests.test_init_called.<locals>.CcSs
d|_dSrt��testrSr;r;r<r�sz2ProtocolTests.test_init_called.<locals>.C.__init__NrXr;r;r;r<r��sr�ruc@seZdZdd�ZdS)z)ProtocolTests.test_init_called.<locals>.BcSs
d|_dSrtr�rSr;r;r<r�sz2ProtocolTests.test_init_called.<locals>.B.__init__NrXr;r;r;r<r?�sr?c@seZdZdS)z*ProtocolTests.test_init_called.<locals>.D1NrIr;r;r;r<re�srec@seZdZdS)z*ProtocolTests.test_init_called.<locals>.D2NrIr;r;r;r<rf�srf)r
rrVrYr�)r7rr+r�r?rerfr;r;r<�test_init_called�szProtocolTests.test_init_calledcCs�td�}Gdd�dt|�}Gdd�d||�}|�|t�jd�|�t��|td�Wd�n1sp0Y|�t��|tdd�Wd�n1s�0YdS)	Nrc@seZdZdS)z(ProtocolTests.test_new_called.<locals>.PNrIr;r;r;r<r+�r�r+cseZdZ�fdd�Z�ZS)z(ProtocolTests.test_new_called.<locals>.Ccst�j|g|�R�}d|_|Srt)�super�__new__r�)r8r�r7��	__class__r;r<r��sz0ProtocolTests.test_new_called.<locals>.C.__new__�rErFrGr��
__classcell__r;r;r�r<r��sr�rurOr�)r
rrVrYr�rPrQ)r7rr+r�r;r;r<�test_new_called�s*zProtocolTests.test_new_calledcCs$td�}td�}|�t��(Gdd�dt||f�}Wd�n1sH0Y|�t��$Gdd�dtt�}Wd�n1s�0Y|�t��*Gdd�dt|t|�}Wd�n1s�0Y|�t��0Gdd�dtj||ft|�}Wd�n1�s0YdS)Nrr~c@seZdZdS�z6ProtocolTests.test_protocols_bad_subscripts.<locals>.PNrIr;r;r;r<r+�r�r+c@seZdZdSr�rIr;r;r;r<r+�r�c@seZdZdSr�rIr;r;r;r<r+�r�c@seZdZdSr�rIr;r;r;r<r+�r�)r
rPrQrrYr@r��r7rr~r+r;r;r<�test_protocols_bad_subscripts�s628z+ProtocolTests.test_protocols_bad_subscriptscCsdtd�}td�}Gdd�dt||f�}|�t|||f��d��|�t|ttf��d��dS)Nrr~c@seZdZdS)z4ProtocolTests.test_generic_protocols_repr.<locals>.PNrIr;r;r;r<r+�r�r+z	P[~T, ~S]zP[int, str])r
rr�rW�endswithrYr{r�r;r;r<�test_generic_protocols_repr�s
z)ProtocolTests.test_generic_protocols_reprcCs�td�}td�}Gdd�dt||f�}|�||�|�|t|f|t|f�|�|||ft||fttf|tttftttff�dS)Nrr~c@seZdZdS)z2ProtocolTests.test_generic_protocols_eq.<locals>.PNrIr;r;r;r<r+�r�r+)r
rrVrYrr{r�r;r;r<�test_generic_protocols_eq�s"�z'ProtocolTests.test_generic_protocols_eqcCshtd�}Gdd�dt|�}|�|j|f�|�|tjd�|�|tjtf�|�|tj|�dS)Nrc@seZdZdS)zDProtocolTests.test_generic_protocols_special_from_generic.<locals>.PNrIr;r;r;r<r+�r�r+r;)r
rrVrvrYrurwrx)r7rr+r;r;r<�+test_generic_protocols_special_from_generic�sz9ProtocolTests.test_generic_protocols_special_from_genericcCs�tGdd�dt��}Gdd�dt�}td�}Gdd�dt|�}|�|j�|�|j�|�|j�|�|j�|�|j�|�|tj�|�t	�
|�dh�|�t	�
|�d	h�|�tt	�
|��td	dh��dS)
Nc@seZdZdZdS)zFProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PRr�NrNr;r;r;r<rnsrnc@seZdZdd�ZdS)zEProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PcSsdSr?r;rSr;r;r<r"szJProtocolTests.test_generic_protocols_special_from_protocol.<locals>.P.methNr*r;r;r;r<r+sr+rc@seZdZdZdd�ZdS)zFProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PGr�cSsdSr?r;rSr;r;r<r"szKProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PG.methN)rErFrGr�r"r;r;r;r<r8sr8r"r�)rrr
r��_is_protocolr��_is_runtime_protocolrYrVr@�_get_protocol_attrs�	frozenset)r7rnr+rr8r;r;r<�,test_generic_protocols_special_from_protocols 
�z:ProtocolTests.test_generic_protocols_special_from_protocolcCs�|�t��"tGdd�d��}Wd�n1s20YGdd�dt�}|�t��$tGdd�d|��}Wd�n1s�0YdS)Nc@seZdZdS)z8ProtocolTests.test_no_runtime_deco_on_nominal.<locals>.CNrIr;r;r;r<r�$sr�c@seZdZdZdS)z<ProtocolTests.test_no_runtime_deco_on_nominal.<locals>.Protor�NrNr;r;r;r<r'src@seZdZdS)z?ProtocolTests.test_no_runtime_deco_on_nominal.<locals>.ConcreteNrIr;r;r;r<r#+sr#)rPrQrr)r7r�rr#r;r;r<�test_no_runtime_deco_on_nominal"s.z-ProtocolTests.test_no_runtime_deco_on_nominalcCs�tGdd�dt��}Gdd�dt�}|�|�|�Gdd�d�}Gdd�d�}|�|�|�|�|�|�Gd	d
�d
�}Gdd�d�}|�|�|�|�|�|�dS)
Nc@seZdZdZdS)z4ProtocolTests.test_none_treated_correctly.<locals>.PNrNr;r;r;r<r+0sr+c@seZdZdS)z4ProtocolTests.test_none_treated_correctly.<locals>.BNrIr;r;r;r<r?4r�r?c@seZdZdZdS)z4ProtocolTests.test_none_treated_correctly.<locals>.Cr�NrNr;r;r;r<r�8sr�c@seZdZdZdS)z4ProtocolTests.test_none_treated_correctly.<locals>.DNrNr;r;r;r<r,;sr,c@seZdZdd�ZdS)z5ProtocolTests.test_none_treated_correctly.<locals>.CIcSs
d|_dSr�r�rSr;r;r<rBsz>ProtocolTests.test_none_treated_correctly.<locals>.CI.__init__NrXr;r;r;r<rgAsrgc@seZdZdd�ZdS)z5ProtocolTests.test_none_treated_correctly.<locals>.DIcSs
d|_dSr?r�rSr;r;r<rFsz>ProtocolTests.test_none_treated_correctly.<locals>.DI.__init__NrXr;r;r;r<�DIEsr�)rrr�r�rk)r7r+r?r�r,rgr�r;r;r<�test_none_treated_correctly/sz)ProtocolTests.test_none_treated_correctlycCs@Gdd�dt�}tjtj|f}tj|tjf}|�||�dS)Nc@seZdZdZdS)z1ProtocolTests.test_protocols_in_unions.<locals>.PNrNr;r;r;r<r+Msr+)rr@rr�rV)r7r+ZAliasZAlias2r;r;r<�test_protocols_in_unionsLsz&ProtocolTests.test_protocols_in_unionsc	Cs�td�}tGdd�dt|��aGdd�dtt�at�}d|_d|_tt	j
d�D]�}t	�||�}t	�|�}|�
|jd�|�
|jd�|�
|jd�|�
|jddd	��t	�t�}t	�|�}Gd
d�d�}|�|�|�qTdS)Nrc@seZdZdZdS)r+r�NrNr;r;r;r<r+Xsr+c@seZdZdS)�CPNrIr;r;r;r<r�\sr�rOr=r�r�c@seZdZdZdS)z2ProtocolTests.test_protocols_pickleable.<locals>.Er�NrNr;r;r;r<r6lsr6)r
rrr+rYr�r�r��range�pickle�HIGHEST_PROTOCOL�dumps�loadsrVr��__dict__rk)	r7rr��protor�r��sr,r6r;r;r<�test_protocols_pickleableTs$


z'ProtocolTests.test_protocols_pickleablecCs |�ttj�|�ttj�dSr?)r=rYr@�SupportsIntr>r{rSr;r;r<�test_supports_intqszProtocolTests.test_supports_intcCs |�ttj�|�ttj�dSr?)r=r�r@�
SupportsFloatr>r{rSr;r;r<�test_supports_floatusz!ProtocolTests.test_supports_floatcCs.Gdd�d�}|�|tj�|�ttj�dS)Nc@seZdZdd�ZdS)z.ProtocolTests.test_supports_complex.<locals>.CcSsdS)Nyr;rSr;r;r<�__complex__}sz:ProtocolTests.test_supports_complex.<locals>.C.__complex__N)rErFrGr�r;r;r;r<r�|sr�)r=r@�SupportsComplexr>r{r�r;r;r<�test_supports_complexysz#ProtocolTests.test_supports_complexcCs.Gdd�d�}|�|tj�|�ttj�dS)Nc@seZdZdd�ZdS)z,ProtocolTests.test_supports_bytes.<locals>.BcSsdS�Nr�r;rSr;r;r<�	__bytes__�sz6ProtocolTests.test_supports_bytes.<locals>.B.__bytes__N)rErFrGr�r;r;r;r<r?�sr?)r=r@�
SupportsBytesr>r{)r7r?r;r;r<�test_supports_bytes�sz!ProtocolTests.test_supports_bytescCs.|�ttj�|�ttj�|�ttj�dSr?)r=r�r@�SupportsAbsrYr>r{rSr;r;r<�test_supports_abs�szProtocolTests.test_supports_abscCs:tttj�|�ttj�|�ttj�|�ttj�dSr?)r5r�r@�
SupportsRoundr=rYr>r{rSr;r;r<�test_supports_round�sz!ProtocolTests.test_supports_roundcCs |�ttj�|�ttj�dSr?)r=r�r@�
Reversibler>rYrSr;r;r<�test_reversible�szProtocolTests.test_reversiblecCs |�ttj�|�ttj�dSr?)r=rYr@�
SupportsIndexr>r{rSr;r;r<�test_supports_index�sz!ProtocolTests.test_supports_indexcCsF|�dtj�Gdd�dtj�}Gdd�d|�}|�}|�||�dS)Nrc@seZdZed�dd�ZdS)z>ProtocolTests.test_bundled_protocol_instance_works.<locals>.C1r�cSsdSrNr;rSr;r;r<�__int__�szFProtocolTests.test_bundled_protocol_instance_works.<locals>.C1.__int__N)rErFrGrYr�r;r;r;r<rI�srIc@seZdZdS)z>ProtocolTests.test_bundled_protocol_instance_works.<locals>.C2NrIr;r;r;r<rJ�srJ)rkr@r�r�)r7rIrJr�r;r;r<�$test_bundled_protocol_instance_works�s
z2ProtocolTests.test_bundled_protocol_instance_workscCsRtGdd�dtjjt��}Gdd�d�}Gdd�d�}|�||�|�||�dS)Nc@seZdZdd�ZdS)z@ProtocolTests.test_collections_protocols_allowed.<locals>.CustomcSsdSr?r;rSr;r;r<�close�r�zFProtocolTests.test_collections_protocols_allowed.<locals>.Custom.closeN)rErFrGr�r;r;r;r<�Custom�sr�c@seZdZdS)z;ProtocolTests.test_collections_protocols_allowed.<locals>.ANrIr;r;r;r<r\�r�r\c@seZdZdd�Zdd�ZdS)z;ProtocolTests.test_collections_protocols_allowed.<locals>.BcSsgSr?r;rSr;r;r<�__iter__�szDProtocolTests.test_collections_protocols_allowed.<locals>.B.__iter__cSsdSr^r;rSr;r;r<r��szAProtocolTests.test_collections_protocols_allowed.<locals>.B.closeN)rErFrGr�r�r;r;r;r<r?�sr?)r�collectionsr=r�rr=r>)r7r�r\r?r;r;r<�"test_collections_protocols_allowed�sz0ProtocolTests.test_collections_protocols_allowedcCsT|�t��"Gdd�dtt�}Wd�n1s20YGdd�dtjt�}dS)Nc@seZdZdS)zEProtocolTests.test_builtin_protocol_whitelist.<locals>.CustomProtocolNrIr;r;r;r<�CustomProtocol�sr�c@seZdZdS)zKProtocolTests.test_builtin_protocol_whitelist.<locals>.CustomContextManagerNrIr;r;r;r<�CustomContextManager�sr�)rPrQrrr@�ContextManager)r7r�r�r;r;r<�test_builtin_protocol_whitelist�s0z-ProtocolTests.test_builtin_protocol_whitelistcCs*Gdd�dt�}Gdd�d|�}|�dS)Nc@seZdZUeed<dS)z-ProtocolTests.test_super_call_init.<locals>.Pr�Nrr;r;r;r<r+�s
r+cseZdZ�fdd�Z�ZS)z/ProtocolTests.test_super_call_init.<locals>.Foocst���dSr?)r�rrSr�r;r<r�sz8ProtocolTests.test_super_call_init.<locals>.Foo.__init__�rErFrGrr�r;r;r�r<r��sr�)r)r7r+r�r;r;r<�test_super_call_init�sz"ProtocolTests.test_super_call_initN)0rErFrGr/r2r3r7r:rArLrMrRrUrVr`rbrhrjrlrmrqr|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)�sZ #%%
'	




r)c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0d]d^�Z1d_d`�Z2daS)b�GenericTestscCs0tttf}|�|jd�|�t��|tWd�n1sB0Y|�t��|ttfWd�n1sx0Ytttf}|�|jtf�|t|�t��|ttfWd�n1s�0Ytttf}|�t��t	|t�Wd�n1�s0Y|�
|�t�dSr�)rr{rrVrvrPrQrrYr5rk)r7rprsZSM1r;r;r<r��s&***zGenericTests.test_basicscCs�td�}td�}|�t��t||Wd�n1s<0Y|�t��t||Wd�n1sr0Y|�t��*Gdd�dt|t|�}Wd�n1s�0Y|�t��tgtt�Wd�n1s�0Y|�t��tttt�Wd�n1�s(0Y|�t�� Gdd�dt�}Wd�n1�sd0Y|�t��*Gdd�dt|t|�}Wd�n1�s�0Y|�t��*Gd	d�dt|t|�}Wd�n1�s�0YdS)
Nrr~c@seZdZdS)z+GenericTests.test_generic_errors.<locals>.CNrIr;r;r;r<r��r�r�c@seZdZdS)z4GenericTests.test_generic_errors.<locals>.NewGenericNrIr;r;r;r<�
NewGeneric�r�r�c@seZdZdS�z3GenericTests.test_generic_errors.<locals>.MyGenericNrIr;r;r;r<�	MyGeneric�r�r�c@seZdZdSr�rIr;r;r;r<r��r�)	r
rPrQrrRrrYr5r�)r7rr~r�r�r�r;r;r<�test_generic_errors�s$**8,.0:z GenericTests.test_generic_errorscCs�td�}td�}|�t��t||fWd�n1s<0Y|�t��t|||fWd�n1st0YdS)Nrr~)r
rPrQr)r7rr~r;r;r<�	test_init�s*zGenericTests.test_initcCs�Gdd�dtjt�}Gdd�d|�}|�|jd�|�t��|jWd�n1sZ0Yd|_d|_Gdd	�d	|�}Gd
d�d|t�}|�|jd�|�|jd�|�|jd�dS)NcseZdZ�fdd�Z�ZS)z*GenericTests.test_init_subclass.<locals>.Xcst�jfi|��d|_dSrN)r��__init_subclass__r)r8�kwargsr�r;r<r��sz<GenericTests.test_init_subclass.<locals>.X.__init_subclass__�rErFrGr�r�r;r;r�r<rp�srpc@seZdZdS)z*GenericTests.test_init_subclass.<locals>.YNrIr;r;r;r<rssrsrOr�r�c@seZdZdS)z*GenericTests.test_init_subclass.<locals>.ZNrIr;r;r;r<�Zsr�c@seZdZdS)z*GenericTests.test_init_subclass.<locals>.WNrIr;r;r;r<�W	sr�)r@rrrVrrP�AttributeErrorrY)r7rprsr�r�r;r;r<�test_init_subclass�s$zGenericTests.test_init_subclasscCs4|�tt�dt�d��|�tt�dt�d��dS)Nz<class 'z.SimpleMapping'>z.MySimpleMapping'>)rVrWrrEr
rSr;r;r<rXs

�

�zGenericTests.test_reprcCs�td�}td�}Gdd�dt|�}|t||f}|�||t||f�|�||t||f�||tf}|�|||tf�|�|||tf�|�|||tf�|t}|�||t�|�||t�|�|||�|�t|��d��dS)Nrr~c@seZdZdS)z'GenericTests.test_chain_repr.<locals>.CNrIr;r;r;r<r�sr�z.C[typing.Tuple[str, int]])	r
rrrVrtrYr{r�r�)r7rr~r�rprsr�r;r;r<�test_chain_reprs"�zGenericTests.test_chain_reprcCs�td�}tddd�}td�}|�tt�d�|�tt|�d�|�tt|�d�|�tt||t�d	�|�ttt�d	�dS)
Nr�UTrr~ztyping.Listztyping.List[~T]ztyping.List[+U]ztyping.List[int])r
rVrWrrY)r7rr�r~r;r;r<�
test_new_repr-szGenericTests.test_new_reprcCs~td�}td�}|�ttj||f||f�d�|�ttt||ft|f�d�|�ttt||ftt�d�dS)Nr�TSztyping.Mapping[~TS, ~T]z"typing.List[typing.Tuple[int, ~T]]z=typing.List[typing.Tuple[typing.List[int], typing.List[int]]])r
rVrWr@r�rrrY)r7rr�r;r;r<�test_new_repr_complex8s"��z"GenericTests.test_new_repr_complexcCsZtd�}|�tt|�d�|�ttj|�d�Gdd�dtjttf�}t|j�dS)Nrztyping.Generic[~T]ztyping.Protocol[~T]c@seZdZdS)z*GenericTests.test_new_repr_bare.<locals>.CNrIr;r;r;r<r�Hr�r�)	r
rVrWrr@rrr�__mro__�r7rr�r;r;r<�test_new_repr_bareDs
zGenericTests.test_new_repr_barecCsptd�}Gdd�dt|�}|�}d|_|�|jddi�Gdd�d|t�}|�}d|_|�|jd	di�dS)
Nrc@seZdZdS)z!GenericTests.test_dict.<locals>.BNrIr;r;r;r<r?Osr?rOr�c@seZdZdS)z!GenericTests.test_dict.<locals>.CNrIr;r;r;r<r�Vsr�r=r�)r
rr�rVr�rYr�)r7rr?�br�r�r;r;r<�	test_dictLszGenericTests.test_dictcCsTtd�}Gdd�dt|�}|�|tjd�|�||tjd�d||t_|�|jd�|�|tjd�d|tt_|�|jd�|�|ttjd�|�|�jd�|�|tt�jd�Gdd�d||�}|�|tjd�|�|jd�d	|_d
|t_|�|jd�|�|tjd�|�|jd
�|�|tjd	�dS)Nrc@seZdZdZdS)z<GenericTests.test_subscripted_generics_as_proxies.<locals>.C�defNrNr;r;r;r<r�_sr�r�Zchanged�newc@seZdZdS)z<GenericTests.test_subscripted_generics_as_proxies.<locals>.DNrIr;r;r;r<r,msr,zfrom derived zzfrom derived x)	r
rrVrYr�r{rr�r�r7rr�r,r;r;r<�$test_subscripted_generics_as_proxies]s*
z1GenericTests.test_subscripted_generics_as_proxiescCs`td�}Gdd�dtjjt|�}|�t�|�d|�|t|�d|�|��|�	�dS)Nrc@seZdZdS)z.GenericTests.test_abc_registry_kept.<locals>.CNrIr;r;r;r<r�zr�r�r�)
r
r�r=r�rrTrYrk�_abc_registry_clear�_abc_caches_clearr�r;r;r<�test_abc_registry_keptxs
z#GenericTests.test_abc_registry_keptcCs4Gdd�dtttf�}|�i|�|�t|�dS)Nc@seZdZdS)z5GenericTests.test_false_subclasses.<locals>.MyMappingNrIr;r;r;r<�	MyMapping�r�r�)rr{r�r>r�)r7r�r;r;r<�test_false_subclasses�sz"GenericTests.test_false_subclassescCs`Gdd�dtttf�}|���|�|�tjj�|�|�t�|�|�t�|�i|�dS)Nc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z'GenericTests.test_abc_bases.<locals>.MMcSsdSr?r;�r7�kr;r;r<r�sz3GenericTests.test_abc_bases.<locals>.MM.__getitem__cSsdSr?r;�r7r�r�r;r;r<r	�sz3GenericTests.test_abc_bases.<locals>.MM.__setitem__cSsdSr?r;r�r;r;r<�__delitem__�sz3GenericTests.test_abc_bases.<locals>.MM.__delitem__cSstd�Sr���iterrSr;r;r<r��sz0GenericTests.test_abc_bases.<locals>.MM.__iter__cSsdSr^r;rSr;r;r<�__len__�sz/GenericTests.test_abc_bases.<locals>.MM.__len__N�rErFrGrr	r�r�r�r;r;r;r<�MM�s
r�)rr{�updaterkr�r=r�r)r7r�r;r;r<�test_abc_bases�s
zGenericTests.test_abc_basescCsVGdd�dtttftjj�}Gdd�dtjjtttf�}|�|jtjjtf�dS)Nc@seZdZdS)z-GenericTests.test_multiple_bases.<locals>.MM1NrIr;r;r;r<�MM1�sr�c@seZdZdS)z-GenericTests.test_multiple_bases.<locals>.MM2NrIr;r;r;r<�MM2�sr�)rr{r�r=rV�	__bases__r)r7r�r�r;r;r<�test_multiple_bases�sz GenericTests.test_multiple_basescCs@td�}Gdd�dtjt|f�}|�|jtjt|ff�dS)Nrc@seZdZdS)z'GenericTests.test_orig_bases.<locals>.CNrIr;r;r;r<r��r�r�)r
r@rr{rV�__orig_bases__r�r;r;r<�test_orig_bases�szGenericTests.test_orig_basescCsrdd�}|�|dditjttf��|�|dditjttf��|�t��(|dditjttf�Wd�n1s|0Ydd�}Gdd�dt	t�}|�||t�|t��|�||t�|t��|�||t�t
��|�t��"|gd	�|t�Wd�n1�s 0Yd
d�}Gdd
�d
t
t�}|�|gd	�|��|�|ddg|��dS)NcsBt|j�dkrt�|jr>|j\��t��fdd�|��D��SdS)Nrc3s&|]\}}t|��ot|��VqdSr?)rR��.0r�r��r
rr;r<�	<genexpr>�s�zSGenericTests.test_naive_runtime_checks.<locals>.naive_dict_check.<locals>.<genexpr>)r�rvr;ru�all�items��obj�tpr;r�r<�naive_dict_check�s
�z@GenericTests.test_naive_runtime_checks.<locals>.naive_dict_checkr�r�cSst|d�st�|j|kS)N�__orig_class__)�hasattrr;rrr;r;r<�naive_generic_check�s
zCGenericTests.test_naive_runtime_checks.<locals>.naive_generic_checkc@seZdZdS)z4GenericTests.test_naive_runtime_checks.<locals>.NodeNrIr;r;r;r<�Node�r�r	r�cst�fdd�|D��S)Nc3s$|]}t|�jdjd�VqdS)rN)rRr�ru)r�r��rr;r<r��s�zXGenericTests.test_naive_runtime_checks.<locals>.naive_list_base_check.<locals>.<genexpr>)rrr;r
r<�naive_list_base_check�s�zEGenericTests.test_naive_runtime_checks.<locals>.naive_list_base_checkc@seZdZdS)z1GenericTests.test_naive_runtime_checks.<locals>.CNrIr;r;r;r<r��r�r�r�r�)r�r@rr{rYr�rPr;rrr)r7rrr	rr�r;r;r<�test_naive_runtime_checks�s 
62z&GenericTests.test_naive_runtime_checkscCs"td�}td�}td�}Gdd�dt|||�}Gdd�d|t|||�}|�|j|f�|�|j|f�|�|tjd�|�|tjd�|�|tjtf�|�|tjtf�|�|jttf�|�|j|ttf�|�|j	t|||f�|�|j	|t|||f�dS)	Nrr�r�c@seZdZdS)z.GenericTests.test_multi_subscr_base.<locals>.CNrIr;r;r;r<r��r�r�c@seZdZdS)z.GenericTests.test_multi_subscr_base.<locals>.DNrIr;r;r;r<r,�r�r,r;)
r
rrVrvrYrur�r�rr�)r7rr�r�r�r,r;r;r<�test_multi_subscr_base�sz#GenericTests.test_multi_subscr_basecCsjtd�}Gdd�dt�}|�t|t|�|�t|tf|t|tf�|�td|fjt|f�dS)Nrc@seZdZdS)z.GenericTests.test_subscript_meta.<locals>.MetaNrIr;r;r;r<�Meta�r�r.)	r
r^rVr$rrYrru�Ellipsis)r7rrr;r;r<�test_subscript_meta�s
 z GenericTests.test_subscript_metacCs�Gdd�dtt�}Gdd�dtt�}|�||�|�tjttjt�|�|j|j�|�tjj|jttjj|jt�|�||j�|�|tj�|�|tjj�|�|jtj�|�|jtjj�|�|t|jt�|�|tt	|jtt	�|�|ttjt�|�|ttjjt�|�|jt
tjt
�|�|jtt	tjjtt	�|�t|tt|jt�|�t|tt	t|jtt	�|�tt|tftttjtf�|�t|t|tft|ttjtf�|�t
j|tt
jtjjt�tjdd�dk�r�|�tt|t��d��|�tt|jt��d��|�tttjt��d	��|�tttjjt��d
��dS)Nc@seZdZdS)z+GenericTests.test_generic_hashes.<locals>.ANrIr;r;r;r<r\�sr\c@s eZdZGdd�dee�ZdS)z+GenericTests.test_generic_hashes.<locals>.Bc@seZdZdS)z-GenericTests.test_generic_hashes.<locals>.B.ANrIr;r;r;r<r\�sr\N)rErFrGrrr\r;r;r;r<r?�sr?r�)r�r�z<locals>.A[str]]z<locals>.B.A[str]]zmod_generics_cache.A[str]]zmod_generics_cache.B.A[str]])rrrVr0r\r{r?rtrrrYrrr@�	FrozenSet�sys�version_infor�rWr��r7r\r?r;r;r<�test_generic_hashes�sJ�"&&����z GenericTests.test_generic_hashescCsntd�}td�}|�t||fttttf�|�tjt||f|tjt||f�|�t�� t|tfdWd�n1s�0Y|�t��$t||f|dfWd�n1s�0Y|�t|tftt�|�t||ftttt	ffttt	f�Gdd�d�}Gdd�d|�}|�t||ft||ft||f�|�t�� t|tfd	Wd�n1�s�0Y|�t
|g|ftt
tgtf�|�t
dt|ftt
dttf�|�t��&t
|g|fdtfWd�n1�s0Y|�t��&t
|g|fgtfWd�n1�s`0YdS)
Nrr�r;.c@seZdZdS)z9GenericTests.test_extended_generic_rules_eq.<locals>.BaseNrIr;r;r;r<�Baser�rc@seZdZdS)z<GenericTests.test_extended_generic_rules_eq.<locals>.DerivedNrIr;r;r;r<�Derivedr�rr�)
r
rVrrYr@r�rPrQrr{rr
r)r7rr�rrr;r;r<�test_extended_generic_rules_eq
s* ,.2,(0$(6z+GenericTests.test_extended_generic_rules_eqcCs�td�}|�ttttf��dd�d�|�tttttf��dd�d�|�ttdt|ft��dd�d�|�ttgt	|ft��dd�d�dS)	Nrztyping.�zUnion[Tuple, Callable]zUnion[Tuple, Tuple[int]].zCallable[..., Optional[int]]zCallable[[], List[int]])
r
rVrWrrr�replacerYrrrlr;r;r<� test_extended_generic_rules_repr&s��"�"�z-GenericTests.test_extended_generic_rules_reprc	Csttdd�dd�}tttd�d�dd�}Gdd�d�}|�t|t�t��dtt|i�|�t|t�t��dtt|i�td	�}t|d
f}|d�dd�}|�	t|t�t��d|�t
d
t|f}|d�d
d�}|�	t|t�t��d|�dS)N�CCr�cSsdSr?r;r�r;r;r<�foobar2r�z5GenericTests.test_generic_forward_ref.<locals>.foobarcSsdSr?r;r�r;r;r<�foobar23r�z6GenericTests.test_generic_forward_ref.<locals>.foobar2c@seZdZdS)z1GenericTests.test_generic_forward_ref.<locals>.CCNrIr;r;r;r<r4r�r�r.cSsdSr?r;r�r;r;r<�barfoo@r�z5GenericTests.test_generic_forward_ref.<locals>.barfoocSsdSr?r;r�r;r;r<�barfoo2Cr�z6GenericTests.test_generic_forward_ref.<locals>.barfoo2)rr�r/rVrr�r�r
rrwr)	r7rrrr�ATrZCTr r;r;r<�test_generic_forward_ref1s$��z%GenericTests.test_generic_forward_refcCs�Gdd�dtttf�}Gdd�dttdf�}Gdd�dttgtf�}Gdd	�d	tdtf�}|�|jttf�|�|ttfjttf�|�|ttfj	|�|�|jtf�|�t
|t��d
�dd�|�|jd
�|�|�t
jj�|�|t
jj�|�|t
jj�|�|�t�|�|t�|�t��$tttdftj�Wd�n1�sb0Y|�t��$tttdftj�Wd�n1�s�0YdS)Nc@seZdZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.T1NrIr;r;r;r<�T1Gr�r#c@seZdZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.T2NrIr;r;r;r<�T2Hr�r$.c@seZdZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.C1NrIr;r;r;r<rIIr�rIc@seZdZdd�ZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.C2cSsdSr?r;rSr;r;r<r(KszIGenericTests.test_extended_generic_rules_subclassing.<locals>.C2.__call__N�rErFrGr(r;r;r;r<rJJsrJ�.���zC1[int]r;)rrr
rrYrVrvr{rurxrW�splitrkr�r=r=r�rPrQr5r@�Sequencer�)r7r#r$rIrJr;r;r<�'test_extended_generic_rules_subclassingFs&4z4GenericTests.test_extended_generic_rules_subclassingcCs�|�t��ttWd�n1s(0Y|�t��ttWd�n1sZ0Y|�t��ttWd�n1s�0Y|�t��tttWd�n1s�0YdSr?)rPrQrrrrrrYrSr;r;r<�test_fail_with_bare_uniones&&&z&GenericTests.test_fail_with_bare_unioncCs�td�}|�t��ttWd�n1s00Y|�t��tt|Wd�n1sf0Y|�t��ttjWd�n1s�0YdSrj)r
rPrQrrrr@rrlr;r;r<�test_fail_with_bare_genericos&*z(GenericTests.test_fail_with_bare_genericcCsztd�}|��Gdd�dt||f�}|�|t�j|�|�|t�j|t�Gdd�dtd|f�}|�||�j|�|�||�j||�Gdd�dt	j
||f�}|�|t�j|�|�|t�j|t�Gd	d
�d
t	jt|f�}|�|t�j|�|�|t�j|t�t
jdk�rvGdd
�d
t	jt|f�}|�|t�j|�|�|t�j|t�dS)Nrc@seZdZdS)z5GenericTests.test_type_erasure_special.<locals>.MyTupNrIr;r;r;r<�MyTup|r�r-c@seZdZdd�ZdS)z6GenericTests.test_type_erasure_special.<locals>.MyCallcSsdSr?r;rSr;r;r<r(�r�z?GenericTests.test_type_erasure_special.<locals>.MyCall.__call__Nr%r;r;r;r<�MyCallsr..c@seZdZdS)z6GenericTests.test_type_erasure_special.<locals>.MyDictNrIr;r;r;r<�MyDict�r�r/c@seZdZdS)z5GenericTests.test_type_erasure_special.<locals>.MyDefNrIr;r;r;r<�MyDef�r�r0�r�r�c@seZdZdS)z7GenericTests.test_type_erasure_special.<locals>.MyChainNrIr;r;r;r<�MyChain�r�r2)r
rDrrwrYr�rVrrr@r�DefaultDictr{rr�ChainMap)r7rr-r.r/r0r2r;r;r<�test_type_erasure_specialxs$z&GenericTests.test_type_erasure_specialcCs�dd�tjD�}|D]�}|�t|�d�|�||�t|dd�rbt|j�dkrb|�|tj	tf�t
|t�r|jD] }|�t|�d�|�||�qrqdS)Ncss|]}tt|�VqdSr?)�getattrr@)r�Zelr;r;r<r��r�z4GenericTests.test_all_repr_eq_any.<locals>.<genexpr>rrvr�)
r@�__all__rtrWrVr6r�rvrrurRr^r�)r7Zobjsr�baser;r;r<�test_all_repr_eq_any�s

z!GenericTests.test_all_repr_eq_anyc
Cs�td�}Gdd�dt|�}Gdd�d|t�at�}d|_d|_ttjd�D]J}t�	||�}t�
|�}|�|jd�|�|jd�|�|jddd	��qPt
tttttttfttttd
fttgtftjtjtg}|D]:}ttjd�D]&}t�	||�}t�
|�}|�||�q�q�ttjtjtttjtjtjtttfg}	|	D]>}ttjd�D](}t�	||�}t�
|�}|�||��q`�qNdS)Nrc@seZdZdS)z#GenericTests.test_pickle.<locals>.BNrIr;r;r;r<r?�sr?c@seZdZdS)r�NrIr;r;r;r<r��sr�rOr=r�r�.)r
rrYr�r�r�r�r�r�r�r�rVr�rrrrrr{rr|r@r3rr�r$r��AbstractSet)
r7rr?r�r�r�r��samplesr�Zmore_samplesr;r;r<�test_pickle�s:

&�
�
zGenericTests.test_picklecCs�td�}Gdd�dt|�}t|tft|tftd|fttgtftttf|||t|ttj|tjttjttj	tt
ftj	|tftttt|tdtdtftdtj
dtfg}|tgD]$}|�|t|��|�|t|��q�dS)Nrc@seZdZdS)z1GenericTests.test_copy_and_deepcopy.<locals>.NodeNrIr;r;r;r<r	�r�r	.)rr)r
rrrYrrrr@r�rr{rrr�rVrr)r7rr	�thingsr�r;r;r<�test_copy_and_deepcopy�s*$"�z#GenericTests.test_copy_and_deepcopycCs�td�atdtd�atdtt�atttttj	t
tjtt
ttfD]<}|�t|�|�|�t|�|�|�t�t�|��|�q>td�}tdtd�}tdtt�}|||fD]$}|�t|�|�|�t|�|�q�dS)Nr��TPBr��TPV�TL�TLB�TLV)r
r�rYr?r|r{r@rr@r�rr�rrrrrwrrr�r�r�)r7rprArBrCr;r;r<�$test_immutability_by_copy_and_pickle�s�z1GenericTests.test_immutability_by_copy_and_picklecs&td��G�fdd�dt��}|d�}|�t|�jd�|�t|�jd�|�t|�|�|�t|�|�d|_|�t|�jd�|�t|�jd�|td�}|�t|�jd�|�t|�jd�|�t|�|�|�t|�|�d|_|�t|�jd�|�t|�jd�|�|j|t�dS)NrcseZdZ�dd�dd�ZdS)z3GenericTests.test_copy_generic_instances.<locals>.CN)rr�cSs
||_dSr?r\r]r;r;r<r�sz<GenericTests.test_copy_generic_instances.<locals>.C.__init__rXr;r�r;r<r��sr�rOr�)	r
rrVrrr�assertIsNotrYr)r7r�r�Zcir;r�r<�test_copy_generic_instances�s&z(GenericTests.test_copy_generic_instancesc	Csvtd�}tt|tftd|ftttfttttj	tt
ftjjt
tjdg}|D]}|�t�|��|�qXdS)Nr.�whatever)r
rrrYrrrrr@r�r{�rer-r|r�rV�weakref�ref)r7rr=r�r;r;r<�test_weakref_all�s �zGenericTests.test_weakref_allcCs�td�}Gdd�dt|�}|�}|t�}d|_d|_|�t��d|_Wd�n1s^0Y|�t��d|_Wd�n1s�0Y|dd�dd�}|�t|t	�t
��d||�|�t|t�t|t��dS)	Nrc@seZdZdZdS)z0GenericTests.test_parameterized_slots.<locals>.C)�potatoN�rErFrG�	__slots__r;r;r;r<r�sr�rr�cSsdSr?r;r�r;r;r<r�
r�z2GenericTests.test_parameterized_slots.<locals>.foor�)
r
rrYrLrPr�ZtomatorVrr�r�rr)r7rr�r�Zc_intr�r;r;r<�test_parameterized_slots�s
$$ z%GenericTests.test_parameterized_slotscCs�td�}Gdd�dt|�}|�}|t�}d|_d|_|�t��d|_Wd�n1s^0Y|�t��d|_Wd�n1s�0YdS)Nrc@seZdZddiZdS)z5GenericTests.test_parameterized_slots_dict.<locals>.D�bananarONrMr;r;r;r<r,sr,ZyesZno)r
rrYrPrPr�r)r7rr,�dZd_intr;r;r<�test_parameterized_slots_dicts
$z*GenericTests.test_parameterized_slots_dictcCsN|�t��0tttf}Gdd�dt|�}Wd�n1s@0YdS)Nc@seZdZdS)z#GenericTests.test_errors.<locals>.CNrIr;r;r;r<r�$sr�)rPrQrrrr)r7r?r�r;r;r<rZ szGenericTests.test_errorscCs�Gdd�dtt�}|�|jt�|�|jd�|t}|�|jt�|�t|��d�dd�Gdd�d|t�}|�|jt�|�|jd	�dS)
Nc@seZdZdS)�#GenericTests.test_repr_2.<locals>.CNrIr;r;r;r<r�(sr�rSr&r'zC[int]c@seZdZdS)�#GenericTests.test_repr_2.<locals>.YNrIr;r;r;r<rs2srsrT)	rrrVrFrErGrYrWr()r7r�rprsr;r;r<�test_repr_2's��zGenericTests.test_repr_2cCs8|�tt�|�tttt�|�tttt�dSr?)rVrrrtr
rrSr;r;r<�	test_eq_19szGenericTests.test_eq_1cCslGdd�dtt�}Gdd�dtt�}|�||�|�||�|�|t|t�|�|t|t�dS)Nc@seZdZdS)z!GenericTests.test_eq_2.<locals>.ANrIr;r;r;r<r\@sr\c@seZdZdS)z!GenericTests.test_eq_2.<locals>.BNrIr;r;r;r<r?Csr?)rrrVrtrr;r;r<�	test_eq_2>szGenericTests.test_eq_2cCsvGdd�dtttf�}Gdd�dtttf�}Gdd�d|ttfttttf|ttf�}|�|jtttf�dS)Nc@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.ANrIr;r;r;r<r\Msr\c@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.BNrIr;r;r;r<r?Psr?c@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.CNrIr;r;r;r<r�Ssr�)rrrr
rVrv)r7r\r?r�r;r;r<�test_multiple_inheritanceKs.z&GenericTests.test_multiple_inheritancecCsNtd�}Gdd�dt|�}Gdd�dtt|�}|�|j|t|ttf�dS)Nr~c@seZdZdS)z9GenericTests.test_multiple_inheritance_special.<locals>.BNrIr;r;r;r<r?Zr�r?c@seZdZdS)z9GenericTests.test_multiple_inheritance_special.<locals>.CNrIr;r;r;r<r�[r�r�)r
rrrYrVr�r�r�)r7r~r?r�r;r;r<�!test_multiple_inheritance_specialXsz.GenericTests.test_multiple_inheritance_specialcs�Gdd�dt��G��fdd�d��Gdd�dtt��}|���� Gdd�d|�}Wd�n1sj0Y|����$Gd	d�d|t�}Wd�n1s�0YdS)
Nc@seZdZdS)zDGenericTests.test_init_subclass_super_called.<locals>.FinalExceptionNrIr;r;r;r<�FinalException_srZcs&eZdZdd����fdd�Z�ZS)z;GenericTests.test_init_subclass_super_called.<locals>.FinalNr�cs<|jD]}|�urt|��r�|��qt�jfi|��dSr?)r�r5r�r�)r8r�r8)rrZr�r;r<r�cs

zMGenericTests.test_init_subclass_super_called.<locals>.Final.__init_subclass__r�r;�rrZr�r<rbsrc@seZdZdS)z:GenericTests.test_init_subclass_super_called.<locals>.TestNrIr;r;r;r<r�hsr�c@seZdZdS�z>GenericTests.test_init_subclass_super_called.<locals>.SubclassNrIr;r;r;r<�Subclassksr]c@seZdZdSr\rIr;r;r;r<r]ns)�	ExceptionrrrPrY)r7r�r]r;r[r<�test_init_subclass_super_called^s.z,GenericTests.test_init_subclass_super_calledcCsrt}Gdd�d|t�}|tjt}Gdd�d|�}|�}|�g�|�d�|�d�|�|��ddg�dS)Nc@s4eZdZdZed�dd�Zdd�Zed�dd	�ZdS)
z)GenericTests.test_nested.<locals>.VisitorNr�cSs
||_dSr?r��r7r�r;r;r<�setysz-GenericTests.test_nested.<locals>.Visitor.setcSs|jSr?r�rSr;r;r<r|sz-GenericTests.test_nested.<locals>.Visitor.getr�cSs|jSr?r�rSr;r;r<�visitsz/GenericTests.test_nested.<locals>.Visitor.visit)rErFrGr�rrarrbr;r;r;r<�Visitorusrcc@seZdZed�dd�ZdS)z0GenericTests.test_nested.<locals>.IntListVisitorr�cSs|j�|�dSr?)r��appendrar;r;r<rd�sz7GenericTests.test_nested.<locals>.IntListVisitor.appendN)rErFrGrYrdr;r;r;r<�IntListVisitor�srer�rO)	rrr@rrYrardrVr)r7�Grcr�rer�r;r;r<�test_nestedqs



zGenericTests.test_nestedcsBtd��G�fdd�dt����d����fdd�}|d�dS)Nrcs eZdZd�ddd�dd�ZdS)z,GenericTests.test_type_erasure.<locals>.NodeN�Node[T]�r�left�rightcSs||_||_||_dSr?ri)r7rrjrkr;r;r<r�sz5GenericTests.test_type_erasure.<locals>.Node.__init__)NNrXr;r�r;r<r	�s��r	r�cs~�|�}��|�}�t|�}��t|�����t|�����t|�����|j|���|j|���|j|�dSr?)rrwr^rVr)r�r�r�r��r	rr7r;r<r��sz+GenericTests.test_type_erasure.<locals>.foorO)r
rr�r;rlr<�test_type_erasure�szGenericTests.test_type_erasurecCs�td�}Gdd�dt|�}Gdd�d|�}|�|jd�|�t��|tWd�n1sb0Y|�t��|tWd�n1s�0Y|�t��||Wd�n1s�0YdS)Nrc@seZdZdS)z)GenericTests.test_implicit_any.<locals>.CNrIr;r;r;r<r��sr�c@seZdZdS)z)GenericTests.test_implicit_any.<locals>.DNrIr;r;r;r<r,�sr,r;)r
rrVrvrPr^rYrr�r;r;r<�test_implicit_any�s&&zGenericTests.test_implicit_anycCsNGdd�dtt�}Gdd�d�}Gdd�d||�}|d�}|�|jd�dS)Nc@seZdZdS)z*GenericTests.test_new_with_args.<locals>.ANrIr;r;r;r<r\�sr\cseZdZ�fdd�Z�ZS)z*GenericTests.test_new_with_args.<locals>.Bcst��|�}||_|Sr?)r�r�r �r8r rr�r;r<r��sz2GenericTests.test_new_with_args.<locals>.B.__new__r�r;r;r�r<r?�sr?c@seZdZdS)z*GenericTests.test_new_with_args.<locals>.CNrIr;r;r;r<r��sr�r�)rrrVr �r7r\r?r�r�r;r;r<�test_new_with_args�s
zGenericTests.test_new_with_argscCsLGdd�d�}Gdd�dtt|�}|d�}|�|jd�|�|jd�dS)NcseZdZ�fdd�Z�ZS)z+GenericTests.test_new_with_args2.<locals>.Acs||_t���dSr?)�from_ar�rr!r�r;r<r�sz4GenericTests.test_new_with_args2.<locals>.A.__init__r�r;r;r�r<r\�sr\cseZdZ�fdd�Z�ZS)z+GenericTests.test_new_with_args2.<locals>.Ccs||_t��|�dSr?)�from_cr�rr!r�r;r<r�sz4GenericTests.test_new_with_args2.<locals>.C.__init__r�r;r;r�r<r��sr�r�)rrrVrrrs)r7r\r�r�r;r;r<�test_new_with_args2�s
z GenericTests.test_new_with_args2cCs�Gdd�dtt�}|�t��|d�Wd�n1s<0YGdd�d�}Gdd�d||�}|d�}|�|jd�|�|jd�|�|jd	�dS)
Nc@seZdZdS)z(GenericTests.test_new_no_args.<locals>.ANrIr;r;r;r<r\�sr\r�cseZdZ�fdd�Z�ZS)z(GenericTests.test_new_no_args.<locals>.Bcst��|�}d|_|S)Nr�)r�r��from_b)r8rr�r;r<r��sz0GenericTests.test_new_no_args.<locals>.B.__new__r�r;r;r�r<r?�sr?cs$eZdZdd�Z�fdd�Z�ZS)z(GenericTests.test_new_no_args.<locals>.CcSs
||_dSr?)r r!r;r;r<r�sz1GenericTests.test_new_no_args.<locals>.C.__init__cst��|�}d|_|S)Nr�)r�r�rsror�r;r<r��sz0GenericTests.test_new_no_args.<locals>.C.__new__)rErFrGrr�r�r;r;r�r<r��sr�r�r�)rrrPrQrVr rursrpr;r;r<�test_new_no_args�s&
zGenericTests.test_new_no_argsN)3rErFrGr�r�r�r�rXr�r�r�r�r�r�r�r�r�r�r�rr
rrrrr"r*r+r,r5r9r<r>rDrFrKrOrRrZrUrVrWrXrYr_rgrmrnrqrtrvr;r;r;r<r��s`
$+
	#

r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
ClassVarTestscCs�|�t��tdWd�n1s(0Y|�t��tttfWd�n1s^0Y|�t��tttWd�n1s�0YdSr�)rPrQrrYr{rSr;r;r<r�	s&*zClassVarTests.test_basicscCsH|�tt�d�tt}|�t|�d�tt}|�t|�dt�dS)Nztyping.ClassVar�typing.ClassVar[int]ztyping.ClassVar[%s.Employee])rVrWrrYrHrE�r7Zcvr;r;r<rX		s
zClassVarTests.test_reprcCs�|�t��$Gdd�dtt��}Wd�n1s40Y|�t��(Gdd�dttt��}Wd�n1sv0YdS)Nc@seZdZdS�z-ClassVarTests.test_cannot_subclass.<locals>.CNrIr;r;r;r<r�	sr�c@seZdZdSrzrIr;r;r;r<r�	s)rPrQr^rrYr�r;r;r<r`	s2z"ClassVarTests.test_cannot_subclasscCs�|�t��t�Wd�n1s&0Y|�t��tt��Wd�n1sZ0Y|�t��"tttt��Wd�n1s�0YdSr?)rPrQrr^rrYrSr;r;r<r�	s$(zClassVarTests.test_cannot_initcCsp|�t��tdtt�Wd�n1s.0Y|�t��ttt�Wd�n1sb0YdSr�)rPrQrRrrYr5rSr;r;r<�test_no_isinstance 	s,z ClassVarTests.test_no_isinstanceN)rErFrGr�rXr`r�r{r;r;r;r<rw�s
rwc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
FinalTestscCs�tt|�t��tdWd�n1s00Y|�t��tttfWd�n1sf0Y|�t��tttWd�n1s�0Y|�t��tttWd�n1s�0YdSr�)rrYrPrQr{rrSr;r;r<r�)	s&**zFinalTests.test_basicscCsd|�tt�d�tt}|�t|�d�tt}|�t|�dt�ttt}|�t|�d�dS)Nztyping.Finalztyping.Final[int]ztyping.Final[%s.Employee]ztyping.Final[tuple[int]])rVrWrrYrHrEr�ryr;r;r<rX4	szFinalTests.test_reprcCs�|�t��$Gdd�dtt��}Wd�n1s40Y|�t��(Gdd�dttt��}Wd�n1sv0YdS)Nc@seZdZdS�z*FinalTests.test_cannot_subclass.<locals>.CNrIr;r;r;r<r�?	sr�c@seZdZdSr}rIr;r;r;r<r�B	s)rPrQr^rrYr�r;r;r<r`=	s2zFinalTests.test_cannot_subclasscCs�|�t��t�Wd�n1s&0Y|�t��tt��Wd�n1sZ0Y|�t��"tttt��Wd�n1s�0YdSr?)rPrQrr^rrYrSr;r;r<r�E	s$(zFinalTests.test_cannot_initcCsp|�t��tdtt�Wd�n1s.0Y|�t��ttt�Wd�n1sb0YdSr�)rPrQrRrrYr5rSr;r;r<r{M	s,zFinalTests.test_no_isinstancecCsdd�}|�|t|��dS)NcSsdSr?r;r�r;r;r<�funcT	r�z.FinalTests.test_final_unmodified.<locals>.func)rwr)r7r~r;r;r<�test_final_unmodifiedS	sz FinalTests.test_final_unmodifiedN)	rErFrGr�rXr`r�r{rr;r;r;r<r|'	s	r|c@seZdZdd�Zdd�ZdS)�	CastTestscCs�|�ttd�d�|�ttd�d�|�tttd��t�|�ttd�d�|�ttd�d�|�ttt	tfd�d�|�tt
d�d�|�tdd�d�dSrN)rVrrYr�rwr^rr�rr{rrSr;r;r<r�Z	szCastTests.test_basicscCstdd�tdd�dS)NrOZhello)rrSr;r;r<rZd	s
zCastTests.test_errorsN)rErFrGr�rZr;r;r;r<r�X	s
r�c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;S)<�ForwardRefTestscCs�Gdd�dtt�}|t}t|jt�t��}|�|dt|t�|�|dt|t�|�|d|d�|�|dtt�|�	d|�t|j
t�t��}|�|dt|t�t|jt�t��}|�|dt|t�dS)Nc@sPeZdZed�dd�Zddded�dd	�Zedd
�dd�Zddd
�d
d�Z	dS)z)ForwardRefTests.test_basics.<locals>.Node)rcSs||_d|_|_dSr?ri)r7rr;r;r<rp	sz2ForwardRefTests.test_basics.<locals>.Node.__init__NzOptional[Node[T]]rh)rjrk�stuffcSs||_||_dSr?)rjrk)r7rjrkr��blahr;r;r<�add_botht	sz2ForwardRefTests.test_basics.<locals>.Node.add_both)�nodecSs|�|d�dSr?�r��r7r�r;r;r<�add_left|	sz2ForwardRefTests.test_basics.<locals>.Node.add_leftcSs|�d|�dSr?r�r�r;r;r<�	add_right	sz3ForwardRefTests.test_basics.<locals>.Node.add_right)NNN)N)
rErFrGrrrYr�rr�r�r;r;r;r<r	n	s��r	rjrkr�r�r�)rrrYrr�r�r�rVr�assertNotInr�r�)r7r	r�Z
both_hintsZ
left_hintsZright_hintsr;r;r<r�l	szForwardRefTests.test_basicscCsBt�d�}|�t��td|�Wd�n1s40YdS)NrYrO)r@r/rPrQrR�r7�frr;r;r<�#test_forwardref_instance_type_error�	s
z3ForwardRefTests.test_forwardref_instance_type_errorcCsBt�d�}|�t��tt|�Wd�n1s40YdS)NrY)r@r/rPrQr5rYr�r;r;r<�#test_forwardref_subclass_type_error�	s
z3ForwardRefTests.test_forwardref_subclass_type_errorcCs8|�t��t�d�Wd�n1s*0YdSr�)rPrQr@r/rSr;r;r<�test_forwardref_only_str_arg�	sz,ForwardRefTests.test_forwardref_only_str_argcCs�t�d�}|�|t�d��|�tdtt�|�|tjdtd��tjdtd�}|�|tjdtd��|�|tjddd��dS)NrY��module�__other_name__)r@r/rVrtrrYrE)r7r�Zfrmr;r;r<�test_forward_equality�	s
z%ForwardRefTests.test_forward_equalitycCs�t�d�}t�d�}t�d�}t�d�}Gdd�d�}||d�dd�}|�t|t�t��||d��|�||�|�||�|�||�|�t|t|�|�t|t|�|�t|t|�|�t||ft|�|�t||t	ft|t	f�dS)Nr�c@seZdZdS)z4ForwardRefTests.test_forward_equality_gth.<locals>.CNrIr;r;r;r<r��	s�r�r�cSsdSr?r;r�r;r;r<r��	sz6ForwardRefTests.test_forward_equality_gth.<locals>.foo)
r@r/rVrr�r�rrtrrY)r7�c1�c1_gth�c2�c2_gthr�r�r;r;r<�test_forward_equality_gth�	s



z)ForwardRefTests.test_forward_equality_gthcCs�t�d�}t�d�}t�d�}t�d�}||d�dd�}t|t�t��|�t|�t|��|�t|�t|��|�t|�t|��tjdtd�}tjddd�}|�t|�t|��|�t|�t|��|�t|�t|��|�t|�ttjdtd���dS)NrYr�cSsdSr?r;r�r;r;r<r��	sz7ForwardRefTests.test_forward_equality_hash.<locals>.foor�r�)	r@r/rr�r�rVr�rErt)r7r�r�r�r�r�Zc3Zc4r;r;r<�test_forward_equality_hash�	s



z*ForwardRefTests.test_forward_equality_hashcCsBGdd�d�}dd�}dd�}|�|�|��|�|�|��dS)Nc@seZdZdS)z:ForwardRefTests.test_forward_equality_namespace.<locals>.ANrIr;r;r;r<r\�	sr\cSs,t�d�}|d�dd�}t|t�t��|S)Nr\r�cSsdSr?r;r�r;r;r<r��	szPForwardRefTests.test_forward_equality_namespace.<locals>.namespace1.<locals>.fun�r@r/rr�r�)r�r�r;r;r<�
namespace1�	s
zCForwardRefTests.test_forward_equality_namespace.<locals>.namespace1cSs:t�d�}Gdd�d�}|d�dd�}t|t�t��|S)Nr\c@seZdZdS)zNForwardRefTests.test_forward_equality_namespace.<locals>.namespace2.<locals>.ANrIr;r;r;r<r\�	sr�cSsdSr?r;r�r;r;r<r��	szPForwardRefTests.test_forward_equality_namespace.<locals>.namespace2.<locals>.funr�)r�r\r�r;r;r<�
namespace2�	s

zCForwardRefTests.test_forward_equality_namespace.<locals>.namespace2)rVrt)r7r\r�r�r;r;r<�test_forward_equality_namespace�	s
z/ForwardRefTests.test_forward_equality_namespacecCs|�ttd�d�dS)NrYztyping.List[ForwardRef('int')])rVrWrrSr;r;r<�test_forward_repr�	sz!ForwardRefTests.test_forward_reprcCs6tdd�dd�}|�t|t�t��dtti�dS)Nrr�cSsdSr?r;r�r;r;r<r��	sz/ForwardRefTests.test_union_forward.<locals>.foor�)rrVrr�r�rr�r;r;r<�test_union_forward�	s
�z"ForwardRefTests.test_union_forwardcCsltdd�dd�}|�t|t�t��dtti�ttd�d�dd�}|�t|t�t��dtti�dS)Nrr�cSsdSr?r;r�r;r;r<r��	sz/ForwardRefTests.test_tuple_forward.<locals>.foor�cSsdSr?r;r�r;r;r<r��	s)rrVrr�r�rr�r/r�r;r;r<�test_tuple_forward�	s
�
�z"ForwardRefTests.test_tuple_forwardcCs2dd�dd�}|�t|t�t��dtti�dS)NzList['int']r�cSsdSr?r;r�r;r;r<r�
sz0ForwardRefTests.test_double_forward.<locals>.foor�)rVrr�r�rrYr�r;r;r<�test_double_forward
s
�z#ForwardRefTests.test_double_forwardcCsDdd�}dd�}dd�}|�}|�}|�||�|�t|||�dS)NcSs0t�d�}|}|d�dd�}t|t�t��}|S)Nr\r�cSsdSr?r;r�r;r;r<r�
r�zPForwardRefTests.test_forward_recursion_actually.<locals>.namespace1.<locals>.funr��r�r\r�Zretr;r;r<r�

s

zCForwardRefTests.test_forward_recursion_actually.<locals>.namespace1cSs0t�d�}|}|d�dd�}t|t�t��}|S)Nr\r�cSsdSr?r;r�r;r;r<r�
r�zPForwardRefTests.test_forward_recursion_actually.<locals>.namespace2.<locals>.funr�r�r;r;r<r�
s

zCForwardRefTests.test_forward_recursion_actually.<locals>.namespace2cSs||kSr?r;)Zo1Zo2r;r;r<�cmp
sz<ForwardRefTests.test_forward_recursion_actually.<locals>.cmp)rErP�RecursionError)r7r�r�r�Zr1Zr2r;r;r<�test_forward_recursion_actually	
sz/ForwardRefTests.test_forward_recursion_actuallycs�td�tt�f�G�fdd�d�}G��fdd�d�}G��fdd�d�}G��fdd	�d	�}|�t|t�t��t|t�t���|�t|t�t��d
tttttttdffi�|�t|t�t��d
ttttttdffi�|�t|t�t��d
ttttttttdffttttdffi�|�t|t�t��d
ttttttdftttttttdfffi�dS)N�ValuecseZdZUe�ed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.Cr�N)rErFrGrrr;)r�r;r<r�&
s
r�cseZdZUe��fed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.Dr�N)rErFrGrrr;�r�Z	ValueListr;r<r,(
s
r,cs"eZdZUee��fed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.Er�N�rErFrGrrrr;r�r;r<r6*
s
r6cs$eZdZUe�e��fed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.Fr�Nr�r;r�r;r<�F,
s
r�r�)rrr{rVrr�r�)r7r�r,r6r�r;r�r<�test_union_forward_recursion"
s8$"��������z,ForwardRefTests.test_union_forward_recursioncCsBtdgdfd�dd�}|�t|t�t��dttgtfi�dS)Nrr�cSsdSr?r;r�r;r;r<r�D
sz2ForwardRefTests.test_callable_forward.<locals>.foor�)rrVrr�r�rr�r;r;r<�test_callable_forwardB
s�z%ForwardRefTests.test_callable_forwardcCs6dd�dd�}|�t|t�t��dtdtfi�dS)NzCallable[..., T]r�cSsdSr?r;r�r;r;r<r�L
sz@ForwardRefTests.test_callable_with_ellipsis_forward.<locals>.foor�.)rVrr�r�rrr�r;r;r<�#test_callable_with_ellipsis_forwardJ
s�z3ForwardRefTests.test_callable_with_ellipsis_forwardcCs�Gdd�d�}Gdd�d�}|�t|t��dtt�|�t|t��dtt�|�t��t|t��fWd�n1s�0YdS)Nc@s.eZdZUdZeded<dZeded<dS)z5ForwardRefTests.test_special_forms_forward.<locals>.Cr�)�
ClassVar[int])r�r�r�)�
Final[int]�constr�N)rErFrGr�r.rr�r;r;r;r<r�T
s
r�c@seZdZUdZeded<dS)z6ForwardRefTests.test_special_forms_forward.<locals>.CFr�r�r�N)rErFrGr�rrr;r;r;r<�CFX
s
r�r�r�)rVrr�rrYrrPrQ)r7r�r�r;r;r<�test_special_forms_forwardR
sz*ForwardRefTests.test_special_forms_forwardcCs6|�t��tdWd�n1s(0YdS)Nz/T)rP�SyntaxErrorrrSr;r;r<�test_syntax_error`
sz!ForwardRefTests.test_syntax_errorcCsDdd�dd�}|�t��t|�Wd�n1s60YdS)NzNode[Tr�cSsdSr?r;r�r;r;r<r�g
sz6ForwardRefTests.test_delayed_syntax_error.<locals>.foo)rPr�rr�r;r;r<�test_delayed_syntax_errore
sz)ForwardRefTests.test_delayed_syntax_errorcCsHtdd�dd�}|�t��t|�Wd�n1s:0YdS)NZ42r�cSsdSr?r;r�r;r;r<r�o
sz,ForwardRefTests.test_type_error.<locals>.foo)rrPrQrr�r;r;r<�test_type_errorm
szForwardRefTests.test_type_errorcCsHdd�dd�}|�t��t|t��Wd�n1s:0YdS)NzNoode[T]r�cSsdSr?r;r�r;r;r<r�w
sz,ForwardRefTests.test_name_error.<locals>.foo)rP�	NameErrorrr�r�r;r;r<�test_name_erroru
szForwardRefTests.test_name_errorcCs,tdid�dd��}t|�}|�|i�dS)N�	whatevers�r�r�cSsdSr?r;r�r;r;r<r�
sz/ForwardRefTests.test_no_type_check.<locals>.foo)r!rrV)r7r��thr;r;r<�test_no_type_check}
sz"ForwardRefTests.test_no_type_checkcCsDtGdd�d��}t|j�}|�|i�t|�j�}|�|i�dS)Nc@seZdZdid�dd�ZdS)z3ForwardRefTests.test_no_type_check_class.<locals>.Cr�r�cSsdSr?r;r�r;r;r<r��
sz7ForwardRefTests.test_no_type_check_class.<locals>.C.fooN�rErFrGr�r;r;r;r<r��
sr�)r!rr�rV)r7r��cth�ithr;r;r<�test_no_type_check_class�
s
z(ForwardRefTests.test_no_type_check_classcs@Gdd�d��tG�fdd�d���}|�t�j�dti�dS)Nc@seZdZed�dd�ZdS)z6ForwardRefTests.test_no_type_check_no_bases.<locals>.Cr�cSsdSr?r;rar;r;r<r"�
r�z;ForwardRefTests.test_no_type_check_no_bases.<locals>.C.methN�rErFrGrYr"r;r;r;r<r��
sr�cseZdZ�ZdS)z6ForwardRefTests.test_no_type_check_no_bases.<locals>.DN)rErFrGr�r;�r�r;r<r,�
sr,r�)r!rVrr"rY�r7r,r;r�r<�test_no_type_check_no_bases�
sz+ForwardRefTests.test_no_type_check_no_basescCslGdd�d�}Gdd�d�}Gdd�d�}Gdd�d�}d	tjti}||||fD]}|�t|�|�qRdS)
Nc@s eZdZUdZejeed<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.C�r�N)rErFrGr�r@rrYrr;r;r;r<r��
s
r�c@seZdZUdZeeed<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.Dr�r�N)rErFrGr�rrYrr;r;r;r<r,�
s
r,c@seZdZUdZded<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.Er�rxr�N�rErFrGr�rr;r;r;r<r6�
s
r6c@seZdZUdZded<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.Fr�r�r�Nr�r;r;r;r<r��
s
r�r�)r@rrYrVr)r7r�r,r6r�Zexpected_result�clazzr;r;r<�(test_no_type_check_forward_ref_as_string�
sz8ForwardRefTests.test_no_type_check_forward_ref_as_stringc	Cs`Gdd�d�}Gdd�d�}||fD]6}|�t��t|�Wd�q$1sP0Yq$dS)Nc@seZdZUdZded<dS)zGForwardRefTests.test_nested_classvar_fails_forward_ref_check.<locals>.Er�z%typing.ClassVar[typing.ClassVar[int]]r�Nr�r;r;r;r<r6�
s
r6c@seZdZUdZeded<dS)zGForwardRefTests.test_nested_classvar_fails_forward_ref_check.<locals>.Fr�r�r�N)rErFrGr�rrr;r;r;r<r��
s
r�)rPrQr)r7r6r�r�r;r;r<�,test_nested_classvar_fails_forward_ref_check�
s
z<ForwardRefTests.test_nested_classvar_fails_forward_ref_checkcCs�tdd��}|�|jd�|did�dd��}|Gdd	�d	��}|�|jd
�t|�}|�|i�t|j�}|�|i�t|�j�}|�|i�dS)NcSs|Sr?r;)r~r;r;r<�magic_decorator�
sz@ForwardRefTests.test_meta_no_type_check.<locals>.magic_decoratorr�r�r�cSsdSr?r;r�r;r;r<r��
sz4ForwardRefTests.test_meta_no_type_check.<locals>.fooc@seZdZdid�dd�ZdS)z2ForwardRefTests.test_meta_no_type_check.<locals>.Cr�r�cSsdSr?r;r�r;r;r<r��
sz6ForwardRefTests.test_meta_no_type_check.<locals>.C.fooNr�r;r;r;r<r��
sr�r�)r"rVrErr�)r7r�r�r�r�r�r�r;r;r<�test_meta_no_type_check�
s

z'ForwardRefTests.test_meta_no_type_checkcCs>d}i}t||�t|dj�}|�||d|dd��dS)Nz^class C:
    def foo(self, a: 'C') -> 'D': pass
class D:
    def bar(self, b: 'D') -> C: pass
r�r,r�)r�rr�rV)r7r��ns�hintsr;r;r<�test_default_globals�
s

z$ForwardRefTests.test_default_globalscCsT|�ttt��dtt�|�ttt��dtt�|�ttt��dt�dS)Nr)rV�gth�Loopr�rrtrYrSr;r;r<�test_final_forward_ref�
sz&ForwardRefTests.test_final_forward_refN) rErFrGr�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�j	s:$	 		
r�c@seZdZdd�Zdd�ZdS)�
OverloadTestscCsLddlm}|�t��"|dd��}|�Wd�n1s>0YdS)Nr��overloadcSsdSr?r;r;r;r;r<r��
sz/OverloadTests.test_overload_fails.<locals>.blah)r@r�rP�RuntimeError�r7r�r�r;r;r<�test_overload_fails�
s

z!OverloadTests.test_overload_failscCs*ddlm}|dd��}dd�}|�dS)Nrr�cSsdSr?r;r;r;r;r<r��
sz2OverloadTests.test_overload_succeeds.<locals>.blahcSsdSr?r;r;r;r;r<r��
s)r@r�r�r;r;r<�test_overload_succeeds�
s

z$OverloadTests.test_overload_succeedsN)rErFrGr�r�r;r;r;r<r��
sr�a�
import asyncio

T_a = TypeVar('T_a')

class AwaitableWrapper(typing.Awaitable[T_a]):

    def __init__(self, value):
        self.value = value

    def __await__(self) -> typing.Iterator[T_a]:
        yield
        return self.value

class AsyncIteratorWrapper(typing.AsyncIterator[T_a]):

    def __init__(self, value: typing.Iterable[T_a]):
        self.value = value

    def __aiter__(self) -> typing.AsyncIterator[T_a]:
        return self

    async def __anext__(self) -> T_a:
        data = await self.value
        if data:
            return data
        else:
            raise StopAsyncIteration

class ACM:
    async def __aenter__(self) -> int:
        return 42
    async def __aexit__(self, etype, eval, tb):
        return None
FT)�
ann_module�ann_module2�ann_module3�ann_module5�ann_module6)�AsyncContextManagerc@seZdZUeed<dS)r\r�N)rErFrGr�rr;r;r;r<r\'s
r\c@s2eZdZUdZeeded<eed<eed<dS)r?Nr�r�r�)rErFrGr�rrrrYr;r;r;r<r?)s
r?c@s eZdZUe�Zeded<dS)�CSubr�N)rErFrGr?r�rrr;r;r;r<r�-s
r�c@s"eZdZUgZeeeed<dS)rf�lstN)rErFrGr�rrrrr;r;r;r<rf/s
rfc@seZdZUeded<dS)r�rN)rErFrGrrr;r;r;r<r�2s
r�c@seZdZUded<ded<dS)�NoneAndForward�parentN�meaning�rErFrGrr;r;r;r<r�5s
r�c@seZdZUeed<eed<dS)�CoolEmployee�name�coolN�rErFrGr{rrYr;r;r;r<r�9s
r�c@s"eZdZUeed<dZeed<dS)�CoolEmployeeWithDefaultr�rr�N)rErFrGr{rr�rYr;r;r;r<r�=s
r�c@seZdZUeed<dd�ZdS)�XMethr�cCs
d|jS)Nr�r�rSr;r;r<�doubleCszXMeth.doubleN)rErFrGrYrr�r;r;r;r<r�As
r�c@s2eZdZUeed<dZeed<dd�Zdd�ZdS)	�XReprr�r�r�cCs|j�d|j��S)Nz -> rZrSr;r;r<�__str__Isz
XRepr.__str__cCsdSr^r;�r7rxr;r;r<�__add__Ksz
XRepr.__add__N)rErFrGrYrr�r�r�r;r;r;r<r�Fs
r��Labelrc@seZdZUeed<eed<dS)�Point2Dr�r�Nrr;r;r;r<r�Ps
r�c@seZdZUeed<dS)r�r�Nrr;r;r;r<r�Ts
r���totalc@seZdZdS)�LabelPoint2DNrIr;r;r;r<r�Wr�r�c@seZdZUeed<eed<dS)�Options�	log_level�log_pathNrr;r;r;r<r�Ys
r�c@seZdZUded<ded<dS)�HasForeignBaseClassr��
some_xreprzmod_generics_cache.A�other_aNr�r;r;r;r<r�]s
r�)�amc	�s@|4IdH�}|Wd�IdHS1IdHs20YdSr?r;)r�r�r;r;r<�g_withasr�rOc@s:eZdZejdd�dd��Zejejdd�dd���ZdS)�
ForRefExamplerScCsdSr?r;rSr;r;r<r~nszForRefExample.funccCsdSr?r;rSr;r;r<�nestedrszForRefExample.nestedN)rErFrGr��decr~r�r;r;r;r<r�ms
r�c@s|eZdZdd�Zdd�Zed�dd��Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�GetTypeHintTestscCs�|�t��td�Wd�n1s(0Y|�t��td�Wd�n1sZ0Y|�t��td�Wd�n1s�0YdS)N�{r=)rPrQr�rSr;r;r<�(test_get_type_hints_from_various_objectsys&&z9GetTypeHintTests.test_get_type_hints_from_various_objectscCsJdtttfttd�}|�tt�|�|�tt�i�|�tt�i�dS)Nr�)r�rCr�r�)rrYr{rVr�r�r�r�)r7Zann_module_type_hintsr;r;r<�test_get_type_hints_modules�sz,GetTypeHintTests.test_get_type_hints_modulesz	known bugcCs*ttjttjd�}|�tt�|�dS)N)Z	default_aZ	default_b)rr0r\r?rVr�)r7Z	mgc_hintsr;r;r<�&test_get_type_hints_modules_forwardref�s�z7GetTypeHintTests.test_get_type_hints_modules_forwardrefcCs<|�ttj�dttji�|�ttj�t�|�ttj�dt	d��|�ttj
�ttttjd��|�ttj�dt
i�|�ttj�dttji�|�ttj�ttd��|�ttj�dt
i�|�tt�tt	d�d��|�tt�ttjtjd	��|�ttj�t
t
d��|�ttj�tjjtjjtjd
��dS)Nr�r)Z123r�)�jr�r�r�rZr�)r�r�)r�r�Zsome_b)Zmy_inner_a1Zmy_inner_a2Z
my_outer_a)rVr�r�r�rrkZj_classr��Mr^r,r{rsrYZh_classr~r�r�r�r�r0r\r?r�rSr;r;r<�test_get_type_hints_classes�s>���
�
�����z,GetTypeHintTests.test_get_type_hints_classescCs&Gdd�d�}|�t|�dti�dS)Nc@seZdZUdZeed<dS)zZGetTypeHintTests.test_get_type_hints_classes_no_implicit_optional.<locals>.WithNoneDefaultN�field)rErFrGrrYrr;r;r;r<�WithNoneDefault�s
r	r)rVr�rY)r7r	r;r;r<�0test_get_type_hints_classes_no_implicit_optional�szAGetTypeHintTests.test_get_type_hints_classes_no_implicit_optionalcCs�tGdd�d��}|�|j�|�|jjj�|�ttjj	�i�Gdd�dt
t�}tGdd�d|��}|�t|j	�dti�dS)Nc@seZdZGdd�d�ZdS)z>GetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheckc@seZdZdd�dd�ZdS)zBGetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheck.Innz
not a typer�cSsdSr?r;rar;r;r<r�r�zKGetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheck.Inn.__init__NrXr;r;r;r<�Inn�srN)rErFrGrr;r;r;r<�	NoTpCheck�src@seZdZed�dd�ZdS)z:GetTypeHintTests.test_respect_no_type_check.<locals>.ABaser�cSsdSr?r;r�r;r;r<r"�r�z?GetTypeHintTests.test_respect_no_type_check.<locals>.ABase.methNr�r;r;r;r<�ABase�sr
c@seZdZdS)z8GetTypeHintTests.test_respect_no_type_check.<locals>.DerNrIr;r;r;r<�Der�srr�)
r!r��__no_type_check__rrrVr�r�ZNTCr"rrrY)r7rr
rr;r;r<�test_respect_no_type_check�sz+GetTypeHintTests.test_respect_no_type_checkcCs||�tt�i�|�tt�i�|�tt�i�|�tt�i�|�ttj�i�|�tt�j�i�|�ttj	�i�dSr?)
rVr�rYr^�dirr�r�r�r{�joinrSr;r;r<� test_get_type_hints_for_builtins�sz1GetTypeHintTests.test_get_type_hints_for_builtinscCsPdd�}d|jd<|�t|�dti�dd�dd�}|�t|�dtd�i�dS)NcSsdSr?r;rZr;r;r<�testf�r�z6GetTypeHintTests.test_previous_behavior.<locals>.testfrYr�r�cSsdSr?r;r�r;r;r<�testg�r�z6GetTypeHintTests.test_previous_behavior.<locals>.testg)rrVr�rYr^)r7rrr;r;r<�test_previous_behavior�s

z'GetTypeHintTests.test_previous_behaviorcCsHGdd�d�}Gdd�d�}|�}ddi|_|�t|t��d|i�dS)Nc@seZdZdS)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations.<locals>.ANrIr;r;r;r<r\�r�r\c@seZdZdS)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations.<locals>.BNrIr;r;r;r<r?�r�r?r�)rrVr�r�)r7r\r?r�r;r;r<�/test_get_type_hints_for_object_with_annotations�s

z@GetTypeHintTests.test_get_type_hints_for_object_with_annotationsc	Cs�|�ttjtj�dtjtji�|�ttt��t	tt
tt	d��|�ttt��ttt	t	tt
td��|�tt�dtt
ti�dS)N�var)r�r�r�)r�r�r�r�r�)rVr�r�ZCVr�r@rr?r�rYrr�rfrrrSr;r;r<�test_get_type_hints_ClassVar�s��

��z-GetTypeHintTests.test_get_type_hints_ClassVarcCs0dti}|�ttj�|�|�ttj�|�dS)Nr7)r�rVr�r~r�)r7Zexpectsr;r;r<�,test_get_type_hints_wrapped_decoratored_func�sz=GetTypeHintTests.test_get_type_hints_wrapped_decoratored_funccCsVtdd�dd�}ttdf}|�t|t�t��dtti�|�t|t�t�dd�dtttdfi�ttd�d�d	d�}ttdf}|�t|t�t��dtti�|�t|t�t�dd�dtttdfi�t	tt
d
fdf}|d�dd
�}|�t|t�t��dt	t
df�|�t|t�t�dd�d|�ttt
d
fdf}|d�dd
�}|�t|t�t��dtt
df�|�t|t�t�dd�d|�t
jdttt
dfft
jttt
dffd�dd�}|�t|t�t��t
jdtt
ft
jtt
fd��t
jdtt
f}|d�dd�}|�t|t�t�dd�d|�dS)Nrpr�cSsdSr?r;r�r;r;r<r�r�z>GetTypeHintTests.test_get_type_hints_annotated.<locals>.foobar)r��
r�T��include_extrascSsdSr?r;r�r;r;r<r�r�)r�r.cSsdSr?r;r�r;r;r<r�r�z>GetTypeHintTests.test_get_type_hints_annotated.<locals>.barfoocSsdSr?r;r�r;r;r<rr�r�ZmutablerZcSsdSr?r;rZr;r;r<r sz?GetTypeHintTests.test_get_type_hints_annotated.<locals>.barfoo2cSsdSr?r;r�r;r;r<�barfoo3r�z?GetTypeHintTests.test_get_type_hints_annotated.<locals>.barfoo3)rr.rYrVrr�r�r�r/rrrwr�r@rr)r7rrpZBArr ZBA2rr;r;r<�test_get_type_hints_annotated�s^
��
��$�$�� ��z.GetTypeHintTests.test_get_type_hints_annotatedcs�ttdf�G�fdd�dtt�}|�t|jt�t��|t|td��|�t|jt�t�dd��|t|td��|�t|jt�t��|t|td��dS)N�Constcs0eZdZddd�dd�Z�ddd�dd�ZdS)	zBGetTypeHintTests.test_get_type_hints_annotated_refs.<locals>.MySetzConst[MySet[T]]zMySet[T]�rxr�cSsdSr?r;r�r;r;r<�__ior__szJGetTypeHintTests.test_get_type_hints_annotated_refs.<locals>.MySet.__ior__cSsdSr?r;r�r;r;r<�__iand__"szKGetTypeHintTests.test_get_type_hints_annotated_refs.<locals>.MySet.__iand__N)rErFrGr"r#r;�r r;r<�MySetsr%r!Tr)	r.rrrVrr#r�r�r")r7r%r;r$r<�"test_get_type_hints_annotated_refss���z3GetTypeHintTests.test_get_type_hints_annotated_refsN)rErFrGrrrrrr
rrrrrrrr&r;r;r;r<rxs	


5rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�GetUtilitiesTestCasecCsdtd�}Gdd�dt|�}|�t|t�|�|�t||�|�|�tt�d�|�ttt�t�|�ttttf�t�|�ttd�t�|�tt	t
t�t	�|�tt�t�|�tt|�t�|�tt
t||ft�t�|�tt
|df�t
�|�tt
�t�|�tt�t�|�tt�tjj�|�ttt�t�|�tt�d�dS)Nrc@seZdZdS)z/GetUtilitiesTestCase.test_get_origin.<locals>.CNrIr;r;r;r<r�8r�r��rO�+r1)r
rrwrrYrrr{rrrrr�r.r�rr�r=r�r;r;r<�test_get_origin6s$ z$GetUtilitiesTestCase.test_get_originc	Cs�td�}Gdd�dt|�}|�t|t�tf�|�t||�|f�|�tt�d�|�ttt�tf�|�ttttf�ttf�|�ttd�d�|�tt	t
t�t
tf�|�tttt|tfft�ttttff�|�ttj
tt||fftt�ttttttff�|�ttg|ft�gtf�|�ttdtf�dtf�|�ttttt|dfgtff�ttt|dfgtff�|�tttdf�tdf�|�ttd�d�|�tt|dd	d
gf�|dd	d
gf�|�tt
�d�|�tt�d�|�tt�d�|�ttt�tf�|�tt�d�|�ttjjtgtf�tgtf�|�ttjjdtf�dtf�|�ttjjgtf�gtf�|�ttjjtgtf�tttgtf��dS)Nrc@seZdZdS)z-GetUtilitiesTestCase.test_get_args.<locals>.CNrIr;r;r;r<r�Lr�r�r;r(.)r;�oner�Zthree)r
rrVr rYrrr{rrrrr@rrrr.r�r�r=r�r;r;r<�
test_get_argsJsD�$� $�($  �z"GetUtilitiesTestCase.test_get_argscCs:tt�}|�|dtti�ttj�}|�|dti�dS)Nr�r)rr�rVrr{ZMyClass)r7r�r;r;r<�test_forward_ref_and_finaljs
z/GetUtilitiesTestCase.test_forward_ref_and_finalcCs8|�td��tt�Wd�n1s*0YdS)Nz4typing.ClassVar\[int\] is not valid as type argument)�assertRaisesRegexrQrr�rSr;r;r<�test_top_level_class_varrs
�z-GetUtilitiesTestCase.test_top_level_class_varN)rErFrGr*r,r-r/r;r;r;r<r'5s r'c@s�eZdZdd�Zdd�Zdd�Zeed�dd	��Zeed�d
d��Z	eed�dd
��Z
eed�dd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@dA�Z$ee%j&dBkdC�dDdE��Z'ee%j&dBkdC�dFdG��Z(dHdI�Z)dJdK�Z*dLdM�Z+dNdO�Z,dPdQ�Z-dRdS�Z.dTdU�Z/dVdW�Z0dXdY�Z1dZd[�Z2d\d]�Z3d^d_�Z4d`da�Z5dbdc�Z6ddde�Z7dfdg�Z8dhdi�Z9djS)k�CollectionsAbcTestscCs |�dtj�|�gtj�dSrN)rkr@�Hashabler�rSr;r;r<�
test_hashable}sz!CollectionsAbcTests.test_hashablecCsX|�gtj�|�gtj�|�gtj�|�dtj�|�ttj�|�ttj�dSrN)rkr@r�r�r=r�rSr;r;r<�
test_iterable�sz!CollectionsAbcTests.test_iterablecCs(tg�}|�|tj�|�dtj�dSrN)r�rkr@�Iteratorr�)r7�itr;r;r<�
test_iterator�sz!CollectionsAbcTests.test_iteratorz&Python 3.5 and multithreading requiredcCsJi}tdt�|�|d}|�}|�|tj�|�|tj�|�d�dS)NzPasync def foo() -> typing.Awaitable[int]:
    return await AwaitableWrapper(42)
r�)r�r�rkr@�	Awaitabler��send�r7r�r��gr;r;r<�test_awaitable�s�z"CollectionsAbcTests.test_awaitablecCs�i}tdt�|�|d}|�}|�|tj�|�t�� t|tjt�Wd�n1s^0Y|�	|tj�z|�
d�Wnty�Yn0dS)Nzasync def foo():
    return
r�)r�r�rkr@�	CoroutinerPrQrRrYr�r8�
StopIterationr9r;r;r<�test_coroutine�s�.z"CollectionsAbcTests.test_coroutinecCs>td�}t|�}|�|tj�|�|tj�|�dtj�dS�NrrO)r��AsyncIteratorWrapperrkr@�
AsyncIterabler��r7Zbase_itr5r;r;r<�test_async_iterable�s
z'CollectionsAbcTests.test_async_iterablecCs0td�}t|�}|�|tj�|�dtj�dSr?)r�r@rkr@�
AsyncIteratorr�rBr;r;r<�test_async_iterator�sz'CollectionsAbcTests.test_async_iteratorcCs |�gtj�|�dtj�dSrN)rkr@�Sizedr�rSr;r;r<�
test_sized�szCollectionsAbcTests.test_sizedcCs |�gtj�|�dtj�dSrN)rkr@�	Containerr�rSr;r;r<�test_container�sz"CollectionsAbcTests.test_containercCs@|�t�tj�|�t�tj�|�ttj�|�dtj�dSrN)rkr�r@�
Collectionr�r=r�r�rSr;r;r<�test_collection�sz#CollectionsAbcTests.test_collectioncCs"|�t�tj�|�dtj�dSrN)rkrar@r:r�rSr;r;r<�test_abstractset�sz$CollectionsAbcTests.test_abstractsetcCs$|�t�tj�|�t�tj�dSr?)rkrar@�
MutableSetr�r�rSr;r;r<�test_mutableset�sz#CollectionsAbcTests.test_mutablesetcCs |�itj�|�dtj�dSrN)rkr@r�r�rSr;r;r<�test_mapping�sz CollectionsAbcTests.test_mappingcCs |�itj�|�dtj�dSrN)rkr@rr�rSr;r;r<�test_mutablemapping�sz'CollectionsAbcTests.test_mutablemappingcCs |�gtj�|�dtj�dSrN)rkr@r)r�rSr;r;r<�
test_sequence�sz!CollectionsAbcTests.test_sequencecCs |�gtj�|�dtj�dSr�)rkr@�MutableSequencer�rSr;r;r<�test_mutablesequence�sz(CollectionsAbcTests.test_mutablesequencecCs$|�dtj�|�td�tj�dSr�)rkr@�
ByteString�	bytearrayrSr;r;r<�test_bytestring�sz#CollectionsAbcTests.test_bytestringcCs|�ttj�dSr?)r=r�r@rrSr;r;r<�	test_list�szCollectionsAbcTests.test_listcCs:|�tjtj�Gdd�dtjt�}|�|�tj�dS)Nc@seZdZdS)z/CollectionsAbcTests.test_deque.<locals>.MyDequeNrIr;r;r;r<�MyDeque�r�rX)r=r��dequer@�DequerYrk)r7rXr;r;r<�
test_deque�szCollectionsAbcTests.test_dequecCs|�tjtj�dSr?)r=r��Counterr@rSr;r;r<�test_counter�sz CollectionsAbcTests.test_countercCs |�ttj�|�ttj�dSr?)r=rar@�Setr>r�rSr;r;r<�test_set�szCollectionsAbcTests.test_setcCs |�ttj�|�ttj�dSr?)r=r�r@rr>rarSr;r;r<�test_frozenset�sz"CollectionsAbcTests.test_frozensetcCs|�ttj�dSr?)r=r�r@rrSr;r;r<r��szCollectionsAbcTests.test_dictcCs td�}td�}|�t||fttftttf�|�t|tfttttf�|�tt|fttttf�|�t|t|fttfttttf�|�t|ttftttttf�|�t|t|fttfttttf�|�t|ttftttttf�dS)N�Kr�)r
rVrr{rYrr�)r7rar�r;r;r<�test_dict_subscribe�s$  ,(,z'CollectionsAbcTests.test_dict_subscribecCs�|�t��t��Wd�n1s(0Y|�t��tjt�Wd�n1s^0Y|�t��tjt�Wd�n1s�0YdSr?)rPrQr@rrrYrSr;r;r<�test_no_list_instantiation

s&*z.CollectionsAbcTests.test_no_list_instantiationcCsRGdd�dtjt�}|�}|�||�|�|tj�|�|t�|�t|�dS)Nc@seZdZdS)z6CollectionsAbcTests.test_list_subclass.<locals>.MyListNrIr;r;r;r<�MyList
srd)r@rrYrkr)r=r�r>)r7rdr�r;r;r<�test_list_subclass
sz&CollectionsAbcTests.test_list_subclasscCs�|�t��t��Wd�n1s(0Y|�t�� tjttf�Wd�n1sb0Y|�t�� tjttf�Wd�n1s�0YdSr?)rPrQr@rr
rr{rYrSr;r;r<�test_no_dict_instantiation
s&.z.CollectionsAbcTests.test_no_dict_instantiationcCsVGdd�dtjttf�}|�}|�||�|�|tj�|�|t�|�t|�dS)Nc@seZdZdS)z6CollectionsAbcTests.test_dict_subclass.<locals>.MyDictNrIr;r;r;r<r/(
sr/)	r@rr{rYrkrr=r�r>)r7r/rQr;r;r<�test_dict_subclass&
sz&CollectionsAbcTests.test_dict_subclasscCsV|�tt���tj�|�ttjttf��tj�|�ttjtt	f��tj�dSr?)
rwr^r@r3r��defaultdictr
rr{rYrSr;r;r<�test_defaultdict_instantiation2
sz2CollectionsAbcTests.test_defaultdict_instantiationcCsLGdd�dtjttf�}|�}|�||�|�|tj�|�tj|�dS)Nc@seZdZdS)z@CollectionsAbcTests.test_defaultdict_subclass.<locals>.MyDefDictNrIr;r;r;r<�	MyDefDict9
srj)	r@r3r{rYrkr=r�rhr>)r7rjZddr;r;r<�test_defaultdict_subclass7
s
z-CollectionsAbcTests.test_defaultdict_subclasscCsV|�tt���tj�|�ttjttf��tj�|�ttjttf��tj�dSr?)	rwr^r@�OrderedDictr�r
rr{rYrSr;r;r<�test_ordereddict_instantiationB
sz2CollectionsAbcTests.test_ordereddict_instantiationcCsLGdd�dtjttf�}|�}|�||�|�|tj�|�tj|�dS)Nc@seZdZdS)z@CollectionsAbcTests.test_ordereddict_subclass.<locals>.MyOrdDictNrIr;r;r;r<�	MyOrdDictI
srn)r@rlr{rYrkr=r�r>)r7rnZodr;r;r<�test_ordereddict_subclassG
s
z-CollectionsAbcTests.test_ordereddict_subclassr1zChainMap was added in 3.3cCs�|�tt���tj�|�ttjttf��tj�|�ttjttf��tj�Gdd�dtjttf�}|�t|ttf��|�dS)Nc@seZdZdS)z;CollectionsAbcTests.test_chainmap_instantiation.<locals>.CMNrIr;r;r;r<�CMW
r�rp)	rwr^r@r4r�r
rr{rY)r7rpr;r;r<�test_chainmap_instantiationR
s
z/CollectionsAbcTests.test_chainmap_instantiationcCsLGdd�dtjttf�}|�}|�||�|�|tj�|�tj|�dS)Nc@seZdZdS)z>CollectionsAbcTests.test_chainmap_subclass.<locals>.MyChainMapNrIr;r;r;r<�
MyChainMap]
srr)r@r4r{rYrkr=r�r>)r7rr�cmr;r;r<�test_chainmap_subclassZ
s
z*CollectionsAbcTests.test_chainmap_subclasscCsz|�tt���tj�|�ttjt��tj�|�ttjt��tj�Gdd�dtjt�}|�t|t��|�dS)Nc@seZdZdS)z7CollectionsAbcTests.test_deque_instantiation.<locals>.DNrIr;r;r;r<r,j
r�r,)rwr^r@rZr�rYrrYr�r;r;r<�test_deque_instantiationf
s
z,CollectionsAbcTests.test_deque_instantiationcCsz|�tt���tj�|�ttjt��tj�|�ttjt��tj�Gdd�dtjt�}|�t|t��|�dS)Nc@seZdZdS)z9CollectionsAbcTests.test_counter_instantiation.<locals>.CNrIr;r;r;r<r�q
r�r�)rwr^r@r\r�rrYr�r;r;r<�test_counter_instantiationm
s
z.CollectionsAbcTests.test_counter_instantiationcCsHGdd�dtjt�}|�}|�||�|�|tj�|�|tj�dS)Nc@seZdZdS)zJCollectionsAbcTests.test_counter_subclass_instantiation.<locals>.MyCounterNrIr;r;r;r<�	MyCounterv
srw)r@r\rYrkr�)r7rwrQr;r;r<�#test_counter_subclass_instantiationt
s
z7CollectionsAbcTests.test_counter_subclass_instantiationcCs�|�t��t��Wd�n1s(0Y|�t��tjt�Wd�n1s^0Y|�t��tjt�Wd�n1s�0YdSr?)rPrQr@r^rrYrSr;r;r<�test_no_set_instantiation~
s&*z-CollectionsAbcTests.test_no_set_instantiationcCs,Gdd�dtjt�}|�}|�||�dS)Nc@seZdZdS)zBCollectionsAbcTests.test_set_subclass_instantiation.<locals>.MySetNrIr;r;r;r<r%�
sr%)r@r^rYrk)r7r%rQr;r;r<�test_set_subclass_instantiation�
sz3CollectionsAbcTests.test_set_subclass_instantiationcCs�|�t��t��Wd�n1s(0Y|�t��tjt�Wd�n1s^0Y|�t��tjt�Wd�n1s�0YdSr?)rPrQr@rrrYrSr;r;r<�test_no_frozenset_instantiation�
s&*z3CollectionsAbcTests.test_no_frozenset_instantiationcCs,Gdd�dtjt�}|�}|�||�dS)Nc@seZdZdS)zNCollectionsAbcTests.test_frozenset_subclass_instantiation.<locals>.MyFrozenSetNrIr;r;r;r<�MyFrozenSet�
sr|)r@rrYrk)r7r|rQr;r;r<�%test_frozenset_subclass_instantiation�
sz9CollectionsAbcTests.test_frozenset_subclass_instantiationcCs�|�t��t�Wd�n1s&0Y|�t��tt�Wd�n1sZ0Y|�t��tt�Wd�n1s�0YdSr?)rPrQrrrYrSr;r;r<�test_no_tuple_instantiation�
s$(z/CollectionsAbcTests.test_no_tuple_instantiationcCs$dd�}|�}|�t|�tj�dS)Ncss
dVdSrNr;r;r;r;r<r��
sz/CollectionsAbcTests.test_generator.<locals>.foo)r=r^r@�	Generator)r7r�r:r;r;r<�test_generator�
sz"CollectionsAbcTests.test_generatorcCs�|�t��t��Wd�n1s(0Y|�t��"tjtttf�Wd�n1sd0Y|�t��"tjtttf�Wd�n1s�0YdSr?)rPrQr@rrrYrSr;r;r<�test_no_generator_instantiation�
s&0z3CollectionsAbcTests.test_no_generator_instantiationcCs2i}tdt�|�|d�}|�t|�tj�dS)Nzasync def f():
    yield 42
rC)r�r�r=r^r@�AsyncGenerator)r7r�r:r;r;r<�test_async_generator�
s�
z(CollectionsAbcTests.test_async_generatorcCs�|�t��t��Wd�n1s(0Y|�t�� tjttf�Wd�n1sb0Y|�t�� tjttf�Wd�n1s�0YdSr?)rPrQr@r�rrYrSr;r;r<�%test_no_async_generator_instantiation�
s&.z9CollectionsAbcTests.test_no_async_generator_instantiationcCsdGdd�dtj�}|�t��|�Wd�n1s80YGdd�d|�}|�t|��d�t|j�srJ�|�|�tj	�Gdd�dtjt
tf�}|�t|��d�|�t|ttf��d�|�t|t
tf��d�|�
t|�|�
t|�|�|tj	�|�|tj	�|�|tj	�|�|t
tf�tj	�|�|t
tf�tjj	�|�|tjj	�|�|tjj	�|�|tjj	�|�t��$t|ttftj	�Wd�n1�s�0Y|�||�Gdd	�d	tj�}|�
t|�Gd
d�dtjtttf�}dd
�}|�|tj�|�|tj�|�|tjj�|�|tjj�|�
t|�|�dS)Nc@seZdZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMANrIr;r;r;r<�MMA�
sr�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMCcSsdSr?r;r�r;r;r<r�
sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__getitem__cSsdSr?r;r�r;r;r<r	�
sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__setitem__cSsdSr?r;r�r;r;r<r��
sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__delitem__cSstd�Sr�r�rSr;r;r<r��
sz:CollectionsAbcTests.test_subclassing.<locals>.MMC.__iter__cSsdSr^r;rSr;r;r<r��
sz9CollectionsAbcTests.test_subclassing.<locals>.MMC.__len__Nr�r;r;r;r<�MMC�
s
r�rc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMBcSsdSr?r;r�r;r;r<r�
sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__getitem__cSsdSr?r;r�r;r;r<r	�
sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__setitem__cSsdSr?r;r�r;r;r<r��
sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__delitem__cSstd�Sr�r�rSr;r;r<r��
sz:CollectionsAbcTests.test_subclassing.<locals>.MMB.__iter__cSsdSr^r;rSr;r;r<r��
sz9CollectionsAbcTests.test_subclassing.<locals>.MMB.__len__Nr�r;r;r;r<�MMB�
s
r�c@seZdZdS)z/CollectionsAbcTests.test_subclassing.<locals>.INrIr;r;r;r<�I�
r�r�c@seZdZdS)z/CollectionsAbcTests.test_subclassing.<locals>.GNrIr;r;r;r<rfr�rfcss
dVdSr^r;r;r;r;r<r:r�z/CollectionsAbcTests.test_subclassing.<locals>.g)r@rrPrQrVr��callabler�rkr�r
rr{r>r�r=r�r=r5r�r�rrYr^)r7r�r�r�r�rfr:r;r;r<�test_subclassing�
sB$4z$CollectionsAbcTests.test_subclassingcCs�Gdd�dtjttf�}i}tdt�|�|d}|�|tj�|�|tj�|�|tjj�|�|tjj�|�	t
|�|�|�}|�|tj�|�|tj�|�|tjj�|�|tjj�|�t
|�|�|�||�dS)Nc@seZdZdd�Zddd�ZdS)z?CollectionsAbcTests.test_subclassing_async_generator.<locals>.GcSsdSr?r;)r7rr;r;r<�asend
szECollectionsAbcTests.test_subclassing_async_generator.<locals>.G.asendNcSsdSr?r;)r7�typ�val�tbr;r;r<�athrowszFCollectionsAbcTests.test_subclassing_async_generator.<locals>.G.athrow)NN)rErFrGr�r�r;r;r;r<rf	srfzasync def g(): yield 0r:)
r@r�rYr�r�r=rAr�r=r>r^rkr�)r7rfr�r:�instancer;r;r<� test_subclassing_async_generators z4CollectionsAbcTests.test_subclassing_async_generatorcCsfGdd�dtj�}Gdd�d|�}Gdd�d�}Gdd�d�}|�||�|�||�|�||�dS)	Nc@seZdZedd��ZdS)z?CollectionsAbcTests.test_subclassing_subclasshook.<locals>.BasecSs|jdkrdSdSdS)Nr�TF)rErwr;r;r<ry#s
zPCollectionsAbcTests.test_subclassing_subclasshook.<locals>.Base.__subclasshook__Nrzr;r;r;r<r"src@seZdZdS)z<CollectionsAbcTests.test_subclassing_subclasshook.<locals>.CNrIr;r;r;r<r�*r�r�c@seZdZdS)z>CollectionsAbcTests.test_subclassing_subclasshook.<locals>.FooNrIr;r;r;r<r�+r�r�c@seZdZdS)z>CollectionsAbcTests.test_subclassing_subclasshook.<locals>.BarNrIr;r;r;r<r�,r�r�)r@r�r=r>)r7rr�r�r�r;r;r<�test_subclassing_subclasshook sz1CollectionsAbcTests.test_subclassing_subclasshookcCs�Gdd�dtj�}Gdd�d|�}Gdd�d�}|�|�|�||�|�||�Gdd�d�}|�|�|�||�|�||�Gd	d
�d
�}tjj�|�|�|tj�dS)Nc@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.ANrIr;r;r;r<r\3r�r\c@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.BNrIr;r;r;r<r?4r�r?c@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.CNrIr;r;r;r<r�6r�r�c@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.DNrIr;r;r;r<r,;r�r,c@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.MNrIr;r;r;r<r@r�r)	r@rHrTr=r>r�r=rr�)r7r\r?r�r,rr;r;r<�test_subclassing_register1s

z-CollectionsAbcTests.test_subclassing_registercCs�Gdd�dtjj�}|�|tj�|�|tj�Gdd�dtjj�}|�|tj�|�|tj�Gdd�dtjj�}|�|tj�Gdd�dtjjtjd	�}Gd
d�d�}|�|�|�|tj�dS)Nc@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.MNrIr;r;r;r<rFr�rc@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.SNrIr;r;r;r<r~Jr�r~c@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.INrIr;r;r;r<r�Nr�r�c@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.ANrIr;r;r;r<r\Qr�r\)�	metaclassc@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.BNrIr;r;r;r<r?Rr�r?)	r�r=r�r=r@r�rR�ABCMetarT)r7rr~r�r\r?r;r;r<�test_collections_as_baseDs
z,CollectionsAbcTests.test_collections_as_baseN):rErFrGr2r3r6r�ASYNCIOr;r>rCrErGrIrKrLrNrOrPrQrSrVrWr[r]r_r`r�rbrcrerfrgrirkrmrorrrqrtrurvrxryrzr{r}r~r�r�r�r�r�r�r�r�r�r;r;r;r<r0{sr






Er0c@s&eZdZdd�Zeed�dd��ZdS)�
OtherABCTestscCs4tjdd��}|�}|�|tj�|�dtj�dS)Ncss
dVdSrNr;r;r;r;r<�managerZsz2OtherABCTests.test_contextmanager.<locals>.managerrO)�
contextlib�contextmanagerrkr@r�r�)r7r�rsr;r;r<�test_contextmanagerYs

z!OtherABCTests.test_contextmanagerzPython 3.5 requiredcCs�Gdd�d�}|�t�tj�|�|�tj�tjdd��}|�}|�|tj�|�tjtj	tf�|�
t�� tdtjt�Wd�n1s�0Y|�
t��tjtt
fWd�n1s�0YdS)Nc@seZdZdS)z7OtherABCTests.test_async_contextmanager.<locals>.NotACMNrIr;r;r;r<�NotACMdsr�css
dVdSrNr;r;r;r;r<r�hsz8OtherABCTests.test_async_contextmanager.<locals>.managerrO)rk�ACMr@r�r�r�r�rVrYrurPrQrRr{)r7r�r�rsr;r;r<�test_async_contextmanagerbs
.z'OtherABCTests.test_async_contextmanagerN)rErFrGr�rr�r�r;r;r;r<r�Ws	r�c@s$eZdZdd�Zdd�Zdd�ZdS)�	TypeTestscCsNGdd�d�}Gdd�d|�}Gdd�d|�}t||d�dd	�}||�dS)
Nc@seZdZdS)z'TypeTests.test_type_basic.<locals>.UserNrIr;r;r;r<�Useryr�r�c@seZdZdS)z,TypeTests.test_type_basic.<locals>.BasicUserNrIr;r;r;r<�	BasicUserzr�r�c@seZdZdS)z*TypeTests.test_type_basic.<locals>.ProUserNrIr;r;r;r<�ProUser{r�r���
user_classr�cSs|�Sr?r;�r�r;r;r<�new_user}sz+TypeTests.test_type_basic.<locals>.new_userr#)r7r�r�r�r�r;r;r<�test_type_basicws
zTypeTests.test_type_basiccCsZGdd�d�}Gdd�d|�}Gdd�d|�}td|d�}t||d	�d
d�}||�dS)Nc@seZdZdS)z)TypeTests.test_type_typevar.<locals>.UserNrIr;r;r;r<r��r�r�c@seZdZdS)z.TypeTests.test_type_typevar.<locals>.BasicUserNrIr;r;r;r<r��r�r�c@seZdZdS)z,TypeTests.test_type_typevar.<locals>.ProUserNrIr;r;r;r<r��r�r�r�r�r�cSs|�Sr?r;r�r;r;r<r��sz-TypeTests.test_type_typevar.<locals>.new_user)r
r$)r7r�r�r�r�r�r;r;r<�test_type_typevar�szTypeTests.test_type_typevarcCsFttt}|ttd�dd�}t|t�t�s2J�|d�dusBJ�dS)Nr�cSs|durdS|�SdSr?r;r�r;r;r<r��sz)TypeTests.test_type_optional.<locals>.foo)rr$�
BaseExceptionrR�KeyboardInterrupt)r7r\r�r;r;r<�test_type_optional�szTypeTests.test_type_optionalN)rErFrGr�r�r�r;r;r;r<r�us
r�c@seZdZdd�Zdd�ZdS)�NewTypeTestscCsLtdt�}tdt�}|�|d�t�|�|d�t�|�|d�dd�dS)N�UserId�UserNamer��Joer��)r%rYr{rkrV)r7r�r�r;r;r<�
test_basic�s


zNewTypeTests.test_basiccCs�tdt�}tdt�}|�t��t|t�Wd�n1s>0Y|�t�� Gdd�d|�}Wd�n1sx0YdS)Nr�r�c@seZdZdS)z#NewTypeTests.test_errors.<locals>.DNrIr;r;r;r<r,�sr,)r%rYr{rPrQr5)r7r�r�r,r;r;r<rZ�s

(zNewTypeTests.test_errorsN)rErFrGr�rZr;r;r;r<r��sr�c@steZdZGdd�de�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�NamedTupleTestsc@seZdZUeed<eed<dS)zNamedTupleTests.NestedEmployeer�r�Nr�r;r;r;r<�NestedEmployee�s
r�cCs�tddtfdtfg�}|�|t�|dd�}|ddd�}|�||�|�|t�|�|jd�|�|jd�|�|jd�|�|jd�|�|j	d�|�|j
d�|�|jt�
dtfdtfg��dS)	N�Empr��idr�rO�Jimr��r�r�)r&r{rYr=r�rkrVr�r�rE�_fieldsrr�rl)r7r�Zjoe�jimr;r;r<r��s
�zNamedTupleTests.test_basicscCs�tjdd�dkr�|�t��tdttd�Wd�n1s@0Y|�t�� Gdd�dt�}Wd�n1sz0YdS)Nr�)r�r��Name)r+rxc@seZdZdZdS)z9NamedTupleTests.test_namedtuple_pyversion.<locals>.NotYetrN)rErFrGrGr;r;r;r<�NotYet�sr�)rrrPrQr&rYr{)r7r�r;r;r<�test_namedtuple_pyversion�s
,z)NamedTupleTests.test_namedtuple_pyversioncCsvtdd�}|�|t�|�|t�|�|jd�|�|jd�|�tjd�|�tjd�|�tjt	j
ttd��dS)NZTimi(#r��r�r�)
r�rkr�rVr�r�rEr�rr�rlr{rY)r7Ztimr;r;r<�test_annotation_usage�s
�z%NamedTupleTests.test_annotation_usagecCs�td�}|�|t�|�|t�|�|jd�|�|jd�tdd�}|�|jd�|�tjd�|�tjd�|�tjt	t
td��|�tjt	dd��|�
t�� Gdd	�d	t�}Wd�n1s�0YdS)
NZJellerZSjoerdr�r�r�)r�c@s"eZdZUdZeed<eed<dS)zRNamedTupleTests.test_annotation_usage_with_default.<locals>.NonDefaultAfterDefaultr�r�r�N)rErFrGr�rYrr;r;r;r<�NonDefaultAfterDefault�s
r�)r�rkr�rVr�r�rEr�rr�r{rY�_field_defaultsrPrQr&)r7ZjelleZcooler_employeer�r;r;r<�"test_annotation_usage_with_default�s

�z2NamedTupleTests.test_annotation_usage_with_defaultcCs�|�td���d�|�td�jtd�d�|�ttd��d�|�tdd�td�d�|�t�� Gdd�dt�}Wd�n1s�0Y|�t�� Gd	d
�d
t�}Wd�n1s�0YdS)Nr�r�rOrz42 -> 1r�c@seZdZUeed<dd�ZdS)zDNamedTupleTests.test_annotation_usage_with_methods.<locals>.XMethBadr�cSsdS)Nzno chance for thisr;rSr;r;r<r��szLNamedTupleTests.test_annotation_usage_with_methods.<locals>.XMethBad._fieldsN)rErFrGrYrr�r;r;r;r<�XMethBad�s
r�c@seZdZUeed<dd�ZdS)zENamedTupleTests.test_annotation_usage_with_methods.<locals>.XMethBad2r�cSsdS)Nzno chance for this as wellr;rSr;r;r<�_source�szMNamedTupleTests.test_annotation_usage_with_methods.<locals>.XMethBad2._sourceN)rErFrGrYrr�r;r;r;r<�	XMethBad2�s
r�)	rVr�r�r�r{r�rPr�r&)r7r�r�r;r;r<�"test_annotation_usage_with_methods�s.z2NamedTupleTests.test_annotation_usage_with_methodscCsNGdd�d�}|�t��"Gdd�dt|�}Wd�n1s@0YdS)Nc@seZdZdS)z4NamedTupleTests.test_multiple_inheritance.<locals>.ANrIr;r;r;r<r\�sr\c@seZdZUeed<dS)z4NamedTupleTests.test_multiple_inheritance.<locals>.Xr�Nrr;r;r;r<rps
rp)rPrQr&)r7r\rpr;r;r<rX�sz)NamedTupleTests.test_multiple_inheritancecCs�tdttd�}|dd�}|�|t�|�|jd�|�|jd�|�|jd�|�|j	t
ttd��|�t��$tddtfgtd�Wd�n1s�0Y|�t��tddd	d
�Wd�n1s�0YdS)N�
LocalEmployee)r�ZageZNick�r�r��r�r�r�rZ)
r&r{rYrkr�rVr�rEr�rr�rPrQ)r7r�Znickr;r;r<�test_namedtuple_keyword_usages
2z-NamedTupleTests.test_namedtuple_keyword_usagecCs�tdttttd�}|�|jd�|�|jd�|tdddtfgd�}|�|j	t�|�|j
d�|�|jd�|�|jdtfg�dS)Nr&)r8r7�typename�fieldsrOr�r�)
r&r^r�r{r�rVrEr�r�r8r7r�r�)r7r&r�r;r;r<�%test_namedtuple_special_keyword_namessz5NamedTupleTests.test_namedtuple_special_keyword_namesc	Cs�td�}Gdd�dt�}||fD]h}|j|d��H|�|jd�|�|ji�|�|ji�|�|�|�Wd�q 1s~0Yq dS)Nr&c@seZdZdS)z2NamedTupleTests.test_empty_namedtuple.<locals>.CNTNrIr;r;r;r<�CNTsr�)�structr;)r&�subTestrVr�r�rrk)r7r&r�r�r;r;r<�test_empty_namedtuplesz%NamedTupleTests.test_empty_namedtuplecCsZ|�t��t��Wd�n1s(0Y|�t��t�Wd�n1sX0Y|�t��"tddtfgd�Wd�n1s�0Y|�t�� tddtfg�Wd�n1s�0Y|�t��tdttd�Wd�n1�s0Y|�t��(tddtfdtfgd�Wd�n1�sL0YdS)Nr�r��_name)r�r�r�r�)r�)rPrQr&r�r{r�rYrSr;r;r<�test_namedtuple_errors(s&$0..z&NamedTupleTests.test_namedtuple_errorsc	Cs�tddtfdtfg�att|jfD]�}|j|d���|dd�}ttj	d�D]2}t�
||�}t�|�}|�||�|�
||�qLt|�}|�||�|�
||�t|�}|�||�|�
||�Wd�q"1s�0Yq"dS)Nr�r�r�)r8�jane�%r�)r&r{rYr�r�r�r�r�r�r�r�r�rVrkrr)r7r8r�r�r��jane2r;r;r<�test_copy_and_pickle6s

z$NamedTupleTests.test_copy_and_pickleN)rErFrGr&r�r�r�r�r�r�rXr�r�r�r�r�r;r;r;r<r��s


r�c@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�TypedDictTestscCs�tdttd��}|�|t�|�|tj�|�|tj	j
�|ddd�}|�t|�t�|�
|dd�|�
|dd�|�
|jd�|�
|jt�|�
|jtf�|�
|jttd��|�
|jd�dS�Nr�r�r�r�r�r�T�r'r{rYr=r�r@rr>r�r=r)rwr^rVrErFr�r�	__total__�r7r�r�r;r;r<�test_basics_functional_syntaxLsz,TypedDictTests.test_basics_functional_syntaxcCs�tdttd�}|�|t�|�|tj�|�|tj	j
�|ddd�}|�t|�t�|�
|dd�|�
|dd�|�
|jd�|�
|jt�|�
|jtf�|�
|jttd��|�
|jd�dSr�r�r�r;r;r<�test_basics_keywords_syntax[sz*TypedDictTests.test_basics_keywords_syntaxc
Cs�tdttttttd�}|�|jd�|�|j	ttttttd��|tddddt
fgdthd�}|�|dt�|�|d	d�|�|d
d�|�|dd�|�|ddt
fg�|�|d
dth�dS)N�TD)r8r7r��	_typenamer�r�rOr��5r�r�r8r7r�r�r�r�)r'r^r�r{rYr�r�rVrErr�ra)r7r�r�r;r;r<�$test_typeddict_special_keyword_namesjsz3TypedDictTests.test_typeddict_special_keyword_namescCs|�t��t��Wd�n1s(0Y|�t��t�Wd�n1sX0Y|�t��"tddtfgd�Wd�n1s�0Y|�t��tdttd�Wd�n1s�0Y|�t��"tdttd�d�Wd�n1�s
0YdS)Nr�r�)r�r�r�r�)r�)rPrQr'r�r{rYrSr;r;r<�test_typeddict_create_errorsvs&$0,z+TypedDictTests.test_typeddict_create_errorscCs~tdttd��}|�tjd�|ddd�}|�t��ti|�Wd�n1sT0Y|�t��t||�Wd�n1s�0Y|�t��tt	|�Wd�n1s�0Y|�t��tddd�Wd�n1s�0Y|�t��"tddtfd	g�Wd�n1�s00Y|�t��$tddtfgtd
�Wd�n1�sp0YdS)Nr�r�r@r�r�ZHir�r�)r�r�r�)
r'r{rYrVrFrPrQrRr5r�r�r;r;r<�test_typeddict_errors�s(((*2z$TypedDictTests.test_typeddict_errorscCs�|�tjd�|�tjt�|�tjtttd��|�tjtf�|�tj	d�|�
ttj�t
ddd�}|�|dd�|�|dd�tddd	d�}|�|d
d	�dS)Nr�rWTrr�rZr�r��hir)rVr�rErFrrYr{r�r�r�r>r@r)r�)r7Z
not_originrxr;r;r<�test_py36_class_syntax_usage�sz+TypedDictTests.test_py36_class_syntax_usagecCs�tdttd�atddd��}ttjd�D]d}t�||�}t�|�}|�	||�|�	|ddd��t�t|�}t�|�}|�	|ddd��|�q*dS)N�EmpDr�r�r�r�)
r'r{rYr�r�r�r�r�r�rV)r7r�r�r�r�ZZZZEmpDnewr;r;r<r<�s

zTypedDictTests.test_picklecCsFtdttd�}|�tj|tjd|f�|�tj|tj	|�dS)Nr�r�)
r'r{rYrVr@rrrtrr)r7r�r;r;r<r��szTypedDictTests.test_optionalcCs�tddtidd�}|�|�i�|�|dd�ddi�|�|jd�|�|jt��|�|jdh�|�t�i�|�tdd�d	di�|�tjd�|�tjt��|�tjd	d
h�dS)Nr,r�Fr�r�r�r�)r�r�r�)r'rYrVr��__required_keys__r��__optional_keys__r�r�r;r;r<�
test_total�szTypedDictTests.test_totalcCsBGdd�dtdd�}|jtddg�ks*J�|jtdg�ks>J�dS)Nc@seZdZUeed<dS)z6TypedDictTests.test_optional_keys.<locals>.Point2Dor3Dr�Nrr;r;r;r<�Point2Dor3D�s
r�Fr�r�r�r�)r�r�r�r�)r7r�r;r;r<�test_optional_keys�sz!TypedDictTests.test_optional_keyscCs�Gdd�dt�}Gdd�d|dd�}Gdd�d|�}|jtd	g�ksHJ�|jtg�ksZJ�|jd	tikslJ�|jtd	g�ks�J�|jtd
dg�ks�J�|jtttd�ks�J�|jtd	d
g�ks�J�|jtd
dg�ks�J�|jttttd�ks�J�dS)Nc@seZdZUeed<dS)z8TypedDictTests.test_keys_inheritance.<locals>.BaseAnimalr�Nrr;r;r;r<�
BaseAnimal�s
r�c@seZdZUeed<eed<dS)z4TypedDictTests.test_keys_inheritance.<locals>.Animal�voice�tailN)rErFrGr{rr�r;r;r;r<�Animal�s
r�Fr�c@seZdZUeed<dS)z1TypedDictTests.test_keys_inheritance.<locals>.Cat�	fur_colorNrr;r;r;r<�Cat�s
r�r�r�r�)r�r�r�r�)r�r�r�r�)r'r�r�r�rr{r�)r7r�r�r�r;r;r<�test_keys_inheritance�s*��z$TypedDictTests.test_keys_inheritancecCs |�tt�tjttd��dS)Nr�)rVrr�r@rrYrSr;r;r<�test_get_type_hints�s�z"TypedDictTests.test_get_type_hintscCsrGdd�dt�}|t}|�|j|�|�|jd�|�|jtf�|dd�}|�t|�t�|�|ddi�dS)Nc@seZdZUeed<dS)z5TypedDictTests.test_non_generic_subscript.<locals>.TDr�N)rErFrGrrr;r;r;r<r��s
r�r;r�r�r�)	r'rYrVrxrvrurwr^r�)r7r�r\r�r;r;r<�test_non_generic_subscript�s
z)TypedDictTests.test_non_generic_subscriptN)rErFrGr�r�r�r�r�r�r<r�r�r�r�r�r�r;r;r;r<r�Ks


 r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�IOTestscCs.ttd�dd�}|jd}|�|jtf�dS)Nr�cSs|��Sr?��readliner�r;r;r<r�szIOTests.test_io.<locals>.stuffr�)r)rrrVrv�r7r�r�r;r;r<�test_io�s
zIOTests.test_iocCs,ttd�dd�}|jd}|�|jd�dS)Nr�cSs|��Sr?r�r�r;r;r<r�	sz"IOTests.test_textio.<locals>.stuffr�r;)r*r{rrVrvr�r;r;r<�test_textios
zIOTests.test_textiocCs,ttd�dd�}|jd}|�|jd�dS)Nr�cSs|��Sr?r�r�r;r;r<r�sz$IOTests.test_binaryio.<locals>.stuffr�r;)r+r|rrVrvr�r;r;r<�
test_binaryios
zIOTests.test_binaryiocCsnddlm}m}m}m}m}|�|tj�|�|tj�|�|tj�|�t	|�t	gd���|�|d�dS)Nr)r)r*r+r7rEr(z	typing.io)
Z	typing.ior)r*r+r7rErwr@rVra)r7r)r*r+r7rEr;r;r<�test_io_submoduleszIOTests.test_io_submoduleN)rErFrGr�r�r�r�r;r;r;r<r��sr�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�RETestscCs�t�dtj�}|�|jt�|�t|�t�|�|t�|�d�}|�|jt	�|�t|�t	�|�|t	�tt
ttft	t
ttfdS)Nz[a-z]+z12345abcde.....)
rH�compiler�r=r�r,r^rk�searchr-rr{r|)r7ZpatZmatr;r;r<r�#s
zRETests.test_basicscCsP|�tttt�|�tttt�|�tttt�|�ttt�dSr?)rVr,r{rtr|r-rSr;r;r<�test_alias_equality2szRETests.test_alias_equalitycCs�ttttf}|�t��|tWd�n1s80Y|�t��tdtt�Wd�n1sp0Y|�t��"ttttt�Wd�n1s�0YdSrN)	r-rr{r|rPrQrRr,r5)r7�mr;r;r<rZ8s&,zRETests.test_errorscCst|�tt�d�|�ttt�d�|�ttt�d�|�tt�d�|�ttt�d�|�ttt�d�dS)Nztyping.Patternztyping.Pattern[str]ztyping.Pattern[bytes]ztyping.Matchztyping.Match[str]ztyping.Match[bytes])rVrWr,r{r|r-rSr;r;r<rXCszRETests.test_reprcCs\ddlm}m}m}m}|�|tj�|�|tj�|�t|�tddg��|�|d�dS)Nr)r-r,r7rEr-r,z	typing.re)	Z	typing.rer-r,r7rErwr@rVra)r7r-r,r7rEr;r;r<�test_re_submoduleKs
zRETests.test_re_submodulecCsR|�t��"}Gdd�dtj�}Wd�n1s20Y|�t|j�d�dS)Nc@seZdZdS)z'RETests.test_cannot_subclass.<locals>.ANrIr;r;r;r<r\Usr\z.type 're.Match' is not an acceptable base type)rPrQr@r-rVr{Z	exception)r7Zexr\r;r;r<r`Rs
0�zRETests.test_cannot_subclassN)	rErFrGr�rrZrXrr`r;r;r;r<r� sr�c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd
�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(S))�AnnotatedTestscCs6|�td��t�Wd�n1s(0YdS)Nz%Type Annotated cannot be instantiated�r.rQr.rSr;r;r<�test_new^s
�zAnnotatedTests.test_newcCs<|�tttddf�d�|�ttttddf�d�dS)Nr�r�ztyping.Annotated[int, 4, 5]z(typing.Annotated[typing.List[int], 4, 5])rVrWr.rYrrSr;r;r<rXes��zAnnotatedTests.test_reprcCsJtttdfdf}|�|ttddf�|�|jd�|�|jt�dS)Nr�r�r�)r.rYrV�__metadata__rxr_r;r;r<roszAnnotatedTests.test_flattencCs�tttdf}tttdf}|�|ttttdf�|�|tjd�|�|tjtt�|�t��|tWd�n1s�0Y|�t��|tt	fWd�n1s�0YdS)N�
my decoration)r)
r.rrrYrVrrxrPrQr�)r7�L�LIr;r;r<�test_specializeus&zAnnotatedTests.test_specializecCs�|�tttddfttddfh�d�|�ttddfttddf�|�ttddfttddf�|�ttdfttddf�|�ttddfttddfttddfhttddfttddfh�dS�Nr�r�r��rVr�r.rYrtr{rrSr;r;r<�test_hash_eq�s(  &�zAnnotatedTests.test_hash_eqcs^G�fdd�d��t�df}|d�}�d�}|�||�|�|j|j�|�|j|j�dS)Ncs$eZdZdZdd�Z�fdd�ZdS)z*AnnotatedTests.test_instantiate.<locals>.Cr�cSs
||_dSr?r�rar;r;r<r�sz3AnnotatedTests.test_instantiate.<locals>.C.__init__cst|��stS|j|jkSr?)rR�NotImplementedr�r�r�r;r<�__eq__�s
z1AnnotatedTests.test_instantiate.<locals>.C.__eq__N)rErFrG�classvarrrr;r�r;r<r��sr��a decorationr�)r.rVr�r)r7r\r�r�r;r�r<�test_instantiate�szAnnotatedTests.test_instantiatecCsNttjtdf}|�|gd��ddd��|�|tgd��ddd��dS)Nr)r�r�r�r�r�r�)r.r@r\rrVrY)r7ZMyCountr;r;r<�test_instantiate_generic�sz'AnnotatedTests.test_instantiate_genericcCs>td}|�t��|d�Wd�n1s00YdS)N)rY�r�r�r�)r.rPrQr_r;r;r<�test_cannot_instantiate_forward�sz.AnnotatedTests.test_cannot_instantiate_forwardcCsBttdf}|�t��|d�Wd�n1s40YdS)Nrr�)r.rrPrQr_r;r;r<� test_cannot_instantiate_type_var�sz/AnnotatedTests.test_cannot_instantiate_type_varcCs<|�t��ttdfjWd�n1s.0YdS)N)r�r�)rPr�r.rr�rSr;r;r<�test_cannot_getattr_typevar�sz*AnnotatedTests.test_cannot_getattr_typevarcCs@Gdd�d�}t|df}|�|jd�d|_|�|jd�dS)Nc@seZdZdZdS)z/AnnotatedTests.test_attr_passthrough.<locals>.Cr�N)rErFrGrr;r;r;r<r��sr�rr�r�)r.rVrr�)r7r�r\r;r;r<�test_attr_passthrough�s
z$AnnotatedTests.test_attr_passthroughcCsJGdd�d�}|�t|t��dtt�|�t|t��dtt�dS)Nc@s>eZdZUdZeeedfed<dZee	edfed<dS)z7AnnotatedTests.test_special_form_containment.<locals>.Cr�rrr r�N)
rErFrGrr.rrYrr�rr;r;r;r<r��s
r�rr�)rVrr�rrYrr�r;r;r<�test_special_form_containment�sz,AnnotatedTests.test_special_form_containmentcCs�|�tttddfttddfh�d�|�ttddfttddf�|�ttddfttddf�|�ttdfttddf�|�ttddfttddfttddfhttddfttddfh�dSrr
rSr;r;r<r�s(  &�cCs@|�td�� Gdd�dt�}Wd�n1s20YdS)NzCannot subclass .*Annotatedc@seZdZdS)z.AnnotatedTests.test_cannot_subclass.<locals>.CNrIr;r;r;r<r��sr�rr�r;r;r<r`�sz#AnnotatedTests.test_cannot_subclasscCs@|�t��"tdttdf�Wd�n1s20YdS)Nr��positive)rPrQrRr.rYrSr;r;r<�test_cannot_check_instance�sz)AnnotatedTests.test_cannot_check_instancecCs@|�t��"ttttdf�Wd�n1s20YdS)Nr)rPrQr5rYr.rSr;r;r<�test_cannot_check_subclass�sz)AnnotatedTests.test_cannot_check_subclasscCs8|�td��ttWd�n1s*0YdS)Nzat least two arguments)r.rQr.rYrSr;r;r<�test_too_few_type_args�sz%AnnotatedTests.test_too_few_type_argsc

Cs6tjtjttftjtttdftjtgtfg}|D]t}t	|df}t
tjd�D]T}|j
||d��2t�||�}t�|�}|�||�Wd�qV1s�0YqVq8Gdd�dtt�at	ttdf}d|_d	|_t
tjd�D]D}t�||�}	t�|	�}|�|jd�|�|jd	�|�|jd�q�dS)
N.r�r�)Zprotocolr^c@seZdZdZdS)�_Annotated_test_Gr�NrNr;r;r;r<r�srzA decorationrOr=)r@rrrYr{rrrr|r.r�r�r�r�r�r�rVrrrr�r�r�)
r7r;r�r�ZprotZpickledZrestoredrfr�r�r;r;r<r<�s*�
.
zAnnotatedTests.test_picklecCs�d}d}tt|f}|�|ttt|f�|�|tt|ftt||f�ttt|f}|�|tttt|f�|�t��|ttfWd�n1s�0Y|�||tttt||f�ttjt	t
f|f}|�|ttfttjttf|f�|�t��|tWd�n1�s80Ytt|f}|�t��|dWd�n1�sx0Y|t}|�t��|dWd�n1�s�0YdS)Nrzanother decoration)r.rrVrYrrPrQr@rr
rr{)r7r�Zdec2r~r	r,ZItr
r;r;r<�
test_subst�s("*"&((zAnnotatedTests.test_substcCs0tttdf}|�|ttttdf�dS)Nr�)rr.rrVrYrqr;r;r<�test_annotated_in_other_typessz,AnnotatedTests.test_annotated_in_other_typesN)rErFrGrrXrrrrrrrrrrr`rrrr<r r!r;r;r;r<r\s(

	
rc@s eZdZdZdd�Zdd�ZdS)�AllTestszTests for __all__.cCs�ddlm}|�d|�|�d|�|�d|�|�d|�|�d|�|�d|�|�d	|�|�d
|�|�d|�|�d|�|�d
|�|�d|�|�d|�dS)Nr)r7r:�
ValuesViewrr�r�r��iorH�osr�Textr�r�)r@r7r�r�r`r;r;r<�test_allszAllTests.test_allcs4ttj���fdd�tt���D�}|�|��dS)Ncsnh|]f\}}|�vsf|�d�s|tjjvr|tjjvr|dvr|�d�s|��|kst|dd�tjkr|�qS)�_>r$rH)rZ_contraZ_corFN)	rvr@r$r7rHr��upperr6rEr��Z
actual_allr;r<�	<setcomp>7s

�z3AllTests.test_all_exported_names.<locals>.<setcomp>)rar@r7�varsrZassertSetEqual)r7Zcomputed_allr;r*r<�test_all_exported_names5s



�z AllTests.test_all_exported_namesN)rErFrG�__doc__r'r-r;r;r;r<r"sr"�__main__)�r�r�r�rHrZunittestrrrrrrr@rr	r
rrr
rrrrrrrrrrrrrrrrrrr r!r"r$r%r&r'r)r*r+r,r-r.r/r=rIr-r�r0r1r2rHrJrKrLrMrcrir�r�r�r�r{r|rrrr
rrrrrrrr#r$r&r'r)r�rwr|r�r�r�Z
ASYNCIO_TESTSr��ImportErrorr�r�r�r�r�r�r�r\r?r�rfr�r�r�r�r�r�r�r�r�r�r�r�r�rYr�r�r8r=�er�r�r�rr'r0r�r�r�r�r�r�r�rr"rEr;r;r;r<�<module>s*"Y*H^'9(1u$
*>F_'3#<A0