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

�i���
@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&ddlm'Z'm(Z(ddlm)Z)ddlm*Z*ddlm+Z+m,Z,ddlm-Z-m.Z.m/Z/ddlm0Z0m1Z1ddlm2Z2m3Z3ddlm4Z4ddlm5Z5m6Z6m7Z7m8Z8ddlm9Z9ddl:Z:ddlZddl;Z;ddl<Z<ddl=m>Z>ddl=m?Z?Gdd�de�Z@Gdd�d�ZAGdd �d eA�ZBGd!d"�d"eA�ZCGd#d$�d$eBeC�ZDGd%d&�d&e@�ZEGd'd(�d(e@�ZFGd)d*�d*e@�ZGGd+d,�d,e@�ZHGd-d.�d.e@�ZIGd/d0�d0�ZJGd1d2�d2eJe@�ZKGd3d4�d4eJe@�ZLGd5d6�d6e@�ZMed7eNeO�ZPed8�ZQGd9d:�d:eePeQf�ZRGd;d<�d<eRePeQf�ZSGd=d>�d>e �ZTe"Gd?d@�d@eTe ��ZUGdAdB�dB�ZVGdCdD�dDe �ZWGdEdF�dFe �ZXe"GdGdH�dHeWeXe ��ZYe"GdIdJ�dJe ��ZZGdKdL�dLeZ�Z[GdMdN�dN�Z\GdOdP�dPe+�Z]e"GdQdR�dRe ��Z^GdSdT�dTe@�Z_GdUdV�dVe@�Z`GdWdX�dXe@�ZaGdYdZ�dZe@�ZbGd[d\�d\e@�ZcGd]d^�d^e@�ZdGd_d`�d`e@�ZedaZfzegef�Wneh�y2dbZiYnwdcZidddl=mjZjmkZkmlZlmmZmmnZnddelmoZoGdfdg�dg�ZpGdhdi�diep�ZqGdjdk�dkeq�ZrGdldm�dmee�ZsGdndo�do�ZtGdpdq�dq�ZuGdrds�dse+�ZvGdtdu�due+�ZwGdvdw�dwe+�ZxGdxdy�dye+�Zye,dzd{eNfg�ZzGd|d}�d}e,�Z{Gd~d�de?j|dbd��Z}Gd�d��d�e{ez�Z~Gd�d��d�e,dbd��ZGd�d��d�e>jp�Z�d�eoe�fd�d��Z�z
e�e�����d�Wne��y�Z�zWYdZ�[�ndZ�[�wwe#Z�Gd�d��d��Z�Gd�d��d�e@�Z�Gd�d��d�e�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�e�5d��Z�e�d�e�e�e��Z�Gd�d��d�e@�Z�Gd�d��d�e@�Z�e�d�k�r�e�dSdS)��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)�is_typeddict)�
no_type_check�no_type_check_decorator��Type)�NewType)�
NamedTuple�	TypedDict��IO�TextIO�BinaryIO)�Pattern�Match)�	Annotated�
ForwardRef)�	TypeAlias)�	ParamSpec�Concatenate�
ParamSpecArgs�ParamSpecKwargs)�	TypeGuard)�mod_generics_cache)�_typed_dict_helperc@s(eZdZddd�Zddd�Zdd�ZdS)	�BaseTestCaseNcCs8t||�sd||f}|dur|d|7}|�|��dS)Nz%r is not a subclass of %r� : %s��
issubclassZfailureException��self�clsZclass_or_tuple�msg�message�rB�-/usr/local/lib/python3.10/test/test_typing.py�assertIsSubclass)�

�zBaseTestCase.assertIsSubclasscCs8t||�rd||f}|dur|d|7}|�|��dS)Nz%r is a subclass of %rr:r;r=rBrBrC�assertNotIsSubclass0rEz BaseTestCase.assertNotIsSubclasscCstjD]}|�qdS�N)�typingZ	_cleanups�r>�frBrBrC�clear_caches7s
�zBaseTestCase.clear_cachesrG)�__name__�
__module__�__qualname__rDrFrKrBrBrBrCr9's

r9c@�eZdZdS)�EmployeeN�rLrMrNrBrBrBrCrP<�rPc@rO)�ManagerNrQrBrBrBrCrS@rRrSc@rO)�FounderNrQrBrBrBrCrTDrRrTc@rO)�ManagingFounderNrQrBrBrBrCrUHrRrUc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�AnyTestscC�:|�t��tdt�Wd�dS1swYdS�N�*)�assertRaises�	TypeError�
isinstancer�r>rBrBrC�test_any_instance_type_errorN�"�z%AnyTests.test_any_instance_type_errorcC�n|�t��
ttt�Wd�n1swY|�t��ttt�Wd�dS1s0wYdSrG)rZr[r<rPrr]rBrBrC�test_any_subclass_type_errorR��"�z%AnyTests.test_any_subclass_type_errorcC�|�tt�d�dS)Nz
typing.Any)�assertEqual�reprrr]rBrBrC�	test_reprX�zAnyTests.test_reprcCsl|�t��
tdt�Wd�n1swY|�t��
ttWd�dS1s/wYdSrX)rZr[r<r�intr]rBrBrC�test_errors[s�
"�zAnyTests.test_errorscC�~|�t��Gdd�dt�}Wd�n1swY|�t��Gdd�dtt��}Wd�dS1s8wYdS)Nc@rO�z(AnyTests.test_cannot_subclass.<locals>.ANrQrBrBrBrC�AcrRrlc@rOrkrQrBrBrBrCrlfrR�rZr[r�type�r>rlrBrBrC�test_cannot_subclassa��"�zAnyTests.test_cannot_subclasscC�j|�t��t�Wd�n1swY|�t��tt��Wd�dS1s.wYdSrGrmr]rBrBrC�test_cannot_instantiatei��"�z AnyTests.test_cannot_instantiatecCs"tjttjttjtdSrG)rHr.rr-r*r]rBrBrC�test_any_works_with_aliasos

z"AnyTests.test_any_works_with_aliasN)
rLrMrNr^rarfrirprsrurBrBrBrCrVLsrVc@�<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
NoReturnTestscCrWrX)rZr[r\r	r]rBrBrC�!test_noreturn_instance_type_errorxr_z/NoReturnTests.test_noreturn_instance_type_errorcCr`rG)rZr[r<rPr	r]rBrBrC�!test_noreturn_subclass_type_error|rbz/NoReturnTests.test_noreturn_subclass_type_errorcCrc)Nztyping.NoReturn)rdrer	r]rBrBrCrf�rgzNoReturnTests.test_reprcC�8|�t��
ttWd�dS1swYdSrG)rZr[r	rhr]rBrBrC�test_not_generic��
"�zNoReturnTests.test_not_genericcCrj)Nc@rO�z-NoReturnTests.test_cannot_subclass.<locals>.ANrQrBrBrBrCrl�rRrlc@rOr}rQrBrBrBrCrl�rR�rZr[r	rnrorBrBrCrp�rqz"NoReturnTests.test_cannot_subclasscCrrrGr~r]rBrBrCrs�rtz%NoReturnTests.test_cannot_instantiateN)	rLrMrNrxryrfr{rprsrBrBrBrCrwvsrwc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!S)"�TypeVarTestscC�$td�}|�||�|�|t�dS�Nr)r
rd�assertIsInstance�r>rrBrBrC�test_basic_plain�szTypeVarTests.test_basic_plaincCsBtd�}|�t��td|�Wd�dS1swYdS)NrrY)r
rZr[r\r�rBrBrC� test_typevar_instance_type_error�s"�z-TypeVarTests.test_typevar_instance_type_errorcCsvtd�}|�t��
tt|�Wd�n1swY|�t��t|t�Wd�dS1s4wYdSr�)r
rZr[r<rhr�rBrBrC� test_typevar_subclass_type_error�s�"�z-TypeVarTests.test_typevar_subclass_type_errorcCs>|�t��tdt�}|Wd�dS1swYdS)N�X)rZr[r
rh�r>r�rBrBrC�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)Nr��Y)	r
�assertNotEqualrdrrh�__args__�__parameters__�assertIs�
__origin__)r>r�r�rBrBrC�test_union_unique�szTypeVarTests.test_union_uniquecCsttd�}|�|dBt|df�|�d|Btd|f�|�t|dB�|td�f�|�td|B�td�|f�dS)Nr��x)r
rdrr r0r�rBrBrC�test_or�s
 zTypeVarTests.test_orcCs(tdtt�}|�t|tft|�dS�Nrl)r
�str�bytesr�rrorBrBrC�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)rdrerr
rrr
)r>r�r�rBrBrCrf�szTypeVarTests.test_reprcCs4|�td�td��|�tdtt�tdtt��dSr�)r�r
rhr�r]rBrBrC�test_no_redefinition�s z!TypeVarTests.test_no_redefinitioncCsD|�t��Gdd�dtd��}Wd�dS1swYdS)Nc@rO)z1TypeVarTests.test_cannot_subclass_vars.<locals>.VNrQrBrBrBrC�V�rRr�r�rZr[r
�r>r�rBrBrC�test_cannot_subclass_vars�s"�z&TypeVarTests.test_cannot_subclass_varscCs@|�t��Gdd�dt�}Wd�dS1swYdS)Nc@rO)z7TypeVarTests.test_cannot_subclass_var_itself.<locals>.VNrQrBrBrBrCr��rRr�r�r�rBrBrC�test_cannot_subclass_var_itself�s"�z,TypeVarTests.test_cannot_subclass_var_itselfcCs:|�t��td��Wd�dS1swYdSr�r�r]rBrBrC�test_cannot_instantiate_vars�r_z)TypeVarTests.test_cannot_instantiate_varscCsv|�t��tddd�Wd�n1swY|�t��tdtttd�Wd�dS1s4wYdS)Nr�rY�Zbound)rZr[r
r��floatrPr]rBrBrC�test_bound_errors�s�"�zTypeVarTests.test_bound_errorscC�d}t|i�dS)Nz&import typing
T = typing.TypeVar('T')
��exec�r>�coderBrBrC�test_missing__name__�sz!TypeVarTests.test_missing__name__cCs>|�t��tdddd�Wd�dS1swYdS)NrT)r�r�)rZ�
ValueErrorr
r]rBrBrC�test_no_bivariant��"�zTypeVarTests.test_no_bivariantc
Cs�td�}dttffD]N}|j|d��>|�t��t||Wd�n1s)wY|�t��t||Wd�n1sDwYWd�n1sSwYq
dS)NrrB��arg)r
rhr��subTestrZr[r�list)r>rr�rBrBrC�test_bad_var_substitution�s������z&TypeVarTests.test_bad_var_substitutionN)rLrMrNr�r�r�r�r�r�r�rfr�r�r�r�r�r�r�r�rBrBrBrCr�s"


rc@�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'S)(�
UnionTestscCstttf}|�|t�dSrG)rrhr�r��r>�urBrBrC�test_basics�zUnionTests.test_basicscCs�|�t��
ttt�Wd�n1swY|�t��
ttt�Wd�n1s/wY|�t��ttttft�Wd�dS1sNwYdSrG)rZr[r<rhrr�r]rBrBrC�test_subclass_error
s��"�zUnionTests.test_subclass_errorcCsltt}|�|t�tttf}tttf}tttf}|�||�|�|t�|�|t�|�|t�dSrG)rrrdrh�objectr�)r>r��u1�u2�u3rBrBrC�test_union_anyszUnionTests.test_union_anycCsTtt}|�|t�tttf}tttf}|�||�|�|t�|�|t�dSrG)rr�rdrhr�)r>r�r�r�rBrBrC�test_union_objectszUnionTests.test_union_objectcCs(tttf}tttf}|�||�dSrG)rrhr�rd)r>r�r�rBrBrC�test_unordered&szUnionTests.test_unorderedcCstt}|�|t�dSrG)rrPr�)r>�trBrBrC�test_single_class_disappears+sz'UnionTests.test_single_class_disappearscCs8tttf}|�|t�|�t|j�|�t|j�dSrG)rrPrSr��assertInr�r�rBrBrC�test_base_class_kept/szUnionTests.test_base_class_keptcCs2tttf}t|tf}|�|ttttf�dSrG)rrhr�rPrd)r>r��vrBrBrC�test_union_union5szUnionTests.test_union_unioncCsR|�tt�d�tttf}|�t|�dt�tttf}|�t|�dt�td�}t|tft}|�t|�tt��ttttf}|�t|�d�tttt	t
tff}|�t|�d�tttB}|�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.Union[int, float]ztyping.Optional[str]z typing.Union[NoneType, str, int])
rdrerrPrhrLr
rr��dictr�r�r)r>r�rrBrBrCrf:s,zUnionTests.test_reprcCs�|�t��Gdd�dt�}Wd�n1swY|�t��Gdd�dtt��}Wd�n1s7wY|�t��Gdd�dtttf�}Wd�dS1sYwYdS)Nc@rO�z*UnionTests.test_cannot_subclass.<locals>.CNrQrBrBrBrC�CUrRr�c@rOr�rQrBrBrBrCr�XrRc@rOr�rQrBrBrBrCr�[rR)rZr[rrnrhr��r>r�rBrBrCrpSs��"�zUnionTests.test_cannot_subclasscCs�|�t��t�Wd�n1swY|�t��
tt��Wd�n1s-wYtttf}|�t��|�Wd�n1sKwY|�t��t|��Wd�dS1sfwYdSrG)rZr[rrnrhr�r�rBrBrCrs^s���"�z"UnionTests.test_cannot_instantiatecCs�|�tttjtftk�|�tttjtftjtk�|�ttttjtfj�|�tjttttjtfj�dSrG)�assertFalserr�rH�Iterablerhr�r�r]rBrBrC�test_union_generalizationis"&z$UnionTests.test_union_generalizationcCsb|�tt�|�tt�|�tt�|�tt�|�dgt�|�ttj�|�ttjt�dSrG)	r�rr�rrrrH�Mappingrr]rBrBrC�test_union_compare_otherosz#UnionTests.test_union_compare_othercCs$tt}ttdf}|�||�dSrG)rrhrrd)r>�or�rBrBrC�
test_optionalx�zUnionTests.test_optionalcC�8|�t��
tdWd�dS1swYdS�NrB)rZr[rr]rBrBrC�
test_empty}r|zUnionTests.test_emptycCs2tttf}d|fdd�}|�t|�d|�dS)Nr�cS�dSrGrB�r�rBrBrCrJ��z(UnionTests.test_no_eval_union.<locals>.f)rrhr�r�r)r>r�rJrBrBrC�test_no_eval_union�szUnionTests.test_no_eval_unioncCs*dtfdd�}|�tt|tf�d�dS)N�returncSr�rGrBrBrBrBrC�fun�r�z0UnionTests.test_function_repr_union.<locals>.funztyping.Union[fun, int])rhrdrer)r>r�rBrBrC�test_function_repr_union�sz#UnionTests.test_function_repr_unioncCstttf}|dSrG)rr�r-rorBrBrC�test_union_str_pattern�sz!UnionTests.test_union_str_patterncs4ddlm�t�tf�fdd�}t|tfdS)Nr��Elementcs�|�SrGrB)�argsr�rBrC�Elem��z#UnionTests.test_etree.<locals>.Elem)Zxml.etree.ElementTreer�rr�)r>r�rBr�rC�
test_etree�szUnionTests.test_etreeN)rLrMrNr�r�r�r�r�r�r�r�rfrprsr�r�r�r�r�r�r�r�rBrBrBrCr�s(		r�c@rv)�
TupleTestscCs�|�t��tttttf�Wd�n1swY|�t��tttttf�Wd�n1s7wYGdd�dt�}|�tt�|�|t�dS)Nc@rO)z"TupleTests.test_basics.<locals>.TPNrQrBrBrBrC�TP��r�)rZr[r<rrhr��tuplerD)r>r�rBrBrCr��s��zTupleTests.test_basicscCsd|�tttt�|�ttdfttdf�|�tttttf�|�ttttdf�dS�N.)rdrrhr�r]rBrBrC�
test_equality�szTupleTests.test_equalitycCs8Gdd�dt�}|�|t�|�tt�|�tt�dS)Nc@rO)z/TupleTests.test_tuple_subclass.<locals>.MyTupleNrQrBrBrBrC�MyTuple�rRr�)r�rDr)r>r�rBrBrC�test_tuple_subclass�szTupleTests.test_tuple_subclasscCsL|�t��tdtttf�Wd�n1swY|�dt�dS)N)rr)rZr[r\rrhr�r]rBrBrC�test_tuple_instance_type_error�s�z)TupleTests.test_tuple_instance_type_errorcCsp|�tt�d�|�ttd�d�|�ttttf�d�|�tttdf�d�|�tttt�d�dS)Nztyping.TuplerBztyping.Tuple[()]ztyping.Tuple[int, float].ztyping.Tuple[int, ...]ztyping.Tuple[list[int]])rdrerrhr�r�r]rBrBrCrf�s
zTupleTests.test_reprcCsr|�t��
tdt�Wd�n1swY|�t��tdtt�Wd�dS1s2wYdSrX)rZr[r<rrhr]rBrBrCri�s�"�zTupleTests.test_errorsN)	rLrMrNr�r�r�r�rfrirBrBrBrCr��s
r�c@r�)(�BaseCallableTestscCsd|j}|�t��ttj|tgtf�Wd�n1swY|�tj|�|�||�dSrG)rrZr[r<�types�FunctionTyperhrD�r>rrBrBrC�test_self_subclass�s�z$BaseCallableTests.test_self_subclasscCs�|j}|tgtf}|�||tgtf�|�t||tgtfh�d�|�||tgtf�|�||tgtf�|�||ttgtf�|�||gtf�|�||dtf�|�||�dS)N�.)rrhrd�lenr�r�)r>rr�rBrBrC�test_eq_hash�szBaseCallableTests.test_eq_hashcCs�|j}|�t��|�Wd�n1swY|�t��
t|��Wd�n1s0wY|tgtf}|�t��|�Wd�n1sOwY|�t��t|��Wd�dS1sjwYdSrG)rrZr[rnrhr�)r>r�crBrBrCrs�s���"�z)BaseCallableTests.test_cannot_instantiatecCs>|j}|�t��
|tWd�dS1swYdSrG)rrZr[rhr�rBrBrC�test_callable_wrong_forms�s
"�z+BaseCallableTests.test_callable_wrong_formscCs*|j}dd�}|�||�|�d|�dS)NcSr�rGrBrBrBrBrCrJ��z9BaseCallableTests.test_callable_instance_works.<locals>.f)rr��assertNotIsInstance�r>rrJrBrBrC�test_callable_instance_works�sz.BaseCallableTests.test_callable_instance_workscCs|j}dd�}|�t��|�||gdf�Wd�n1s!wY|�t��|�||gtf�Wd�n1s@wY|�t��|�d|gdf�Wd�n1s_wY|�t��|�d|gtf�Wd�dS1swYdS)NcSr�rGrBrBrBrBrCrJ�r�z>BaseCallableTests.test_callable_instance_type_error.<locals>.f)rrZr[r�rr�r�rBrBrC�!test_callable_instance_type_error�s���"�z3BaseCallableTests.test_callable_instance_type_errorcCs�|j}|j�d�}|gtf}|�t|�|�d��|ttgtf}|�t|�|�d��|dtf}|�t|�|�d��|ttgttf}|�t|�|�d��dS)N�	.Callablez
[[], bool]z[[str, float], int].z
[..., str]z[[str, float], list[int]])	rrM�boolrdrer�r�rhr�)r>r�fullnameZct0Zct2ZctvZct3rBrBrCrfszBaseCallableTests.test_reprcCsD|j}d|dtffdd�}|�t|t�t��d|dtfi�dS)N�a.cSr�rGrB�rrBrBrC�foor�z:BaseCallableTests.test_callable_with_ellipsis.<locals>.foo)rrrdr�globals�locals)r>rrrBrBrC�test_callable_with_ellipsiss
�z-BaseCallableTests.test_callable_with_ellipsiscCs|j}tj|dtfdSr�)rrHrr�r�rBrBrC�test_ellipsis_in_genericsz*BaseCallableTests.test_ellipsis_in_genericcCs:|j}|�|tBt|tf�|�t|Btt|f�dSrG)rrdrrr�rBrBrC�test_or_and_rorsz!BaseCallableTests.test_or_and_rorcCsh|j}|ttgtf}|tjjur|�|tj�|�	|j
tjj�|�|jtttf�|�|j
d�dSr�)rrhr�r��collections�abcr�r��GenericAliasr�r�rdr�r��r>r�aliasrBrBrC�
test_basic szBaseCallableTests.test_basiccCs.|j}|ttgtf}|�t�|��|�dSrG)rrhr�r�rd�weakref�refrrBrBrC�test_weakref)szBaseCallableTests.test_weakrefc
Cs�|j}td�atd�a|ttgtf|ttf|ttf|tttftfg}|D]F}t	t
jd�D]<}|j||d��+t
�
||�}t
�|�}|�|j|j�|�|j|j�|�|j|j�Wd�n1siwYq2q)bbdS)N�T_pickle�P_pickler�)r�proto)rr
rr2rrhr�r�r3�range�pickle�HIGHEST_PROTOCOLr��dumps�loadsrdr�r�r�)r>r�samplesrr�s�loadedrBrBrC�test_pickle.s(

�
���zBaseCallableTests.test_picklecCs�|j}|j�d�}|ttgtf}|ttgtf}|dtf}|�|t|ttgtf�|tjurD|�|d|tt	d�gt	d�f�|�|tt
tf|tt
gtf�|�|t|dtf�|�|t|dtf�|tttf}|�t|�|�d��|�t|t
�|�d��|�|t
|tt
gtf�|tjttttftgtf}|�|ttt
f|tjttttft
gtf�dS)Nr�.z[[int, ~VT], str]z[[int, dict], str])rrMrhrr
rrdr�rHrnr�r	rer�rr�)r>rr��C1�C2�C3�C4ZC5rBrBrC�test_var_substitutionEs&
$" �z'BaseCallableTests.test_var_substitutioncCs`|j}td�}td�}d}|�t|��|||fdtfWd�dS1s)wYdS)N�PrzAExpected a list of types, an ellipsis, ParamSpec, or Concatenate.r)rr2r
�assertRaisesRegexr[rh)r>rr"r�patrBrBrC�test_type_subst_error^s"�z'BaseCallableTests.test_type_subst_errorcCsR|j}Gdd�d|�}|tgtf}|�|�j|�|�|�j|tgtf�dS)Nc@�eZdZdd�ZdS)z/BaseCallableTests.test_type_erasure.<locals>.C1cSr�rGrBr]rBrBrC�__call__kr�z8BaseCallableTests.test_type_erasure.<locals>.C1.__call__N)rLrMrNr'rBrBrBrCrj�r)rrhrr��	__class__rd�__orig_class__)r>rrrrBrBrC�test_type_erasurehs
z#BaseCallableTests.test_type_erasurecCs�|j}|j�d�}td�}td�}||tf}|�|tgtf|tgtf�|�|ttgtf|ttgtf�|�|gtf|gtf�|�|dtf|dtf�|�||tf||tf�|�|tt|ftf|tt|ftf�|�t|�|�d��|�t|ttgtf�|�d��|�	t
��|ttfWd�n1s�wY||tf}|�|tg|tgtf�|�|ttg|ttgtf�|�|g|gtf�|�|d|dtf�|�||||tf�|�|tt|f|tt|ftf�|�|t|tgtf�|�|ttf|ttgtf�|�t|�|�d��|�t|ttf�|�d��dS)	Nr�r"�P2.z[~P, ~T]z[[int, str], str]z	[~P, int]z[[int, str], int])rrMr2rrdrhr�r3rerZr[)r>rr�r"r,rrrBrBrC�test_paramspecqs> $�"� � "z BaseCallableTests.test_paramspeccCs,|j}|j�d�}td�}td�}td�}|tt|f|f}|�t|�|�d��|�||tf|tt|ftf�|�|tt	gtf|ttt	gtf�|�|gtf|tgtf�|�|tt|ftf|ttt|ftf�|�
t��|dtfWd�n1s�wY|tt|ftf}|�t|�|�d��|�|||tt|ftf�|�|tt	g|ttt	gtf�|�|tt	f|ttt	gtf�|�|g|tgtf�|�|tt|f|ttt|ftf�|�
t��
|dWd�dS1�swYdS)Nr�rr"r,z![typing.Concatenate[int, ~P], ~T].z"[typing.Concatenate[int, ~P], int])rrMr
r2r3rhrdrer�r�rZr[)r>rr�rr"r,r�rBrBrC�test_concatenate�s@
�$&��
� ""�
$�z"BaseCallableTests.test_concatenatecCs�|j}|ttgtf}|�td��|tWd�n1s wYtd�}||tf}|�td��|tttfWd�n1sGwY|�td��
|tWd�dS1sbwYdS)Nzis not a generic classr"�many arguments for�few arguments for)rrhr�r�r#r[r2r)r>rrr"rrBrBrCri�s
��
"�zBaseCallableTests.test_errorsN)rLrMrNr�r�rsr�r�r�rfrrrr
rrr!r%r+r-r.rirBrBrBrCr��s(
	
	"r�c@seZdZejZdd�ZdS)�TypingCallableTestscCsRtjttgtf}tjjttgtf}|�|j|j�|�t	|j�t	|j��dSrG)
rHrrhr�r�rr	rdr��hash)r>�c1�c2rBrBrC�test_consistency�sz$TypingCallableTests.test_consistencyN)rLrMrNrHrr5rBrBrBrCr1�sr1c@seZdZejjZdS)�CollectionsCallableTestsN)rLrMrNrr	rrBrBrBrCr6�r(r6c@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�r9���)sfoo�bar)rr]rBrBrCr��szLiteralTests.test_basicscCs*tttdtddd�ttdS)N)y@@.rBr:r@�rrB)rrhrr]rBrBrC�3test_illegal_parameters_do_not_raise_runtime_errors�sz@LiteralTests.test_illegal_parameters_do_not_raise_runtime_errorscCsttdttddS)Nr8)rrB�baz)rrr]rBrBrC� test_literals_inside_other_types�r�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�Trztyping.Literal[1, True, 'foo']ztyping.Literal[int]ztyping.Literalztyping.Literal[None]�r�r9r:r:ztyping.Literal[1, 2, 3])rdrerrhr]rBrBrCrf�szLiteralTests.test_reprcCs�|�t��t�Wd�n1swY|�t��
td�Wd�n1s-wY|�t��
tt��Wd�n1sGwY|�t��ttd��Wd�dS1sdwYdS�Nr�)rZr[rrnr]rBrBrC�test_cannot_init�s���"�zLiteralTests.test_cannot_initcCs�|�t��tdtd�Wd�n1swY|�t��tttd�Wd�n1s3wY|�t��tdtd�Wd�n1sOwY|�t��tttd�Wd�dS1slwYdSrH)rZr[r\rrhr<r]rBrBrC� test_no_isinstance_or_issubclass�s���"�z-LiteralTests.test_no_isinstance_or_issubclasscCs~|�t��Gdd�dtd�}Wd�n1swY|�t��Gdd�dt�}Wd�dS1s8wYdS)Nc@rO)z-LiteralTests.test_no_subclassing.<locals>.FooNrQrBrBrBrC�Foor�rKr�c@rO)z-LiteralTests.test_no_subclassing.<locals>.BarNrQrBrBrBrC�Barr�rL�rZr[r)r>rKrLrBrBrC�test_no_subclassings�"�z LiteralTests.test_no_subclassingcCs<|�t��tddWd�dS1swYdSrHrMr]rBrBrC�test_no_multiple_subscriptss"�z(LiteralTests.test_no_multiple_subscriptscCs�|�tdtd�|�tdtd�|�tdtd�|�tdtd�|�tdtd�|�tdtd	�|�tdtd�|�tdtd
�|�tdtd�dS)
NrFTr�r9)r�T)r�r�r>�Tr9�r9r�r8rG)r�rrdr]rBrBrC�
test_equal
szLiteralTests.test_equalcCsX|�ttd�ttd��|�ttd�ttd��|�ttd�ttd��dS)Nr�r>rQr8rG)rdr2rr]rBrBrC�	test_hashs zLiteralTests.test_hashcCsb|�tdjd�|�tdjd�|�tdtdtdfjd�|�tggfjggf�dS)Nr8rGr�r9)r:r@)r�r9r:r@)rdrr�r]rBrBrC�	test_argss zLiteralTests.test_argscCshttdtdtdf}ttddf}ttd}|||fD]}|�|td�|�|jd�q dS)Nr�r9r:r>r8)rrdr�)r>�l1�l2�l3�lrBrBrC�test_flatten!s�zLiteralTests.test_flattenN)rLrMrNr�rDrFrfrIrJrNrOrRrSrTrYrBrBrBrCr7�s

r7�XK�XVc@sHeZdZdedefdd�Zdedefdd�Zdded	edefd
d�ZdS)
�
SimpleMapping�keyr�cCr�rGrB�r>r]rBrBrC�__getitem__0r�zSimpleMapping.__getitem__�valuecCr�rGrB�r>r]r`rBrBrC�__setitem__3r�zSimpleMapping.__setitem__N�defaultcCr�rGrB�r>r]rcrBrBrC�get6r�zSimpleMapping.getrG)rLrMrNrZr[r_rbrerBrBrBrCr\.sr\c@s@eZdZdd�Zdefdd�Zdefdd�Zddefd	d
�ZdS)�MySimpleMappingcCs
i|_dSrG��storer]rBrBrC�__init__<�
zMySimpleMapping.__init__r]cCs
|j|SrGrgr^rBrBrCr_?rjzMySimpleMapping.__getitem__cCs||j|<dSrGrgrarBrBrCrbB�zMySimpleMapping.__setitem__NcCs$z|j|WSty|YSwrG)rh�KeyErrorrdrBrBrCreEs
�zMySimpleMapping.getrG)rLrMrNrir�r_rbrerBrBrBrCrf:s
rfc@�eZdZUeed<eed<dS)�
Coordinater�r;N�rLrMrNrh�__annotations__rBrBrBrCrnL�
rnc@�eZdZUeed<dS)�Point�labelN�rLrMrNr�rprBrBrBrCrsP�
rsc@s&eZdZUeed<eed<eed<dS)�MyPointr�r;rtN�rLrMrNrhrpr�rBrBrBrCrwTs
rwc@rr)�XAxisr�NrorBrBrBrCryY�
ryc@rr)�YAxisr;NrorBrBrBrCr{\rzr{c@rO)�PositionNrQrBrBrBrCr|_�r|c@s(eZdZUeed<dedefdd�ZdS)�Proto�attrr�r�cCr�rGrB�r>r�rBrBrC�methfr�z
Proto.methN)rLrMrNrhrpr�r�rBrBrBrCr~cs
r~c@rO)�ConcreteNrQrBrBrBrCr�irRr�c@s,eZdZUdZeed<dedefdd�ZdS)�Otherr�rr�r�cCs|dkrdSdS)N�thisr�rrBr�rBrBrCr�nsz
Other.methN)rLrMrNrrhrpr�r�rBrBrBrCr�ls
r�c@rm)�NTr�r;NrorBrBrBrCr�srqr�c@seZdZUejed<dS)�HasCallProtocolr'N)rLrMrNrHrrprBrBrBrCr�ws
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�
ProtocolTestscCs�tGdd�dt��}Gdd�d�}Gdd�d�}dd�}|�||�|�|�|�|�||�|�|�|�|�tj|�|�||�dS)	Nc@r&)z,ProtocolTests.test_basic_protocol.<locals>.PcSr�rGrBr]rBrBrCr��r�z1ProtocolTests.test_basic_protocol.<locals>.P.methN�rLrMrNr�rBrBrBrCr"~�r"c@rO)z,ProtocolTests.test_basic_protocol.<locals>.CNrQrBrBrBrCr��r�r�c@r&)z,ProtocolTests.test_basic_protocol.<locals>.DcSr�rGrBr]rBrBrCr��r�z1ProtocolTests.test_basic_protocol.<locals>.D.methNr�rBrBrBrC�D�r(r�cSr�rGrBrBrBrBrCrJ�r�z,ProtocolTests.test_basic_protocol.<locals>.f)rrrDr�rFr�r�r�)r>r"r�r�rJrBrBrC�test_basic_protocol}sz!ProtocolTests.test_basic_protocolcCsrtGdd�dt��}Gdd�d�}dd�}ttt|tjfD]}|�||�qt�ddt|fD]}|�	||�q.dS)	Nc@rO)zFProtocolTests.test_everything_implements_empty_protocol.<locals>.EmptyNrQrBrBrBrC�Empty�r}r�c@rO)zBProtocolTests.test_everything_implements_empty_protocol.<locals>.CNrQrBrBrBrCr��rRr�cSr�rGrBrBrBrBrCrJ�r�zBProtocolTests.test_everything_implements_empty_protocol.<locals>.fr�rB)
rrr�rnr�r�r�rDrHr�)r>r�r�rJ�thingrBrBrC�)test_everything_implements_empty_protocol�s�z7ProtocolTests.test_everything_implements_empty_protocolcCsdd�}|�|t�dS)NcSr�rGrBrBrBrBrCrJ�r�z:ProtocolTests.test_function_implements_protocol.<locals>.f)r�r�rIrBrBrC�!test_function_implements_protocol�sz/ProtocolTests.test_function_implements_protocolcCsGdd�d�}Gdd�dt�}|�t��Gdd�d|t�}Wd�n1s(wY|�t��Gdd�dt|�}Wd�n1sFwY|�t��Gdd�d||t�}Wd�n1sewYGd	d
�d
||�}Gdd�d||�}|�|�|�|�|�|�dS)
Nc@rO)z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.CNrQrBrBrBrCr��r�r�c@rO)z:ProtocolTests.test_no_inheritance_from_nominal.<locals>.BPNrQrBrBrBrC�BP�r�r�c@rO�z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.PNrQrBrBrBrCr"�rRr"c@rOr�rQrBrBrBrCr"�rRc@rOr�rQrBrBrBrCr"�rRc@rO)z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.DNrQrBrBrBrCr��r�r�c@rO)z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.ENrQrBrBrBrC�E�r�r�)rrZr[r�)r>r�r�r"r�r�rBrBrC� test_no_inheritance_from_nominal�s���z.ProtocolTests.test_no_inheritance_from_nominalcCs�Gdd�dt�}|�t��|�Wd�n1swYGdd�d|�}|�|�|�|�t��|d�Wd�n1sCwYtd�}Gdd�dt|�}|�t��|�Wd�n1siwY|�t��
|t�Wd�n1s�wY|�t��
||�Wd�n1s�wYGd	d
�d
||�}|�|t�|�|�t��|td�Wd�dS1s�wYdS)Nc@rO)z.ProtocolTests.test_no_instantiation.<locals>.PNrQrBrBrBrCr"�r�r"c@rO)z.ProtocolTests.test_no_instantiation.<locals>.CNrQrBrBrBrCr��r�r�rYrc@rO)z/ProtocolTests.test_no_instantiation.<locals>.PGNrQrBrBrBrC�PG�r�r�c@rO)z/ProtocolTests.test_no_instantiation.<locals>.CGNrQrBrBrBrC�CG�r�r�)rrZr[r�r
rh)r>r"r�rr�r�rBrBrC�test_no_instantiation�s2�
����"�z#ProtocolTests.test_no_instantiationcCsvtGdd�dt��}Gdd�d|�}Gdd�d|�}|�t��|�Wd�n1s-wY|�|�|�dS)Nc@s eZdZejdefdd��ZdS)z9ProtocolTests.test_cannot_instantiate_abstract.<locals>.Pr�cSst�rG)�NotImplementedErrorr]rBrBrC�ameth��z?ProtocolTests.test_cannot_instantiate_abstract.<locals>.P.amethN)rLrMrNr	�abstractmethodrhr�rBrBrBrCr"�sr"c@rO)z9ProtocolTests.test_cannot_instantiate_abstract.<locals>.BNrQrBrBrBrC�B�rRr�c@�eZdZdefdd�ZdS)z9ProtocolTests.test_cannot_instantiate_abstract.<locals>.Cr�cS�dS)N�rBr]rBrBrCr��r�z?ProtocolTests.test_cannot_instantiate_abstract.<locals>.C.amethN)rLrMrNrhr�rBrBrBrCr���r�)rrrZr[r�)r>r"r�r�rBrBrC� test_cannot_instantiate_abstract�s�z.ProtocolTests.test_cannot_instantiate_abstractcCs�Gdd�dt�}tGdd�d|t��}Gdd�d�}Gdd�d�}Gd	d
�d
�}|�|�|�|�|�|�|�||�|�||�|�|�|�|�||�dS)Nc@r&)z5ProtocolTests.test_subprotocols_extending.<locals>.P1cSr�rGrBr]rBrBrC�meth1�r�z;ProtocolTests.test_subprotocols_extending.<locals>.P1.meth1N�rLrMrNr�rBrBrBrC�P1�r(r�c@r&)z5ProtocolTests.test_subprotocols_extending.<locals>.P2cSr�rGrBr]rBrBrC�meth2�r�z;ProtocolTests.test_subprotocols_extending.<locals>.P2.meth2N�rLrMrNr�rBrBrBrCr,�r�r,c@�eZdZdd�Zdd�ZdS)z4ProtocolTests.test_subprotocols_extending.<locals>.CcSr�rGrBr]rBrBrCr��r�z:ProtocolTests.test_subprotocols_extending.<locals>.C.meth1cSr�rGrBr]rBrBrCr��r�z:ProtocolTests.test_subprotocols_extending.<locals>.C.meth2N�rLrMrNr�r�rBrBrBrCr���r�c@r&)z5ProtocolTests.test_subprotocols_extending.<locals>.C1cSr�rGrBr]rBrBrCr�r�z;ProtocolTests.test_subprotocols_extending.<locals>.C1.meth1Nr�rBrBrBrCr�r(rc@r&)z5ProtocolTests.test_subprotocols_extending.<locals>.C2cSr�rGrBr]rBrBrCr�r�z;ProtocolTests.test_subprotocols_extending.<locals>.C2.meth2Nr�rBrBrBrCrr(r�rrr�rFr�rD)r>r�r,r�rrrBrBrC�test_subprotocols_extending�sz)ProtocolTests.test_subprotocols_extendingcCs�Gdd�dt�}Gdd�dt�}tGdd�d||t��}Gdd�d�}Gd	d
�d
�}Gdd�d�}|�|�|�|�|�|�|�||�|�||�|�|�|�|�||�dS)
Nc@r&)z3ProtocolTests.test_subprotocols_merging.<locals>.P1cSr�rGrBr]rBrBrCr�r�z9ProtocolTests.test_subprotocols_merging.<locals>.P1.meth1Nr�rBrBrBrCr�r(r�c@r&)z3ProtocolTests.test_subprotocols_merging.<locals>.P2cSr�rGrBr]rBrBrCr�r�z9ProtocolTests.test_subprotocols_merging.<locals>.P2.meth2Nr�rBrBrBrCr,r(r,c@rO)z2ProtocolTests.test_subprotocols_merging.<locals>.PNrQrBrBrBrCr"r}r"c@r�)z2ProtocolTests.test_subprotocols_merging.<locals>.CcSr�rGrBr]rBrBrCr�r�z8ProtocolTests.test_subprotocols_merging.<locals>.C.meth1cSr�rGrBr]rBrBrCr�r�z8ProtocolTests.test_subprotocols_merging.<locals>.C.meth2Nr�rBrBrBrCr�r�r�c@r&)z3ProtocolTests.test_subprotocols_merging.<locals>.C1cSr�rGrBr]rBrBrCr�#r�z9ProtocolTests.test_subprotocols_merging.<locals>.C1.meth1Nr�rBrBrBrCr"r(rc@r&)z3ProtocolTests.test_subprotocols_merging.<locals>.C2cSr�rGrBr]rBrBrCr�'r�z9ProtocolTests.test_subprotocols_merging.<locals>.C2.meth2Nr�rBrBrBrCr&r(rr�)r>r�r,r"r�rrrBrBrC�test_subprotocols_mergingsz'ProtocolTests.test_subprotocols_mergingcCs�td�}tGdd�dt��}tGdd�dt|��}Gdd�dt�}Gdd	�d	t|�}Gd
d�d�}|�||�|�||�|�||�|�t��t|||�Wd�n1s\wY|�t��t|||�Wd�n1sxwY|�t��
t||�Wd�n1s�wY|�t��
t||�Wd�n1s�wY|�t��t|||�Wd�n1s�wY|�t��t||t�Wd�dS1s�wYdS)Nrc@r&)z2ProtocolTests.test_protocols_issubclass.<locals>.PcSr�rGrBr]rBrBrCr�6r�z4ProtocolTests.test_protocols_issubclass.<locals>.P.xN�rLrMrNr�rBrBrBrCr"4r�r"c@r&)z3ProtocolTests.test_protocols_issubclass.<locals>.PGcSr�rGrBr]rBrBrCr�:r�z5ProtocolTests.test_protocols_issubclass.<locals>.PG.xNr�rBrBrBrCr�8r�r�c@r&)z5ProtocolTests.test_protocols_issubclass.<locals>.BadPcSr�rGrBr]rBrBrCr�=r�z7ProtocolTests.test_protocols_issubclass.<locals>.BadP.xNr�rBrBrBrC�BadP<r(r�c@r&)z6ProtocolTests.test_protocols_issubclass.<locals>.BadPGcSr�rGrBr]rBrBrCr�@r�z8ProtocolTests.test_protocols_issubclass.<locals>.BadPG.xNr�rBrBrBrC�BadPG?r(r�c@r&)z2ProtocolTests.test_protocols_issubclass.<locals>.CcSr�rGrBr]rBrBrCr�Cr�z4ProtocolTests.test_protocols_issubclass.<locals>.C.xNr�rBrBrBrCr�Br(r�)r
rrrDrZr[r<rh�r>rr"r�r�r�r�rBrBrC�test_protocols_issubclass1s:�����"�z'ProtocolTests.test_protocols_issubclasscCs8Gdd�d�}tGdd�dt��}|�t��
t||�Wd�n1s&wY|�|�|�|�|�|�t��
t||�Wd�n1sLwY|�|�|�Gdd�d|�}|�||�|�|�|�|�|�|�	||�|�|�|�|�t��t||�Wd�dS1s�wYdS)Nc@�eZdZdZdS)z?ProtocolTests.test_protocols_issubclass_non_callable.<locals>.Cr�Nr�rBrBrBrCr�W�r�c@r�)zFProtocolTests.test_protocols_issubclass_non_callable.<locals>.PNonCallr�Nr�rBrBrBrC�PNonCallZ�r�c@rO)z?ProtocolTests.test_protocols_issubclass_non_callable.<locals>.DNrQrBrBrBrCr�gr�r�)
rrrZr[r<r��registerrFr�rD)r>r�r�r�rBrBrC�&test_protocols_issubclass_non_callableVs*�
�
"�z4ProtocolTests.test_protocols_issubclass_non_callablecCshtd�}tGdd�dt��}tGdd�dt|��}Gdd�dt�}Gdd	�d	t|�}Gd
d�d�}|�|�|�|�|�|�|�t��t|�||�Wd�n1sYwY|�t��t|�||�Wd�n1svwY|�t��t|�|�Wd�n1s�wY|�t��t|�|�Wd�dS1s�wYdS)Nrc@r&)z2ProtocolTests.test_protocols_isinstance.<locals>.PcSr�rGrBr�rBrBrCr�vr�z7ProtocolTests.test_protocols_isinstance.<locals>.P.methNr�rBrBrBrCr"tr�r"c@r&)z3ProtocolTests.test_protocols_isinstance.<locals>.PGcSr�rGrBr�rBrBrCr�zr�z8ProtocolTests.test_protocols_isinstance.<locals>.PG.methNr�rBrBrBrCr�xr�r�c@r&)z5ProtocolTests.test_protocols_isinstance.<locals>.BadPcSr�rGrBr�rBrBrCr�}r�z:ProtocolTests.test_protocols_isinstance.<locals>.BadP.methNr�rBrBrBrCr�|r(r�c@r&)z6ProtocolTests.test_protocols_isinstance.<locals>.BadPGcSr�rGrBr�rBrBrCr��r�z;ProtocolTests.test_protocols_isinstance.<locals>.BadPG.methNr�rBrBrBrCr�r(r�c@r&)z2ProtocolTests.test_protocols_isinstance.<locals>.CcSr�rGrBr�rBrBrCr��r�z7ProtocolTests.test_protocols_isinstance.<locals>.C.methNr�rBrBrBrCr��r(r�)r
rrr�rZr[r\r�rBrBrC�test_protocols_isinstanceqs,���"�z'ProtocolTests.test_protocols_isinstancecsZGdd�d�}Gdd�d��G�fdd�d�}Gdd�d|�}Gd	d
�d
|�}Gdd�d�}td
��tGdd�dt��}tGdd�dt��}tGdd�dt���}tG�fdd�dt���}	||||	fD]J}
||||fD]"}|j|j|
jd��|�|�|
�Wd�n1s�wYqn|jd|
jd��|�|�|
�Wd�n1s�wYqfGdd�dt�}Gdd�dt�}
Gdd�dt��}G�fdd�dt��}|�|||	�|	|||
||fD]A}|||||fD]7}|j|j|d��$|�t��t	|�|�Wd�n	1�swYWd�n	1�s$wYq�q�dS) Nc@�eZdZedd��ZdS)zMProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.CcSr�rXrBr]rBrBrCr�r�zRProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.C.attrN�rLrMrN�propertyrrBrBrBrCr���r�c@seZdZddd�ZdS)z\ProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.CustomDescriptorNcSr�rXrB)r>�objZobjtyperBrBrC�__get__�r�zdProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.CustomDescriptor.__get__rG)rLrMrNr�rBrBrBrC�CustomDescriptor��r�cseZdZ��ZdS)zMProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.DN)rLrMrNrrB)r�rBrCr���
r�c@rO)zMProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.ENrQrBrBrBrCr��r�r�c@rO)zMProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.FNrQrBrBrBrC�F�r�r�c@rO)zQProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.EmptyNrQrBrBrBrCr��r�r�rc@r�)zMProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.PcSr�rGrBr]rBrBrCr�r�zRProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.P.attrNr�rBrBrBrCr"��r"c@rr)zNProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.P1rNrorBrBrBrCr��rvr�c@r�)zNProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.PGcSr�rGrBr]rBrBrCr�r�zSProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.PG.attrNr�rBrBrBrCr��r�r�c�eZdZU�ed<dS)zOProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.PG1rN�rLrMrNrprB�rrBrC�PG1�rvr�)�klass�protocol_classc@r�)zPProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.BadPcSr�rGrBr]rBrBrCr�r�zUProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.BadP.attrNr�rBrBrBrCr��r�r�c@rr)zQProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.BadP1rNrorBrBrBrC�BadP1�rzr�c@r�)zQProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.BadPGcSr�rGrBr]rBrBrCr�r�zVProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.BadPG.attrNr�rBrBrBrCr��r�r�cr�)zRProtocolTests.test_protocols_isinstance_properties_and_descriptors.<locals>.BadPG1rNr�rBr�rBrC�BadPG1�rzr�)r�r�)
r
rrr�rLr�r�rZr[r\)r>r�r�r�r�r�r"r�r�r�r�r�r�r�r�r�r�rB)r�rrC�4test_protocols_isinstance_properties_and_descriptors�sV�����(������zBProtocolTests.test_protocols_isinstance_properties_and_descriptorscCsPtGdd�dt��}Gdd�d�}Gdd�d�}|�|�|�|�|�|�dS)Nc@rr)zNProtocolTests.test_protocols_isinstance_not_fooled_by_custom_dir.<locals>.HasXr�NrorBrBrBrC�HasX�rvr�c@�eZdZdZdd�ZdS)zXProtocolTests.test_protocols_isinstance_not_fooled_by_custom_dir.<locals>.CustomDirWithX�
cS�gSrGrBr]rBrBrC�__dir__�r�z`ProtocolTests.test_protocols_isinstance_not_fooled_by_custom_dir.<locals>.CustomDirWithX.__dir__N)rLrMrNr�r�rBrBrBrC�CustomDirWithX�sr�c@r&)z[ProtocolTests.test_protocols_isinstance_not_fooled_by_custom_dir.<locals>.CustomDirWithoutXcSsdgS)Nr�rBr]rBrBrCr���zcProtocolTests.test_protocols_isinstance_not_fooled_by_custom_dir.<locals>.CustomDirWithoutX.__dir__N)rLrMrNr�rBrBrBrC�CustomDirWithoutX�r(r�)rrr�r�)r>r�r�r�rBrBrC�2test_protocols_isinstance_not_fooled_by_custom_dir�sz@ProtocolTests.test_protocols_isinstance_not_fooled_by_custom_dircCsGdd�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@r&)z<ProtocolTests.test_protocols_isinstance_py36.<locals>.APointcS�||_||_||_dSrG�r�r;rt)r>r�r;rtrBrBrCri�s
zEProtocolTests.test_protocols_isinstance_py36.<locals>.APoint.__init__N�rLrMrNrirBrBrBrC�APoint�r(r�c@r�)z<ProtocolTests.test_protocols_isinstance_py36.<locals>.BPointr�cS�||_||_dSrG�r�r;)r>r�r;rBrBrCri�s
zEProtocolTests.test_protocols_isinstance_py36.<locals>.BPoint.__init__N)rLrMrNrtrirBrBrBrC�BPoint��r�c@r�)z7ProtocolTests.test_protocols_isinstance_py36.<locals>.CcS�
||_dSrG�r�r>rrBrBrCri�rjz@ProtocolTests.test_protocols_isinstance_py36.<locals>.C.__init__cSr��NrrBr�rBrBrCr��r�z<ProtocolTests.test_protocols_isinstance_py36.<locals>.C.methN)rLrMrNrir�rBrBrBrCr��r�r�c@rO)z9ProtocolTests.test_protocols_isinstance_py36.<locals>.BadNrQrBrBrBrC�Bad�r�r�r�r9rlrY)	r�rsr�rwr|r�r~r�r�)r>r�r�r�r�rBrBrC�test_protocols_isinstance_py36�s"z,ProtocolTests.test_protocols_isinstance_py36cCsftd�}tGdd�dt��}tGdd�dt|��}Gdd�d�}|�|d�|�|�|d�|�dS)	Nrc@r�)z7ProtocolTests.test_protocols_isinstance_init.<locals>.Pr�Nr�rBrBrBrCr"r�r"c@r�)z8ProtocolTests.test_protocols_isinstance_init.<locals>.PGr�Nr�rBrBrBrCr�r�r�c@r&)z7ProtocolTests.test_protocols_isinstance_init.<locals>.CcSr�rGr��r>r�rBrBrCrirjz@ProtocolTests.test_protocols_isinstance_init.<locals>.C.__init__Nr�rBrBrBrCr�r(r�r�)r
rrr�)r>rr"r�r�rBrBrC�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@rO)z=ProtocolTests.test_protocol_checks_after_subscript.<locals>.PNrQrBrBrBrCr" r�r"c@rO)z=ProtocolTests.test_protocol_checks_after_subscript.<locals>.CNrQrBrBrBrCr�!r�r�c@rO)zBProtocolTests.test_protocol_checks_after_subscript.<locals>.Other1NrQrBrBrBrC�Other1"r�r�c@rO)zBProtocolTests.test_protocol_checks_after_subscript.<locals>.Other2NrQrBrBrBrC�Other2#r�r�c@rO)z>ProtocolTests.test_protocol_checks_after_subscript.<locals>.D1NrQrBrBrBrC�D1)r�r�c@rO)z>ProtocolTests.test_protocol_checks_after_subscript.<locals>.D2NrQrBrBrBrC�D2*r�r�)rrrr�rFrhr�rD)	r>r"r�r�r�ZCAr�r��CIrBrBrC�$test_protocol_checks_after_subscriptsz2ProtocolTests.test_protocol_checks_after_subscriptcCsvtGdd�dt��}Gdd�dt�}Gdd�d|�}Gdd�d�}|�|�|�|�|�|�|�|�|�|�dS)	Nc@r�)z8ProtocolTests.test_protocols_support_register.<locals>.Pr�Nr�rBrBrBrCr"1r�r"c@r&)z9ProtocolTests.test_protocols_support_register.<locals>.PMcSr�rGrBr]rBrBrCr�6r�z>ProtocolTests.test_protocols_support_register.<locals>.PM.methNr�rBrBrBrC�PM5r(r�c@rO)z8ProtocolTests.test_protocols_support_register.<locals>.DNrQrBrBrBrCr�8r�r�c@rO)z8ProtocolTests.test_protocols_support_register.<locals>.CNrQrBrBrBrCr�:r�r�)rrr�r�)r>r"r�r�r�rBrBrC�test_protocols_support_register0s

z-ProtocolTests.test_protocols_support_registercC�`tGdd�dt��}Gdd�d�}Gdd�d|�}Gdd�d�}|�|�|�|�|�|�dS)	Nc@r�)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.Pr�Nr�rBrBrBrCr"Br�r"c@r�)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.Ar�Nr�rBrBrBrCrlFr�rlc@�eZdZdZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.BNr�rBrBrBrCr�Ir�r�c@r&)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.CcS�
d|_dSrGr�r]rBrBrCriMrjzWProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.C.__init__Nr�rBrBrBrCr�Lr(r�)rrr��r>r"rlr�r�rBrBrC�5test_none_on_non_callable_doesnt_block_implementationA�zCProtocolTests.test_none_on_non_callable_doesnt_block_implementationcCr�)	Nc@r&)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.PcSr�rGrBr]rBrBrCr�Vr�zFProtocolTests.test_none_on_callable_blocks_implementation.<locals>.P.xNr�rBrBrBrCr"Tr�r"c@r&)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.AcSr�rGrBr]rBrBrCr�Yr�zFProtocolTests.test_none_on_callable_blocks_implementation.<locals>.A.xNr�rBrBrBrCrlXr(rlc@r�)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.BNr�rBrBrBrCr�[r�r�c@r&)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.CcSr�rGr�r]rBrBrCri_rjzMProtocolTests.test_none_on_callable_blocks_implementation.<locals>.C.__init__Nr�rBrBrBrCr�^r(r�)rrr�r�rBrBrC�+test_none_on_callable_blocks_implementationSr�z9ProtocolTests.test_none_on_callable_blocks_implementationcCs�Gdd�dt�}tGdd�dt��}Gdd�d|�}Gdd�d|�}Gd	d
�d
�}Gdd�d�}|�|�|�|�|�|�|�||�|�||�|�|�|�|�||�dS)
Nc@r�)z5ProtocolTests.test_non_protocol_subclasses.<locals>.Pr�Nr�rBrBrBrCr"fr�r"c@r&)z6ProtocolTests.test_non_protocol_subclasses.<locals>.PRcSr�rGrBr]rBrBrCr�kr�z;ProtocolTests.test_non_protocol_subclasses.<locals>.PR.methNr�rBrBrBrC�PRir�r�c@r�)z8ProtocolTests.test_non_protocol_subclasses.<locals>.NonPr�Nr�rBrBrBrC�NonPmr�r�c@rO)z9ProtocolTests.test_non_protocol_subclasses.<locals>.NonPRNrQrBrBrBrC�NonPRpr�r�c@r�)z5ProtocolTests.test_non_protocol_subclasses.<locals>.Cr�Nr�rBrBrBrCr�rr�r�c@r&)z5ProtocolTests.test_non_protocol_subclasses.<locals>.DcSr�rGrBr]rBrBrCr�vr�z:ProtocolTests.test_non_protocol_subclasses.<locals>.D.methNr�rBrBrBrCr�ur(r�r�)r>r"r�r�r�r�r�rBrBrC�test_non_protocol_subclassesesz*ProtocolTests.test_non_protocol_subclassescCstGdd�dt�}Gdd�d�}Gdd�d�}Gdd�d|�}|�|�|�|�|�|�|�||�|�||�dS)	Nc@r�)z1ProtocolTests.test_custom_subclasshook.<locals>.Pr�Nr�rBrBrBrCr"�r�r"c@rO)z7ProtocolTests.test_custom_subclasshook.<locals>.OKClassNrQrBrBrBrC�OKClass�r�r�c@r�)z8ProtocolTests.test_custom_subclasshook.<locals>.BadClassr�Nr�rBrBrBrC�BadClass�r�r�c@r�)z1ProtocolTests.test_custom_subclasshook.<locals>.CcSs|j�d�S�N�OK)rL�
startswith�r?�otherrBrBrC�__subclasshook__�szBProtocolTests.test_custom_subclasshook.<locals>.C.__subclasshook__N�rLrMrN�classmethodr�rBrBrBrCr��r�r�)rr�r�rDrF)r>r"r�r�r�rBrBrC�test_custom_subclasshooksz&ProtocolTests.test_custom_subclasshookcCs^tGdd�dt��}Gdd�d�}|�t��t|�|�Wd�dS1s(wYdS)Nc@r�)z8ProtocolTests.test_issubclass_fails_correctly.<locals>.Pr�Nr�rBrBrBrCr"�r�r"c@rO)z8ProtocolTests.test_issubclass_fails_correctly.<locals>.CNrQrBrBrBrCr��r�r�)rrrZr[r<�r>r"r�rBrBrC�test_issubclass_fails_correctly�s"�z-ProtocolTests.test_issubclass_fails_correctlycCs�td�}td�}tGdd�dt||f��}Gdd�d|t|ft|�}|�t��|tWd�n1s9wY|�t��|ttfWd�n1sTwYGdd�d|t|f�}|�|t�|�dS)	Nr�Sc@r&)z9ProtocolTests.test_defining_generic_protocols.<locals>.PRcSr�rGrBr]rBrBrCr��r�z>ProtocolTests.test_defining_generic_protocols.<locals>.PR.methNr�rBrBrBrCr��r�r�c@r�)z8ProtocolTests.test_defining_generic_protocols.<locals>.Pr�N�rLrMrNr;rBrBrBrCr"�r�r"c@rO)z8ProtocolTests.test_defining_generic_protocols.<locals>.CNrQrBrBrBrCr��r�r�)r
rrrhrZr[r�r�)r>rrr�r"r�rBrBrC�test_defining_generic_protocols�s
��z-ProtocolTests.test_defining_generic_protocolscs0td��td�}tGdd�dtt�|f��}Gdd�d|ttft�}|�t��t|ttf|�Wd�n1s=wY|�	||�|�t��|tWd�n1s\wYG�fdd�dtt��}G�fd	d
�d
t�t�}tGdd�d|tt��}Gd
d�d�}|�
|�|�dS)Nrrc@r&)zCProtocolTests.test_defining_generic_protocols_old_style.<locals>.PRcSr�rGrBr]rBrBrCr��r�zHProtocolTests.test_defining_generic_protocols_old_style.<locals>.PR.methNr�rBrBrBrCr��r�r�c@r�)zBProtocolTests.test_defining_generic_protocols_old_style.<locals>.Pr�NrrBrBrBrCr"�r�r"c�eZdZd�defdd�ZdS)zCProtocolTests.test_defining_generic_protocols_old_style.<locals>.P1r�r�cSr�rGrBr�rBrBrCrB�r�zGProtocolTests.test_defining_generic_protocols_old_style.<locals>.P1.barN�rLrMrNr�rBrBr�rBrCr���r�cr)zCProtocolTests.test_defining_generic_protocols_old_style.<locals>.P2r�r�cSr�rGrBr�rBrBrCrB�r�zGProtocolTests.test_defining_generic_protocols_old_style.<locals>.P2.barNr	rBr�rBrCr,�r
r,c@r�)zEProtocolTests.test_defining_generic_protocols_old_style.<locals>.PSubr�Nr�rBrBrBrC�PSub�r�rc@s"eZdZdZdedefdd�ZdS)zEProtocolTests.test_defining_generic_protocols_old_style.<locals>.Testr�r�r�cSs|SrGrBr�rBrBrCrB�r�zIProtocolTests.test_defining_generic_protocols_old_style.<locals>.Test.barN)rLrMrNr�r�rBrBrBrBrC�Test�sr)r
rrrrhr�rZr[r<rDr�)r>rr�r"r�r,rrrBr�rC�)test_defining_generic_protocols_old_style�s$�
�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@rO)z)ProtocolTests.test_init_called.<locals>.PNrQrBrBrBrCr"�r�r"c@r&)z)ProtocolTests.test_init_called.<locals>.CcS�
d|_dSr���testr]rBrBrCri�rjz2ProtocolTests.test_init_called.<locals>.C.__init__Nr�rBrBrBrCr��r(r�r�c@r&)z)ProtocolTests.test_init_called.<locals>.BcSrr�rr]rBrBrCri�rjz2ProtocolTests.test_init_called.<locals>.B.__init__Nr�rBrBrBrCr��r(r�c@rO)z*ProtocolTests.test_init_called.<locals>.D1NrQrBrBrBrCr��rRr�c@rO)z*ProtocolTests.test_init_called.<locals>.D2NrQrBrBrBrCr��rRr�)r
rrdrhr)r>rr"r�r�r�r�rBrBrC�test_init_called�szProtocolTests.test_init_calledcCs�td�}Gdd�dt|�}Gdd�d||�}|�|t�jd�|�t��|td�Wd�n1s8wY|�t��|tdd�Wd�dS1sUwYdS)	Nrc@rO)z(ProtocolTests.test_new_called.<locals>.PNrQrBrBrBrCr"�r�r"c�eZdZ�fdd�Z�ZS)z(ProtocolTests.test_new_called.<locals>.Ccst�j|g|�R�}d|_|Sr�)�super�__new__r)r?r�r>�r)rBrCr�sz0ProtocolTests.test_new_called.<locals>.C.__new__�rLrMrNr�
__classcell__rBrBrrCr���r�r�rYr)r
rrdrhrrZr[�r>rr"r�rBrBrC�test_new_called�s�"�zProtocolTests.test_new_calledcCs$td�}td�}|�t��Gdd�dt||f�}Wd�n1s$wY|�t��Gdd�dtt�}Wd�n1sCwY|�t��Gdd�dt|t|�}Wd�n1sewY|�t��Gdd�dtj||ft|�}Wd�dS1s�wYdS)Nrrc@rO�z6ProtocolTests.test_protocols_bad_subscripts.<locals>.PNrQrBrBrBrCr"r�r"c@rOrrQrBrBrBrCr"r�c@rOrrQrBrBrBrCr"r�c@rOrrQrBrBrBrCr"r�)r
rZr[rrhrHr��r>rrr"rBrBrC�test_protocols_bad_subscripts�s���""�z+ProtocolTests.test_protocols_bad_subscriptscCsdtd�}td�}Gdd�dt||f�}|�t|||f��d��|�t|ttf��d��dS)Nrrc@rO)z4ProtocolTests.test_generic_protocols_repr.<locals>.PNrQrBrBrBrCr"
r�r"z	P[~T, ~S]zP[int, str])r
r�
assertTruere�endswithrhr�rrBrBrC�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rc@rO)z2ProtocolTests.test_generic_protocols_eq.<locals>.PNrQrBrBrBrCr"r�r")r
rrdrhrr�rrBrBrC�test_generic_protocols_eqs"�z'ProtocolTests.test_generic_protocols_eqcCshtd�}Gdd�dt|�}|�|j|f�|�|tjd�|�|tjtf�|�|tj|�dS)Nrc@rO)zDProtocolTests.test_generic_protocols_special_from_generic.<locals>.PNrQrBrBrBrCr" r�r"rB)r
rrdr�rhr�r�r��r>rr"rBrBrC�+test_generic_protocols_special_from_generics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@r�)zFProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PRr�Nr�rBrBrBrCr�(r�r�c@r&)zEProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PcSr�rGrBr]rBrBrCr�-r�zJProtocolTests.test_generic_protocols_special_from_protocol.<locals>.P.methNr�rBrBrBrCr",r(r"rc@r�)zFProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PGr�cSr�rGrBr]rBrBrCr�5r�zKProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PG.methN)rLrMrNr�r�rBrBrBrCr�2r�r�r�r�)rrr
rZ_is_protocolr�Z_is_runtime_protocolrhrdrHZ_get_protocol_attrs�	frozenset)r>r�r"rr�rBrBrC�,test_generic_protocols_special_from_protocol's 
�z:ProtocolTests.test_generic_protocols_special_from_protocolcCs�|�t��tGdd�d��}Wd�n1swYGdd�dt�}|�t��tGdd�d|��}Wd�dS1sAwYdS)Nc@rO)z8ProtocolTests.test_no_runtime_deco_on_nominal.<locals>.CNrQrBrBrBrCr�ErRr�c@r�)z<ProtocolTests.test_no_runtime_deco_on_nominal.<locals>.Protor�Nr�rBrBrBrCr~Hr�r~c@rO)z?ProtocolTests.test_no_runtime_deco_on_nominal.<locals>.ConcreteNrQrBrBrBrCr�Lr}r�)rZr[rr)r>r�r~r�rBrBrC�test_no_runtime_deco_on_nominalCs�"�z-ProtocolTests.test_no_runtime_deco_on_nominalcCs�tGdd�dt��}Gdd�dt�}|�|�|�Gdd�d�}Gdd�d�}|�|�|�|�|�|�Gd	d
�d
�}Gdd�d�}|�|�|�|�|�|�dS)
Nc@r�)z4ProtocolTests.test_none_treated_correctly.<locals>.PNr�rBrBrBrCr"Qr�r"c@rO)z4ProtocolTests.test_none_treated_correctly.<locals>.BNrQrBrBrBrCr�Ur�r�c@r�)z4ProtocolTests.test_none_treated_correctly.<locals>.Cr�Nr�rBrBrBrCr�Yr�r�c@r�)z4ProtocolTests.test_none_treated_correctly.<locals>.DNr�rBrBrBrCr�\r�r�c@r&)z5ProtocolTests.test_none_treated_correctly.<locals>.CIcSrrHr�r]rBrBrCricrjz>ProtocolTests.test_none_treated_correctly.<locals>.CI.__init__Nr�rBrBrBrCr�br(r�c@r&)z5ProtocolTests.test_none_treated_correctly.<locals>.DIcSr�rGr�r]rBrBrCrigrjz>ProtocolTests.test_none_treated_correctly.<locals>.DI.__init__Nr�rBrBrBrC�DIfr(r')rrr�r�r�)r>r"r�r�r�r�r'rBrBrC�test_none_treated_correctlyPsz)ProtocolTests.test_none_treated_correctlycCs@Gdd�dt�}tjtj|f}tj|tjf}|�||�dS)Nc@r�)z1ProtocolTests.test_protocols_in_unions.<locals>.PNr�rBrBrBrCr"nr�r")rrHrr�rd)r>r"�AliasZAlias2rBrBrC�test_protocols_in_unionsmsz&ProtocolTests.test_protocols_in_unionsc	Cs�td�}tGdd�dt|��aGdd�dtt�at�}d|_d|_tt	j
d�D]E}t	�||�}t	�|�}|�
|jd�|�
|jd�|�
|jd�|�
|jddd	��t	�t|�}t	�|�}Gd
d�d�}|�|�|�q*dS)Nrc@r�)r"r�Nr�rBrBrBrCr"yr�r"c@rO)�CPNrQrBrBrBrCr+}rRr+rYr	r�rCc@r�)z2ProtocolTests.test_protocols_pickleable.<locals>.Er�Nr�rBrBrBrCr��r�r�)r
rrr"rhr+rrBrrrrrrdr��__dict__r�)	r>rr�rr<r�rr�r�rBrBrC�test_protocols_pickleableus&

�z'ProtocolTests.test_protocols_pickleablecC� |�ttj�|�ttj�dSrG)rDrhrH�SupportsIntrFr�r]rBrBrC�test_supports_int��zProtocolTests.test_supports_intcCr.rG)rDr�rHZ
SupportsFloatrFr�r]rBrBrC�test_supports_float�r1z!ProtocolTests.test_supports_floatcC�.Gdd�d�}|�|tj�|�ttj�dS)Nc@r&)z.ProtocolTests.test_supports_complex.<locals>.CcSr�)NyrBr]rBrBrC�__complex__�r�z:ProtocolTests.test_supports_complex.<locals>.C.__complex__N)rLrMrNr4rBrBrBrCr��r(r�)rDrH�SupportsComplexrFr�r�rBrBrC�test_supports_complex��z#ProtocolTests.test_supports_complexcCr3)Nc@r&)z,ProtocolTests.test_supports_bytes.<locals>.BcSr��N�rBr]rBrBrC�	__bytes__�r�z6ProtocolTests.test_supports_bytes.<locals>.B.__bytes__N)rLrMrNr:rBrBrBrCr��r(r�)rDrH�
SupportsBytesrFr�)r>r�rBrBrC�test_supports_bytes�r7z!ProtocolTests.test_supports_bytescCs.|�ttj�|�ttj�|�ttj�dSrG)rDr�rH�SupportsAbsrhrFr�r]rBrBrC�test_supports_abs�szProtocolTests.test_supports_abscCs:tttj�|�ttj�|�ttj�|�ttj�dSrG)r<r�rHZ
SupportsRoundrDrhrFr�r]rBrBrC�test_supports_round�sz!ProtocolTests.test_supports_roundcCr.rG)rDr�rH�
ReversiblerFrhr]rBrBrC�test_reversible�r1zProtocolTests.test_reversiblecCr.rG)rDrhrHZ
SupportsIndexrFr�r]rBrBrC�test_supports_index�r1z!ProtocolTests.test_supports_indexcCsF|�dtj�Gdd�dtj�}Gdd�d|�}|�}|�||�dS)Nrc@r�)z>ProtocolTests.test_bundled_protocol_instance_works.<locals>.C1r�cSr�rXrBr]rBrBrC�__int__�r�zFProtocolTests.test_bundled_protocol_instance_works.<locals>.C1.__int__N)rLrMrNrhrCrBrBrBrCr�r�rc@rO)z>ProtocolTests.test_bundled_protocol_instance_works.<locals>.C2NrQrBrBrBrCr�rRr)r�rHr=r/)r>rrr�rBrBrC�$test_bundled_protocol_instance_works�s
z2ProtocolTests.test_bundled_protocol_instance_workscCsRtGdd�dtjjt��}Gdd�d�}Gdd�d�}|�||�|�||�dS)Nc@r&)z@ProtocolTests.test_collections_protocols_allowed.<locals>.CustomcSr�rGrBr]rBrBrC�close�r�zFProtocolTests.test_collections_protocols_allowed.<locals>.Custom.closeN)rLrMrNrErBrBrBrC�Custom�r�rFc@rO)z;ProtocolTests.test_collections_protocols_allowed.<locals>.ANrQrBrBrBrCrl�r�rlc@r�)z;ProtocolTests.test_collections_protocols_allowed.<locals>.BcSr�rGrBr]rBrBrC�__iter__�r�zDProtocolTests.test_collections_protocols_allowed.<locals>.B.__iter__cSr�r�rBr]rBrBrCrE�r�zAProtocolTests.test_collections_protocols_allowed.<locals>.B.closeN)rLrMrNrGrErBrBrBrCr��sr�)rrr	r�rrDrF)r>rFrlr�rBrBrC�"test_collections_protocols_allowed�sz0ProtocolTests.test_collections_protocols_allowedcCsT|�t��Gdd�dtt�}Wd�n1swYGdd�dtjt�}dS)Nc@rO)zEProtocolTests.test_builtin_protocol_allowlist.<locals>.CustomProtocolNrQrBrBrBrC�CustomProtocol�rRrIc@rO)zKProtocolTests.test_builtin_protocol_allowlist.<locals>.CustomContextManagerNrQrBrBrBrC�CustomContextManager�rRrJ)rZr[rrrH�ContextManager)r>rIrJrBrBrC�test_builtin_protocol_allowlist�s�z-ProtocolTests.test_builtin_protocol_allowlistcCsLGdd�dt�}|�td��td|�Wd�dS1swYdS)Nc@rr)zCProtocolTests.test_non_runtime_protocol_isinstance_check.<locals>.Pr�NrorBrBrBrCr"�rzr"z@runtime_checkabler�)rr#r[r\�r>r"rBrBrC�*test_non_runtime_protocol_isinstance_check�s"�z8ProtocolTests.test_non_runtime_protocol_isinstance_checkcCs*Gdd�dt�}Gdd�d|�}|�dS)Nc@rr)z-ProtocolTests.test_super_call_init.<locals>.Pr�NrorBrBrBrCr"�rzr"cr)z/ProtocolTests.test_super_call_init.<locals>.Foocst���dSrG)rrir]rrBrCri�rkz8ProtocolTests.test_super_call_init.<locals>.Foo.__init__�rLrMrNrirrBrBrrCrK�rrK)r)r>r"rKrBrBrC�test_super_call_init�s
z"ProtocolTests.test_super_call_initN)3rLrMrNr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
rrrr r!r#r%r&r(r*r-r0r2r6r<r>r?rArBrDrHrLrNrPrBrBrBrCr�|sb #%G%
#	




r�c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0d]d^�Z1d_d`�Z2dadb�Z3dcdd�Z4dedf�Z5dgdh�Z6diS)j�GenericTestscCsRtttf}|�|jd�|�t��|tWd�n1s!wY|�t��|ttfWd�n1s<wYtttf}|�|jtf�|t|�t��|ttfWd�n1siwYtttf}|�t��
t	|t�Wd�n1s�wY|�
|�t�td�}|�tt
|tBj|f�dS)NrBr)r\r�rrdr�rZr[rZrhr<r�r
rr�r�)r>r�r�ZSM1rrBrBrCr��s*
���� zGenericTests.test_basicscCs�td�}td�}|�t��t||Wd�n1swY|�t��t||Wd�n1s9wY|�t��Gdd�dt|t|�}Wd�n1s[wY|�t��tgtt�Wd�n1swwY|�t��tttt�Wd�n1s�wY|�t��Gdd�dt�}Wd�n1s�wY|�t��Gdd�dt|t|�}Wd�n1s�wY|�t��Gd	d�dt|t|�}Wd�dS1s�wYdS)
Nrrc@rO)z+GenericTests.test_generic_errors.<locals>.CNrQrBrBrBrCr�r�r�c@rO)z4GenericTests.test_generic_errors.<locals>.NewGenericNrQrBrBrBrC�
NewGenericr�rRc@rO�z3GenericTests.test_generic_errors.<locals>.MyGenericNrQrBrBrBrC�	MyGenericr�rTc@rOrSrQrBrBrBrCrTr�)	r
rZr[rr\rrhr<r�)r>rrr�rRrTrBrBrC�test_generic_errors	s4�������"�z GenericTests.test_generic_errorscCs�td�}td�}|�t��t||fWd�n1swY|�t��t|||fWd�dS1s;wYdS)Nrr)r
rZr[r)r>rrrBrBrC�	test_inits�"�zGenericTests.test_initcCs�Gdd�dtjt�}Gdd�d|�}|�|jd�|�t��|jWd�n1s-wYd|_d|_Gdd	�d	|�}Gd
d�d|t�}|�|jd�|�|jd�|�|jd�dS)Ncr)z*GenericTests.test_init_subclass.<locals>.Xcst�jdi|��d|_dS)NrYrB)r�__init_subclass__r)r?�kwargsrrBrCrW's
z<GenericTests.test_init_subclass.<locals>.X.__init_subclass__�rLrMrNrWrrBrBrrCr�&rr�c@rO)z*GenericTests.test_init_subclass.<locals>.YNrQrBrBrBrCr�*rRr�rYr�r9c@rO)z*GenericTests.test_init_subclass.<locals>.ZNrQrBrBrBrC�Z1rRrZc@rO)z*GenericTests.test_init_subclass.<locals>.WNrQrBrBrBrC�W3rRr[)rHrrrdrrZ�AttributeErrorrh)r>r�r�rZr[rBrBrC�test_init_subclass%s�zGenericTests.test_init_subclasscCs4|�tt�dt�d��|�tt�dt�d��dS)Nz<class 'z.SimpleMapping'>z.MySimpleMapping'>)rdrer\rLrfr]rBrBrCrf9s

�

�zGenericTests.test_reprcCs�td�}td�}Gdd�dt|�}|t||f}|�||t||f�|�||t||f�||tf}|�|||tf�|�|||tf�|�|||tf�|t}|�||t�|�||t�|�|||�|�t|��d��dS)Nrrc@rO)z'GenericTests.test_chain_repr.<locals>.CNrQrBrBrBrCr�CrRr�z.C[typing.Tuple[str, int]])	r
rrrdr�rhr�rr)r>rrr�r�r�rZrBrBrC�test_chain_repr?s"
�zGenericTests.test_chain_reprcCs�td�}tddd�}td�}|�tt�d�|�tt|�d�|�tt|�d�|�tt||t�d	�|�ttt�d	�dS)
Nr�UTr�rztyping.Listztyping.List[~T]ztyping.List[+U]ztyping.List[int])r
rdrerrh)r>rr_rrBrBrC�
test_new_reprWs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
rdrerHr�rrrh)r>rrarBrBrC�test_new_repr_complexbs"��z"GenericTests.test_new_repr_complexcCsZtd�}|�tt|�d�|�ttj|�d�Gdd�dtjttf�}t|j�dS)Nrztyping.Generic[~T]ztyping.Protocol[~T]c@rO)z*GenericTests.test_new_repr_bare.<locals>.CNrQrBrBrBrCr�rr�r�)	r
rdrerrHrrr�__mro__�r>rr�rBrBrC�test_new_repr_barens
zGenericTests.test_new_repr_barecCsptd�}Gdd�dt|�}|�}d|_|�|jddi�Gdd�d|t�}|�}d|_|�|jd	di�dS)
Nrc@rO)z!GenericTests.test_dict.<locals>.BNrQrBrBrBrCr�yrRr�rYrc@rO)z!GenericTests.test_dict.<locals>.CNrQrBrBrBrCr��rRr�r	rB)r
rrrdr,rhrB)r>rr��br�r�rBrBrC�	test_dictvszGenericTests.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@r�)z<GenericTests.test_subscripted_generics_as_proxies.<locals>.C�defNr�rBrBrBrCr��r�r�rh�changed�newc@rO)z<GenericTests.test_subscripted_generics_as_proxies.<locals>.DNrQrBrBrBrCr��rRr�zfrom derived zzfrom derived x)	r
rrdrhr�r�rr<r�r>rr�r�rBrBrC�$test_subscripted_generics_as_proxies�s*
z1GenericTests.test_subscripted_generics_as_proxiescCs`td�}Gdd�dtjjt|�}|�t�|�d|�|t|�d|�|��|�	�dS)Nrc@rO)z.GenericTests.test_abc_registry_kept.<locals>.CNrQrBrBrBrCr��r�r�r�)
r
rr	r�rr�rhr��_abc_registry_clear�_abc_caches_clearrdrBrBrC�test_abc_registry_kept�s
z#GenericTests.test_abc_registry_keptcCs4Gdd�dtttf�}|�i|�|�t|�dS)Nc@rO)z5GenericTests.test_false_subclasses.<locals>.MyMappingNrQrBrBrBrC�	MyMapping�r�rp)rr�r�rFr�)r>rprBrBrC�test_false_subclasses�sz"GenericTests.test_false_subclassescCs`Gdd�dtttf�}|���|�|�tjj�|�|�t�|�|�t�|�i|�dS)Nc@�4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z'GenericTests.test_abc_bases.<locals>.MMcSr�rGrB�r>�krBrBrCr_�r�z3GenericTests.test_abc_bases.<locals>.MM.__getitem__cSr�rGrB�r>rtr�rBrBrCrb�r�z3GenericTests.test_abc_bases.<locals>.MM.__setitem__cSr�rGrBrsrBrBrC�__delitem__�r�z3GenericTests.test_abc_bases.<locals>.MM.__delitem__cS�td�Sr���iterr]rBrBrCrG�r�z0GenericTests.test_abc_bases.<locals>.MM.__iter__cSr�r�rBr]rBrBrC�__len__�r�z/GenericTests.test_abc_bases.<locals>.MM.__len__N�rLrMrNr_rbrvrGrzrBrBrBrC�MM��r|)rr��updater�rr	r�r)r>r|rBrBrC�test_abc_bases�s
zGenericTests.test_abc_basescCsVGdd�dtttftjj�}Gdd�dtjjtttf�}|�|jtjjtf�dS)Nc@rO)z-GenericTests.test_multiple_bases.<locals>.MM1NrQrBrBrBrC�MM1�rRr�c@rO)z-GenericTests.test_multiple_bases.<locals>.MM2NrQrBrBrBrC�MM2�rRr�)rr�rr	rd�	__bases__r)r>r�r�rBrBrC�test_multiple_bases�sz GenericTests.test_multiple_basescCs@td�}Gdd�dtjt|f�}|�|jtjt|ff�dS)Nrc@rO)z'GenericTests.test_orig_bases.<locals>.CNrQrBrBrBrCr��r�r�)r
rHrr�rd�__orig_bases__rdrBrBrC�test_orig_bases�szGenericTests.test_orig_basescCspdd�}|�|dditjttf��|�|dditjttf��|�t��|dditjttf�Wd�n1s>wYdd�}Gdd�dt	t�}|�||t�|t��|�||t�|t��|�||t�t
��|�t��|gd	�|t�Wd�n1s�wYd
d�}Gdd
�d
t
t�}|�|gd	�|��|�|ddg|��dS)NcsBt|j�dkr	t�|jr|j\��t��fdd�|��D��SdS)Nrc3s(�|]\}}t|��ot|��VqdSrG)r\��.0rtr��r
rrBrC�	<genexpr>�s
��
�zSGenericTests.test_naive_runtime_checks.<locals>.naive_dict_check.<locals>.<genexpr>)r�r�r�r��all�items�r��tprBr�rC�naive_dict_check�s
��z@GenericTests.test_naive_runtime_checks.<locals>.naive_dict_checkr�r�cSst|d�st�|j|kS)Nr*)�hasattrr�r*r�rBrBrC�naive_generic_check�s

zCGenericTests.test_naive_runtime_checks.<locals>.naive_generic_checkc@rO)z4GenericTests.test_naive_runtime_checks.<locals>.NodeNrQrBrBrBrC�Node�r�r�r8cst�fdd�|D��S)Nc3s&�|]}t|�jdjd�VqdS)rN)r\r�r�)r�r��r�rBrCr��s��zXGenericTests.test_naive_runtime_checks.<locals>.naive_list_base_check.<locals>.<genexpr>)r�r�rBr�rC�naive_list_base_check�s�zEGenericTests.test_naive_runtime_checks.<locals>.naive_list_base_checkc@rO)z1GenericTests.test_naive_runtime_checks.<locals>.CNrQrBrBrBrCr��r�r�rrf)rrHrr�rhr�rZr�rrr)r>r�r�r�r�r�rBrBrC�test_naive_runtime_checks�s$
��z&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@rO)z.GenericTests.test_multi_subscr_base.<locals>.CNrQrBrBrBrCr��r�r�c@rO)z.GenericTests.test_multi_subscr_base.<locals>.DNrQrBrBrBrCr��r�r�rB)
r
rrdr�rhr�r�r�rr�)r>rr_r�r�r�rBrBrC�test_multi_subscr_base�s"z#GenericTests.test_multi_subscr_basecCsjtd�}Gdd�dt�}|�t|t|�|�t|tf|t|tf�|�td|fjt|f�dS)Nrc@rO)z.GenericTests.test_subscript_meta.<locals>.MetaNrQrBrBrBrC�Metar�r�.)	r
rnrdr%rrhrr��Ellipsis)r>rr�rBrBrC�test_subscript_metas
 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
��dSdS)Nc@rO)z+GenericTests.test_generic_hashes.<locals>.ANrQrBrBrBrCrl
rRrlc@s eZdZGdd�dee�ZdS)z+GenericTests.test_generic_hashes.<locals>.Bc@rO)z-GenericTests.test_generic_hashes.<locals>.B.ANrQrBrBrBrCrlrRrlN)rLrMrNrrrlrBrBrBrCr�sr�r9)r:r9z<locals>.A[str]]z<locals>.B.A[str]]zmod_generics_cache.A[str]]zmod_generics_cache.B.A[str]])rrrdr7rlr�r�r�rrrhrrrH�	FrozenSet�sys�version_inforrer�r>rlr�rBrBrC�test_generic_hashessL�"&&�����z GenericTests.test_generic_hashescCs�td�}td�}|�t||fttttf�|�tjt||f|tjt||f�|�t��t|tfdWd�n1sFwY|�t|tftt�|�t||ftttt	ffttt	f�Gdd�d�}Gdd�d|�}|�t||ft||ft||f�|�t��t|tfdWd�n1s�wY|�t
|g|ftt
tgtf�|�t
d	t|ftt
d	ttf�dS)
Nrr_rBc@rO)z9GenericTests.test_extended_generic_rules_eq.<locals>.BaseNrQrBrBrBrC�BaseAr�r�c@rO)z<GenericTests.test_extended_generic_rules_eq.<locals>.DerivedNrQrBrBrBrC�DerivedBr�r�r�.)
r
rdrrhrHr�rZr[rr�rr
r)r>rr_r�r�rBrBrC�test_extended_generic_rules_eq7s" ,�,(�$,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
rdrerrr�replacerhrrr�rBrBrC� test_extended_generic_rules_reprJs��"�"�z-GenericTests.test_extended_generic_rules_reprc
CsDdttdfdd�}dtttd�fdd�}dttd�tBfdd	�}Gd
d�d�}|�t|t�t��dtt|i�|�t|t�t��dtt|i�|�t|t�t��dt|tBtBi�td�}t	|df}d|fd
d�}|�
t|t�t��d|�tdt|f}d|fdd�}	|�
t|	t�t��d|�dS)Nr��CCcSr�rGrBr�rBrBrC�foobarVr�z5GenericTests.test_generic_forward_ref.<locals>.foobarcSr�rGrBr�rBrBrC�foobar2Wr�z6GenericTests.test_generic_forward_ref.<locals>.foobar2zCC | intcSr�rGrBr�rBrBrC�foobar3Xr�z6GenericTests.test_generic_forward_ref.<locals>.foobar3c@rO)z1GenericTests.test_generic_forward_ref.<locals>.CCNrQrBrBrBrCr�Yr�r.cSr�rGrBr�rBrBrC�barfooir�z5GenericTests.test_generic_forward_ref.<locals>.barfoocSr�rGrBr�rBrBrC�barfoo2lr�z6GenericTests.test_generic_forward_ref.<locals>.barfoo2)rr�r0rhrdrrrr
rr�r)
r>r�r�r�r�r�ATr�ZCTr�rBrBrC�test_generic_forward_refUs.��� z%GenericTests.test_generic_forward_refcCs�Gdd�dtttf�}Gdd�dttdf�}Gdd�dtjt�}|�|jttf�|�|ttfj	ttf�|�|ttfj
|�|�|jtf�|�t|t��d�d	d
�|�|jtf�|�
|�tjj�|�|tjj�|�
|�t�|�|t�|�t��tttdftj�Wd�n1s�wY|�t��tttdftj�Wd�dS1s�wYdS)Nc@rO)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.T1NrQrBrBrBrC�T1pr�r�c@rO)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.T2NrQrBrBrBrC�T2qr�r�.c@r&)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.C1cSr�)NFrB)r>�itemrBrBrC�__contains__sr�zMGenericTests.test_extended_generic_rules_subclassing.<locals>.C1.__contains__N)rLrMrNr�rBrBrBrCrrr(r�.���zC1[int])rrr
rH�	Containerrdr�rhr�r�r�re�splitr�rr	rDr�rZr[r<�Sequencer�)r>r�r�rrBrBrC�'test_extended_generic_rules_subclassingos&�"�z4GenericTests.test_extended_generic_rules_subclassingcCs�|�t��ttWd�n1swY|�t��ttWd�n1s-wY|�t��ttWd�n1sFwY|�t��tttWd�dS1sbwYdSrG)rZr[rrrrrrhr]rBrBrC�test_fail_with_bare_union�s
�
�
�"�z&GenericTests.test_fail_with_bare_unioncCs�td�}|�t��ttWd�n1swY|�t��tt|Wd�n1s3wY|�t��ttjWd�dS1sNwYdSr�)r
rZr[rrrrHrr�rBrBrC�test_fail_with_bare_generic�s
��"�z(GenericTests.test_fail_with_bare_genericcCs8td�}|��Gdd�dt||f�}|�|t�j|�|�|t�j|t�Gdd�dtj	||f�}|�|t�j|�|�|t�j|t�Gdd�dtj
t|f�}|�|t�j|�|�|t�j|t�tj
dkr�Gd	d
�d
tjt|f�}|�|t�j|�|�|t�j|t�dSdS)Nrc@rO)z5GenericTests.test_type_erasure_special.<locals>.MyTupNrQrBrBrBrC�MyTup�r�r�c@rO)z6GenericTests.test_type_erasure_special.<locals>.MyDictNrQrBrBrBrC�MyDict�r�r�c@rO)z5GenericTests.test_type_erasure_special.<locals>.MyDefNrQrBrBrBrC�MyDef�r�r��r:r:c@rO)z7GenericTests.test_type_erasure_special.<locals>.MyChainNrQrBrBrBrC�MyChain�r�r�)r
rKrr�rhr)rdr*rHr�DefaultDictr�r�r��ChainMap)r>rr�r�r�r�rBrBrC�test_type_erasure_special�s 
�z&GenericTests.test_type_erasure_specialcCs�dd�tjD�}|D]@}|�t|�d�|�||�t|dd�r1t|j�dkr1|�|tj	tf�t
|t�rJ|jD]}|�t|�d�|�||�q9q
dS)Ncss�|]}tt|�VqdSrG)�getattrrH)r��elrBrBrCr��s�z4GenericTests.test_all_repr_eq_any.<locals>.<genexpr>r�r�r�)
rH�__all__r�rerdr�r�r�rr�r\rnrc)r>Zobjsr��baserBrBrC�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]%}t�	||�}t�
|�}|�|jd�|�|jd�|�|jddd	��q(t
tttttttfttttd
ftdttgtftjtjtg}|D]}ttjd�D]}t�	||�}t�
|�}|�||�q|qsttjtjtttjtjtjtttfg}	|	D]}ttjd�D]}t�	||�}t�
|�}|�||�q�q�dS)Nrc@rO)z#GenericTests.test_pickle.<locals>.BNrQrBrBrBrCr��rRr�c@rO)r�NrQrBrBrBrCr��rRr�rYr	r�rC.rB)r
rrhr�rrBrrrrrrdr,rrrrrr�rr�rHr�r�r�r%r��AbstractSet)
r>rr�r�rr<r�rrZmore_samplesrBrBrCr�sB

 �
��
��zGenericTests.test_picklecCstd�}Gdd�dt|�}t|tft|tftdtd|fttgtftttf|||t|ttj|tjttjttj	tt
ftj	|tftttt|tdtdtftdtj
dtfg}|tgD]}|�|t|��|�|t|��qldS)Nrc@rO)z1GenericTests.test_copy_and_deepcopy.<locals>.NodeNrQrBrBrBrCr��r�r�rB.)rr)r
rrrhrrrrHr�rr�rrr�rdrr)r>rr��thingsr�rBrBrC�test_copy_and_deepcopy�s$"��z#GenericTests.test_copy_and_deepcopycCs�td�atdtd�atdtt�atttttj	t
tjtt
ttfD]}|�t|�|�|�t|�|�|�t�t�|��|�qtd�}tdtd�}tdtt�}|||fD]}|�t|�|�|�t|�|�qSdS)Nr��TPBr��TPV�TL�TLB�TLV)r
r�rhr�r�r�r�rrHr�rr�rrrrr�rrrrr)r>r�r�r�r�rBrBrC�$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cseZdZd�ddfdd�ZdS)z3GenericTests.test_copy_generic_instances.<locals>.Crr�NcSr�rGr�r�rBrBrCri	rjz<GenericTests.test_copy_generic_instances.<locals>.C.__init__r�rBr�rBrCr�	r
r�rYr�)	r
rrdrrr�assertIsNotrhr*)r>r�r�ZcirBr�rC�test_copy_generic_instances	s&z(GenericTests.test_copy_generic_instancesc	Csvtd�}tt|tftd|ftttfttttj	tt
ftjjt
tjdg}|D]}|�t�|��|�q,dS)Nr.�whatever)r
rrrhrrrrrHr�r��rer.r�r�rdrr)r>rr�r�rBrBrC�test_weakref_all	s ��zGenericTests.test_weakref_allcCs�td�}Gdd�dt|�}|�}|t�}d|_d|_|�t��d|_Wd�n1s/wY|�t��d|_Wd�n1sGwYd|dfdd�}|�t|t	�t
��d||�|�t|t�t|t��dS)Nrc@r�)z0GenericTests.test_parameterized_slots.<locals>.C)�potatoN�rLrMrN�	__slots__rBrBrBrCr�%	r�r�rr�cSr�rGrBr�rBrBrCr2	r�z2GenericTests.test_parameterized_slots.<locals>.foo)
r
rrhr�rZr\Ztomatordrrrrr)r>rr�r�Zc_intrrBrBrC�test_parameterized_slots#	s
��  z%GenericTests.test_parameterized_slotscCs�td�}Gdd�dt|�}|�}|t�}d|_d|_|�t��d|_Wd�n1s/wY|�t��d|_Wd�dS1sHwYdS)Nrc@seZdZddiZdS)z5GenericTests.test_parameterized_slots_dict.<locals>.D�bananarYNr�rBrBrBrCr�8	r(r�Zyes�no)r
rrhr�rZr\r�)r>rr��dZd_intrBrBrC�test_parameterized_slots_dict6	s
�"�z*GenericTests.test_parameterized_slots_dictcCsP|�t��tttf}Gdd�dt|�}Wd�dS1s!wYdS)Nc@rO)z#GenericTests.test_errors.<locals>.CNrQrBrBrBrCr�I	rRr�)rZr[r\rZrr)r>r�r�rBrBrCriE	s"�zGenericTests.test_errorscCs�Gdd�dtt�}|�|jt�|�|jd�|t}|�|jt�|�t|��d�dd�Gdd�d|t�}|�|jt�|�|jd	�dS)
Nc@rO)�#GenericTests.test_repr_2.<locals>.CNrQrBrBrBrCr�M	rRr�r�r�r�zC[int]c@rO)�#GenericTests.test_repr_2.<locals>.YNrQrBrBrBrCr�W	rRr�r�)	rrrdrMrLrNrhrer�)r>r�r�r�rBrBrC�test_repr_2L	s��zGenericTests.test_repr_2cCs8|�tt�|�tttt�|�tttt�dSrG)rdrrr�r
rr]rBrBrC�	test_eq_1^	szGenericTests.test_eq_1cCslGdd�dtt�}Gdd�dtt�}|�||�|�||�|�|t|t�|�|t|t�dS)Nc@rO)z!GenericTests.test_eq_2.<locals>.ANrQrBrBrBrCrle	rRrlc@rO)z!GenericTests.test_eq_2.<locals>.BNrQrBrBrBrCr�h	rRr�)rrrdr�r�rBrBrC�	test_eq_2c	szGenericTests.test_eq_2cCsvGdd�dtttf�}Gdd�dtttf�}Gdd�d|ttfttttf|ttf�}|�|jtttf�dS)Nc@rO)z1GenericTests.test_multiple_inheritance.<locals>.ANrQrBrBrBrCrlr	rRrlc@rO)z1GenericTests.test_multiple_inheritance.<locals>.BNrQrBrBrBrCr�u	rRr�c@rO)z1GenericTests.test_multiple_inheritance.<locals>.CNrQrBrBrBrCr�x	rRr�)rrrr
rdr�)r>rlr�r�rBrBrC�test_multiple_inheritancep	s.z&GenericTests.test_multiple_inheritancecCsNtd�}Gdd�dt|�}Gdd�dtt|�}|�|j|t|ttf�dS)Nrc@rO)z9GenericTests.test_multiple_inheritance_special.<locals>.BNrQrBrBrBrCr�	r�r�c@rO)z9GenericTests.test_multiple_inheritance_special.<locals>.CNrQrBrBrBrCr��	r�r�)r
rrrhrdrcr�r�)r>rr�r�rBrBrC�!test_multiple_inheritance_special}	sz.GenericTests.test_multiple_inheritance_specialcs�Gdd�dt��G��fdd�d��Gdd�dtt��}|����Gdd�d|�}Wd�n1s5wY|����Gd	d�d|t�}Wd�dS1sUwYdS)
Nc@rO)zDGenericTests.test_init_subclass_super_called.<locals>.FinalExceptionNrQrBrBrBrC�FinalException�	rRr�cs"eZdZd���fdd�Z�ZS)z;GenericTests.test_init_subclass_super_called.<locals>.Finalr�Ncs<|jD]}|�urt|��r�|��qt�jdi|��dSr�)r�r<rrW)r?rXr�)rr�r)rBrCrW�	s

�zMGenericTests.test_init_subclass_super_called.<locals>.Final.__init_subclass__)r�NrYrB�rr�rrCr�	src@rO)z:GenericTests.test_init_subclass_super_called.<locals>.TestNrQrBrBrBrCr�	rRrc@rO�z>GenericTests.test_init_subclass_super_called.<locals>.SubclassNrQrBrBrBrC�Subclass�	rRr�c@rOr�rQrBrBrBrCr��	rR)�	ExceptionrrrZrh)r>rr�rBr�rC�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@s4eZdZdZdefdd�Zdd�Zdefdd	�ZdS)
z)GenericTests.test_nested.<locals>.VisitorNrcSr�rGr�r>rrBrBrC�set�	rjz-GenericTests.test_nested.<locals>.Visitor.setcS�|jSrGrr]rBrBrCre�	r�z-GenericTests.test_nested.<locals>.Visitor.getr�cSr�rGrr]rBrBrC�visit�	r�z/GenericTests.test_nested.<locals>.Visitor.visit)rLrMrNrrr�rer�rBrBrBrC�Visitor�	s
r�c@r�)z0GenericTests.test_nested.<locals>.IntListVisitorr�cSs|j�|�dSrG)r�appendr�rBrBrCr��	�z7GenericTests.test_nested.<locals>.IntListVisitor.appendN)rLrMrNrhr�rBrBrBrC�IntListVisitor�	�r�r�rY)	rrrHrrhr�r�rdre)r>�Gr�r�r�rrBrBrC�test_nested�	s



zGenericTests.test_nestedcsBtd��G�fdd�dt���d�f���fdd�}|d�dS)Nrcs(eZdZ		dd�ddddfdd�ZdS)	z,GenericTests.test_type_erasure.<locals>.NodeNrt�left�Node[T]�rightcSr�rG�rtr�r�)r>rtr�r�rBrBrCri�	s
z5GenericTests.test_type_erasure.<locals>.Node.__init__�NNr�rBr�rBrCr��	s���r�r�cs~�|�}��|�}�t|�}��t|�����t|�����t|�����|j|���|j|���|j|�dSrG)rr�rnrdrt)r�rrfr��r�rr>rBrCr�	sz+GenericTests.test_type_erasure.<locals>.foorY�r
r�r>rrBr�rCr+�	szGenericTests.test_type_erasurecCs�td�}Gdd�dt|�}Gdd�d|�}|�|jd�|�t��|tWd�n1s1wY|�t��|tWd�n1sJwY|�t��
||Wd�dS1sdwYdS)Nrc@rO)z)GenericTests.test_implicit_any.<locals>.CNrQrBrBrBrCr��	rRr�c@rO)z)GenericTests.test_implicit_any.<locals>.DNrQrBrBrBrCr��	rRr�rB)r
rrdr�rZr[rhrrkrBrBrC�test_implicit_any�	s
�
�
"�zGenericTests.test_implicit_anycCsNGdd�dtt�}Gdd�d�}Gdd�d||�}|d�}|�|jd�dS)Nc@rO)z*GenericTests.test_new_with_args.<locals>.ANrQrBrBrBrCrl�	rRrlcr)z*GenericTests.test_new_with_args.<locals>.Bcst��|�}||_|SrG)rrr��r?r�r�rrBrCr�	�z2GenericTests.test_new_with_args.<locals>.B.__new__rrBrBrrCr��	rr�c@rO)z*GenericTests.test_new_with_args.<locals>.CNrQrBrBrBrCr��	rRr�r)rrrdr��r>rlr�r�r�rBrBrC�test_new_with_args�	s
zGenericTests.test_new_with_argscCsLGdd�d�}Gdd�dtt|�}|d�}|�|jd�|�|jd�dS)Ncr)z+GenericTests.test_new_with_args2.<locals>.Acs||_t���dSrG)�from_arrir�rrBrCri�	sz4GenericTests.test_new_with_args2.<locals>.A.__init__rOrBrBrrCrl�	rrlcr)z+GenericTests.test_new_with_args2.<locals>.Ccs||_t��|�dSrG)�from_crrir�rrBrCri�	sz4GenericTests.test_new_with_args2.<locals>.C.__init__rOrBrBrrCr��	rr�r)rrrdrr)r>rlr�r�rBrBrC�test_new_with_args2�	s
z GenericTests.test_new_with_args2cCs�Gdd�dtt�}|�t��|d�Wd�n1swYGdd�d�}Gdd�d||�}|d�}|�|jd�|�|jd�|�|jd	�dS)
Nc@rO)z(GenericTests.test_new_no_args.<locals>.ANrQrBrBrBrCrl
rRrlrcr)z(GenericTests.test_new_no_args.<locals>.Bcst��|�}d|_|S)Nrf)rr�from_b)r?r�rrBrCr
r�z0GenericTests.test_new_no_args.<locals>.B.__new__rrBrBrrCr�
rr�cs$eZdZdd�Z�fdd�Z�ZS)z(GenericTests.test_new_no_args.<locals>.CcSr�rGr�r�rBrBrCri
rjz1GenericTests.test_new_no_args.<locals>.C.__init__cst��|�}d|_|S)Nr�)rrrr�rrBrCr
r�z0GenericTests.test_new_no_args.<locals>.C.__new__)rLrMrNrirrrBrBrrCr�
sr�rfr�)rrrZr[rdr�rrr�rBrBrC�test_new_no_args
s
�
zGenericTests.test_new_no_argsc
Cs�tttttttftttdtttd�ft	tfD]@}|j
|d��0|�tdt
�d|����d���Gdd�d|�}Wd�n1sIwYWd�n1sXwYqdS)	Nr>r")r@�^zCannot subclass �$c@rO)z4GenericTests.test_subclass_special_form.<locals>.FooNrQrBrBrBrCrK1
rRrK)rrhrrr�rrr3r2r6r�r#r[r��escape)r>r�rKrBrBrC�test_subclass_special_form#
s$
�	������z'GenericTests.test_subclass_special_formcCsBtddd�}Gdd�dt|�}td�}Gdd�d|t|�}dS)	Nr�Tr�c@rO)z2GenericTests.test_complex_subclasses.<locals>.BaseNrQrBrBrBrCr�7
rRr�rc@rO)z1GenericTests.test_complex_subclasses.<locals>.SubNrQrBrBrBrC�Sub=
rRr	r�)r>r�r�rr	rBrBrC�test_complex_subclasses4
sz$GenericTests.test_complex_subclassescCs�|�ttjtf�|�tttjtf�Gdd�d�}ttfD]A}ttttj	tj
fD]5}|j||d��$|�t
d��||tWd�n1sMwYWd�n1s\wYq,q!|�t|�jtf�dS)Nc@seZdZefZdS)z0GenericTests.test_parameter_detection.<locals>.AN)rLrMrNrr�rBrBrBrCrlC
r�rl)Zgeneric�subz0.* is not a generic class|no type variables left)rdrrr�r�rhr
r2r�r
�	UnionTyper�r#r[r�)r>rlrrfrBrBrC�test_parameter_detection@
s ������z%GenericTests.test_parameter_detectioncCs�td�}Gdd�dt|�}t|tttttjtjfD]�}t	t
fD]V}|j||d��E|�|||ft||tf�|�|||ft|t|f�||}|�
t��|tWd�n1sbwYWd�n1sqwYq ttjjfD]]}|j||d��L|�||g|ft||gtf�|�||g|ft|tg|f�||g|f}|�
t��|tWd�n1s�wYWd�n1s�wYq}qdS)Nrc@rO)z2GenericTests.test_non_generic_subscript.<locals>.GNrQrBrBrBrCr�S
rRr�)r�r)�callabler)r
rrhrr�r2r�r
rrr�r�rdrZr[rrr	)r>rr�rr�rr�rBrBrC�test_non_generic_subscriptQ
s<�  
����$$
������z'GenericTests.test_non_generic_subscriptN)7rLrMrNr�rUrVr]rfr^r`rbrergrlrorqrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r�r�r�rir�r�r�r�r�r�r�r+r�r�rrrr
r
rrBrBrBrCrQ�sj
$+
	$


rQc@rr)�
ClassVarTestscCs�|�t��tdWd�n1swY|�t��tttfWd�n1s/wY|�t��tttWd�dS1sKwYdSrH)rZr[rrhr�r]rBrBrCr�m
�
��"�zClassVarTests.test_basicscCsH|�tt�d�tt}|�t|�d�tt}|�t|�dt�dS)Nztyping.ClassVar�typing.ClassVar[int]ztyping.ClassVar[%s.Employee])rdrerrhrPrL�r>ZcvrBrBrCrfu
s
zClassVarTests.test_reprcC�|�t��Gdd�dtt��}Wd�n1swY|�t��Gdd�dttt��}Wd�dS1s<wYdS)Nc@rO�z-ClassVarTests.test_cannot_subclass.<locals>.CNrQrBrBrBrCr�~
rRr�c@rOrrQrBrBrBrCr��
rR)rZr[rnrrhr�rBrBrCrp|
��"�z"ClassVarTests.test_cannot_subclasscC�|�t��t�Wd�n1swY|�t��
tt��Wd�n1s-wY|�t��tttt��Wd�dS1sLwYdSrG)rZr[rrnrrhr]rBrBrCrI�
���"�zClassVarTests.test_cannot_initcC�r|�t��tdtt�Wd�n1swY|�t��ttt�Wd�dS1s2wYdSrH)rZr[r\rrhr<r]rBrBrC�test_no_isinstance�
��"�z ClassVarTests.test_no_isinstanceN�rLrMrNr�rfrprIrrBrBrBrCrk
src@rv)�
FinalTestscCs�tt|�t��tdWd�n1swY|�t��tttfWd�n1s3wY|�t��tttWd�n1sNwY|�t��tttWd�dS1sjwYdSrH)rrhrZr[r�rr]rBrBrCr��
s
���"�zFinalTests.test_basicscC�d|�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]])rdrerrhrPrLr�rrBrBrCrf�
�zFinalTests.test_reprcCr)Nc@rO�z*FinalTests.test_cannot_subclass.<locals>.CNrQrBrBrBrCr��
rRr�c@rOr rQrBrBrBrCr��
rR)rZr[rnrrhr�rBrBrCrp�
rzFinalTests.test_cannot_subclasscCrrG)rZr[rrnrrhr]rBrBrCrI�
rzFinalTests.test_cannot_initcCrrH)rZr[r\rrhr<r]rBrBrCr�
rzFinalTests.test_no_isinstancecCsdd�}|�|t|��dS)NcSr�rGrBr�rBrBrC�func�
r�z.FinalTests.test_final_unmodified.<locals>.func)r�r)r>r!rBrBrC�test_final_unmodified�
sz FinalTests.test_final_unmodifiedN)	rLrMrNr�rfrprIrr"rBrBrBrCr�
s	rc@r�)�	CastTestscCs�|�ttd�d�|�ttd�d�|�tttd��t�|�ttd�d�|�ttd�d�|�ttt	tfd�d�|�tt
d�d�|�tdd�d�dSrX)rdrrhr�r�rnrr�rr�rr]rBrBrCr��
szCastTests.test_basicscCstdd�tdd�dS)NrYZhello)rr]rBrBrCri�
s
zCastTests.test_errorsN)rLrMrNr�rirBrBrBrCr#�
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@sVeZdZdefdd�Z			dddddd	efd
d�Zdedfd
d�Zdddd�Z	dS)z)ForwardRefTests.test_basics.<locals>.NodertcSs||_d|_|_dSrGr�)r>rtrBrBrCri�
sz2ForwardRefTests.test_basics.<locals>.Node.__init__Nr�zOptional[Node[T]]r�r��stuffcSr�rG)r�r�)r>r�r�r%�blahrBrBrC�add_both�
s
z2ForwardRefTests.test_basics.<locals>.Node.add_both�nodecSs|�|d�dSrG�r'�r>r(rBrBrC�add_left�
r�z2ForwardRefTests.test_basics.<locals>.Node.add_leftcSs|�d|�dSrGr)r*rBrBrC�	add_right�
r�z3ForwardRefTests.test_basics.<locals>.Node.add_right)NNNrG)r(r�)
rLrMrNrrirhr'rr+r,rBrBrBrCr��
s���
�r�r�r�r%r&r()rrrhrr'rrrdr�assertNotInr+r,)r>r�r�Z
both_hintsZ
left_hintsZright_hintsrBrBrCr��
szForwardRefTests.test_basicscCsDt�d�}|�t��td|�Wd�dS1swYdS)NrhrY)rHr0rZr[r\�r>�frrBrBrC�#test_forwardref_instance_type_error�
�
"�z3ForwardRefTests.test_forwardref_instance_type_errorcCsDt�d�}|�t��tt|�Wd�dS1swYdS)Nrh)rHr0rZr[r<rhr.rBrBrC�#test_forwardref_subclass_type_errorr1z3ForwardRefTests.test_forwardref_subclass_type_errorcCs:|�t��t�d�Wd�dS1swYdSrH)rZr[rHr0r]rBrBrC�test_forwardref_only_str_argr_z,ForwardRefTests.test_forwardref_only_str_argcCs�t�d�}|�|t�d��|�tdtt�|�|tjdtd��tjdtd�}|�|tjdtd��|�|tjddd��dS)Nrh��module�__other_name__)rHr0rdr�rrhrL)r>r/ZfrmrBrBrC�test_forward_equality	s
z%ForwardRefTests.test_forward_equalitycCst�d�}t�d�}t�d�}t�d�}Gdd�d�}d|d|fdd�}|�t|t�t��||d��|�||�|�||�|�||�|�t|t|�|�t|t|�|�t|t|�|�t||ft|�|�t||t	ft|t	f�dS)Nr�c@rO)z4ForwardRefTests.test_forward_equality_gth.<locals>.CNrQrBrBrBrCr�rRrrfcSr�rGrB�rrfrBrBrCrr�z6ForwardRefTests.test_forward_equality_gth.<locals>.foor8)
rHr0rdrrrrr�rrh)r>r3�c1_gthr4�c2_gthr�rrBrBrC�test_forward_equality_gths



"z)ForwardRefTests.test_forward_equality_gthcCst�d�}t�d�}t�d�}t�d�}d|d|fdd�}t|t�t��|�t|�t|��|�t|�t|��|�t|�t|��tjdtd�}tjddd�}|�t|�t|��|�t|�t|��|�t|�t|��|�t|�ttjdtd���dS)NrhrrfcSr�rGrBr8rBrBrCr-r�z7ForwardRefTests.test_forward_equality_hash.<locals>.foor4r6)	rHr0rrrrdr2rLr�)r>r3r9r4r:rZc3Zc4rBrBrC�test_forward_equality_hash's



"z*ForwardRefTests.test_forward_equality_hashcCsBGdd�d�}dd�}dd�}|�|�|��|�|�|��dS)Nc@rO)z:ForwardRefTests.test_forward_equality_namespace.<locals>.ANrQrBrBrBrCrl>rRrlcSs,t�d�}d|fdd�}t|t�t��|S)Nrlr�cSr�rGrBr�rBrBrCr�Br�zPForwardRefTests.test_forward_equality_namespace.<locals>.namespace1.<locals>.fun�rHr0rrr)rr�rBrBrC�
namespace1@s
zCForwardRefTests.test_forward_equality_namespace.<locals>.namespace1cSs:t�d�}Gdd�d�}d|fdd�}t|t�t��|S)Nrlc@rO)zNForwardRefTests.test_forward_equality_namespace.<locals>.namespace2.<locals>.ANrQrBrBrBrCrlJrRr�cSr�rGrBr�rBrBrCr�Lr�zPForwardRefTests.test_forward_equality_namespace.<locals>.namespace2.<locals>.funr=)rrlr�rBrBrC�
namespace2Gs

zCForwardRefTests.test_forward_equality_namespace.<locals>.namespace2)rdr�)r>rlr>r?rBrBrC�test_forward_equality_namespace=s
z/ForwardRefTests.test_forward_equality_namespacecCs|�ttd�d�dS)Nrhztyping.List[ForwardRef('int')])rdrerr]rBrBrC�test_forward_reprU�z!ForwardRefTests.test_forward_reprcCstdtdfdd�}|�t|t�t��dtti�dttd�tBfdd�}|�t|t�t��dtttBi�dS)NrrcSr�rGrBrrBrBrCrZr�z/ForwardRefTests.test_union_forward.<locals>.foocSr�rGrBrrBrBrCr`r�)	rrdrrrrr�r0rhr�rBrBrC�test_union_forwardXs
��z"ForwardRefTests.test_union_forwardcCsldtdfdd�}|�t|t�t��dtti�dttd�fdd�}|�t|t�t��dtti�dS)NrrcSr�rGrBrrBrBrCrhr�z/ForwardRefTests.test_tuple_forward.<locals>.foocSr�rGrBrrBrBrCrnr�)rrdrrrrr�r0r�rBrBrC�test_tuple_forwardfs
�
�z"ForwardRefTests.test_tuple_forwardcCs.ddd�}|�t|t�t��dtti�dS)Nr�List['int']cSr�rGrBrrBrBrCrur�z0ForwardRefTests.test_double_forward.<locals>.foo)rrE)rdrrrrrhr�rBrBrC�test_double_forwardts

�z#ForwardRefTests.test_double_forwardcCsDdd�}dd�}dd�}|�}|�}|�||�|�t|||�dS)NcS�0t�d�}|}d|fdd�}t|t�t��}|S)Nrlr�cSr�rGrBr�rBrBrCr�~r�zPForwardRefTests.test_forward_recursion_actually.<locals>.namespace1.<locals>.funr=�rrlr��retrBrBrCr>{�

zCForwardRefTests.test_forward_recursion_actually.<locals>.namespace1cSrG)Nrlr�cSr�rGrBr�rBrBrCr��r�zPForwardRefTests.test_forward_recursion_actually.<locals>.namespace2.<locals>.funr=rHrBrBrCr?�rJzCForwardRefTests.test_forward_recursion_actually.<locals>.namespace2cSs||kSrGrB)Zo1Zo2rBrBrC�cmp�r�z<ForwardRefTests.test_forward_recursion_actually.<locals>.cmp)r�rZ�RecursionError)r>r>r?rKZr1Zr2rBrBrC�test_forward_recursion_actuallyzs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>.CrN)rLrMrNrrprB)rNrBrCr���
r�cseZdZUe��fed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.DrN)rLrMrNrrprB�rNZ	ValueListrBrCr���
r�cs"eZdZUee��fed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.ErN�rLrMrNrrrprBrPrBrCr���
r�cs$eZdZUe�e��fed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.FrNrRrBrPrBrCr��s
r�r)rrr�rdrrr)r>r�r�r�r�rBrPrC�test_union_forward_recursion�s8$"��������z,ForwardRefTests.test_union_forward_recursioncCsBdtdgdffdd�}|�t|t�t��dttgtfi�dS)NrrcSr�rGrBrrBrBrCr�r�z2ForwardRefTests.test_callable_forward.<locals>.foo)rrdrrrrr�rBrBrC�test_callable_forward�s�z%ForwardRefTests.test_callable_forwardcCs2ddd�}|�t|t�t��dtdtfi�dS)Nr�Callable[..., T]cSr�rGrBrrBrBrCr�r�z@ForwardRefTests.test_callable_with_ellipsis_forward.<locals>.foo.)rrV)rdrrrrrr�rBrBrC�#test_callable_with_ellipsis_forward�s
�z3ForwardRefTests.test_callable_with_ellipsis_forwardcCs�Gdd�d�}Gdd�d�}|�t|t��dtt�|�t|t��dtt�|�t��t|t��fWd�dS1sBwYdS)Nc@s.eZdZUdZeded<dZeded<dS)z5ForwardRefTests.test_special_forms_forward.<locals>.Cr@)�
ClassVar[int])r:rAr)�
Final[int]�constrfN)rLrMrNrr/rprfrBrBrBrCr���
r�c@�eZdZUdZeded<dS)z6ForwardRefTests.test_special_forms_forward.<locals>.CFr@rYrfN)rLrMrNrfrrprBrBrBrC�CF�rQr]rrf)rdrrrrhrrZr[)r>r�r]rBrBrC�test_special_forms_forward�s"�z*ForwardRefTests.test_special_forms_forwardcCr�)Nz/T)rZ�SyntaxErrorrr]rBrBrC�test_syntax_error�s
"�z!ForwardRefTests.test_syntax_errorcCsBddd�}|�t��
t|�Wd�dS1swYdS)Nr�Node[TcSr�rGrBrrBrBrCr�r�z6ForwardRefTests.test_delayed_syntax_error.<locals>.foo)rra)rZr_rr�rBrBrC�test_delayed_syntax_error�s

"�z)ForwardRefTests.test_delayed_syntax_errorcCsJdtdfdd�}|�t��
t|�Wd�dS1swYdS)NrZ42cSr�rGrBrrBrBrCr�r�z,ForwardRefTests.test_type_error.<locals>.foo)rrZr[rr�rBrBrC�test_type_error�s
"�zForwardRefTests.test_type_errorcCsFddd�}|�t��t|t��Wd�dS1swYdS)Nr�Noode[T]cSr�rGrBrrBrBrCr�r�z,ForwardRefTests.test_name_error.<locals>.foo)rrd)rZ�	NameErrorrrr�rBrBrC�test_name_error�s
"�zForwardRefTests.test_name_errorcCs.tdddifdd��}t|�}|�|i�dS)Nr�	whateversr�cSr�rGrBrrBrBrCr�r�z/ForwardRefTests.test_no_type_check.<locals>.foo)r"rrd)r>r�thrBrBrC�test_no_type_check�sz"ForwardRefTests.test_no_type_checkcCsDtGdd�d��}t|j�}|�|i�t|�j�}|�|i�dS)Nc@�eZdZdddifdd�ZdS)z3ForwardRefTests.test_no_type_check_class.<locals>.Crrgr�cSr�rGrBrrBrBrCr�r�z7ForwardRefTests.test_no_type_check_class.<locals>.C.fooN�rLrMrNrrBrBrBrCr���r�)r"rrrd)r>r��cth�ithrBrBrC�test_no_type_check_class�s
z(ForwardRefTests.test_no_type_check_classcs@Gdd�d��tG�fdd�d���}|�t�j�dti�dS)Nc@r�)z6ForwardRefTests.test_no_type_check_no_bases.<locals>.Cr�cSr�rGrBr�rBrBrCr�r�z;ForwardRefTests.test_no_type_check_no_bases.<locals>.C.methN�rLrMrNrhr�rBrBrBrCr�r�r�cseZdZ�ZdS)z6ForwardRefTests.test_no_type_check_no_bases.<locals>.DN)rLrMrNr�rB�r�rBrCr�r�r�r�)r"rdrr�rh�r>r�rBrqrC�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|�|�q)dS)
Nc@s eZdZUdZejeed<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.C�rN)rLrMrNrrHrrhrprBrBrBrCr�
�
r�c@seZdZUdZeeed<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.DrtrN)rLrMrNrrrhrprBrBrBrCr�rQr�c@�eZdZUdZded<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.ErtrrN�rLrMrNrrprBrBrBrCr�rOr�c@rv)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.FrtrXrNrwrBrBrBrCr�rOr�r)rHrrhrdr)r>r�r�r�r�Zexpected_result�clazzrBrBrC�(test_no_type_check_forward_ref_as_strings�z8ForwardRefTests.test_no_type_check_forward_ref_as_stringc	Cs`Gdd�d�}Gdd�d�}||fD]}|�t��t|�Wd�n1s(wYqdS)Nc@rv)zGForwardRefTests.test_nested_classvar_fails_forward_ref_check.<locals>.Ertz%typing.ClassVar[typing.ClassVar[int]]rNrwrBrBrBrCr�rOr�c@r\)zGForwardRefTests.test_nested_classvar_fails_forward_ref_check.<locals>.FrtrXrN)rLrMrNrrrprBrBrBrCr�rQr�)rZr[r)r>r�r�rxrBrBrC�,test_nested_classvar_fails_forward_ref_checks
���z<ForwardRefTests.test_nested_classvar_fails_forward_ref_checkcCs�tdd��}|�|jd�|dddifdd��}|Gd	d
�d
��}|�|jd�t|�}|�|i�t|j�}|�|i�t|�j�}|�|i�dS)NcSs|SrGrB)r!rBrBrC�magic_decorator&r�z@ForwardRefTests.test_meta_no_type_check.<locals>.magic_decoratorr{rrgr�cSr�rGrBrrBrBrCr,r�z4ForwardRefTests.test_meta_no_type_check.<locals>.fooc@rj)z2ForwardRefTests.test_meta_no_type_check.<locals>.Crrgr�cSr�rGrBrrBrBrCr2r�z6ForwardRefTests.test_meta_no_type_check.<locals>.C.fooNrkrBrBrBrCr�0rlr�r)r#rdrLrr)r>r{rr�rhrmrnrBrBrC�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�)rr�)r�rrrd)r>r��ns�hintsrBrBrC�test_default_globals=s

z$ForwardRefTests.test_default_globalscCsT|�ttt��dtt�|�ttt��dtt�|�ttt��dt�dS)Nr)rd�gth�Looprrr�rhr]rBrBrC�test_final_forward_refHsz&ForwardRefTests.test_final_forward_refN) rLrMrNr�r0r2r3r7r;r<r@rArCrDrFrMrTrUrWr^r`rbrcrfrirorsryrzr|rr�rBrBrBrCr$�
s<$	 		
r$c@r�)�
OverloadTestscCsNddlm}|�t��|dd��}|�Wd�dS1s wYdS)Nr��overloadcSr�rGrBrBrBrBrCr&Ur�z/OverloadTests.test_overload_fails.<locals>.blah)rHr�rZ�RuntimeError�r>r�r&rBrBrC�test_overload_failsPs
"�z!OverloadTests.test_overload_failscCs*ddlm}|dd��}dd�}|�dS)Nrr�cSr�rGrBrBrBrBrCr&^r�z2OverloadTests.test_overload_succeeds.<locals>.blahcSr�rGrBrBrBrBrCr&br�)rHr�r�rBrBrC�test_overload_succeeds[s


z$OverloadTests.test_overload_succeedsN)rLrMrNr�r�rBrBrBrCr�Nsr�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@rr)rlr;N)rLrMrNr�rprBrBrBrCrl�rzrlc@s2eZdZUdZeeded<eed<eed<dS)r�Nr�r;rf)rLrMrNr�rrrprhrBrBrBrCr��s
r�c@s eZdZUe�Zeded<dS)�CSubr<N)rLrMrNr�r<rrprBrBrBrCr��rur�c@s"eZdZUgZeeeed<dS)r��lstN)rLrMrNr�rrrrprBrBrBrCr��rSr�c@seZdZUeded<dS)r�rN)rLrMrNrrprBrBrBrCr��rOr�c@seZdZUded<ded<dS)�NoneAndForward�parentN�meaningr�rBrBrBrCr��rqr�c@�eZdZUeed<eed<dS)�CoolEmployee�name�coolN�rLrMrNr�rprhrBrBrBrCr��rqr�c@s"eZdZUeed<dZeed<dS)�CoolEmployeeWithDefaultr�rr�N)rLrMrNr�rpr�rhrBrBrBrCr��s
r�c@�eZdZUeed<dd�ZdS)�XMethr�cCs
d|jS)Nr9r�r]rBrBrC�double�rjzXMeth.doubleN)rLrMrNrhrpr�rBrBrBrCr��rqr�c@s2eZdZUeed<dZeed<dd�Zdd�ZdS)	�XReprr�r�r;cCs|j�d|j��S)Nz -> r�r]rBrBrC�__str__��z
XRepr.__str__cCr�r�rB�r>r�rBrBrC�__add__�r�z
XRepr.__add__N)rLrMrNrhrpr;r�r�rBrBrBrCr��s

r��Labelrtc@rm)�Point2Dr�r;NrorBrBrBrCr��rqr�c@rr)rLrfNrorBrBrBrCrL�rzrL��totalc@rO)�LabelPoint2DNrQrBrBrBrCr��r�r�c@r�)�Options�	log_level�log_pathNrxrBrBrBrCr��rqr�c@seZdZUded<ded<dS)�HasForeignBaseClassr��
some_xreprzmod_generics_cache.A�other_aNr�rBrBrBrCr��rqr��amc	�sB�|4IdH�
}|Wd�IdHS1IdHswYdSrGrB)r�r�rBrBrC�g_with�s�0�r�c@s2eZdZejddd��Zejejddd���ZdS)�
ForRefExampler>cCr�rGrBr]rBrBrCr!�r�zForRefExample.funccCr�rGrBr]rBrBrC�nested�szForRefExample.nestedN)r>r�)rLrMrNr��decr!r�rBrBrBrCr��sr�c@s�eZdZdd�Zdd�Zed�dd��Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$S)%�GetTypeHintTestscCs�|�t��td�Wd�n1swY|�t��td�Wd�n1s-wY|�t��
td�Wd�dS1sGwYdS)N�{r	)rZr[r�r]rBrBrC�(test_get_type_hints_from_various_objects�s
�
�
"�z9GetTypeHintTests.test_get_type_hints_from_various_objectscCsPdtttfttttBd�}|�tt�|�|�tt�i�|�tt�i�dS)Nr9)r�rJr�r;r�)	rrhr�r�rdr�r�r�r�)r>Zann_module_type_hintsrBrBrC�test_get_type_hints_modules�sz,GetTypeHintTests.test_get_type_hints_modulesz	known bugcCs*ttjttjd�}|�tt�|�dS)N)Z	default_aZ	default_b)rr7rlr�rdr�)r>Z	mgc_hintsrBrBrC�&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�)�jrtr;r<r�r�)r�r�)r�r�Zsome_b)Zmy_inner_a1Zmy_inner_a2Z
my_outer_a)rdr�r�r�rr�Zj_classr��Mrnr�r�r�rhZh_classrrr�r�r�r7rlr�rr]rBrBrC�test_get_type_hints_classes
s>���
�
�����z,GetTypeHintTests.test_get_type_hints_classescC�&Gdd�d�}|�t|�dti�dS)Nc@seZdZUdZeed<dS)zZGetTypeHintTests.test_get_type_hints_classes_no_implicit_optional.<locals>.WithNoneDefaultN�field)rLrMrNr�rhrprBrBrBrC�WithNoneDefault
rOr�r�)rdr�rh)r>r�rBrBrC�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@seZdZddd�ZdS)zBGetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheck.Innr��
not a typecSr�rGrBr�rBrBrCri$
r�zKGetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheck.Inn.__init__N)r�r�r�rBrBrBrC�Inn#
r�r�N)rLrMrNr�rBrBrBrC�	NoTpCheck!
r�r�c@r�)z:GetTypeHintTests.test_respect_no_type_check.<locals>.ABaser�cSr�rGrBr�rBrBrCr�)
r�z?GetTypeHintTests.test_respect_no_type_check.<locals>.ABase.methNrprBrBrBrC�ABase(
r�r�c@rO)z8GetTypeHintTests.test_respect_no_type_check.<locals>.DerNrQrBrBrBrC�Der*
rRr�r�)
r"rZ__no_type_check__r�rirdr�r�ZNTCr�rrrh)r>r�r�r�rBrBrC�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�dSrG)
rdr�rhrn�dirr�r�r�r��joinr]rBrBrC� test_get_type_hints_for_builtins.
sz1GetTypeHintTests.test_get_type_hints_for_builtinscCsLdd�}d|jd<|�t|�dti�ddd�}|�t|�dtd�i�dS)NcSr�rGrBr�rBrBrC�testf9
r�z6GetTypeHintTests.test_previous_behavior.<locals>.testfrhr�cSr�rGrBr�rBrBrC�testg<
r�z6GetTypeHintTests.test_previous_behavior.<locals>.testg)r�N)rprdr�rhrn)r>r�r�rBrBrC�test_previous_behavior8
s


z'GetTypeHintTests.test_previous_behaviorcCsHGdd�d�}Gdd�d�}|�}ddi|_|�t|t��d|i�dS)Nc@rO)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations.<locals>.ANrQrBrBrBrCrl@
r�rlc@rO)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations.<locals>.BNrQrBrBrBrCr�A
r�r�r�)rprdr�r)r>rlr�rfrBrBrC�/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�rf)r<r;rfr�r�)rdr�r�ZCVr,rHrr�rrhrr�r�rrr]rBrBrC�test_get_type_hints_ClassVarF
s��

�� z-GetTypeHintTests.test_get_type_hints_ClassVarcCs0dti}|�ttj�|�|�ttj�|�dS)Nr>)r�rdr�r!r�)r>ZexpectsrBrBrC�,test_get_type_hints_wrapped_decoratored_funcP
sz=GetTypeHintTests.test_get_type_hints_wrapped_decoratored_funcc
Cs�dtdfdd�}ttdf}|�t|t�t��dtti�|�t|t�t�dd�dtttdfi�dttd�fdd�}ttdf}|�t|t�t��dtti�|�t|t�t�dd�dtttdfi�t	tt
d	fd
f}d|fdd�}|�t|t�t��dt	t
d
f�|�t|t�t�dd�d|�ttt
d	fd
f}d|fd
d�}|�t|t�t��dtt
d
f�|�t|t�t�dd�d|�dt
jd
ttt
dffdt
jttt
dfffdd�}|�t|t�t��t
jd
tt
ft
jtt
fd��t
jd
tt
f}d|fdd�}|�t|t�t�dd�d|�t
jttBdf}d|fdd�}	|�t|	t�t��dttBi�|�t|	t�t�dd�dt
jttBdfi�dS)Nr�r�cSr�rGrBr�rBrBrCr�V
r�z>GetTypeHintTests.test_get_type_hints_annotated.<locals>.foobar�r�r�T�Zinclude_extrascSr�rGrBr�rBrBrCr�a
r�)r�r.cSr�rGrBr�rBrBrCr�m
r�z>GetTypeHintTests.test_get_type_hints_annotated.<locals>.barfoocSr�rGrBr�rBrBrCr�u
r�rZr;ZmutablecSr�rGrBr�rBrBrCr�|
r�z?GetTypeHintTests.test_get_type_hints_annotated.<locals>.barfoo2r�cSr�rGrBr�rBrBrC�barfoo3�
r�z?GetTypeHintTests.test_get_type_hints_annotated.<locals>.barfoo3cSr�rGrBr�rBrBrC�barfoo4�
r�z?GetTypeHintTests.test_get_type_hints_annotated.<locals>.barfoo4)rr/rhrdrrrr�r0rrr�r�rHrrr�)
r>r�r�ZBAr�r�ZBA2r�ZBA3r�rBrBrC�test_get_type_hints_annotatedU
sr
��
��$�$�
� ��
��z.GetTypeHintTests.test_get_type_hints_annotatedc	CsfdttttdfBfdd�}|�t|�dtttBi�|�t|dd�dttttdfBi�dS)Nr��metacSr�rGrBr�rBrBrC�
with_union�
r�zKGetTypeHintTests.test_get_type_hints_annotated_in_union.<locals>.with_unionTr�)rhr�r/r�rdr)r>r�rBrBrC�&test_get_type_hints_annotated_in_union�
s
�z7GetTypeHintTests.test_get_type_hints_annotated_in_unioncs�ttdf�G�fdd�dtt�}|�t|jt�t��|t|td��|�t|jt�t�dd��|t|td��|�t|jt�t��|t|td��dS)N�Constcs,eZdZd
dd�Zd�dddfdd�Zd	S)zBGetTypeHintTests.test_get_type_hints_annotated_refs.<locals>.MySetr��Const[MySet[T]]r��MySet[T]cSr�rGrBr�rBrBrC�__ior__�
r�zJGetTypeHintTests.test_get_type_hints_annotated_refs.<locals>.MySet.__ior__cSr�rGrBr�rBrBrC�__iand__�
r�zKGetTypeHintTests.test_get_type_hints_annotated_refs.<locals>.MySet.__iand__N)r�r�r�r�)rLrMrNr�r�rB�r�rBrC�MySet�
s
r�)r�r�Tr�)	r/rrrdrr�rrr�)r>r�rBr�rC�"test_get_type_hints_annotated_refs�
s���z3GetTypeHintTests.test_get_type_hints_annotated_refscCr�)Nc@seZdZUeZded<dS)zIGetTypeHintTests.test_get_type_hints_classes_str_annotations.<locals>.Foor;r�N)rLrMrNr�r;rprBrBrBrCrK�
s
rKr�)rdrr��r>rKrBrBrC�+test_get_type_hints_classes_str_annotations�
sz<GetTypeHintTests.test_get_type_hints_classes_str_annotationscCs6Gdd�d�}d|_|�dtj�|�t|�i�dS)Nc@rO)zBGetTypeHintTests.test_get_type_hints_bad_module.<locals>.BadModuleNrQrBrBrBrC�	BadModule�
rRr��bad)rMr-r��modulesrdr)r>r�rBrBrC�test_get_type_hints_bad_module�
sz/GetTypeHintTests.test_get_type_hints_bad_modulecCsRGdd�d�}Gdd�d|�}d|_|_|�dtj�|�t|�ttd��dS)Nc@rr)zJGetTypeHintTests.test_get_type_hints_annotated_bad_module.<locals>.BadBaserN)rLrMrNr�rprBrBrBrC�BadBase�
rzr�c@rr)zJGetTypeHintTests.test_get_type_hints_annotated_bad_module.<locals>.BadTyperBN)rLrMrNr�rprBrBrBrC�BadType�
rzr�r�rC)rMr-r�r�rdrr�r�)r>r�r�rBrBrC�(test_get_type_hints_annotated_bad_module�
s
z9GetTypeHintTests.test_get_type_hints_annotated_bad_moduleN)rLrMrNr�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rBrBrBrCr��s&	


?	r�c@�,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�GetUtilitiesTestCasecCs�td�}td�}Gdd�dt|�}|�t|t�|�|�t||�|�|�tt�d�|�ttt�t�|�ttttf�t�|�tt	d�t	�|�tt
tt�t
�|�tt�t�|�tt|�t�|�ttt||ft�t
�|�tt|df�t�|�tt�t
�|�tt�t�|�tt�tjj�|�tt
t�t
�|�tt
�d�|�tt
tB�tj�|�t|j�|�|�t|j�|�dS)Nrr"c@rO)z/GetUtilitiesTestCase.test_get_origin.<locals>.CNrQrBrBrBrCr��
r�r��rY�+r�)r
r2rr�rrhrrr�rrrrr�r/r�rrr	r�rr�rXrrBrBrC�test_get_origin�
s, z$GetUtilitiesTestCase.test_get_originc	CsPtd�}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��td�}|�tt|tf�|tf�|�tttt|ftf�tt|ftf�|�tttB�ttf�dS)Nrc@rO)z-GetUtilitiesTestCase.test_get_args.<locals>.CNrQrBrBrBrCr��
r�r�rBr�.)rB�oner9Zthreer")r
rrdr rhrrr�rrrrrHrrrr/r�rr	r2r3)r>rr�r"rBrBrC�
test_get_args�
sP�$� $�($  ��z"GetUtilitiesTestCase.test_get_argscCs:tt�}|�|dtti�ttj�}|�|dti�dS)Nr�r`)rr�rdrr��MyClass)r>r~rBrBrC�test_forward_ref_and_finals
z/GetUtilitiesTestCase.test_forward_ref_and_finalcCs:|�td��
tt�Wd�dS1swYdS)Nz4typing.ClassVar\[int\] is not valid as type argument)r#r[rr�r]rBrBrC�test_top_level_class_vars�
"�z-GetUtilitiesTestCase.test_top_level_class_varN)rLrMrNr�r�r�r�rBrBrBrCr��
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�Z9djdk�Z:dlS)m�CollectionsAbcTestscCs |�dtj�|�gtj�dSrX)r�rH�Hashabler�r]rBrBrC�
test_hashable#r1z!CollectionsAbcTests.test_hashablecCsX|�gtj�|�gtj�|�gtj�|�dtj�|�ttj�|�ttj�dSrX)r�rHr�r�rDr�r]rBrBrC�
test_iterable'sz!CollectionsAbcTests.test_iterablecCs(tg�}|�|tj�|�dtj�dSrX)ryr�rH�Iteratorr�)r>�itrBrBrC�
test_iterator2sz!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�rr�rH�	Awaitabler��send�r>r}r�grBrBrC�test_awaitable7s�z"CollectionsAbcTests.test_awaitablecCs�i}tdt�|�|d}|�}|�|tj�|�t��t|tjt�Wd�n1s/wY|�	|tj�z|�
d�WdStyMYdSw)Nzasync def foo():
    return
r)r�rr�rH�	CoroutinerZr[r\rhr�r��
StopIterationr�rBrBrC�test_coroutineDs"���z"CollectionsAbcTests.test_coroutinecCs>td�}t|�}|�|tj�|�|tj�|�dtj�dS�Nr�rY)r�AsyncIteratorWrapperr�rH�
AsyncIterabler��r>Zbase_itr�rBrBrC�test_async_iterableVs
z'CollectionsAbcTests.test_async_iterablecCs0td�}t|�}|�|tj�|�dtj�dSr)rrr�rH�
AsyncIteratorr�rrBrBrC�test_async_iterator^sz'CollectionsAbcTests.test_async_iteratorcC� |�gtj�|�dtj�dSrX)r�rH�Sizedr�r]rBrBrC�
test_sizeder1zCollectionsAbcTests.test_sizedcCrrX)r�rHr�r�r]rBrBrC�test_containerir1z"CollectionsAbcTests.test_containercCs@|�t�tj�|�t�tj�|�ttj�|�dtj�dSrX)r�r�rH�
Collectionr$rDr�r�r]rBrBrC�test_collectionmsz#CollectionsAbcTests.test_collectioncCs"|�t�tj�|�dtj�dSrX)r�r�rHr�r�r]rBrBrC�test_abstractsetssz$CollectionsAbcTests.test_abstractsetcCs$|�t�tj�|�t�tj�dSrG)r�r�rH�
MutableSetr�r$r]rBrBrC�test_mutablesetwsz#CollectionsAbcTests.test_mutablesetcC� |�itj�|�dtj�dSrX)r�rHr�r�r]rBrBrC�test_mapping{r1z CollectionsAbcTests.test_mappingcCrrX)r�rHrr�r]rBrBrC�test_mutablemappingr1z'CollectionsAbcTests.test_mutablemappingcCrrX)r�rHr�r�r]rBrBrC�
test_sequence�r1z!CollectionsAbcTests.test_sequencecCrr�)r�rH�MutableSequencer�r]rBrBrC�test_mutablesequence�r1z(CollectionsAbcTests.test_mutablesequencecCs$|�dtj�|�td�tj�dSr8)r�rH�
ByteString�	bytearrayr]rBrBrC�test_bytestring�sz#CollectionsAbcTests.test_bytestringcC�|�ttj�dSrG)rDr�rHrr]rBrBrC�	test_list�r�zCollectionsAbcTests.test_listcCs:|�tjtj�Gdd�dtjt�}|�|�tj�dS)Nc@rO)z/CollectionsAbcTests.test_deque.<locals>.MyDequeNrQrBrBrBrC�MyDeque�r�r)rDr�dequerH�Dequerhr�)r>rrBrBrC�
test_deque�szCollectionsAbcTests.test_dequecCs|�tjtj�dSrG)rDr�CounterrHr]rBrBrC�test_counter�rgz CollectionsAbcTests.test_countercCr.rG)rDr�rH�SetrFr$r]rBrBrC�test_set�r1zCollectionsAbcTests.test_setcCr.rG)rDr$rHr�rFr�r]rBrBrC�test_frozenset�r1z"CollectionsAbcTests.test_frozensetcCrrG)rDr�rHrr]rBrBrCrg�r�zCollectionsAbcTests.test_dictcCs td�}td�}|�t||fttftttf�|�t|tfttttf�|�tt|fttttf�|�t|t|fttfttttf�|�t|ttftttttf�|�t|t|fttfttttf�|�t|ttftttttf�dS)N�Kr�)r
rdrr�rhrr�)r>r%r�rBrBrC�test_dict_subscribe�s$  ,(,,z'CollectionsAbcTests.test_dict_subscribecC�|�t��t��Wd�n1swY|�t��tjt�Wd�n1s/wY|�t��tjt�Wd�dS1sKwYdSrG)rZr[rHrrrhr]rBrBrC�test_no_list_instantiation�rz.CollectionsAbcTests.test_no_list_instantiationcCsRGdd�dtjt�}|�}|�||�|�|tj�|�|t�|�t|�dS)Nc@rO)z6CollectionsAbcTests.test_list_subclass.<locals>.MyListNrQrBrBrBrC�MyList�rRr))rHrrhr�r�rDr�rF)r>r)rrBrBrC�test_list_subclass�sz&CollectionsAbcTests.test_list_subclasscCs�|�t��t��Wd�n1swY|�t��tjttf�Wd�n1s1wY|�t��tjttf�Wd�dS1sOwYdSrG)rZr[rHrr
rr�rhr]rBrBrC�test_no_dict_instantiation��
��"�z.CollectionsAbcTests.test_no_dict_instantiationcCsVGdd�dtjttf�}|�}|�||�|�|tj�|�|t�|�t|�dS)Nc@rO)z6CollectionsAbcTests.test_dict_subclass.<locals>.MyDictNrQrBrBrBrCr��rRr�)	rHrr�rhr�rrDr�rF)r>r�r�rBrBrC�test_dict_subclass�sz&CollectionsAbcTests.test_dict_subclasscCsV|�tt���tj�|�ttjttf��tj�|�ttjtt	f��tj�dSrG)
r�rnrHr�r�defaultdictr
rr�rhr]rBrBrC�test_defaultdict_instantiation��"z2CollectionsAbcTests.test_defaultdict_instantiationcCsLGdd�dtjttf�}|�}|�||�|�|tj�|�tj|�dS)Nc@rO)z@CollectionsAbcTests.test_defaultdict_subclass.<locals>.MyDefDictNrQrBrBrBrC�	MyDefDict�rRr1)	rHr�r�rhr�rDrr.rF)r>r1�ddrBrBrC�test_defaultdict_subclass��
z-CollectionsAbcTests.test_defaultdict_subclasscCsV|�tt���tj�|�ttjttf��tj�|�ttjttf��tj�dSrG)	r�rnrH�OrderedDictrr
rr�rhr]rBrBrC�test_ordereddict_instantiation�r0z2CollectionsAbcTests.test_ordereddict_instantiationcC�LGdd�dtjttf�}|�}|�||�|�|tj�|�tj|�dS)Nc@rO)z@CollectionsAbcTests.test_ordereddict_subclass.<locals>.MyOrdDictNrQrBrBrBrC�	MyOrdDict�rRr8)rHr5r�rhr�rDrrF)r>r8ZodrBrBrC�test_ordereddict_subclass�r4z-CollectionsAbcTests.test_ordereddict_subclassr�zChainMap was added in 3.3cCs�|�tt���tj�|�ttjttf��tj�|�ttjttf��tj�Gdd�dtjttf�}|�t|ttf��|�dS)Nc@rO)z;CollectionsAbcTests.test_chainmap_instantiation.<locals>.CMNrQrBrBrBrC�CM�r�r:)	r�rnrHr�rr
rr�rh)r>r:rBrBrC�test_chainmap_instantiation�s
z/CollectionsAbcTests.test_chainmap_instantiationcCr7)Nc@rO)z>CollectionsAbcTests.test_chainmap_subclass.<locals>.MyChainMapNrQrBrBrBrC�
MyChainMaprRr<)rHr�r�rhr�rDrrF)r>r<�cmrBrBrC�test_chainmap_subclasss
z*CollectionsAbcTests.test_chainmap_subclasscCsz|�tt���tj�|�ttjt��tj�|�ttjt��tj�Gdd�dtjt�}|�t|t��|�dS)Nc@rO)z7CollectionsAbcTests.test_deque_instantiation.<locals>.DNrQrBrBrBrCr�r�r�)r�rnrHrrrrrhrrrBrBrC�test_deque_instantiation�
z,CollectionsAbcTests.test_deque_instantiationcCsz|�tt���tj�|�ttjt��tj�|�ttjt��tj�Gdd�dtjt�}|�t|t��|�dS)Nc@rO)z9CollectionsAbcTests.test_counter_instantiation.<locals>.CNrQrBrBrBrCr�r�r�)r�rnrHr rrrhr�rBrBrC�test_counter_instantiationr@z.CollectionsAbcTests.test_counter_instantiationcCsHGdd�dtjt�}|�}|�||�|�|tj�|�|tj�dS)Nc@rO)zJCollectionsAbcTests.test_counter_subclass_instantiation.<locals>.MyCounterNrQrBrBrBrC�	MyCounterrRrB)rHr rhr�r)r>rBr�rBrBrC�#test_counter_subclass_instantiations
z7CollectionsAbcTests.test_counter_subclass_instantiationcCr'rG)rZr[rHr"rrhr]rBrBrC�test_no_set_instantiation$rz-CollectionsAbcTests.test_no_set_instantiationcC�,Gdd�dtjt�}|�}|�||�dS)Nc@rO)zBCollectionsAbcTests.test_set_subclass_instantiation.<locals>.MySetNrQrBrBrBrCr�.rRr�)rHr"rhr�)r>r�r�rBrBrC�test_set_subclass_instantiation,�z3CollectionsAbcTests.test_set_subclass_instantiationcCr'rG)rZr[rHr�rrhr]rBrBrC�test_no_frozenset_instantiation4rz3CollectionsAbcTests.test_no_frozenset_instantiationcCrE)Nc@rO)zNCollectionsAbcTests.test_frozenset_subclass_instantiation.<locals>.MyFrozenSetNrQrBrBrBrC�MyFrozenSet>rRrI)rHr�rhr�)r>rIr�rBrBrC�%test_frozenset_subclass_instantiation<rGz9CollectionsAbcTests.test_frozenset_subclass_instantiationcCs�|�t��t�Wd�n1swY|�t��
tt�Wd�n1s-wY|�t��tt�Wd�dS1sHwYdSrG)rZr[rrrhr]rBrBrC�test_no_tuple_instantiationDs��"�z/CollectionsAbcTests.test_no_tuple_instantiationcCs$dd�}|�}|�t|�tj�dS)Ncs��dVdSrXrBrBrBrBrCrMs�
z/CollectionsAbcTests.test_generator.<locals>.foo)rDrnrH�	Generator)r>rr�rBrBrC�test_generatorLsz"CollectionsAbcTests.test_generatorcCs�|�t��t��Wd�n1swY|�t��tjtttf�Wd�n1s2wY|�t��tjtttf�Wd�dS1sQwYdSrG)rZr[rHrMrrhr]rBrBrC�test_no_generator_instantiationRs
��"�z3CollectionsAbcTests.test_no_generator_instantiationcCs2i}tdt�|�|d�}|�t|�tj�dS)Nzasync def f():
    yield 42
rJ)r�rrDrnrH�AsyncGenerator)r>r}r�rBrBrC�test_async_generatorZs�
z(CollectionsAbcTests.test_async_generatorcCs�|�t��t��Wd�n1swY|�t��tjttf�Wd�n1s1wY|�t��tjttf�Wd�dS1sOwYdSrG)rZr[rHrPrrhr]rBrBrC�%test_no_async_generator_instantiationar,z9CollectionsAbcTests.test_no_async_generator_instantiationcCsTGdd�dtj�}|�t��|�Wd�n1swYGdd�d|�}|�t|��d�|�|�tj�Gdd�dtjtt	f�}|�t|��d�|�t|t
t
f��d�|�t|tt	f��d�|�t|�|�t|�|�
|tj�|�
|tj�|�
|tj�|�|tt	f�tj�|�|tt	f�tjj�|�
|tjj�|�
|tjj�|�
|tjj�|�t��t|t
t
ftj�Wd�n1s�wY|�
||�Gdd	�d	tj�}|�t|�Gd
d�dtjtttf�}dd
�}|�
|tj�|�
|tj�|�
|tjj�|�
|tjj�|�t|�|�dS)Nc@rO)z1CollectionsAbcTests.test_subclassing.<locals>.MMANrQrBrBrBrC�MMAkrRrSc@rr)z1CollectionsAbcTests.test_subclassing.<locals>.MMCcSr�rGrBrsrBrBrCr_rr�z=CollectionsAbcTests.test_subclassing.<locals>.MMC.__getitem__cSr�rGrBrurBrBrCrbtr�z=CollectionsAbcTests.test_subclassing.<locals>.MMC.__setitem__cSr�rGrBrsrBrBrCrvvr�z=CollectionsAbcTests.test_subclassing.<locals>.MMC.__delitem__cSrwr�rxr]rBrBrCrGxr�z:CollectionsAbcTests.test_subclassing.<locals>.MMC.__iter__cSr�r�rBr]rBrBrCrzzr�z9CollectionsAbcTests.test_subclassing.<locals>.MMC.__len__Nr{rBrBrBrC�MMCqr}rTrc@rr)z1CollectionsAbcTests.test_subclassing.<locals>.MMBcSr�rGrBrsrBrBrCr_�r�z=CollectionsAbcTests.test_subclassing.<locals>.MMB.__getitem__cSr�rGrBrurBrBrCrb�r�z=CollectionsAbcTests.test_subclassing.<locals>.MMB.__setitem__cSr�rGrBrsrBrBrCrv�r�z=CollectionsAbcTests.test_subclassing.<locals>.MMB.__delitem__cSrwr�rxr]rBrBrCrG�r�z:CollectionsAbcTests.test_subclassing.<locals>.MMB.__iter__cSr�r�rBr]rBrBrCrz�r�z9CollectionsAbcTests.test_subclassing.<locals>.MMB.__len__Nr{rBrBrBrC�MMB�r}rUc@rO)z/CollectionsAbcTests.test_subclassing.<locals>.INrQrBrBrBrC�I�r�rVc@rO)z/CollectionsAbcTests.test_subclassing.<locals>.GNrQrBrBrBrCr��r�r�csrLr�rBrBrBrBrCr��s�
z/CollectionsAbcTests.test_subclassing.<locals>.g)rHrrZr[rdr�r�r�r
rr�rFr�rDrr	r<r�r�rMrhrn)r>rSrTrUrVr�r�rBrBrC�test_subclassingisD��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>.GcSr�rGrB)r>r`rBrBrC�asend�r�zECollectionsAbcTests.test_subclassing_async_generator.<locals>.G.asendNcSr�rGrB)r>�typ�val�tbrBrBrC�athrow�r�zFCollectionsAbcTests.test_subclassing_async_generator.<locals>.G.athrowr�)rLrMrNrXr\rBrBrBrCr��sr�zasync def g(): yield 0r�)
rHrPrhr�rrDrrr	rFrnr�r�)r>r�r}r��instancerBrBrC� test_subclassing_async_generator�s z4CollectionsAbcTests.test_subclassing_async_generatorcCsfGdd�dtj�}Gdd�d|�}Gdd�d�}Gdd�d�}|�||�|�||�|�||�dS)	Nc@r�)z?CollectionsAbcTests.test_subclassing_subclasshook.<locals>.BasecSs|jdkrdSdS)NrKTF)rLr�rBrBrCr��s
zPCollectionsAbcTests.test_subclassing_subclasshook.<locals>.Base.__subclasshook__NrrBrBrBrCr��r�r�c@rO)z<CollectionsAbcTests.test_subclassing_subclasshook.<locals>.CNrQrBrBrBrCr��r�r�c@rO)z>CollectionsAbcTests.test_subclassing_subclasshook.<locals>.FooNrQrBrBrBrCrK�r�rKc@rO)z>CollectionsAbcTests.test_subclassing_subclasshook.<locals>.BarNrQrBrBrBrCrL�r�rL)rHr�rDrF)r>r�r�rKrLrBrBrC�test_subclassing_subclasshook�sz1CollectionsAbcTests.test_subclassing_subclasshookcCs�Gdd�dtj�}Gdd�d|�}Gdd�d�}|�|�|�||�|�||�Gdd�d�}|�|�|�||�|�||�Gd	d
�d
�}tjj�|�|�|tj�dS)Nc@rO)z8CollectionsAbcTests.test_subclassing_register.<locals>.ANrQrBrBrBrCrl�r�rlc@rO)z8CollectionsAbcTests.test_subclassing_register.<locals>.BNrQrBrBrBrCr��r�r�c@rO)z8CollectionsAbcTests.test_subclassing_register.<locals>.CNrQrBrBrBrCr��r�r�c@rO)z8CollectionsAbcTests.test_subclassing_register.<locals>.DNrQrBrBrBrCr��r�r�c@rO)z8CollectionsAbcTests.test_subclassing_register.<locals>.MNrQrBrBrBrCr��r�r�)	rHr�r�rDrFrr	rr�)r>rlr�r�r�r�rBrBrC�test_subclassing_register�s

z-CollectionsAbcTests.test_subclassing_registercCs�Gdd�dtjj�}|�|tj�|�|tj�Gdd�dtjj�}|�|tj�|�|tj�Gdd�dtjj�}|�|tj�Gdd�dtjjtjd	�}Gd
d�d�}|�|�|�|tj�dS)Nc@rO)z7CollectionsAbcTests.test_collections_as_base.<locals>.MNrQrBrBrBrCr��r�r�c@rO)z7CollectionsAbcTests.test_collections_as_base.<locals>.SNrQrBrBrBrCr�r�rc@rO)z7CollectionsAbcTests.test_collections_as_base.<locals>.INrQrBrBrBrCrV�r�rVc@rO)z7CollectionsAbcTests.test_collections_as_base.<locals>.ANrQrBrBrBrCrl�r�rl)�	metaclassc@rO)z7CollectionsAbcTests.test_collections_as_base.<locals>.BNrQrBrBrBrCr��r�r�)	rr	r�rDrHr�r�ABCMetar�)r>r�rrVrlr�rBrBrC�test_collections_as_base�s
z,CollectionsAbcTests.test_collections_as_basecCsD|�tjtjBttjtjf�|�tjtjBttjtjf�dSrG)rdrHr	r�rr�r�r]rBrBrCr�s $z#CollectionsAbcTests.test_or_and_rorN);rLrMrNr�r�r�r�ASYNCIOr�rrrr
rr
rrrrrrrrrr!r#r$rgr&r(r*r+r-r/r3r6r9r�r�r;r>r?rArCrDrFrHrJrKrNrOrQrRrWr^r_r`rcrrBrBrBrCr�!sv






Er�c@s&eZdZdd�Zeed�dd��ZdS)�
OtherABCTestscCs4tjdd��}|�}|�|tj�|�dtj�dS)NcsrLrXrBrBrBrBrC�manager��
z2OtherABCTests.test_contextmanager.<locals>.managerrY)�
contextlib�contextmanagerr�rHrKr�)r>rfr=rBrBrC�test_contextmanagers

z!OtherABCTests.test_contextmanagerzPython 3.5 requiredcCs�Gdd�d�}|�t�tj�|�|�tj�tjdd��}|�}|�|tj�|�tjtj	tf�|�
t��tdtjt�Wd�n1sKwY|�
t��tjtt
fWd�dS1shwYdS)Nc@rO)z7OtherABCTests.test_async_contextmanager.<locals>.NotACMNrQrBrBrBrC�NotACMrRrkcsrLrXrBrBrBrBrCrfrgz8OtherABCTests.test_async_contextmanager.<locals>.managerrY)r��ACMrHr�r�rhrirdrhr�rZr[r\r�)r>rkrfr=rBrBrC�test_async_contextmanagers
�"�z'OtherABCTests.test_async_contextmanagerN)rLrMrNrjrrdrmrBrBrBrCres	rec@�$eZdZdd�Zdd�Zdd�ZdS)�	TypeTestscCsPGdd�d�}Gdd�d|�}Gdd�d|�}dt|d|fd	d
�}||�dS)Nc@rO)z'TypeTests.test_type_basic.<locals>.UserNrQrBrBrBrC�User#r�rpc@rO)z,TypeTests.test_type_basic.<locals>.BasicUserNrQrBrBrBrC�	BasicUser$r�rqc@rO)z*TypeTests.test_type_basic.<locals>.ProUserNrQrBrBrBrC�ProUser%r�rr�
user_classr�cS�|�SrGrB�rsrBrBrC�new_user'r�z+TypeTests.test_type_basic.<locals>.new_userr$)r>rprqrrrvrBrBrC�test_type_basic!s
zTypeTests.test_type_basiccCs\Gdd�d�}Gdd�d|�}Gdd�d|�}td|d�}d	t|d
|fdd�}||�dS)
Nc@rO)z)TypeTests.test_type_typevar.<locals>.UserNrQrBrBrBrCrp.r�rpc@rO)z.TypeTests.test_type_typevar.<locals>.BasicUserNrQrBrBrBrCrq/r�rqc@rO)z,TypeTests.test_type_typevar.<locals>.ProUserNrQrBrBrBrCrr0r�rrr_r�rsr�cSrtrGrBrurBrBrCrv4r�z-TypeTests.test_type_typevar.<locals>.new_user)r
r%)r>rprqrrr_rvrBrBrC�test_type_typevar,szTypeTests.test_type_typevarcCs&ttt}d|dttfdd�}dS)Nrr�cSs|durdS|�SrGrBrrBrBrCr<sz)TypeTests.test_type_optional.<locals>.foo)rr%�
BaseException)r>rlrrBrBrC�test_type_optional9szTypeTests.test_type_optionalN)rLrMrNrwrxrzrBrBrBrCros
roc@sdeZdZedd��Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)�NewTypeTestscCs tdt�at|jdt�|_dS)N�UserId�	.UserName)r&rhr|rNr��UserName�r?rBrBrC�
setUpClassGs
zNewTypeTests.setUpClasscCs
b|`dSrG)r|r~rrBrBrC�
tearDownClassMszNewTypeTests.tearDownClasscCs|��dSrG)rKr]rBrBrC�tearDownSszNewTypeTests.tearDowncCs:|�td�t�|�|�d�t�|�td�dd�dS)NrA�Joer��)r�r|rhr~r�rdr]rBrBrCr
VszNewTypeTests.test_basiccCst|�t��
ttt�Wd�n1swY|�t��Gdd�dt�}Wd�dS1s3wYdS)Nc@rO)z#NewTypeTests.test_errors.<locals>.DNrQrBrBrBrCr�_rRr�)rZr[r<r|rhrrrBrBrCri[s�"�zNewTypeTests.test_errorsc	Cs�t|jfD]H}|j|d��8|�t|Btt|f�|�|tBt|tf�|�tt|B�t|f�|�t|tB�|tf�Wd�n1sHwYqdS)Nr)rhr~r�rdr|rr )r>r?rBrBrCr�bs���zNewTypeTests.test_orcCs�|�tjd�|�tjd�|�tjt�|�tjt�|j}|�|jd�|�|j|jjd�|�|jt�|�|jt	�dS)Nr|r~r})
rdr|rLrNrMZ
__supertype__rhr~r)r�)r>r~rBrBrC�test_special_attrsks
�zNewTypeTests.test_special_attrscCs<|�tt�t�d��|�t|j�t�d|jj�d��dS)Nz.UserIdr�r})rdrer|rLr~r)rNr]rBrBrCrfxs�zNewTypeTests.test_reprc
Cs�tdt�}ttjd�D]X}|j|d��Ht�t|�}t�|�}|�	|t�t�|j
|�}t�|�}|�	||j
�|�tj��t�||�Wd�n1sPwYWd�n1s_wYqdS)N�UserAger�)r)
r&r�rrrr�rr|rr�r~rZ�
PicklingError)r>r�r�pickledrrBrBrCr}s 


�����zNewTypeTests.test_picklecCr�)Nz-import typing
NT = typing.NewType('NT', int)
r�r�rBrBrCr��sz!NewTypeTests.test_missing__name__N)rLrMrNrr�r�r�r
rir�r�rfrr�rBrBrBrCr{Fs

	
r{c@steZdZGdd�de�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�NamedTupleTestsc@r�)zNamedTupleTests.NestedEmployeer�r�Nr�rBrBrBrC�NestedEmployee�rqr�cCs�tddtfdtfg�}|�|t�|dd�}|ddd�}|�||�|�|t�|�|jd�|�|jd�|�|jd�|�|jd�|�|j	d�|�|j
d�|�|jt�
dtfdtfg��dS)	N�Empr��idr�rY�Jimr��r�r�)r'r�rhrDr�r�rdr�r�rL�_fieldsrprr5)r>r�Zjoe�jimrBrBrCr��s
�zNamedTupleTests.test_basicscCs�tjdd�dkrE|�t��tdttd�Wd�n1s wY|�t��Gdd�dt�}Wd�dS1s>wYdSdS)Nr9)r:r��Name)r�r�c@r�)z9NamedTupleTests.test_namedtuple_pyversion.<locals>.NotYetrN)rLrMrNr�rBrBrBrC�NotYet�r�r�)r�r�rZr[r'rhr�)r>r�rBrBrC�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�r�r�rdr�r�rLr�rprr5r�rh)r>ZtimrBrBrC�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�dS1sfwYdS)
NZJellerZSjoerdr�r�r�)r�c@s"eZdZUdZeed<eed<dS)zRNamedTupleTests.test_annotation_usage_with_default.<locals>.NonDefaultAfterDefaultr:r�r;N)rLrMrNr�rhrprBrBrBrC�NonDefaultAfterDefault�s
r�)r�r�r�rdr�r�rLr�rpr�r�rh�_field_defaultsrZr[r')r>ZjelleZcooler_employeer�rBrBrC�"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�n1sFwY|�t��Gd	d
�d
t�}Wd�dS1sdwYdS)Nr�r9rYrz42 -> 1r:c@r�)zDNamedTupleTests.test_annotation_usage_with_methods.<locals>.XMethBadr�cSr�)Nzno chance for thisrBr]rBrBrCr��r�zLNamedTupleTests.test_annotation_usage_with_methods.<locals>.XMethBad._fieldsN)rLrMrNrhrpr�rBrBrBrC�XMethBad�rqr�c@r�)zENamedTupleTests.test_annotation_usage_with_methods.<locals>.XMethBad2r�cSr�)Nzno chance for this as wellrBr]rBrBrC�_source�r�zMNamedTupleTests.test_annotation_usage_with_methods.<locals>.XMethBad2._sourceN)rLrMrNrhrpr�rBrBrBrC�	XMethBad2�rqr�)	rdr�r�r�r�r�rZr\r')r>r�r�rBrBrC�"test_annotation_usage_with_methods�s�"�z2NamedTupleTests.test_annotation_usage_with_methodscCsPGdd�d�}|�t��Gdd�dt|�}Wd�dS1s!wYdS)Nc@rO)z4NamedTupleTests.test_multiple_inheritance.<locals>.ANrQrBrBrBrCrl�rRrlc@rr)z4NamedTupleTests.test_multiple_inheritance.<locals>.Xr�NrorBrBrBrCr��rzr�)rZr[r')r>rlr�rBrBrCr��s"�z)NamedTupleTests.test_multiple_inheritancecCs�tdttd�}|dd�}|�|t�|�|jd�|�|jd�|�|jd�|�|j	t
ttd��|�t��tddtfgtd�Wd�n1sLwY|�t��tddd	d
�Wd�dS1siwYdS)N�
LocalEmployee)r�ZageZNick�r�r��r;r�rr�)
r'r�rhr�r�rdr�rLr�rpr�rZr[)r>r�ZnickrBrBrC�test_namedtuple_keyword_usage�s
�"�z-NamedTupleTests.test_namedtuple_keyword_usagecCs�tdttttd�}|�|jd�|�|jd�|tdddtfgd�}|�|j	t�|�|j
d�|�|jd�|�|jdtfg�dS)Nr�)r?r>�typename�fieldsrYrrB)
r'rnr�r�r�rdrLr�r�r?r>r�r�)r>r�rrBrBrC�%test_namedtuple_special_keyword_names�sz5NamedTupleTests.test_namedtuple_special_keyword_namesc	Cs�td�}Gdd�dt�}||fD]4}|j|d��$|�|jd�|�|ji�|�|ji�|�|�|�Wd�n1s?wYqdS)Nr�c@rO)z2NamedTupleTests.test_empty_namedtuple.<locals>.CNTNrQrBrBrBrC�CNTrRr�)�structrB)r'r�rdr�r�rpr�)r>r�r�r�rBrBrC�test_empty_namedtuple�s���z%NamedTupleTests.test_empty_namedtuplecCsX|�t��t��Wd�n1swY|�t��t�Wd�n1s,wY|�t��tddtfgd�Wd�n1sJwY|�t��tddtfg�Wd�n1sgwY|�t��tdttd�Wd�n1s�wY|�t��tddtfdtfgd�Wd�dS1s�wYdS)Nr�r��_name)r�r�r�r�)r�)rZr[r'rr�r�rhr]rBrBrC�test_namedtuple_errorss$
�����"�z&NamedTupleTests.test_namedtuple_errorsc	Cs�tddtfdtfg�att|jfD]^}|j|d��N|dd�}ttj	d�D]}t�
||�}t�|�}|�||�|�
||�q&t|�}|�||�|�
||�t|�}|�||�|�
||�Wd�n1sjwYqdS)Nr�r�r�r�jane�%r�)r'r�rhr�r�r�r�rrrrrrdr�rr)r>r?r�rr<�jane2rBrBrC�test_copy_and_pickles$

���z$NamedTupleTests.test_copy_and_pickleN)rLrMrNr'r�r�r�r�r�r�r�r�r�r�r�r�rBrBrBrCr��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�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�rhrDr�rHrrFrr	r�r�rnrdrLrMr�rp�	__total__�r>r�r�rBrBrC�test_basics_functional_syntax0sz,TypedDictTests.test_basics_functional_syntaxcCs�tdttd�}|�|t�|�|tj�|�|tj	j
�|ddd�}|�t|�t�|�
|dd�|�
|dd�|�
|jd�|�
|jt�|�
|jtf�|�
|jttd��|�
|jd�dSr�r�r�rBrBrC�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)r?r>r��	_typenamer�r�rYr�5rBrEr?r>r�r�r�r�)r(rnr�r�rhr�r�rdrLrpr�r�)r>r�rrBrBrC�$test_typeddict_special_keyword_namesNsz3TypedDictTests.test_typeddict_special_keyword_namescCs|�t��t��Wd�n1swY|�t��t�Wd�n1s,wY|�t��tddtfgd�Wd�n1sJwY|�t��tdttd�Wd�n1sfwY|�t��tdttd�d�Wd�dS1s�wYdS)Nr�r�)r�r�r�r�)r�)rZr[r(rr�rhr]rBrBrC�test_typeddict_create_errorsZs
����"�z+TypedDictTests.test_typeddict_create_errorscCs|tdttd��}|�tjd�|ddd�}|�t��
ti|�Wd�n1s*wY|�t��
t||�Wd�n1sDwY|�t��
tt	|�Wd�n1s^wY|�t��tddd�Wd�n1sywY|�t��tddtfd	g�Wd�n1s�wY|�t��tddtfgtd
�Wd�dS1s�wYdS)Nr�r�rHr�r�ZHir�r�)r;r�r�)
r(r�rhrdrMrZr[r\r<r�r�rBrBrC�test_typeddict_errorsgs*�����"�z$TypedDictTests.test_typeddict_errorscCs�|�tjd�|�tjt�|�tjtttd��|�tjtf�|�tj	d�|�
ttj�t
ddd�}|�|dd�|�|dd�tddd	d�}|�|d
d	�dS)Nr�r�Trr�r�r�r;�hirt)rdr�rLrMrprhr�r�r�r�rFrHr�r�)r>Z
not_originr�rBrBrC�test_py36_class_syntax_usagexsz+TypedDictTests.test_py36_class_syntax_usagecCs�tdttd�atddd��}ttjd�D]2}t�||�}t�|�}|�	||�|�	|ddd��t�t|�}t�|�}|�	|ddd��|�qdS)N�EmpDr�r�r�r�)
r(r�rhr�rrrrrrd)r>r�rr<r�ZZZZEmpDnewrBrBrCr�s

�zTypedDictTests.test_picklecCsFtdttd�}|�tj|tjd|f�|�tj|tj	|�dS)Nr�r�)
r(r�rhrdrHrrr�rr)r>r�rBrBrCr��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�r9)r�r�r�)r(rhrdr��__required_keys__r$�__optional_keys__r�rrrBrBrC�
test_total�szTypedDictTests.test_totalcCsGdd�dtdd�}dS)Nc@rr)z6TypedDictTests.test_optional_keys.<locals>.Point2Dor3Dr<NrorBrBrBrC�Point2Dor3D�rzr�Fr�)r�)r>r�rBrBrC�test_optional_keys�rBz!TypedDictTests.test_optional_keyscCs8Gdd�dt�}Gdd�d|dd�}Gdd�d|�}dS)	Nc@rr)z8TypedDictTests.test_keys_inheritance.<locals>.BaseAnimalr�NrurBrBrBrC�
BaseAnimal�rzr�c@r�)z4TypedDictTests.test_keys_inheritance.<locals>.AnimalZvoice�tailN)rLrMrNr�rpr�rBrBrBrC�Animal�rqr�Fr�c@rr)z1TypedDictTests.test_keys_inheritance.<locals>.CatZ	fur_colorNrurBrBrBrC�Cat�rzr�)r()r>r�r�r�rBrBrC�test_keys_inheritance�sz$TypedDictTests.test_keys_inheritancec

Cs>Gdd�dt�}Gdd�dt�}Gdd�dtdd�}td	d
ti�}Gdd�d�}Gd
d�d||�}|�|jtgd���|�|jtg��|�|jtttd��Gdd�d||�}|�|jtddg��|�|jtdg��|�|jtttd��Gdd�d||dd�}|�|jtdg��|�|jtddg��|�|jtttd��Gdd�d||�}	|�|	jtd
dg��|�|	jtdg��|�|	jtttd��||f||f|||f||f||fg}
|
D];}|j	|d��*|�
td��Gdd�dg|�R�}Wd�n	1�swYWd�n	1�swYq�dS)Nc@rr)z5TypedDictTests.test_multiple_inheritance.<locals>.Oner�NrorBrBrBrC�One�rzr�c@rr)z5TypedDictTests.test_multiple_inheritance.<locals>.Two�twoNrurBrBrBrC�Two�rzr�c@rr)z9TypedDictTests.test_multiple_inheritance.<locals>.Untotal�untotalNrurBrBrBrC�Untotal�rzr�Fr��Inline�inlinec@rO)z9TypedDictTests.test_multiple_inheritance.<locals>.RegularNrQrBrBrBrC�Regular�rRr�c@rr)z7TypedDictTests.test_multiple_inheritance.<locals>.Child�childN�rLrMrNr�rprBrBrBrC�Child�rzr�)r�r�r�c@rr)zCTypedDictTests.test_multiple_inheritance.<locals>.ChildWithOptionalr�Nr�rBrBrBrC�ChildWithOptional�rzr�r�r�r�)r�r�r�c@rr)zETypedDictTests.test_multiple_inheritance.<locals>.ChildWithTotalFalser�Nr�rBrBrBrC�ChildWithTotalFalse�rzr�c@rr)zLTypedDictTests.test_multiple_inheritance.<locals>.ChildWithInlineAndOptionalr�Nr�rBrBrBrC�ChildWithInlineAndOptionalrzr�)r�r�r�)�basesz=cannot inherit from both a TypedDict type and a non-TypedDictc@rO)z7TypedDictTests.test_multiple_inheritance.<locals>.WrongNrQrBrBrBrC�Wrong!rRr�)r(r�rdr�r$r�rprhr�r�r#r[)
r>r�r�r�r�r�r�r�r�r�Zwrong_basesr�r�rBrBrCr��s�
��
�
��
��
�
�
��
��������z(TypedDictTests.test_multiple_inheritancecCr�rGrBr]rBrBrC�test_is_typeddict$r�z TypedDictTests.test_is_typeddictcCs |�tt�tjttd��dS)Nr8)rdrrLrHrrhr]rBrBrC�test_get_type_hints*s�z"TypedDictTests.test_get_type_hintscCsrGdd�dt�}|t}|�|j|�|�|jd�|�|jtf�|dd�}|�t|�t�|�|ddi�dS)Nc@rr)z5TypedDictTests.test_non_generic_subscript.<locals>.TDrN)rLrMrNrrprBrBrBrCr�3rzr�rBr�rr)	r(rhrdr�r�r�r�rnr�)r>r�rlrrBrBrCr0s
z)TypedDictTests.test_non_generic_subscriptN)rLrMrNr�r�r�r�r�r�rr�r�r�r�r�r�r�rrBrBrBrCr�/s 


 Wr�c@r�)
�IOTestscCs0dtdtfdd�}|jd}|�|jtf�dS)Nrr�cS�|��SrG��readlinerrBrBrCr%Br�zIOTests.test_io.<locals>.stuff)r*rrprdr��r>r%rrBrBrC�test_io@s
zIOTests.test_iocC�.dtdtfdd�}|jd}|�|jd�dS)Nrr�cSr�rGr�rrBrBrCr%Jr�z"IOTests.test_textio.<locals>.stuffrB)r+r�rprdr�r�rBrBrC�test_textioH�
zIOTests.test_textiocCr�)Nrr�cSr�rGr�rrBrBrCr%Rr�z$IOTests.test_binaryio.<locals>.stuffrB)r,r�rprdr�r�rBrBrC�
test_binaryioPr�zIOTests.test_binaryiocCsnddlm}m}m}m}m}|�|tj�|�|tj�|�|tj�|�t	|�t	gd���|�|d�dS)Nr)r*r+r,r�rLr)z	typing.io)
Z	typing.ior*r+r,r�rLr�rHrdr�)r>r*r+r,r�rLrBrBrC�test_io_submoduleXszIOTests.test_io_submoduleN)rLrMrNr�r�r�r�rBrBrBrCr�>s
r�c@rv)�RETestscCs�t�dtj�}|�|jt�|�t|�t�|�|t�|�d�}|�|jt	�|�t|�t	�|�|t	�tt
ttft	t
ttfdS)Nz[a-z]+z12345abcde.....)
r��compilerVrDr)r-rnr��searchr.rr�r�)r>r$ZmatrBrBrCr�ds
zRETests.test_basicscCsP|�tttt�|�tttt�|�tttt�|�ttt�dSrG)rdr-r�r�r�r.r]rBrBrC�test_alias_equalitysszRETests.test_alias_equalitycCs�ttttf}|�t��|tWd�n1swY|�t��tdtt�Wd�n1s8wY|�t��ttttt�Wd�dS1sWwYdSrX)	r.rr�r�rZr[r\r-r<)r>�mrBrBrCriys
��"�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])rdrer-r�r�r.r]rBrBrCrf�szRETests.test_reprcCs\ddlm}m}m}m}|�|tj�|�|tj�|�t|�tddg��|�|d�dS)Nr)r.r-r�rLr.r-z	typing.re)	Z	typing.rer.r-r�rLr�rHrdr�)r>r.r-r�rLrBrBrC�test_re_submodule�s
zRETests.test_re_submodulecCsR|�t��}Gdd�dtj�}Wd�n1swY|�t|j�d�dS)Nc@rO)z'RETests.test_cannot_subclass.<locals>.ANrQrBrBrBrCrl�rRrlz.type 're.Match' is not an acceptable base type)rZr[rHr.rdr��	exception)r>�exrlrBrBrCrp�s��zRETests.test_cannot_subclassN)	rLrMrNr�r�rirfr�rprBrBrBrCr�as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)*�AnnotatedTestscCs8|�td��t�Wd�dS1swYdS)Nz%Type Annotated cannot be instantiated�r#r[r/r]rBrBrC�test_new�s�"�zAnnotatedTests.test_newcCs<|�tttddf�d�|�ttttddf�d�dS)Nr@rAztyping.Annotated[int, 4, 5]z(typing.Annotated[typing.List[int], 4, 5])rdrer/rhrr]rBrBrCrf�s��zAnnotatedTests.test_reprcCsJtttdfdf}|�|ttddf�|�|jd�|�|jt�dS)Nr@rAr?)r/rhrd�__metadata__r�rorBrBrCrY�szAnnotatedTests.test_flattencCs�tttdf}tttdf}|�|ttttdf�|�|tjd�|�|tjtt�|�t��|tWd�n1sFwY|�t��|tt	fWd�dS1sbwYdS)N�
my decoration)r�)
r/rrrhrdr�r�rZr[r�)r>�L�LIrBrBrC�test_specialize�s
�"�zAnnotatedTests.test_specializecCs�|�tttddfttddfh�d�|�ttddfttddf�|�ttddfttddf�|�ttdfttddf�|�ttddfttddfttddfhttddfttddfh�dS)Nr@rAr�)rdr�r/rhr�r�rr]rBrBrC�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@cSr�rGr�r�rBrBrCri�rjz3AnnotatedTests.test_instantiate.<locals>.C.__init__cst|��stS|j|jkSrG)r\�NotImplementedr�r�rqrBrC�__eq__�s
z1AnnotatedTests.test_instantiate.<locals>.C.__eq__N)rLrMrN�classvarrir�rBrqrBrCr��sr��a decorationrA)r/rdr�r�)r>rlrr�rBrqrC�test_instantiate�szAnnotatedTests.test_instantiatecCsNttjtdf}|�|gd��ddd��|�|tgd��ddd��dS)Nr�)r@r@rAr9r�r?)r/rHr rrdrh)r>ZMyCountrBrBrC�test_instantiate_generic�s"z'AnnotatedTests.test_instantiate_genericcCs@td}|�t��
|d�Wd�dS1swYdS)N)rh�rAr�rA)r/rZr[rorBrBrC�test_cannot_instantiate_forward�s
"�z.AnnotatedTests.test_cannot_instantiate_forwardcCsDttdf}|�t��
|d�Wd�dS1swYdS)Nr�rA)r/rrZr[rorBrBrC� test_cannot_instantiate_type_var�s
"�z/AnnotatedTests.test_cannot_instantiate_type_varcCs>|�t��ttdfjWd�dS1swYdS)N)rArt)rZr\r/rr�r]rBrBrC�test_cannot_getattr_typevar�r�z*AnnotatedTests.test_cannot_getattr_typevarcCs@Gdd�d�}t|df}|�|jd�d|_|�|jd�dS)Nc@r�)z/AnnotatedTests.test_attr_passthrough.<locals>.Cr@N)rLrMrNr�rBrBrBrCr��r�r�r�r@rA)r/rdr�r�)r>r�rlrBrBrC�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@r�r�r�rZN)
rLrMrNr�r/rrhrprZrrBrBrBrCr��s
r�r�rZ)rdrrrrhrr�rBrBrC�test_special_form_containment�s z,AnnotatedTests.test_special_form_containmentcCsB|�td��Gdd�dt�}Wd�dS1swYdS)NzCannot subclass .*Annotatedc@rO)z.AnnotatedTests.test_cannot_subclass.<locals>.CNrQrBrBrBrCr�rRr�r�r�rBrBrCrps"�z#AnnotatedTests.test_cannot_subclasscCsB|�t��tdttdf�Wd�dS1swYdS)NrA�positive)rZr[r\r/rhr]rBrBrC�test_cannot_check_instance�"�z)AnnotatedTests.test_cannot_check_instancecCsB|�t��ttttdf�Wd�dS1swYdS)Nr)rZr[r<rhr/r]rBrBrC�test_cannot_check_subclassrz)AnnotatedTests.test_cannot_check_subclasscCs:|�td��
ttWd�dS1swYdS)Nzat least two arguments)r#r[r/rhr]rBrBrC�test_too_few_type_argss
"�z%AnnotatedTests.test_too_few_type_argsc

Cs6tjtjttftjtttdftjtgtfg}|D]:}t	|df}t
tjd�D]*}|j
||d��t�||�}t�|�}|�||�Wd�n1sPwYq+qGdd�dtt�at	ttdf}d|_d	|_t
tjd�D]"}t�||�}	t�|	�}|�|jd�|�|jd	�|�|jd�qvdS)
N.rr�)�protocolrnc@r�)�_Annotated_test_Gr�Nr�rBrBrBrCr#r�rzA decorationrYr	)rHrrrhr�rrrr�r/rrrr�rrrdrrrrrBr�)
r>rr�r�Zprotr�Zrestoredr�rr<rBrBrCrs2�
���
�zAnnotatedTests.test_picklecCs�d}d}tt|f}|�|ttt|f�|�|tt|ftt||f�ttt|f}|�|tttt|f�|�t��|ttfWd�n1sSwY|�||tttt||f�ttjt	t
f|f}|�|ttfttjttf|f�|�t��|tWd�n1s�wYtt|f}|�t��|dWd�n1s�wY|t}|�t��
|dWd�dS1s�wYdS)Nr�zanother decoration)r/rrdrhrrZr[rHrr
rr�)r>r�Zdec2rr�r�ZItr�rBrBrC�
test_subst1s0"�"&
�
�
"�zAnnotatedTests.test_substcCs0tttdf}|�|ttttdf�dS)NrA)rr/rrdrhr�rBrBrC�test_annotated_in_other_typesNs z,AnnotatedTests.test_annotated_in_other_typescCs2Gdd�dttdf�}|�|j|ttfd�dS)Nc@rO)z,AnnotatedTests.test_annotated_mro.<locals>.XNrQrBrBrBrCr�Sr�r�r�z Annotated should be transparent.)r/rhrdrcr�r�rBrBrC�test_annotated_mroRs�z!AnnotatedTests.test_annotated_mroN)rLrMrNr�rfrYr�r�r�r�r�r�r�r�rrprrrrrr	r
rBrBrBrCr��s*

	r�c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�TypeAliasTestscC�t}dSrG�rP�r>r)rBrBrC�-test_canonical_usage_with_variable_annotationYr�z<TypeAliasTests.test_canonical_usage_with_variable_annotationcCrrGr
rrBrBrC�&test_canonical_usage_with_type_comment\r�z5TypeAliasTests.test_canonical_usage_with_type_commentcCs6|�t��t�Wd�dS1swYdSrG)rZr[r1r]rBrBrCrs_s"�z&TypeAliasTests.test_cannot_instantiatecCrWrX)rZr[r\r1r]rBrBrCrcr_z!TypeAliasTests.test_no_isinstancecCr�)Nc@seZdZUded<dS)z/TypeAliasTests.test_stringized_usage.<locals>.Ar1rNr�rBrBrBrCrlhrzrlr)rdrr1rorBrBrC�test_stringized_usagegsz$TypeAliasTests.test_stringized_usagecCr`rG)rZr[r<rPr1r]rBrBrC�test_no_issubclassls�"�z!TypeAliasTests.test_no_issubclasscCrj)Nc@rO�z.TypeAliasTests.test_cannot_subclass.<locals>.CNrQrBrBrBrCr�urRr�c@rOrrQrBrBrBrCr�yrR)rZr[r1rnr�rBrBrCrpss�"�z#TypeAliasTests.test_cannot_subclasscCrc)Nztyping.TypeAlias)rdrer1r]rBrBrCrf|rgzTypeAliasTests.test_reprcCrzrG)rZr[r1rhr]rBrBrC�test_cannot_subscriptr|z$TypeAliasTests.test_cannot_subscriptN)rLrMrNrrrsrrrrprfrrBrBrBrCrXs	rc@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�ParamSpecTestscCr�)Nr")r2rdr�rMrBrBrCr��r�zParamSpecTests.test_basic_plaincCs�td�}td�}t|tf}|�|j|tf�|�|j|f�t||f}|�|j||f�|�|j||f�tjj|tf}|�|j|tf�|�|j|f�tjj||f}|�|j||f�|�|j||f�dS�Nr"r)	r2r
rrhrdr�r�rr	�r>r"rrrrr rBrBrC�test_valid_uses�szParamSpecTests.test_valid_usescCstd�}td�}|�dt|��|�dt|��|�|jt�|�|jt�|�|jj	|�|�|jj	|�|�
|j|j�|�
|j|j�|�|j|j�|�|j|j�|�|j|j�|�|j|j�|�|j|j�|�
t|j�d�|�
t|j�d�dS)Nr"�P_2r�rX�P.args�P.kwargs)
r2r�r�r�r�r4rXr5r�r�rdr�re)r>r"rrBrBrC�test_args_kwargs�s"zParamSpecTests.test_args_kwargscCshtd�}Gdd�dt|�}|�t|t�t��dt|tfi�|�t|jt�t��|j	|j
d��dS)Nr"c@s(eZdZUedefed<d
dd�Zd	S)z)ParamSpecTests.test_stringized.<locals>.Cr"r!r�rrXrc_r�rGrB)r>r�rXrBrBrCr�r�z-ParamSpecTests.test_stringized.<locals>.C.fooN)r�rrXr)rLrMrNrrhrprrBrBrBrCr��s
r�r!)r�rX)r2rrdr�rrrrhrr�rXrrBrBrC�test_stringized�s$�zParamSpecTests.test_stringizedcs�td��td��td�}G��fdd�dt��f�}|t|f}|�|jt|f�|�|j|f�|�td��|tWd�n1sGwY|�td��|t|t	fWd�n1sdwY|tt
t|ff}|�|jtt
t|ff�|�|j|f�|tttgf}|�|jtttff�|�|jd�|td	f}|�|jttf�|�|jd�G�fd
d�dt��}|tt	tg}|�|jtt	tff�|�|jd�|tt	tf}	|�|	jtt	tff�|�|	jd�|�|j|	j�|�|j
|	j
�|�|j|	j�|�||	�|t}
|�|
jtff�|�|
jd�|�td��|tt	gtfWd�n	1�sBwY|�td��||tfWd�dS1�s`wYdS)Nrr"rcs&eZdZUe�efed<�ed<dS)z,ParamSpecTests.test_user_generics.<locals>.XrJr�N�rLrMrNrrhrprB�r"rrBrCr��s
r�r0r/rB.cseZdZUe�efed<dS)z,ParamSpecTests.test_user_generics.<locals>.ZrJNrrB)r"rBrCrZ�rQrZ)r
r2rrhrdr�r�r#r[r�r3r�r�r�)r>rr��G1�G2�G3ZG4rZZG5ZG6ZG7rBrrC�test_user_generics�sT
���$�z!ParamSpecTests.test_user_genericscs�td��td��G��fdd�dt��f�}|ttgtgf}|tgttgf}|�||�|�|jttftff�|�|jtfttff�dS)Nr"r,cs.eZdZUe�efed<e�efed<dS)zCParamSpecTests.test_multiple_paramspecs_in_user_generics.<locals>.XrJr�N)rLrMrNrrhrpr�rB�r"r,rBrCr��r[r�)r2rrhr�r�r�rdr�)r>r�r r!rBr$rC�)test_multiple_paramspecs_in_user_generics�sz8ParamSpecTests.test_multiple_paramspecs_in_user_genericsc
Cs�td�}td�}dtd|ttBtttff}|D]Y}|j|d��I|�t��tj	||f|tfWd�n1s<wY|�t��t
jj	||f|tfWd�n1s]wYWd�n1slwYqdS)Nrr"rYr�)r
r2rhr�rr�rZr[rHrrr	)r>rr"Zbad_argsr�rBrBrCr��s������z(ParamSpecTests.test_bad_var_substitutioncCs�td�}td�}|�|t|j�|�|t||fj�|�|t|j�|�|t||fj�|�|t|t	Bj�|�|t||ft	Bj�dS�Nrr")
r
r2r-rr�r�rr�r�rhr"rBrBrC�"test_no_paramspec_in__parameters__
sz1ParamSpecTests.test_no_paramspec_in__parameters__cCs�td�}td�}t||f}t|}t|}t|tB}|�|j||f�|�|j||f�|�|j||f�tttgt	f}|�|ttgt	ft|�|�|ttgt	ft|�|�|ttgt	ft|tB�dSr&)
r
r2rrr�rhrdr�r�r�)r>rr"rr r!r"r�rBrBrC�!test_paramspec_in_nested_genericss$z0ParamSpecTests.test_paramspec_in_nested_genericscCsVtd�}td�}t|tf}|�|j|f�|�||j|f�|�|tjd�|�|ttfjtf�|�|tt|fj|f�|�|tt|fjt|f�|�|djd�ttt|ftf}|�|j|f�|�||j|f�|�|tjd�|�|ttfjtf�|�|tt|fj|f�|�|tt|fjt|f�dS)Nr"r,rB.)r2rrhrdr�r�rr3)r>r"r,rrrBrBrC�test_paramspec_gets_copied,s""z)ParamSpecTests.test_paramspec_gets_copiedN)
rLrMrNr�rrrr#r%r�r'r(r)rBrBrBrCr�s6rc@rn)�ConcatenateTestscCs2td�}Gdd�d�}t||f}|�|t�dS)Nr"c@rO)z-ConcatenateTests.test_basics.<locals>.MyClassNrQrBrBrBrCr�Er�r�)r2r3r�)r>r"r�r�rBrBrCr�CszConcatenateTests.test_basicscCs td�}td�}ttt|ftf}|�|jtt|ftf�|�|j|f�ttt||f|f}|�|jtt||f|f�|�|j||f�tj	jtt|ftf}|�|jtt|ftf�|�|j|f�tj	jtt||f|f}|�|jtt||f|f�|�|j||f�dSr)
r2r
rr3rhrdr�r�rr	rrBrBrCrIsz ConcatenateTests.test_valid_usescCs�td�}td�}td�}t||f}|�|t|ftt|f�|�|tttgftttf�|�|tgftf�|�|ttt|ffttt|f�|�t��|tdfWd�n1scwYtt|f}|�||tt|f�|�|ttgtttf�|�|ttftttf�|�|gtf�|�|tt|fttt|f�|�t��
|dWd�dS1s�wYdS)Nrr"r,.)	r
r2r3rdrhr�r�rZr[)r>rr"r,r�rBrBrCr![s,��"
"�z&ConcatenateTests.test_var_substitutionN)rLrMrNr�rr!rBrBrBrCr*Bsr*c@rr)�TypeGuardTestscCs6ttdttfdd�}|�t|�dtti�dS)Nr�cSr�rGrBr�rBrBrCrur�z'TypeGuardTests.test_basics.<locals>.foo)r6rhrdr�r�rBrBrCr�rszTypeGuardTests.test_basicscCr)Nztyping.TypeGuardztyping.TypeGuard[int]ztyping.TypeGuard[%s.Employee]ztyping.TypeGuard[tuple[int]])rdrer6rhrPrLr�rrBrBrCrfxrzTypeGuardTests.test_reprcCr)Nc@rO�z.TypeGuardTests.test_cannot_subclass.<locals>.CNrQrBrBrBrCr��rRr�c@rOr,rQrBrBrBrCr��rR)rZr[rnr6rhr�rBrBrCrp�rz#TypeGuardTests.test_cannot_subclasscCrrG)rZr[r6rnrrhr]rBrBrCrI�rzTypeGuardTests.test_cannot_initcCrrH)rZr[r\r6rhr<r]rBrBrCr�rz!TypeGuardTests.test_no_isinstanceNrrBrBrBrCr+qs	r+�
SpecialAttrsP�
SpecialAttrsTc@s0eZdZdd�Ze�de�Zdd�Zdd�Z	dS)	�SpecialAttrsTestsc Cs�itjd�tjd�tjd�tjd�tjd�tjd�tjd�tjd�tj	d	�tj
d
�tjd�tjd�tj
d
�tjd�tjd�tjd�tjd�itjd�tjd�tjd�tjd�tjd�tjd�tjd�tjd�tjd�tjd�tjd�tjd�tjd�tjd�tj d �tj!d!�tj"d"��itj#d#�tj$d$�tj%d%�tj&d&�tjt'd�tjt'd�tjt't'fd�tjt'd�tjt'd�tjt'd�tjgt'fd�tjd't'fd�tj	t't'fd	�tj
t'd
�tjt'd�tjt'd�tj
t't't'fd
��itjt'd�tjt't'fd�tjt'd�tjt't'fd�tjt'd�tjt't't'fd�tjt't'fd�tjt'd�tjt'd�tjt'd�tjt'd�tjt't'fd�tjt'd�tjt't'fd�tjt'd�tjt'd�tjt't'fd��itj t'd �tj!t'd!�tj"t'd"�tj$t'd$�tj$t'd'fd$�tj%t'd%�tj&t'd&�tj(d(�tj'd)�tj)d*�tj*d+�tj+d,�tj,d-�tj-d.�tj.d/�tj/d0�tj0d1��tj1d2tj2d3tj3d4tj4d5tj(t'd6fd(tj)t'd*tj*t't5fd+tj+t'd,tj-t'd.tj-d7d.tj-d8d.tj0t'd1tj2t'd3tj4t'd)tj4t6t7fd5i�}|�8�D]V\}}|j9|d9��B|�:|j;|t<|��|�:|j=|t<|��|�:|j>d:t<|��t?t@jAd;�D]}t@�B||�}t@�C|�}|�D||��qCWd�n	1�scwY�qdS)<Nr�r�rPrrr�rrr�rr�rKr�r r�rrr�rMr��	ItemsViewr�r��KeysViewrr��MappingViewrrrr5r@r�r"r	rr%�
ValuesView.r/rrr3rr0rr&r	rr1r6r
rZ
Annotationr>rPrrHr�)ErHr�r�rPrrr�rrr�rr�rKr�r r�rrr�rMr�r0r�r�r1rr�r2rrrr5r@r�r"r	rr%r3rr/rr3rr0rr&r	rr1r6r
rr-rhr�r�r�rdrLr�rNrMrrrrrr�)r>Zcls_to_checkr?r�rrrrBrBrCr��s��������	�
���
������������������� �!�"�#�$�%�&�'�
)�
*�+�
,�
-�
.�/�0�1�
2�
3�
4�5�
6�7�
8�9�
:�;�<�
=�
>�
?�
@�A�
B�C�
D�
E�F�
G�
H�
I�
J�K�
L�
M�O�P�Q�R�S�T�U�V�W�X�Y







�p
����z$SpecialAttrsTests.test_special_attrs�SpecialAttrsTests.TypeNamec	Cs�t�d�}|�t|d��|�t|d��|�|jd�ttjd�D]}|�	t
��t�||�Wd�n1s;wYq#|�tj
jd�|�tj
jd�|�tj
jt�ttjd�D]}t�tj
|�}t�|�}|�tj
|�q`|�tjd�|�ttd��|�tjt�ttjd�D]}t�t|�}t�|�}|�t|�q�|�tjd	�|�ttd��|�tjt�ttjd�D]}t�t|�}t�|�}|�t|�q�dS)
Nzset[Any]rLrNrHr��TypeNamer4r.r-)rHr0r�r�rdrMrrrrZr[rr/r5rLrNrr�r.r-)r>r/rrrrBrBrC�test_special_attrs2sJ
����


�z%SpecialAttrsTests.test_special_attrs2cCs@Gdd�dtt�}|�dt|t��|�dt|t��dS)Nc@seZdZdd�ZdZdS)z4SpecialAttrsTests.test_genericalias_dir.<locals>.FoocSr�rGrBr]rBrBrCrBOr�z8SpecialAttrsTests.test_genericalias_dir.<locals>.Foo.barr:N)rLrMrNrBrErBrBrBrCrKNsrKrBrE)rrr�r�rhr�rBrBrC�test_genericalias_dirMsz'SpecialAttrsTests.test_genericalias_dirN)
rLrMrNr�rHr&rr5r6r7rBrBrBrCr/�s
{2r/c@s eZdZdZdd�Zdd�ZdS)�AllTestszTests for __all__.cCs�ddlm}|�d|�|�d|�|�d|�|�d|�|�d|�|�d|�|�d	|�|�d
|�|�d|�|�d|�|�d
|�|�d|�|�d|�dS)Nr)r�r�r3rr�rKr��ior��osr�ZTextr;r5)rHr�r�r-r�rBrBrC�test_all[szAllTests.test_allcs4ttj���fdd�tt���D�}|�|��dS)Ncsnh|]3\}}|�vs3|�d�s5|tjjvr5|tjjvr5|dvr5|�d�s5|��|ks5t|dd�tjkr|�qS)�_>r�r9)r�Z_contraZ_corMN)	r�rHr9r�r�r�upperr�rLr��Z
actual_allrBrC�	<setcomp>ss���
z3AllTests.test_all_exported_names.<locals>.<setcomp>)r�rHr��varsr�ZassertSetEqual)r>Zcomputed_allrBr>rC�test_all_exported_namesqs



�z AllTests.test_all_exported_namesN)rLrMrN�__doc__r;rArBrBrBrCr8Xsr8�__main__)�rhrrr�r�ZunittestrrrrrrrHrr	r
rrr
rrrrrrrrrrrrrrrrrrr r!r"r#r%r&r'r(r*r+r,r-r.r/r0r1r2r3r4r5r6r	rr�rr7r8r9rPrSrTrUrVrwrr�r�r�r1r6r7r�r�rZr[r\rfrnrsrwryr{r|r~r�r�r�r�r�rQrrr#r$r�Z
ASYNCIO_TESTSr��ImportErrorrdr�r�r�r�r�r�rlr�r�r�r�r�r�r�r�r�r�r�rKrLr�r�r�rhr�rlr�r��er�r�r�r�r�reror{r�r�r�r�r�rrr*r+r-r��complexr.r/r8rLrBrBrBrC�<module>s6*"l,u^~}'1{$��jOc'M#<<,?/
'=
0
�