HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/test/__pycache__/test_typing.cpython-38.opt-2.pyc
U

.D�g0��
@s*ddlZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZmZddl
mZmZddl
mZmZddl
mZmZmZddl
mZmZmZddl
mZmZmZdd	l
mZdd
l
mZmZmZmZm Z ddl
m!Z!m"Z"ddl
m#Z#dd
l
m$Z$m%Z%ddl
m&Z&m'Z'ddl
m(Z(ddl
m)Z)ddl
m*Z*m+Z+ddl
m,Z,m-Z-m.Z.ddl
m/Z/m0Z0ddl1Z1ddl
Z
ddl2Z2ddl3Z3ddl4m5Z5Gdd�de�Z6Gdd�d�Z7Gdd�de7�Z8Gdd�de7�Z9Gdd�de8e9�Z:Gdd �d e6�Z;Gd!d"�d"e6�Z<Gd#d$�d$e6�Z=Gd%d&�d&e6�Z>Gd'd(�d(e6�Z?Gd)d*�d*e6�Z@Gd+d,�d,e6�ZAed-eBeC�ZDed.�ZEGd/d0�d0eeDeEf�ZFGd1d2�d2eFeDeEf�ZGGd3d4�d4e �ZHe"Gd5d6�d6eHe ��ZIGd7d8�d8�ZJGd9d:�d:e �ZKGd;d<�d<e �ZLe"Gd=d>�d>eKeLe ��ZMe"Gd?d@�d@e ��ZNGdAdB�dBeN�ZOGdCdD�dD�ZPGdEdF�dFe*�ZQe"GdGdH�dHe ��ZRGdIdJ�dJe6�ZSGdKdL�dLe6�ZTGdMdN�dNe6�ZUGdOdP�dPe6�ZVGdQdR�dRe6�ZWGdSdT�dTe6�ZXGdUdV�dVe6�ZYdWZZze[eZ�Wne\k
�r�dXZ]YnXdYZ]ddZl4m^Z^m_Z_m`Z`dd[l
maZaGd\d]�d]�ZbGd^d_�d_eb�ZcGd`da�daec�ZdGdbdc�dcee�ZeGddde�de�ZfGdfdg�dg�ZgGdhdi�die*�ZhGdjdk�dke*�ZiGdldm�dme*�ZjGdndo�doe*�Zke+dpdqeBfg�ZlGdrds�dse+�ZmGdtdu�duemel�ZnGdvdw�dwe+dXdx�ZoGdydz�dze5jb�Zpeaeqd{�d|d}�Zrzeres���td�Wn$euk
�rRZvzW5dZv[vXYnXe#ZwGd~d�d�ZxGd�d��d�e6�ZyGd�d��d�e�ZzGd�d��d�e6�Z{Gd�d��d�e6�Z|Gd�d��d�e6�Z}Gd�d��d�e6�Z~Gd�d��d�e6�ZGd�d��d�e6�Z�Gd�d��d�e6�Z�Gd�d��d�e6�Z�Gd�d��d�e6�Z�e�d�k�r&e�dS)��N)�TestCase�main�
skipUnless�SkipTest�skip)�copy�deepcopy)�Any�NoReturn)�TypeVar�AnyStr)�T�KT�VT)�Union�Optional�Literal)�Tuple�List�MutableMapping)�Callable)�Generic�ClassVar�Final�final�Protocol)�cast�runtime_checkable)�get_type_hints)�
get_origin�get_args)�
no_type_check�no_type_check_decorator��Type)�NewType)�
NamedTuple�	TypedDict)�IO�TextIO�BinaryIO)�Pattern�Match)�mod_generics_cachec@s(eZdZddd�Zd	dd�Zdd�ZdS)
�BaseTestCaseNcCs8t||�s4d||f}|dk	r*|d|7}|�|��dS)Nz%r is not a subclass of %r� : %s��
issubclassZfailureException��self�clsZclass_or_tuple�msg�message�r7�//opt/cppython/lib/python3.8/test/test_typing.py�assertIsSubclass#s

zBaseTestCase.assertIsSubclasscCs8t||�r4d||f}|dk	r*|d|7}|�|��dS)Nz%r is a subclass of %rr/r0r2r7r7r8�assertNotIsSubclass*s

z BaseTestCase.assertNotIsSubclasscCstjD]
}|�qdS�N)�typingZ	_cleanups�r3�fr7r7r8�clear_caches1s
zBaseTestCase.clear_caches)N)N)�__name__�
__module__�__qualname__r9r:r?r7r7r7r8r.!s

r.c@seZdZdS)�EmployeeN�r@rArBr7r7r7r8rC6srCc@seZdZdS)�ManagerNrDr7r7r7r8rE:srEc@seZdZdS)�FounderNrDr7r7r7r8rF>srFc@seZdZdS)�ManagingFounderNrDr7r7r7r8rGBsrGc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�AnyTestsc	Cs$|�t��tdt�W5QRXdS�N�*)�assertRaises�	TypeError�
isinstancer	�r3r7r7r8�test_any_instance_type_errorHsz%AnyTests.test_any_instance_type_errorc	CsD|�t��ttt�W5QRX|�t��ttt�W5QRXdSr;)rKrLr1rCr	rNr7r7r8�test_any_subclass_type_errorLsz%AnyTests.test_any_subclass_type_errorcCs|�tt�d�dS)Nz
typing.Any)�assertEqual�reprr	rNr7r7r8�	test_reprRszAnyTests.test_reprc	CsB|�t��tdt�W5QRX|�t��ttW5QRXdSrI)rKrLr1r	�intrNr7r7r8�test_errorsUszAnyTests.test_errorsc	CsT|�t��Gdd�dt�}W5QRX|�t��Gdd�dtt��}W5QRXdS)Nc@seZdZdS�z(AnyTests.test_cannot_subclass.<locals>.ANrDr7r7r7r8�A]srWc@seZdZdSrVrDr7r7r7r8rW`s�rKrLr	�type�r3rWr7r7r8�test_cannot_subclass[szAnyTests.test_cannot_subclassc	Cs@|�t��t�W5QRX|�t��tt��W5QRXdSr;rXrNr7r7r8�test_cannot_instantiatecsz AnyTests.test_cannot_instantiatecCs"tjttjttjtdSr;)r<r,r	r+r(rNr7r7r8�test_any_works_with_aliasis

z"AnyTests.test_any_works_with_aliasN)
r@rArBrOrPrSrUr[r\r]r7r7r7r8rHFsrHc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
NoReturnTestsc	Cs$|�t��tdt�W5QRXdSrI)rKrLrMr
rNr7r7r8�!test_noreturn_instance_type_errorrsz/NoReturnTests.test_noreturn_instance_type_errorc	CsD|�t��ttt�W5QRX|�t��ttt�W5QRXdSr;)rKrLr1rCr
rNr7r7r8�!test_noreturn_subclass_type_errorvsz/NoReturnTests.test_noreturn_subclass_type_errorcCs|�tt�d�dS)Nztyping.NoReturn)rQrRr
rNr7r7r8rS|szNoReturnTests.test_reprc	Cs"|�t��ttW5QRXdSr;)rKrLr
rTrNr7r7r8�test_not_genericszNoReturnTests.test_not_genericc	CsT|�t��Gdd�dt�}W5QRX|�t��Gdd�dtt��}W5QRXdS)Nc@seZdZdS�z-NoReturnTests.test_cannot_subclass.<locals>.ANrDr7r7r7r8rW�srWc@seZdZdSrbrDr7r7r7r8rW�s�rKrLr
rYrZr7r7r8r[�sz"NoReturnTests.test_cannot_subclassc	Cs@|�t��t�W5QRX|�t��tt��W5QRXdSr;rcrNr7r7r8r\�sz%NoReturnTests.test_cannot_instantiateN)	r@rArBr_r`rSrar[r\r7r7r7r8r^psr^c@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�TypeVarTestscCs$td�}|�||�|�|t�dS�Nr
)rrQ�assertIsInstance�r3r
r7r7r8�test_basic_plain�szTypeVarTests.test_basic_plainc	Cs,td�}|�t��td|�W5QRXdS)Nr
rJ)rrKrLrMrgr7r7r8� test_typevar_instance_type_error�sz-TypeVarTests.test_typevar_instance_type_errorc	CsLtd�}|�t��tt|�W5QRX|�t��t|t�W5QRXdSre)rrKrLr1rTrgr7r7r8� test_typevar_subclass_type_error�s
z-TypeVarTests.test_typevar_subclass_type_errorc	Cs(|�t��tdt�}|W5QRXdS)N�X)rKrLrrT)r3rkr7r7r8�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)Nrk�Y)	r�assertNotEqualrQrrT�__args__�__parameters__�assertIs�
__origin__)r3rkrmr7r7r8�test_union_unique�szTypeVarTests.test_union_uniquecCs(tdtt�}|�t|tft|�dS�NrW)r�str�bytesrnrrZr7r7r8�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)rQrRr
rrrr)r3rxr{r7r7r8rS�szTypeVarTests.test_reprcCs4|�td�td��|�tdtt�tdtt��dSre)rnrrTrurNr7r7r8�test_no_redefinition�sz!TypeVarTests.test_no_redefinitionc	Cs.|�t��Gdd�dtd��}W5QRXdS)Nc@seZdZdS)z1TypeVarTests.test_cannot_subclass_vars.<locals>.VNrDr7r7r7r8�V�sr~r
�rKrLr�r3r~r7r7r8�test_cannot_subclass_vars�sz&TypeVarTests.test_cannot_subclass_varsc	Cs*|�t��Gdd�dt�}W5QRXdS)Nc@seZdZdS)z7TypeVarTests.test_cannot_subclass_var_itself.<locals>.VNrDr7r7r7r8r~�sr~rr�r7r7r8�test_cannot_subclass_var_itself�sz,TypeVarTests.test_cannot_subclass_var_itselfc	Cs$|�t��td��W5QRXdSrtrrNr7r7r8�test_cannot_instantiate_vars�sz)TypeVarTests.test_cannot_instantiate_varsc	CsL|�t��tddd�W5QRX|�t��tdtttd�W5QRXdS)NrkrJ�Zbound)rKrLrru�floatrCrNr7r7r8�test_bound_errors�szTypeVarTests.test_bound_errorscCsd}t|i�dS)Nz&import typing
T = typing.TypeVar('T')
)�exec)r3�coder7r7r8�test_missing__name__�sz!TypeVarTests.test_missing__name__c	Cs(|�t��tdddd�W5QRXdS)Nr
T)rzr|)rK�
ValueErrorrrNr7r7r8�test_no_bivariant�szTypeVarTests.test_no_bivariantN)r@rArBrhrirjrlrsrwrSr}r�r�r�r�r�r�r7r7r7r8rd�s

rdc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�
UnionTestscCstttf}|�|t�dSr;)rrTr�rn�r3�ur7r7r8�test_basics�szUnionTests.test_basicsc	Cs�|�t��ttt�W5QRX|�t��ttt�W5QRX|�t��tttttf�W5QRX|�t��ttttft�W5QRXdSr;)rKrLr1rTrrurNr7r7r8�test_subclass_error�szUnionTests.test_subclass_errorcCsltt}|�|t�tttf}tttf}tttf}|�||�|�|t�|�|t�|�|t�dSr;)rr	rQrT�objectrn)r3r��u1�u2�u3r7r7r8�test_union_any�szUnionTests.test_union_anycCsTtt}|�|t�tttf}tttf}|�||�|�|t�|�|t�dSr;)rr�rQrTrn)r3r�r�r�r7r7r8�test_union_objectszUnionTests.test_union_objectcCs(tttf}tttf}|�||�dSr;)rrTr�rQ)r3r�r�r7r7r8�test_unorderedszUnionTests.test_unorderedcCstt}|�|t�dSr;)rrCrq)r3�tr7r7r8�test_single_class_disappearssz'UnionTests.test_single_class_disappearscCs8tttf}|�|t�|�t|j�|�t|j�dSr;)rrCrErn�assertInror�r7r7r8�test_base_class_keptszUnionTests.test_base_class_keptcCs2tttf}t|tf}|�|ttttf�dSr;)rrTr�rCrQ)r3r��vr7r7r8�test_union_unionszUnionTests.test_union_unioncCs�|�tt�d�tttf}|�t|�dt�tttf}|�t|�dt�td�}t|tft}|�t|�tt��ttttf}|�t|�d�dS)Nztyping.Unionztyping.Union[%s.Employee, int]ztyping.Union[int, %s.Employee]r
z#typing.Union[typing.List[int], int])rQrRrrCrTr@rr)r3r�r
r7r7r8rS#szUnionTests.test_reprc	Cs�|�t��Gdd�dt�}W5QRX|�t��Gdd�dtt��}W5QRX|�t��Gdd�dtttf�}W5QRXdS)Nc@seZdZdS�z*UnionTests.test_cannot_subclass.<locals>.CNrDr7r7r7r8�C1sr�c@seZdZdSr�rDr7r7r7r8r�4sc@seZdZdSr�rDr7r7r7r8r�7s)rKrLrrYrTru�r3r�r7r7r8r[/szUnionTests.test_cannot_subclassc	Cs�|�t��t�W5QRX|�t��tt��W5QRXtttf}|�t��|�W5QRX|�t��t|��W5QRXdSr;)rKrLrrYrTr�r�r7r7r8r\:sz"UnionTests.test_cannot_instantiatecCs�|�tttjtftk�|�tttjtftjtk�|�ttttjtfj�|�tjttttjtfj�dSr;)�assertFalserrur<�IterablerTr�rorNr7r7r8�test_union_generalizationEs"z$UnionTests.test_union_generalizationcCsb|�tt�|�tt�|�tt�|�tt�|�dgt�|�ttj�|�ttjt�dSr;)	rnrr�r	rrr<�MappingrrNr7r7r8�test_union_compare_otherKsz#UnionTests.test_union_compare_othercCs$tt}ttdf}|�||�dSr;)rrTrrQ)r3�or�r7r7r8�
test_optionalTszUnionTests.test_optionalc	Cs"|�t��tdW5QRXdS�Nr7)rKrLrrNr7r7r8�
test_emptyYszUnionTests.test_emptyc	Cs,|�t��tdtttf�W5QRXdSrI)rKrLrMrrTrurNr7r7r8�test_union_instance_type_error]sz)UnionTests.test_union_instance_type_errorcCs2tttf}|d�dd�}|�t|�d|�dS)N��xcSsdSr;r7r�r7r7r8r>c�z(UnionTests.test_no_eval_union.<locals>.fr�)rrTrurqr)r3r�r>r7r7r8�test_no_eval_unionaszUnionTests.test_no_eval_unioncCs*td�dd�}|�tt|tf�d�dS)N��returncSsdSr;r7r7r7r7r8�fungr�z0UnionTests.test_function_repr_union.<locals>.funztyping.Union[fun, int])rTrQrRr)r3r�r7r7r8�test_function_repr_unionfsz#UnionTests.test_function_repr_unioncCstttf}|dSr;)rrur+rZr7r7r8�test_union_str_patternjsz!UnionTests.test_union_str_patterncsVzddlm�Wntk
r,td��YnXt�tf�fdd�}t|tfdS)Nr��ElementzcElementTree not foundcs�|�Sr;r7)�argsr�r7r8�Elemxsz#UnionTests.test_etree.<locals>.Elem)Zxml.etree.cElementTreer��ImportErrorrrru)r3r�r7r�r8�
test_etreeoszUnionTests.test_etreeN)r@rArBr�r�r�r�r�r�r�r�rSr[r\r�r�r�r�r�r�r�r�r�r7r7r7r8r��s(
		r�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
TupleTestsc	Cs�|�t��tttttf�W5QRX|�t��tttttf�W5QRXGdd�dt�}|�ttt��|�t|t��dS)Nc@seZdZdS)z"TupleTests.test_basics.<locals>.TPNrDr7r7r7r8�TP�sr�)rKrLr1rrTru�tuple�
assertTrue)r3r�r7r7r8r��szTupleTests.test_basicscCsd|�tttt�|�ttdfttdf�|�tttttf�|�ttttdf�dS�N.)rQrrTrnrNr7r7r8�
test_equality�szTupleTests.test_equalitycCs$Gdd�dt�}|�t|t��dS)Nc@seZdZdS)z/TupleTests.test_tuple_subclass.<locals>.MyTupleNrDr7r7r7r8�MyTuple�sr�)r�r�r1r)r3r�r7r7r8�test_tuple_subclass�szTupleTests.test_tuple_subclassc	Cs8|�t��tdtttf�W5QRX|�dt�dS)N)rr)rKrLrMrrTrfrNr7r7r8�test_tuple_instance_type_error�sz)TupleTests.test_tuple_instance_type_errorcCsX|�tt�d�|�ttd�d�|�ttttf�d�|�tttdf�d�dS)Nztyping.Tupler7ztyping.Tuple[()]ztyping.Tuple[int, float].ztyping.Tuple[int, ...])rQrRrrTr�rNr7r7r8rS�szTupleTests.test_reprc	CsH|�t��tdt�W5QRX|�t��tdtt�W5QRXdSrI)rKrLr1rrTrNr7r7r8rU�szTupleTests.test_errorsN)	r@rArBr�r�r�r�rSrUr7r7r7r8r�~s
r�c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�
CallableTestsc	CsT|�t��(|�ttdd��ttgtf��W5QRX|�ttdd��t��dS)NcSs|Sr;r7r�r7r7r8�<lambda>�r�z2CallableTests.test_self_subclass.<locals>.<lambda>cSs|Sr;r7r�r7r7r8r��r�)rKrLr�r1rYrrTrNr7r7r8�test_self_subclass�s,z CallableTests.test_self_subclasscCs�|�ttgtfttgtf�|�tttgtfttgtfh�d�|�ttgtfttgtf�|�ttgtfttgtf�|�ttgtftttgtf�|�ttgtftgtf�|�ttgtft�dS�N�)rQrrT�lenrnrurNr7r7r8�test_eq_hash�s (  "zCallableTests.test_eq_hashc	Cs�|�t��t�W5QRX|�t��tt��W5QRXttgtf}|�t��|�W5QRX|�t��t|��W5QRXdSr;)rKrLrrYrTru)r3�cr7r7r8r\�sz%CallableTests.test_cannot_instantiatec	Cs�|�t��tdgtfW5QRX|�t��tdtfW5QRX|�t��tdgtfW5QRX|�t��ttdgdfW5QRX|�t��ttW5QRXdS)N.r7r��)rKrLrrTrNr7r7r8�test_callable_wrong_forms�sz'CallableTests.test_callable_wrong_formscCs$dd�}|�|t�|�dt�dS)NcSsdSr;r7r7r7r7r8r>�sz5CallableTests.test_callable_instance_works.<locals>.f)rfr�assertNotIsInstancer=r7r7r8�test_callable_instance_works�sz*CallableTests.test_callable_instance_worksc	Cs�dd�}|�t��|�|tgdf�W5QRX|�t��|�|tgtf�W5QRX|�t��|�dtgdf�W5QRX|�t��|�dtgtf�W5QRXdS)NcSsdSr;r7r7r7r7r8r>�sz:CallableTests.test_callable_instance_type_error.<locals>.f)rKrLrfrr	r�r=r7r7r8�!test_callable_instance_type_error�sz/CallableTests.test_callable_instance_type_errorcCs\tgtf}|�t|�d�tttgtf}|�t|�d�tdtf}|�t|�d�dS)Nztyping.Callable[[], bool]z"typing.Callable[[str, float], int].ztyping.Callable[..., str])r�boolrQrRrur�rT)r3Zct0Zct2Zctvr7r7r8rS�szCallableTests.test_reprcCs>tdtfd�dd�}|�t|t�t��dtdtfi�dS)N.��acSsdSr;r7r�r7r7r8�foo�sz6CallableTests.test_callable_with_ellipsis.<locals>.foor�)rr
rQr�globals�locals�r3r�r7r7r8�test_callable_with_ellipsis�s�z)CallableTests.test_callable_with_ellipsiscCstjtdtfdSr�)r<rrrurNr7r7r8�test_ellipsis_in_generic�sz&CallableTests.test_ellipsis_in_genericN)r@rArBr�r�r\r�r�r�rSr�r�r7r7r7r8r��s	r�c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�LiteralTestscCsPtdtdtdtdtdtdttdtdftddS)	Nr��r�r��)r��y�zT)r��2F)r�r�)��)sfoo�bar)rrNr7r7r8r��szLiteralTests.test_basicscCs*tttdtddd�ttdS)N)y@@.r7r�r��r�r�)rrTr
rNr7r7r8�3test_illegal_parameters_do_not_raise_runtime_errorssz@LiteralTests.test_illegal_parameters_do_not_raise_runtime_errorscCsttdttddS)Nr�)r�r��baz)rrrNr7r7r8� test_literals_inside_other_types	sz-LiteralTests.test_literals_inside_other_typescCsd|�ttd�d�|�ttd�d�|�ttt�d�|�tt�d�|�ttd�d�dS)Nr�ztyping.Literal[1])r�Tr�ztyping.Literal[1, True, 'foo']ztyping.Literal[int]ztyping.Literalztyping.Literal[None])rQrRrrTrNr7r7r8rS
s
zLiteralTests.test_reprc	Cs�|�t��t�W5QRX|�t��td�W5QRX|�t��tt��W5QRX|�t��ttd��W5QRXdSr�)rKrLrrYrNr7r7r8�test_cannot_initszLiteralTests.test_cannot_initc	Cs�|�t��tdtd�W5QRX|�t��tttd�W5QRX|�t��tdtd�W5QRX|�t��tttd�W5QRXdSr�)rKrLrMrrTr1rNr7r7r8� test_no_isinstance_or_issubclasssz-LiteralTests.test_no_isinstance_or_issubclassc	CsT|�t��Gdd�dtd�}W5QRX|�t��Gdd�dt�}W5QRXdS)Nc@seZdZdS)z-LiteralTests.test_no_subclassing.<locals>.FooNrDr7r7r7r8�Foo*sr�r�c@seZdZdS)z-LiteralTests.test_no_subclassing.<locals>.BarNrDr7r7r7r8�Bar,sr��rKrLr)r3r�r�r7r7r8�test_no_subclassing(sz LiteralTests.test_no_subclassingc	Cs&|�t��tddW5QRXdSr�r�rNr7r7r8�test_no_multiple_subscripts.sz(LiteralTests.test_no_multiple_subscriptsN)r@rArBr�r�r�rSr�r�r�r�r7r7r7r8r��s

r��XK�XVc@s@eZdZeed�dd�Zeed�dd�Zdeeed�d	d
�ZdS)�
SimpleMapping)�keyr�cCsdSr;r7�r3r�r7r7r8�__getitem__9szSimpleMapping.__getitem__)r��valuecCsdSr;r7�r3r�r�r7r7r8�__setitem__<szSimpleMapping.__setitem__N)r��defaultr�cCsdSr;r7�r3r�r�r7r7r8�get?szSimpleMapping.get)N)r@rArBr�r�r�r�r�r7r7r7r8r�7sr�c@s@eZdZdd�Zed�dd�Zed�dd�Zded�d	d
�ZdS)�MySimpleMappingcCs
i|_dSr;��storerNr7r7r8�__init__EszMySimpleMapping.__init__)r�cCs
|j|Sr;r�r�r7r7r8r�HszMySimpleMapping.__getitem__cCs||j|<dSr;r�r�r7r7r8r�KszMySimpleMapping.__setitem__NcCs*z|j|WStk
r$|YSXdSr;)r��KeyErrorr�r7r7r8r�NszMySimpleMapping.get)N)r@rArBr�rur�r�r�r7r7r7r8r�Csr�c@seZdZUeed<eed<dS)�
Coordinater�r�N�r@rArBrT�__annotations__r7r7r7r8r�Us
r�c@seZdZUeed<dS)�Point�labelN)r@rArBrurr7r7r7r8rYs
rc@s&eZdZUeed<eed<eed<dS)�MyPointr�r�rN�r@rArBrTrrur7r7r7r8r]s
rc@seZdZUeed<dS)�XAxisr�Nr�r7r7r7r8rbs
rc@seZdZUeed<dS)�YAxisr�Nr�r7r7r7r8res
rc@seZdZdS)�PositionNrDr7r7r7r8rhsrc@s&eZdZUeed<eed�dd�ZdS)�Proto�attr��argr�cCsdSr;r7�r3rr7r7r8�methosz
Proto.methN)r@rArBrTrrur
r7r7r7r8rls
rc@seZdZdS)�ConcreteNrDr7r7r7r8rrsrc@s*eZdZUdZeed<eed�dd�ZdS)�Otherr�r	r
cCs|dkrdSdS)N�thisr�rr7rr7r7r8r
wsz
Other.methN)r@rArBr	rTrrur
r7r7r7r8rus
rc@seZdZUeed<eed<dS)�NTr�r�Nr�r7r7r7r8r|s
rc@seZdZUejed<dS)�HasCallProtocol�__call__N)r@rArBr<rrr7r7r7r8r�s
rc@sdeZdZdd�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-dWS)X�
ProtocolTestscCs�tGdd�dt��}Gdd�d�}Gdd�d�}dd�}|�||�|�|�|�|�||�|�|�|�|�tj|�|�||�dS)	Nc@seZdZdd�ZdS)z,ProtocolTests.test_basic_protocol.<locals>.PcSsdSr;r7rNr7r7r8r
�sz1ProtocolTests.test_basic_protocol.<locals>.P.methN�r@rArBr
r7r7r7r8�P�src@seZdZdS)z,ProtocolTests.test_basic_protocol.<locals>.CNrDr7r7r7r8r��sr�c@seZdZdd�ZdS)z,ProtocolTests.test_basic_protocol.<locals>.DcSsdSr;r7rNr7r7r8r
�sz1ProtocolTests.test_basic_protocol.<locals>.D.methNrr7r7r7r8�D�srcSsdSr;r7r7r7r7r8r>�sz,ProtocolTests.test_basic_protocol.<locals>.f)rrr9rfr:r��types�FunctionType)r3rr�rr>r7r7r8�test_basic_protocol�sz!ProtocolTests.test_basic_protocolcCsrtGdd�dt��}Gdd�d�}dd�}ttt|tjfD]}|�||�q:t�ddt|fD]}|�	||�q\dS)	Nc@seZdZdS)zFProtocolTests.test_everything_implements_empty_protocol.<locals>.EmptyNrDr7r7r7r8�Empty�src@seZdZdS)zBProtocolTests.test_everything_implements_empty_protocol.<locals>.CNrDr7r7r7r8r��sr�cSsdSr;r7r7r7r7r8r>�szBProtocolTests.test_everything_implements_empty_protocol.<locals>.fr�r7)
rrr�rYr�rrr9r<rf)r3rr�r>�thingr7r7r8�)test_everything_implements_empty_protocol�sz7ProtocolTests.test_everything_implements_empty_protocolcCsdd�}|�|t�dS)NcSsdSr;r7r7r7r7r8r>�sz:ProtocolTests.test_function_implements_protocol.<locals>.f)rfrr=r7r7r8�!test_function_implements_protocol�sz/ProtocolTests.test_function_implements_protocolc	Cs�Gdd�d�}Gdd�dt�}|�t��Gdd�d|t�}W5QRX|�t��Gdd�dt|�}W5QRX|�t��Gdd�d||t�}W5QRXGd	d
�d
||�}Gdd�d||�}|�|�|�|�|�|�dS)
Nc@seZdZdS)z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.CNrDr7r7r7r8r��sr�c@seZdZdS)z:ProtocolTests.test_no_inheritance_from_nominal.<locals>.BPNrDr7r7r7r8�BP�src@seZdZdS�z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.PNrDr7r7r7r8r�src@seZdZdSr rDr7r7r7r8r�sc@seZdZdSr rDr7r7r7r8r�sc@seZdZdS)z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.DNrDr7r7r7r8r�src@seZdZdS)z9ProtocolTests.test_no_inheritance_from_nominal.<locals>.ENrDr7r7r7r8�E�sr!)rrKrLr�)r3r�rrrr!r7r7r8� test_no_inheritance_from_nominal�sz.ProtocolTests.test_no_inheritance_from_nominalc	Cs�Gdd�dt�}|�t��|�W5QRXGdd�d|�}|�|�|�td�}Gdd�dt|�}|�t��|�W5QRX|�t��|t�W5QRX|�t��||�W5QRXGdd	�d	||�}|�|t�|�dS)
Nc@seZdZdS)z.ProtocolTests.test_no_instantiation.<locals>.PNrDr7r7r7r8r�src@seZdZdS)z.ProtocolTests.test_no_instantiation.<locals>.CNrDr7r7r7r8r��sr�r
c@seZdZdS)z/ProtocolTests.test_no_instantiation.<locals>.PGNrDr7r7r7r8�PG�sr#c@seZdZdS)z/ProtocolTests.test_no_instantiation.<locals>.CGNrDr7r7r7r8�CG�sr$)rrKrLrfrrT)r3rr�r
r#r$r7r7r8�test_no_instantiation�sz#ProtocolTests.test_no_instantiationc	CsbtGdd�dt��}Gdd�d|�}Gdd�d|�}|�t��|�W5QRX|�|�|�dS)Nc@s eZdZejed�dd��ZdS)z9ProtocolTests.test_cannot_instantiate_abstract.<locals>.Pr�cSst�dSr;)�NotImplementedErrorrNr7r7r8�ameth�sz?ProtocolTests.test_cannot_instantiate_abstract.<locals>.P.amethN)r@rArB�abc�abstractmethodrTr'r7r7r7r8r�src@seZdZdS)z9ProtocolTests.test_cannot_instantiate_abstract.<locals>.BNrDr7r7r7r8�B�sr*c@seZdZed�dd�ZdS)z9ProtocolTests.test_cannot_instantiate_abstract.<locals>.Cr�cSsdS)N�r7rNr7r7r8r'�sz?ProtocolTests.test_cannot_instantiate_abstract.<locals>.C.amethN)r@rArBrTr'r7r7r7r8r��sr�)rrrKrLrf)r3rr*r�r7r7r8� 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@seZdZdd�ZdS)z5ProtocolTests.test_subprotocols_extending.<locals>.P1cSsdSr;r7rNr7r7r8�meth1�sz;ProtocolTests.test_subprotocols_extending.<locals>.P1.meth1N�r@rArBr-r7r7r7r8�P1�sr/c@seZdZdd�ZdS)z5ProtocolTests.test_subprotocols_extending.<locals>.P2cSsdSr;r7rNr7r7r8�meth2�sz;ProtocolTests.test_subprotocols_extending.<locals>.P2.meth2N�r@rArBr0r7r7r7r8�P2�sr2c@seZdZdd�Zdd�ZdS)z4ProtocolTests.test_subprotocols_extending.<locals>.CcSsdSr;r7rNr7r7r8r-�sz:ProtocolTests.test_subprotocols_extending.<locals>.C.meth1cSsdSr;r7rNr7r7r8r0sz:ProtocolTests.test_subprotocols_extending.<locals>.C.meth2N�r@rArBr-r0r7r7r7r8r��sr�c@seZdZdd�ZdS)z5ProtocolTests.test_subprotocols_extending.<locals>.C1cSsdSr;r7rNr7r7r8r-sz;ProtocolTests.test_subprotocols_extending.<locals>.C1.meth1Nr.r7r7r7r8�C1sr4c@seZdZdd�ZdS)z5ProtocolTests.test_subprotocols_extending.<locals>.C2cSsdSr;r7rNr7r7r8r0sz;ProtocolTests.test_subprotocols_extending.<locals>.C2.meth2Nr1r7r7r7r8�C2sr5�rrr�r:rfr9)r3r/r2r�r4r5r7r7r8�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@seZdZdd�ZdS)z3ProtocolTests.test_subprotocols_merging.<locals>.P1cSsdSr;r7rNr7r7r8r-sz9ProtocolTests.test_subprotocols_merging.<locals>.P1.meth1Nr.r7r7r7r8r/sr/c@seZdZdd�ZdS)z3ProtocolTests.test_subprotocols_merging.<locals>.P2cSsdSr;r7rNr7r7r8r0sz9ProtocolTests.test_subprotocols_merging.<locals>.P2.meth2Nr1r7r7r7r8r2sr2c@seZdZdS)z2ProtocolTests.test_subprotocols_merging.<locals>.PNrDr7r7r7r8rsrc@seZdZdd�Zdd�ZdS)z2ProtocolTests.test_subprotocols_merging.<locals>.CcSsdSr;r7rNr7r7r8r- sz8ProtocolTests.test_subprotocols_merging.<locals>.C.meth1cSsdSr;r7rNr7r7r8r0#sz8ProtocolTests.test_subprotocols_merging.<locals>.C.meth2Nr3r7r7r7r8r�sr�c@seZdZdd�ZdS)z3ProtocolTests.test_subprotocols_merging.<locals>.C1cSsdSr;r7rNr7r7r8r-'sz9ProtocolTests.test_subprotocols_merging.<locals>.C1.meth1Nr.r7r7r7r8r4&sr4c@seZdZdd�ZdS)z3ProtocolTests.test_subprotocols_merging.<locals>.C2cSsdSr;r7rNr7r7r8r0+sz9ProtocolTests.test_subprotocols_merging.<locals>.C2.meth2Nr1r7r7r7r8r5*sr5r6)r3r/r2rr�r4r5r7r7r8�test_subprotocols_mergingsz'ProtocolTests.test_subprotocols_mergingc	Cs^td�}tGdd�dt��}tGdd�dt|��}Gdd�dt�}Gdd	�d	t|�}Gd
d�d�}|�||�|�||�|�||�|�t��t|||�W5QRX|�t��t|||�W5QRX|�t��t||�W5QRX|�t��t||�W5QRX|�t��t|||�W5QRX|�t��t||t�W5QRXdS)Nr
c@seZdZdd�ZdS)z2ProtocolTests.test_protocols_issubclass.<locals>.PcSsdSr;r7rNr7r7r8r�:r�z4ProtocolTests.test_protocols_issubclass.<locals>.P.xN�r@rArBr�r7r7r7r8r8src@seZdZdd�ZdS)z3ProtocolTests.test_protocols_issubclass.<locals>.PGcSsdSr;r7rNr7r7r8r�>r�z5ProtocolTests.test_protocols_issubclass.<locals>.PG.xNr9r7r7r7r8r#<sr#c@seZdZdd�ZdS)z5ProtocolTests.test_protocols_issubclass.<locals>.BadPcSsdSr;r7rNr7r7r8r�Ar�z7ProtocolTests.test_protocols_issubclass.<locals>.BadP.xNr9r7r7r7r8�BadP@sr:c@seZdZdd�ZdS)z6ProtocolTests.test_protocols_issubclass.<locals>.BadPGcSsdSr;r7rNr7r7r8r�Dr�z8ProtocolTests.test_protocols_issubclass.<locals>.BadPG.xNr9r7r7r7r8�BadPGCsr;c@seZdZdd�ZdS)z2ProtocolTests.test_protocols_issubclass.<locals>.CcSsdSr;r7rNr7r7r8r�Gr�z4ProtocolTests.test_protocols_issubclass.<locals>.C.xNr9r7r7r7r8r�Fsr�)rrrr9rKrLr1rT�r3r
rr#r:r;r�r7r7r8�test_protocols_issubclass5s.z'ProtocolTests.test_protocols_issubclassc	Cs�Gdd�d�}tGdd�dt��}|�t��t||�W5QRX|�|�|�|�|�|�t��t||�W5QRX|�|�|�Gdd�d|�}|�||�|�|�|�|�|�|�	||�|�|�|�|�t��t||�W5QRXdS)Nc@seZdZdZdS)z?ProtocolTests.test_protocols_issubclass_non_callable.<locals>.Cr�Nr9r7r7r7r8r�[sr�c@seZdZdZdS)zFProtocolTests.test_protocols_issubclass_non_callable.<locals>.PNonCallr�Nr9r7r7r7r8�PNonCall^sr>c@seZdZdS)z?ProtocolTests.test_protocols_issubclass_non_callable.<locals>.DNrDr7r7r7r8rksr)
rrrKrLr1rf�registerr:r�r9)r3r�r>rr7r7r8�&test_protocols_issubclass_non_callableZs$

z4ProtocolTests.test_protocols_issubclass_non_callablec	Cstd�}tGdd�dt��}tGdd�dt|��}Gdd�dt�}Gdd	�d	t|�}Gd
d�d�}|�|�|�|�|�|�|�t��t|�||�W5QRX|�t��t|�||�W5QRX|�t��t|�|�W5QRX|�t��t|�|�W5QRXdS)Nr
c@seZdZdd�ZdS)z2ProtocolTests.test_protocols_isinstance.<locals>.PcSsdSr;r7r�r7r7r8r
zr�z7ProtocolTests.test_protocols_isinstance.<locals>.P.methNrr7r7r7r8rxsrc@seZdZdd�ZdS)z3ProtocolTests.test_protocols_isinstance.<locals>.PGcSsdSr;r7r�r7r7r8r
~r�z8ProtocolTests.test_protocols_isinstance.<locals>.PG.methNrr7r7r7r8r#|sr#c@seZdZdd�ZdS)z5ProtocolTests.test_protocols_isinstance.<locals>.BadPcSsdSr;r7r�r7r7r8r
�r�z:ProtocolTests.test_protocols_isinstance.<locals>.BadP.methNrr7r7r7r8r:�sr:c@seZdZdd�ZdS)z6ProtocolTests.test_protocols_isinstance.<locals>.BadPGcSsdSr;r7r�r7r7r8r
�r�z;ProtocolTests.test_protocols_isinstance.<locals>.BadPG.methNrr7r7r7r8r;�sr;c@seZdZdd�ZdS)z2ProtocolTests.test_protocols_isinstance.<locals>.CcSsdSr;r7r�r7r7r8r
�r�z7ProtocolTests.test_protocols_isinstance.<locals>.C.methNrr7r7r7r8r��sr�)rrrrfrKrLrMr<r7r7r8�test_protocols_isinstanceus$z'ProtocolTests.test_protocols_isinstancecCsGdd�d�}Gdd�d�}Gdd�d�}Gdd�d�}|�|d	d
d�t�|�|d	d
�t�|�t�t�|�|d	d
�t�|�t�t�|�t�t�|�|d�t�|�|�t�|�|�t�|�|�t�|�|�t�|�t�t�|�td	d
�t�dS)
Nc@seZdZdd�ZdS)z<ProtocolTests.test_protocols_isinstance_py36.<locals>.APointcSs||_||_||_dSr;�r�r�r)r3r�r�rr7r7r8r��szEProtocolTests.test_protocols_isinstance_py36.<locals>.APoint.__init__N�r@rArBr�r7r7r7r8�APoint�srDc@seZdZdZdd�ZdS)z<ProtocolTests.test_protocols_isinstance_py36.<locals>.BPointr*cSs||_||_dSr;�r�r�)r3r�r�r7r7r8r��szEProtocolTests.test_protocols_isinstance_py36.<locals>.BPoint.__init__N)r@rArBrr�r7r7r7r8�BPoint�srFc@seZdZdd�Zdd�ZdS)z7ProtocolTests.test_protocols_isinstance_py36.<locals>.CcSs
||_dSr;�r	�r3r	r7r7r8r��sz@ProtocolTests.test_protocols_isinstance_py36.<locals>.C.__init__cSsdS�Nrr7rr7r7r8r
�sz<ProtocolTests.test_protocols_isinstance_py36.<locals>.C.methN)r@rArBr�r
r7r7r7r8r��sr�c@seZdZdS)z9ProtocolTests.test_protocols_isinstance_py36.<locals>.BadNrDr7r7r7r8�Bad�srJr�r�rWrJ)	rfrr�rrrrrr)r3rDrFr�rJr7r7r8�test_protocols_isinstance_py36�s"z,ProtocolTests.test_protocols_isinstance_py36cCsftd�}tGdd�dt��}tGdd�dt|��}Gdd�d�}|�|d�|�|�|d�|�dS)	Nr
c@seZdZdZdS)z7ProtocolTests.test_protocols_isinstance_init.<locals>.Pr�Nr9r7r7r7r8r�src@seZdZdZdS)z8ProtocolTests.test_protocols_isinstance_init.<locals>.PGr�Nr9r7r7r7r8r#�sr#c@seZdZdd�ZdS)z7ProtocolTests.test_protocols_isinstance_init.<locals>.CcSs
||_dSr;r��r3r�r7r7r8r��sz@ProtocolTests.test_protocols_isinstance_init.<locals>.C.__init__NrCr7r7r7r8r��sr�r�)rrrrf)r3r
rr#r�r7r7r8�test_protocols_isinstance_init�sz,ProtocolTests.test_protocols_isinstance_initc	Cs�Gdd�dtt�}Gdd�d|t�}Gdd�d�}Gdd�d�}|t}|�|�|�|�||�Gd	d
�d
|t�}Gdd�d|t�}|t}|�|�|�|�||�dS)
Nc@seZdZdS)z=ProtocolTests.test_protocol_checks_after_subscript.<locals>.PNrDr7r7r7r8r�src@seZdZdS)z=ProtocolTests.test_protocol_checks_after_subscript.<locals>.CNrDr7r7r7r8r��sr�c@seZdZdS)zBProtocolTests.test_protocol_checks_after_subscript.<locals>.Other1NrDr7r7r7r8�Other1�srNc@seZdZdS)zBProtocolTests.test_protocol_checks_after_subscript.<locals>.Other2NrDr7r7r7r8�Other2�srOc@seZdZdS)z>ProtocolTests.test_protocol_checks_after_subscript.<locals>.D1NrDr7r7r7r8�D1�srPc@seZdZdS)z>ProtocolTests.test_protocol_checks_after_subscript.<locals>.D2NrDr7r7r7r8�D2�srQ)rr
r	r�r:rTrfr9)	r3rr�rNrOZCArPrQ�CIr7r7r8�$test_protocol_checks_after_subscript�sz2ProtocolTests.test_protocol_checks_after_subscriptcCsvtGdd�dt��}Gdd�dt�}Gdd�d|�}Gdd�d�}|�|�|�|�|�|�|�|�|�|�dS)	Nc@seZdZdZdS)z8ProtocolTests.test_protocols_support_register.<locals>.Pr�Nr9r7r7r7r8r�src@seZdZdd�ZdS)z9ProtocolTests.test_protocols_support_register.<locals>.PMcSsdSr;r7rNr7r7r8r
�r�z>ProtocolTests.test_protocols_support_register.<locals>.PM.methNrr7r7r7r8�PM�srTc@seZdZdS)z8ProtocolTests.test_protocols_support_register.<locals>.DNrDr7r7r7r8r�src@seZdZdS)z8ProtocolTests.test_protocols_support_register.<locals>.CNrDr7r7r7r8r��sr�)rrr?rf)r3rrTrr�r7r7r8�test_protocols_support_register�s

z-ProtocolTests.test_protocols_support_registercCs`tGdd�dt��}Gdd�d�}Gdd�d|�}Gdd�d�}|�|�|�|�|�|�dS)	Nc@seZdZdZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.Pr�Nr9r7r7r7r8r�src@seZdZdZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.Ar�Nr9r7r7r7r8rW�srWc@seZdZdZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.BNr9r7r7r7r8r*�sr*c@seZdZdd�ZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.CcSs
d|_dSr;r�rNr7r7r8r��szWProtocolTests.test_none_on_non_callable_doesnt_block_implementation.<locals>.C.__init__NrCr7r7r7r8r��sr�)rrrf�r3rrWr*r�r7r7r8�5test_none_on_non_callable_doesnt_block_implementation�szCProtocolTests.test_none_on_non_callable_doesnt_block_implementationcCs`tGdd�dt��}Gdd�d�}Gdd�d|�}Gdd�d�}|�|�|�|�|�|�dS)	Nc@seZdZdd�ZdS)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.PcSsdSr;r7rNr7r7r8r�r�zFProtocolTests.test_none_on_callable_blocks_implementation.<locals>.P.xNr9r7r7r7r8rsrc@seZdZdd�ZdS)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.AcSsdSr;r7rNr7r7r8r�r�zFProtocolTests.test_none_on_callable_blocks_implementation.<locals>.A.xNr9r7r7r7r8rWsrWc@seZdZdZdS)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.BNr9r7r7r7r8r*sr*c@seZdZdd�ZdS)zDProtocolTests.test_none_on_callable_blocks_implementation.<locals>.CcSs
d|_dSr;r�rNr7r7r8r�szMProtocolTests.test_none_on_callable_blocks_implementation.<locals>.C.__init__NrCr7r7r7r8r�
sr�)rrr�rVr7r7r8�+test_none_on_callable_blocks_implementation�sz9ProtocolTests.test_none_on_callable_blocks_implementationcCs�Gdd�dt�}tGdd�dt��}Gdd�d|�}Gdd�d|�}Gd	d
�d
�}Gdd�d�}|�|�|�|�|�|�|�||�|�||�|�|�|�|�||�dS)
Nc@seZdZdZdS)z5ProtocolTests.test_non_protocol_subclasses.<locals>.Pr�Nr9r7r7r7r8rsrc@seZdZdd�ZdS)z6ProtocolTests.test_non_protocol_subclasses.<locals>.PRcSsdSr;r7rNr7r7r8r
r�z;ProtocolTests.test_non_protocol_subclasses.<locals>.PR.methNrr7r7r7r8�PRsrYc@seZdZdZdS)z8ProtocolTests.test_non_protocol_subclasses.<locals>.NonPr�Nr9r7r7r7r8�NonPsrZc@seZdZdS)z9ProtocolTests.test_non_protocol_subclasses.<locals>.NonPRNrDr7r7r7r8�NonPRsr[c@seZdZdZdS)z5ProtocolTests.test_non_protocol_subclasses.<locals>.Cr�Nr9r7r7r7r8r�sr�c@seZdZdd�ZdS)z5ProtocolTests.test_non_protocol_subclasses.<locals>.DcSsdSr;r7rNr7r7r8r
"r�z:ProtocolTests.test_non_protocol_subclasses.<locals>.D.methNrr7r7r7r8r!srr6)r3rrYrZr[r�rr7r7r8�test_non_protocol_subclassessz*ProtocolTests.test_non_protocol_subclassescCstGdd�dt�}Gdd�d�}Gdd�d�}Gdd�d|�}|�|�|�|�|�|�|�||�|�||�dS)	Nc@seZdZdZdS)z1ProtocolTests.test_custom_subclasshook.<locals>.Pr�Nr9r7r7r7r8r,src@seZdZdS)z7ProtocolTests.test_custom_subclasshook.<locals>.OKClassNrDr7r7r7r8�OKClass/sr]c@seZdZdZdS)z8ProtocolTests.test_custom_subclasshook.<locals>.BadClassr�Nr9r7r7r7r8�BadClass1sr^c@seZdZedd��ZdS)z1ProtocolTests.test_custom_subclasshook.<locals>.CcSs|j�d�S�N�OK)r@�
startswith�r4�otherr7r7r8�__subclasshook__5szBProtocolTests.test_custom_subclasshook.<locals>.C.__subclasshook__N�r@rArB�classmethodrdr7r7r7r8r�4sr�)rrfr�r9r:)r3rr]r^r�r7r7r8�test_custom_subclasshook+sz&ProtocolTests.test_custom_subclasshookc	CsHtGdd�dt��}Gdd�d�}|�t��t|�|�W5QRXdS)Nc@seZdZdZdS)z8ProtocolTests.test_issubclass_fails_correctly.<locals>.Pr�Nr9r7r7r7r8r?src@seZdZdS)z8ProtocolTests.test_issubclass_fails_correctly.<locals>.CNrDr7r7r7r8r�Csr�)rrrKrLr1)r3rr�r7r7r8�test_issubclass_fails_correctly>s
z-ProtocolTests.test_issubclass_fails_correctlyc	Cs�td�}td�}tGdd�dt||f��}Gdd�d|t|ft|�}|�t��|tW5QRX|�t��|ttfW5QRX|�t��|tdfW5QRX|�t��|ttfW5QRXGdd	�d	|t|f�}|�|t�|�dS)
Nr
�Sc@seZdZdd�ZdS)z9ProtocolTests.test_defining_generic_protocols.<locals>.PRcSsdSr;r7rNr7r7r8r
Nr�z>ProtocolTests.test_defining_generic_protocols.<locals>.PR.methNrr7r7r7r8rYLsrYc@seZdZdZdS)z8ProtocolTests.test_defining_generic_protocols.<locals>.Pr�N�r@rArBr�r7r7r7r8rPsrr�c@seZdZdS)z8ProtocolTests.test_defining_generic_protocols.<locals>.CNrDr7r7r7r8r�\sr�)	rrrrTrKrLrurrf)r3r
rirYrr�r7r7r8�test_defining_generic_protocolsHsz-ProtocolTests.test_defining_generic_protocolsc	sLtd��td�}tGdd�dtt�|f��}Gdd�d|ttft�}|�t��t|ttf|�W5QRX|�	||�|�t��|tW5QRX|�t��|tdfW5QRXG�fdd	�d	tt��}G�fd
d�dt�t�}tGdd
�d
|tt��}Gdd�d�}|�
|�|�|�t��|ttfW5QRXdS)Nr
ric@seZdZdd�ZdS)zCProtocolTests.test_defining_generic_protocols_old_style.<locals>.PRcSsdSr;r7rNr7r7r8r
fr�zHProtocolTests.test_defining_generic_protocols_old_style.<locals>.PR.methNrr7r7r7r8rYdsrYc@seZdZdZdS)zBProtocolTests.test_defining_generic_protocols_old_style.<locals>.Pr�Nrjr7r7r7r8rhsrr�cseZdZ�ed�dd�ZdS)zCProtocolTests.test_defining_generic_protocols_old_style.<locals>.P1�r�r�cSsdSr;r7rLr7r7r8r�tr�zGProtocolTests.test_defining_generic_protocols_old_style.<locals>.P1.barN�r@rArBrur�r7�r
r7r8r/ssr/cseZdZ�ed�dd�ZdS)zCProtocolTests.test_defining_generic_protocols_old_style.<locals>.P2rlcSsdSr;r7rLr7r7r8r�wr�zGProtocolTests.test_defining_generic_protocols_old_style.<locals>.P2.barNrmr7rnr7r8r2vsr2c@seZdZdZdS)zEProtocolTests.test_defining_generic_protocols_old_style.<locals>.PSubr�Nr9r7r7r7r8�PSubysroc@s eZdZdZeed�dd�ZdS)zEProtocolTests.test_defining_generic_protocols_old_style.<locals>.Testr�rlcSs|Sr;r7rLr7r7r8r��szIProtocolTests.test_defining_generic_protocols_old_style.<locals>.Test.barN)r@rArBr�rur�r7r7r7r8�Test}srp)rrrrrTrurKrLr1r9rfr)r3rirYrr/r2rorpr7rnr8�)test_defining_generic_protocols_old_style`s(z7ProtocolTests.test_defining_generic_protocols_old_stylecCsHtd�}Gdd�dt|�}Gdd�d||�}|�|t�jd�dS)Nr
c@seZdZdS)z)ProtocolTests.test_init_called.<locals>.PNrDr7r7r7r8r�src@seZdZdd�ZdS)z)ProtocolTests.test_init_called.<locals>.CcSs
d|_dSr_)�testrNr7r7r8r��sz2ProtocolTests.test_init_called.<locals>.C.__init__NrCr7r7r7r8r��sr�r`)rrrQrTrr)r3r
rr�r7r7r8�test_init_called�szProtocolTests.test_init_calledc	Cs�td�}td�}|�t��Gdd�dt||f�}W5QRX|�t��Gdd�dtt�}W5QRX|�t�� Gdd�dt|t|�}W5QRX|�t��&Gdd�dtj||ft|�}W5QRXdS)Nr
ric@seZdZdS�z6ProtocolTests.test_protocols_bad_subscripts.<locals>.PNrDr7r7r7r8r�src@seZdZdSrtrDr7r7r7r8r�sc@seZdZdSrtrDr7r7r7r8r�sc@seZdZdSrtrDr7r7r7r8r�s)rrKrLrrTr<r��r3r
rirr7r7r8�test_protocols_bad_subscripts�s"$z+ProtocolTests.test_protocols_bad_subscriptscCsdtd�}td�}Gdd�dt||f�}|�t|||f��d��|�t|ttf��d��dS)Nr
ric@seZdZdS)z4ProtocolTests.test_generic_protocols_repr.<locals>.PNrDr7r7r7r8r�srz	P[~T, ~S]zP[int, str])rrr�rR�endswithrTrurur7r7r8�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
ric@seZdZdS)z2ProtocolTests.test_generic_protocols_eq.<locals>.PNrDr7r7r7r8r�sr)rrrQrTrrurur7r7r8�test_generic_protocols_eq�s"�z'ProtocolTests.test_generic_protocols_eqcCshtd�}Gdd�dt|�}|�|j|f�|�|tjd�|�|tjtf�|�|tj|�dS)Nr
c@seZdZdS)zDProtocolTests.test_generic_protocols_special_from_generic.<locals>.PNrDr7r7r7r8r�srr7)rrrQrprTrorqrr)r3r
rr7r7r8�+test_generic_protocols_special_from_generic�sz9ProtocolTests.test_generic_protocols_special_from_genericcCs�tGdd�dt��}Gdd�dt�}td�}Gdd�dt|�}|�|j�|�|j�|�|j�|�|j�|�|j�|�|tj�|�t	�
|�dh�|�t	�
|�d	h�|�tt	�
|��td	dh��dS)
Nc@seZdZdZdS)zFProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PRr�Nr9r7r7r7r8rY�srYc@seZdZdd�ZdS)zEProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PcSsdSr;r7rNr7r7r8r
�szJProtocolTests.test_generic_protocols_special_from_protocol.<locals>.P.methNrr7r7r7r8r�srr
c@seZdZdZdd�ZdS)zFProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PGr�cSsdSr;r7rNr7r7r8r
�szKProtocolTests.test_generic_protocols_special_from_protocol.<locals>.PG.methN)r@rArBr�r
r7r7r7r8r#�sr#r
r�)rrrr�Z_is_protocolr�Z_is_runtime_protocolrTrQr<Z_get_protocol_attrs�	frozenset)r3rYrr
r#r7r7r8�,test_generic_protocols_special_from_protocol�s 
�z:ProtocolTests.test_generic_protocols_special_from_protocolc	Csf|�t��tGdd�d��}W5QRXGdd�dt�}|�t��tGdd�d|��}W5QRXdS)Nc@seZdZdS)z8ProtocolTests.test_no_runtime_deco_on_nominal.<locals>.CNrDr7r7r7r8r��sr�c@seZdZdZdS)z<ProtocolTests.test_no_runtime_deco_on_nominal.<locals>.Protor�Nr9r7r7r7r8r�src@seZdZdS)z?ProtocolTests.test_no_runtime_deco_on_nominal.<locals>.ConcreteNrDr7r7r7r8r�sr)rKrLrr)r3r�rrr7r7r8�test_no_runtime_deco_on_nominal�sz-ProtocolTests.test_no_runtime_deco_on_nominalcCs�tGdd�dt��}Gdd�dt�}|�|�|�Gdd�d�}Gdd�d�}|�|�|�|�|�|�Gd	d
�d
�}Gdd�d�}|�|�|�|�|�|�dS)
Nc@seZdZdZdS)z4ProtocolTests.test_none_treated_correctly.<locals>.PNr9r7r7r7r8r�src@seZdZdS)z4ProtocolTests.test_none_treated_correctly.<locals>.BNrDr7r7r7r8r*�sr*c@seZdZdZdS)z4ProtocolTests.test_none_treated_correctly.<locals>.Cr�Nr9r7r7r7r8r��sr�c@seZdZdZdS)z4ProtocolTests.test_none_treated_correctly.<locals>.DNr9r7r7r7r8r�src@seZdZdd�ZdS)z5ProtocolTests.test_none_treated_correctly.<locals>.CIcSs
d|_dSr�r�rNr7r7r8r��sz>ProtocolTests.test_none_treated_correctly.<locals>.CI.__init__NrCr7r7r7r8rR�srRc@seZdZdd�ZdS)z5ProtocolTests.test_none_treated_correctly.<locals>.DIcSs
d|_dSr;r�rNr7r7r8r��sz>ProtocolTests.test_none_treated_correctly.<locals>.DI.__init__NrCr7r7r7r8�DI�sr~)rrr�r�rf)r3rr*r�rrRr~r7r7r8�test_none_treated_correctly�sz)ProtocolTests.test_none_treated_correctlycCs@Gdd�dt�}tjtj|f}tj|tjf}|�||�dS)Nc@seZdZdZdS)z1ProtocolTests.test_protocols_in_unions.<locals>.PNr9r7r7r7r8rsr)rr<rr�rQ)r3rZAliasZAlias2r7r7r8�test_protocols_in_unionssz&ProtocolTests.test_protocols_in_unionsc	Cs�td�}tGdd�dt|��aGdd�dtt�at�}d|_d|_tt	j
d�D]�}t	�||�}t	�|�}|�
|jd�|�
|jd�|�
|jd�|�
|jddd	��t	�t�}t	�|�}Gd
d�d�}|�|�|�qTdS)Nr
c@seZdZdZdS)rr�Nr9r7r7r7r8rsrc@seZdZdS)�CPNrDr7r7r7r8r�sr�rJr(r�r�c@seZdZdZdS)z2ProtocolTests.test_protocols_pickleable.<locals>.Er�Nr9r7r7r7r8r!"sr!)rrrrrTr�r�r��range�pickle�HIGHEST_PROTOCOL�dumps�loadsrQr��__dict__rf)	r3r
r��protor�r��srr!r7r7r8�test_protocols_pickleable
s$


z'ProtocolTests.test_protocols_pickleablecCs |�ttj�|�ttj�dSr;)r9rTr<�SupportsIntr:rurNr7r7r8�test_supports_int'szProtocolTests.test_supports_intcCs |�ttj�|�ttj�dSr;)r9r�r<Z
SupportsFloatr:rurNr7r7r8�test_supports_float+sz!ProtocolTests.test_supports_floatcCs.Gdd�d�}|�|tj�|�ttj�dS)Nc@seZdZdd�ZdS)z.ProtocolTests.test_supports_complex.<locals>.CcSsdS)Nyr7rNr7r7r8�__complex__3sz:ProtocolTests.test_supports_complex.<locals>.C.__complex__N)r@rArBr�r7r7r7r8r�2sr�)r9r<�SupportsComplexr:rur�r7r7r8�test_supports_complex/sz#ProtocolTests.test_supports_complexcCs.Gdd�d�}|�|tj�|�ttj�dS)Nc@seZdZdd�ZdS)z,ProtocolTests.test_supports_bytes.<locals>.BcSsdS�Nr�r7rNr7r7r8�	__bytes__=sz6ProtocolTests.test_supports_bytes.<locals>.B.__bytes__N)r@rArBr�r7r7r7r8r*<sr*)r9r<�
SupportsBytesr:ru)r3r*r7r7r8�test_supports_bytes9sz!ProtocolTests.test_supports_bytescCs.|�ttj�|�ttj�|�ttj�dSr;)r9r�r<�SupportsAbsrTr:rurNr7r7r8�test_supports_absCszProtocolTests.test_supports_abscCs:tttj�|�ttj�|�ttj�|�ttj�dSr;)r1r�r<Z
SupportsRoundr9rTr:rurNr7r7r8�test_supports_roundHsz!ProtocolTests.test_supports_roundcCs |�ttj�|�ttj�dSr;)r9�listr<�
Reversibler:rTrNr7r7r8�test_reversibleNszProtocolTests.test_reversiblecCs |�ttj�|�ttj�dSr;)r9rTr<Z
SupportsIndexr:rurNr7r7r8�test_supports_indexRsz!ProtocolTests.test_supports_indexcCsF|�dtj�Gdd�dtj�}Gdd�d|�}|�}|�||�dS)Nrc@seZdZed�dd�ZdS)z>ProtocolTests.test_bundled_protocol_instance_works.<locals>.C1r�cSsdSrIr7rNr7r7r8�__int__YszFProtocolTests.test_bundled_protocol_instance_works.<locals>.C1.__int__N)r@rArBrTr�r7r7r7r8r4Xsr4c@seZdZdS)z>ProtocolTests.test_bundled_protocol_instance_works.<locals>.C2NrDr7r7r7r8r5[sr5)rfr<r�r�)r3r4r5r�r7r7r8�$test_bundled_protocol_instance_worksVs
z2ProtocolTests.test_bundled_protocol_instance_workscCsRtGdd�dtjjt��}Gdd�d�}Gdd�d�}|�||�|�||�dS)Nc@seZdZdd�ZdS)z@ProtocolTests.test_collections_protocols_allowed.<locals>.CustomcSsdSr;r7rNr7r7r8�closecr�zFProtocolTests.test_collections_protocols_allowed.<locals>.Custom.closeN)r@rArBr�r7r7r7r8�Customasr�c@seZdZdS)z;ProtocolTests.test_collections_protocols_allowed.<locals>.ANrDr7r7r7r8rWesrWc@seZdZdd�Zdd�ZdS)z;ProtocolTests.test_collections_protocols_allowed.<locals>.BcSsgSr;r7rNr7r7r8�__iter__gszDProtocolTests.test_collections_protocols_allowed.<locals>.B.__iter__cSsdSrIr7rNr7r7r8r�iszAProtocolTests.test_collections_protocols_allowed.<locals>.B.closeN)r@rArBr�r�r7r7r7r8r*fsr*)r�collectionsr(r�rr9r:)r3r�rWr*r7r7r8�"test_collections_protocols_allowed`sz0ProtocolTests.test_collections_protocols_allowedc	Cs@|�t��Gdd�dtt�}W5QRXGdd�dtjt�}dS)Nc@seZdZdS)zEProtocolTests.test_builtin_protocol_whitelist.<locals>.CustomProtocolNrDr7r7r7r8�CustomProtocolqsr�c@seZdZdS)zKProtocolTests.test_builtin_protocol_whitelist.<locals>.CustomContextManagerNrDr7r7r7r8�CustomContextManagertsr�)rKrLrrr<�ContextManager)r3r�r�r7r7r8�test_builtin_protocol_whitelistosz-ProtocolTests.test_builtin_protocol_whitelistN).r@rArBrrrr"r%r,r7r8r=r@rArKrMrSrUrWrXr\rgrhrkrqrsrvrxryrzr|r}rr�r�r�r�r�r�r�r�r�r�r�r�r�r7r7r7r8r�sV #%%
'	




rc@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�GenericTestsc	Cs�tttf}|�|jd�|�t��|tW5QRX|�t��|ttfW5QRXtttf}|�|jtf�|t|�t��|ttfW5QRXtttf}|�t��t	|t�W5QRX|�
|�t�dSr�)r�rur	rQrprKrLr�rTr1rf)r3rkrmZSM1r7r7r8r�yszGenericTests.test_basicsc	Csvtd�}td�}|�t��t|�W5QRX|�t��t||W5QRX|�t��t||W5QRX|�t�� Gdd�dt|t|�}W5QRX|�t��tgtt�W5QRX|�t��tttt�W5QRX|�t��Gdd�dt�}W5QRX|�t�� Gdd�dt|t|�}W5QRX|�t�� Gd	d�dt|t|�}W5QRXdS)
Nr
ric@seZdZdS)z+GenericTests.test_generic_errors.<locals>.CNrDr7r7r7r8r��sr�c@seZdZdS)z4GenericTests.test_generic_errors.<locals>.NewGenericNrDr7r7r7r8�
NewGeneric�sr�c@seZdZdS�z3GenericTests.test_generic_errors.<locals>.MyGenericNrDr7r7r7r8�	MyGeneric�sr�c@seZdZdSr�rDr7r7r7r8r��s)	rrKrLrrMrrTr1r�)r3r
rir�r�r�r7r7r8�test_generic_errors�s($$z GenericTests.test_generic_errorsc	CsZtd�}td�}|�t��t||fW5QRX|�t��t|||fW5QRXdS)Nr
ri)rrKrLr)r3r
rir7r7r8�	test_init�szGenericTests.test_initc	Cs�Gdd�dtjt�}Gdd�d|�}|�|jd�|�t��|jW5QRXd|_d|_Gdd	�d	|�}Gd
d�d|t�}|�|jd�|�|jd�|�|jd�dS)NcseZdZ�fdd�Z�ZS)z*GenericTests.test_init_subclass.<locals>.Xcst�jf|�d|_dSrI)�super�__init_subclass__r	)r4�kwargs��	__class__r7r8r��sz<GenericTests.test_init_subclass.<locals>.X.__init_subclass__�r@rArBr��
__classcell__r7r7r�r8rk�srkc@seZdZdS)z*GenericTests.test_init_subclass.<locals>.YNrDr7r7r7r8rm�srmrJr�r�c@seZdZdS)z*GenericTests.test_init_subclass.<locals>.ZNrDr7r7r7r8�Z�sr�c@seZdZdS)z*GenericTests.test_init_subclass.<locals>.WNrDr7r7r7r8�W�sr�)r<rr
rQr	rK�AttributeErrorrT)r3rkrmr�r�r7r7r8�test_init_subclass�szGenericTests.test_init_subclasscCs4|�tt�dt�d��|�tt�dt�d��dS)Nz<class 'z.SimpleMapping'>z.MySimpleMapping'>)rQrRr�r@r�rNr7r7r8rS�s

�

�zGenericTests.test_reprcCs�td�}td�}Gdd�dt|�}|t||f}|�||t||f�|�||t||f�||tf}|�|||tf�|�|||tf�|�|||tf�|t}|�||t�|�||t�|�|||�|�t|��d��dS)Nr
ric@seZdZdS)z'GenericTests.test_chain_repr.<locals>.CNrDr7r7r7r8r��sr�z.C[typing.Tuple[str, int]])	rrrrQrnrTrur�rw)r3r
rir�rkrmr�r7r7r8�test_chain_repr�s"�zGenericTests.test_chain_reprcCs�td�}tddd�}td�}|�tt�d�|�tt|�d�|�tt|�d�|�tt||t�d	�|�ttt�d	�dS)
Nr
�UTryriztyping.Listztyping.List[~T]ztyping.List[+U]ztyping.List[int])rrQrRrrT)r3r
r�rir7r7r8�
test_new_repr�szGenericTests.test_new_reprcCs~td�}td�}|�ttj||f||f�d�|�ttt||ft|f�d�|�ttt||ftt�d�dS)Nr
�TSztyping.Mapping[~TS, ~T]z"typing.List[typing.Tuple[int, ~T]]z=typing.List[typing.Tuple[typing.List[int], typing.List[int]]])rrQrRr<r�rrrT)r3r
r�r7r7r8�test_new_repr_complex�s"��z"GenericTests.test_new_repr_complexcCsZtd�}|�tt|�d�|�ttj|�d�Gdd�dtjttf�}t|j�dS)Nr
ztyping.Generic[~T]ztyping.Protocol[~T]c@seZdZdS)z*GenericTests.test_new_repr_bare.<locals>.CNrDr7r7r7r8r��sr�)	rrQrRrr<r�Dictr	�__mro__�r3r
r�r7r7r8�test_new_repr_bare�s
zGenericTests.test_new_repr_barecCsptd�}Gdd�dt|�}|�}d|_|�|jddi�Gdd�d|t�}|�}d|_|�|jd	di�dS)
Nr
c@seZdZdS)z!GenericTests.test_dict.<locals>.BNrDr7r7r7r8r*�sr*rJr�c@seZdZdS)z!GenericTests.test_dict.<locals>.CNrDr7r7r7r8r�sr�r(r�)rrr�rQr�rTr�)r3r
r*�br�r�r7r7r8�	test_dict�szGenericTests.test_dictcCsTtd�}Gdd�dt|�}|�|tjd�|�||tjd�d||t_|�|jd�|�|tjd�d|tt_|�|jd�|�|ttjd�|�|�jd�|�|tt�jd�Gdd�d||�}|�|tjd�|�|jd�d	|_d
|t_|�|jd�|�|tjd�|�|jd
�|�|tjd	�dS)Nr
c@seZdZdZdS)z<GenericTests.test_subscripted_generics_as_proxies.<locals>.C�defNr9r7r7r7r8r�sr�r��changed�newc@seZdZdS)z<GenericTests.test_subscripted_generics_as_proxies.<locals>.DNrDr7r7r7r8rsrzfrom derived zzfrom derived x)	rrrQrTr�rurr�r�r3r
r�rr7r7r8�$test_subscripted_generics_as_proxies
s*
z1GenericTests.test_subscripted_generics_as_proxiescCs`td�}Gdd�dtjjt|�}|�t�|�d|�|t|�d|�|��|�	�dS)Nr
c@seZdZdS)z.GenericTests.test_abc_registry_kept.<locals>.CNrDr7r7r7r8r�'sr�r�)
rr�r(r�rr?rTrf�_abc_registry_clear�_abc_caches_clearr�r7r7r8�test_abc_registry_kept%s
z#GenericTests.test_abc_registry_keptcCs4Gdd�dtttf�}|�i|�|�t|�dS)Nc@seZdZdS)z5GenericTests.test_false_subclasses.<locals>.MyMappingNrDr7r7r7r8�	MyMapping0sr�)rrur�r:�dict)r3r�r7r7r8�test_false_subclasses/sz"GenericTests.test_false_subclassescCs`Gdd�dtttf�}|���|�|�tjj�|�|�t�|�|�t�|�i|�dS)Nc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z'GenericTests.test_abc_bases.<locals>.MMcSsdSr;r7�r3�kr7r7r8r�6sz3GenericTests.test_abc_bases.<locals>.MM.__getitem__cSsdSr;r7�r3r�r�r7r7r8r�8sz3GenericTests.test_abc_bases.<locals>.MM.__setitem__cSsdSr;r7r�r7r7r8�__delitem__:sz3GenericTests.test_abc_bases.<locals>.MM.__delitem__cSstd�Sr���iterrNr7r7r8r�<sz0GenericTests.test_abc_bases.<locals>.MM.__iter__cSsdSrIr7rNr7r7r8�__len__>sz/GenericTests.test_abc_bases.<locals>.MM.__len__N�r@rArBr�r�r�r�r�r7r7r7r8�MM5s
r�)rru�updaterfr�r(r�r)r3r�r7r7r8�test_abc_bases4s
zGenericTests.test_abc_basescCsVGdd�dtttftjj�}Gdd�dtjjtttf�}|�|jtjjtf�dS)Nc@seZdZdS)z-GenericTests.test_multiple_bases.<locals>.MM1NrDr7r7r7r8�MM1Hsr�c@seZdZdS)z-GenericTests.test_multiple_bases.<locals>.MM2NrDr7r7r7r8�MM2Jsr�)rrur�r(rQ�	__bases__r)r3r�r�r7r7r8�test_multiple_basesGsz GenericTests.test_multiple_basescCs@td�}Gdd�dtjt|f�}|�|jtjt|ff�dS)Nr
c@seZdZdS)z'GenericTests.test_orig_bases.<locals>.CNrDr7r7r7r8r�Psr�)rr<r�rurQ�__orig_bases__r�r7r7r8�test_orig_basesNszGenericTests.test_orig_basesc	CsLdd�}|�|dditjttf��|�|dditjttf��|�t��|dditjttf�W5QRXdd�}Gdd�dt	t�}|�||t�|t��|�||t�|t��|�||t�t
��|�t��|dd	d
g|t�W5QRXdd�}Gd
d�dt
t�}|�|dd	d
g|��|�|ddg|��dS)NcsBt|j�dkrt�|jr>|j\��t��fdd�|��D��SdS)Nrc3s&|]\}}t|��ot|��VqdSr;)rM��.0r�r��rrr7r8�	<genexpr>Zs�zSGenericTests.test_naive_runtime_checks.<locals>.naive_dict_check.<locals>.<genexpr>)r�rpr&ro�all�items��obj�tpr7r�r8�naive_dict_checkTs
�z@GenericTests.test_naive_runtime_checks.<locals>.naive_dict_checkr�r�cSst|d�st�|j|kS)N�__orig_class__)�hasattrr&r�r�r7r7r8�naive_generic_checkcs
zCGenericTests.test_naive_runtime_checks.<locals>.naive_generic_checkc@seZdZdS)z4GenericTests.test_naive_runtime_checks.<locals>.NodeNrDr7r7r7r8�Nodehsr�r�r�cst�fdd�|D��S)Nc3s$|]}t|�jdjd�VqdS)rN)rMr�ro)r�r��r�r7r8r�qs�zXGenericTests.test_naive_runtime_checks.<locals>.naive_list_base_check.<locals>.<genexpr>)r�r�r7r�r8�naive_list_base_checkos�zEGenericTests.test_naive_runtime_checks.<locals>.naive_list_base_checkc@seZdZdS)z1GenericTests.test_naive_runtime_checks.<locals>.CNrDr7r7r7r8r�ssr�r�r�)r�r<r�rurTr�rKr&r
rr)r3r�r�r�r�r�r7r7r8�test_naive_runtime_checksSs 
"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@seZdZdS)z.GenericTests.test_multi_subscr_base.<locals>.CNrDr7r7r7r8r�{sr�c@seZdZdS)z.GenericTests.test_multi_subscr_base.<locals>.DNrDr7r7r7r8r|srr7)
rrrQrprTror�r�rr�)r3r
r�r~r�rr7r7r8�test_multi_subscr_basewsz#GenericTests.test_multi_subscr_basecCsjtd�}Gdd�dt�}|�t|t|�|�t|tf|t|tf�|�td|fjt|f�dS)Nr
c@seZdZdS)z.GenericTests.test_subscript_meta.<locals>.MetaNrDr7r7r7r8�Meta�sr�.)	rrYrQr$rrTrro�Ellipsis)r3r
r�r7r7r8�test_subscript_meta�s
 z GenericTests.test_subscript_metacCs�Gdd�dtt�}Gdd�dtt�}|�||�|�tjttjt�|�|j|j�|�tjj|jttjj|jt�|�||j�|�|tj�|�|tjj�|�|jtj�|�|jtjj�|�|t|jt�|�|tt	|jtt	�|�|ttjt�|�|ttjjt�|�|jt
tjt
�|�|jtt	tjjtt	�|�t|tt|jt�|�t|tt	t|jtt	�|�tt|tftttjtf�|�t|t|tft|ttjtf�|�t
j|tt
jtjjt�tjdd�dk�r�|�tt|t��d��|�tt|jt��d��|�tttjt��d	��|�tttjjt��d
��dS)Nc@seZdZdS)z+GenericTests.test_generic_hashes.<locals>.ANrDr7r7r7r8rW�srWc@s eZdZGdd�dee�ZdS)z+GenericTests.test_generic_hashes.<locals>.Bc@seZdZdS)z-GenericTests.test_generic_hashes.<locals>.B.ANrDr7r7r7r8rW�srWN)r@rArBrr
rWr7r7r7r8r*�sr*r�)r�r�z<locals>.A[str]]z<locals>.B.A[str]]zmod_generics_cache.A[str]]zmod_generics_cache.B.A[str]])rr
rQr-rWrur*rnrr	rTrrr<�	FrozenSet�sys�version_infor�rRrw�r3rWr*r7r7r8�test_generic_hashes�sJ�"&&����z GenericTests.test_generic_hashesc	Cstd�}td�}|�t||fttttf�|�tjt||f|tjt||f�|�t��t|tfdW5QRX|�t��t||f|dfW5QRX|�t|tftt�|�t||ftttt	ffttt	f�Gdd�d�}Gdd�d|�}|�t||ft||ft||f�|�t��t|tfd	W5QRX|�t
|g|ftt
tgtf�|�t
dt|ftt
dttf�|�t��t
|g|fdtfW5QRX|�t��t
|g|fgtfW5QRXdS)
Nr
r�r7.c@seZdZdS)z9GenericTests.test_extended_generic_rules_eq.<locals>.BaseNrDr7r7r7r8�Base�sr�c@seZdZdS)z<GenericTests.test_extended_generic_rules_eq.<locals>.DerivedNrDr7r7r7r8�Derived�sr�r�)
rrQrrTr<r�rKrLrrurrr)r3r
r�r�r�r7r7r8�test_extended_generic_rules_eq�s* ,,($( 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]].z#Callable[..., Union[int, NoneType]]zCallable[[], List[int]])
rrQrRrrr�replacerTrrrgr7r7r8� test_extended_generic_rules_repr�s��"�"�z-GenericTests.test_extended_generic_rules_reprcCs�ttdd�dd�}Gdd�d�}|�t|t�t��dtt|i�td�}t|df}|d�d	d
�}|�t|t�t��d|�tdt|f}|d�dd�}|�t|t�t��d|�dS)
N�CCr�cSsdSr;r7r�r7r7r8�foobar�r�z5GenericTests.test_generic_forward_ref.<locals>.foobarc@seZdZdS)z1GenericTests.test_generic_forward_ref.<locals>.CCNrDr7r7r7r8r��sr�r
.cSsdSr;r7r�r7r7r8�barfoo�r�z5GenericTests.test_generic_forward_ref.<locals>.barfoocSsdSr;r7r�r7r7r8�barfoo2�r�z6GenericTests.test_generic_forward_ref.<locals>.barfoo2)	rrQrr�r�rrrqr)r3rr�r
�ATrZCTrr7r7r8�test_generic_forward_ref�s�z%GenericTests.test_generic_forward_refc	Cs�Gdd�dtttf�}Gdd�dttdf�}Gdd�dttgtf�}Gdd	�d	tdtf�}|�|jttf�|�|ttfjttf�|�|ttfj	|�|�|jtf�|�
t��|tW5QRX|�
t��|ttfW5QRX|�t|t��
d
�dd�|�|jd
�|�|�tjj�|�|tjj�|�|tjj�|�|�t�|�|t�|�
t��tttdftj�W5QRX|�
t��tttdftj�W5QRXdS)Nc@seZdZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.T1NrDr7r7r7r8�T1�src@seZdZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.T2NrDr7r7r7r8�T2�sr.c@seZdZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.C1NrDr7r7r7r8r4�sr4c@seZdZdd�ZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.C2cSsdSr;r7rNr7r7r8r�szIGenericTests.test_extended_generic_rules_subclassing.<locals>.C2.__call__N�r@rArBrr7r7r7r8r5�sr5�.���zC1[int]r7)rr
rrrTrQrprurorrrKrLrR�splitrfr�r(r9r�r1r<�Sequencer�)r3rrr4r5r7r7r8�'test_extended_generic_rules_subclassing�s.z4GenericTests.test_extended_generic_rules_subclassingc	Cs�|�t��ttW5QRX|�t��ttW5QRX|�t��ttW5QRX|�t��tttW5QRXdSr;)rKrLrrrrrrTrNr7r7r8�test_fail_with_bare_unionsz&GenericTests.test_fail_with_bare_unionc	Csltd�}|�t��ttW5QRX|�t��tt|W5QRX|�t��ttjW5QRXdSre)rrKrLrrrr<rrgr7r7r8�test_fail_with_bare_genericsz(GenericTests.test_fail_with_bare_genericcCsztd�}|��Gdd�dt||f�}|�|t�j|�|�|t�j|t�Gdd�dtd|f�}|�||�j|�|�||�j||�Gdd�dtj	||f�}|�|t�j|�|�|t�j|t�Gd	d
�d
tj
t|f�}|�|t�j|�|�|t�j|t�tj
dk�rvGdd
�d
tjt|f�}|�|t�j|�|�|t�j|t�dS)Nr
c@seZdZdS)z5GenericTests.test_type_erasure_special.<locals>.MyTupNrDr7r7r7r8�MyTup"src@seZdZdd�ZdS)z6GenericTests.test_type_erasure_special.<locals>.MyCallcSsdSr;r7rNr7r7r8r&r�z?GenericTests.test_type_erasure_special.<locals>.MyCall.__call__Nrr7r7r7r8�MyCall%sr.c@seZdZdS)z6GenericTests.test_type_erasure_special.<locals>.MyDictNrDr7r7r7r8�MyDict)src@seZdZdS)z5GenericTests.test_type_erasure_special.<locals>.MyDefNrDr7r7r7r8�MyDef,sr�r�r�c@seZdZdS)z7GenericTests.test_type_erasure_special.<locals>.MyChainNrDr7r7r7r8�MyChain1sr)rr?rrqrTr�r�rr<r��DefaultDictrur�r��ChainMap)r3r
rrrrrr7r7r8�test_type_erasure_specials$z&GenericTests.test_type_erasure_specialcCs�dd�tjD�}|D]�}|�t|�d�|�||�t|dd�rbt|j�dkrb|�|tj	tf�t
|t�r|jD] }|�t|�d�|�||�qrqdS)Ncss|]}tt|�VqdSr;)�getattrr<)r��elr7r7r8r�6sz4GenericTests.test_all_repr_eq_any.<locals>.<genexpr>r�rpr�)
r<�__all__rnrRrQrr�rpr	rorMrYr�)r3Zobjsr��baser7r7r8�test_all_repr_eq_any5s

z!GenericTests.test_all_repr_eq_anyc
Cs�td�}Gdd�dt|�}Gdd�d|t�at�}d|_d|_ttjd�D]J}t�	||�}t�
|�}|�|jd�|�|jd�|�|jddd	��qPt
tttttttfttttd
fttgtftjtjtg}|D]:}ttjd�D]&}t�	||�}t�
|�}|�||�q�q�ttjtjtttjtjtjtttfg}	|	D]>}ttjd�D](}t�	||�}t�
|�}|�||��q`�qNdS)Nr
c@seZdZdS)z#GenericTests.test_pickle.<locals>.BNrDr7r7r7r8r*Esr*c@seZdZdS)r�NrDr7r7r7r8r�Hsr�rJr(r�r�.)rrrTr�r�r�r�r�r�r�r�rQr�r	rrrrrurrvr<rr�r�r$r��AbstractSet)
r3r
r*r�r�r�r�Zsamplesr�Zmore_samplesr7r7r8�test_pickleAsD



�

�
zGenericTests.test_picklecCs�td�}Gdd�dt|�}t|tft|tftd|fttgtftttf|||t|ttj|tjttjttj	tt
ftj	|tftttt|tdtdtftdtj
dtfg}|tgD]$}|�|t|��|�|t|��q�dS)Nr
c@seZdZdS)z1GenericTests.test_copy_and_deepcopy.<locals>.NodeNrDr7r7r7r8r�fsr�.)r
r
)rrrrTrrr	r<r�r�rurrr�rQrr)r3r
r��thingsr�r7r7r8�test_copy_and_deepcopyds,*


�z#GenericTests.test_copy_and_deepcopycCs�td�atdtd�atdtt�atttttj	t
tjtt
ttfD]<}|�t|�|�|�t|�|�|�t�t�|��|�q>td�}tdtd�}tdtt�}|||fD]$}|�t|�|�|�t|�|�q�dS)Nr��TPBr��TPV�TL�TLB�TLV)rr�rTr!rvrur"rr<r�rr�rr	rrrqrrr�r�r�)r3rkr#r$r%r7r7r8�$test_immutability_by_copy_and_pickleps$�z1GenericTests.test_immutability_by_copy_and_picklecs&td��G�fdd�dt��}|d�}|�t|�jd�|�t|�jd�|�t|�|�|�t|�|�d|_|�t|�jd�|�t|�jd�|td�}|�t|�jd�|�t|�jd�|�t|�|�|�t|�|�d|_|�t|�jd�|�t|�jd�|�|j|t�dS)Nr
cseZdZ�dd�dd�ZdS)z3GenericTests.test_copy_generic_instances.<locals>.CN)r	r�cSs
||_dSr;rGrHr7r7r8r��sz<GenericTests.test_copy_generic_instances.<locals>.C.__init__rCr7rnr7r8r��sr�rJr�)	rrrQrr	r�assertIsNotrTr�)r3r�r�Zcir7rnr8�test_copy_generic_instances�s&z(GenericTests.test_copy_generic_instancesc	Csvtd�}tt|tftd|ftttfttttj	tt
ftjjt
tjdg}|D]}|�t�|��|�qXdS)Nr
.�whatever)rr	rrTrrrrr<r�ru�rer,rvr�rQ�weakref�ref)r3r
rr�r7r7r8�test_weakref_all�s 

�zGenericTests.test_weakref_allc	Cs�td�}Gdd�dt|�}|�}|t�}d|_d|_|�t��d|_W5QRX|�t��d|_W5QRX|dd�dd�}|�t|t	�t
��d||�|�t|t�t|t��dS)	Nr
c@seZdZdZdS)z0GenericTests.test_parameterized_slots.<locals>.C)�potatoN�r@rArB�	__slots__r7r7r7r8r��sr�rr�cSsdSr;r7r�r7r7r8r��r�z2GenericTests.test_parameterized_slots.<locals>.foor�)
rrrTr.rKr�ZtomatorQrr�r�rr)r3r
r�r�Zc_intr�r7r7r8�test_parameterized_slots�s
 z%GenericTests.test_parameterized_slotsc	Csttd�}Gdd�dt|�}|�}|t�}d|_d|_|�t��d|_W5QRX|�t��d|_W5QRXdS)Nr
c@seZdZddiZdS)z5GenericTests.test_parameterized_slots_dict.<locals>.D�bananarJNr/r7r7r7r8r�srZyes�no)rrrTr2rKr�r)r3r
r�dZd_intr7r7r8�test_parameterized_slots_dict�s
z*GenericTests.test_parameterized_slots_dictc	Cs:|�t��&tttf}Gdd�dt|�}W5QRXdS)Nc@seZdZdS)z#GenericTests.test_errors.<locals>.CNrDr7r7r7r8r��sr�)rKrLr�r�r	r)r3r*r�r7r7r8rU�szGenericTests.test_errorscCs�Gdd�dtt�}|�|jt�|�|jd�|t}|�|jt�|�t|��d�dd�Gdd�d|t�}|�|jt�|�|jd	�dS)
Nc@seZdZdS)�#GenericTests.test_repr_2.<locals>.CNrDr7r7r7r8r��sr�r6rr	zC[int]c@seZdZdS)�#GenericTests.test_repr_2.<locals>.YNrDr7r7r7r8rm�srmr7)	rr
rQrAr@rBrTrRr
)r3r�rkrmr7r7r8�test_repr_2�s��zGenericTests.test_repr_2cCs8|�tt�|�tttt�|�tttt�dSr;)rQrr
rnrrrNr7r7r8�	test_eq_1�szGenericTests.test_eq_1cCslGdd�dtt�}Gdd�dtt�}|�||�|�||�|�|t|t�|�|t|t�dS)Nc@seZdZdS)z!GenericTests.test_eq_2.<locals>.ANrDr7r7r7r8rW�srWc@seZdZdS)z!GenericTests.test_eq_2.<locals>.BNrDr7r7r7r8r*�sr*)rr
rQrnr�r7r7r8�	test_eq_2�szGenericTests.test_eq_2cCsvGdd�dtttf�}Gdd�dtttf�}Gdd�d|ttfttttf|ttf�}|�|jtttf�dS)Nc@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.ANrDr7r7r7r8rW�srWc@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.BNrDr7r7r7r8r*�sr*c@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.CNrDr7r7r7r8r��sr�)rr
rrrQrp)r3rWr*r�r7r7r8�test_multiple_inheritance�s.z&GenericTests.test_multiple_inheritancecCsNtd�}Gdd�dt|�}Gdd�dtt|�}|�|j|t|ttf�dS)Nric@seZdZdS)z9GenericTests.test_multiple_inheritance_special.<locals>.BNrDr7r7r7r8r*sr*c@seZdZdS)z9GenericTests.test_multiple_inheritance_special.<locals>.CNrDr7r7r7r8r�sr�)rrrrTrQr�r�r�)r3rir*r�r7r7r8�!test_multiple_inheritance_special�sz.GenericTests.test_multiple_inheritance_specialc	s�Gdd�dt��G��fdd�d��Gdd�dtt��}|����Gdd�d|�}W5QRX|����Gd	d�d|t�}W5QRXdS)
Nc@seZdZdS)zDGenericTests.test_init_subclass_super_called.<locals>.FinalExceptionNrDr7r7r7r8�FinalExceptionsr=cs&eZdZdd����fdd�Z�ZS)z;GenericTests.test_init_subclass_super_called.<locals>.FinalNr�cs8|jD]}|�k	rt|��r�|��qt�jf|�dSr;)r�r1r�r�)r4r�r)rr=r�r7r8r�	s

zMGenericTests.test_init_subclass_super_called.<locals>.Final.__init_subclass__r�r7�rr=r�r8rsrc@seZdZdS)z:GenericTests.test_init_subclass_super_called.<locals>.TestNrDr7r7r7r8rpsrpc@seZdZdS�z>GenericTests.test_init_subclass_super_called.<locals>.SubclassNrDr7r7r7r8�Subclasssr@c@seZdZdSr?rDr7r7r7r8r@s)�	Exceptionrr
rKrT)r3rpr@r7r>r8�test_init_subclass_super_calledsz,GenericTests.test_init_subclass_super_calledcCsrt}Gdd�d|t�}|tjt}Gdd�d|�}|�}|�g�|�d�|�d�|�|��ddg�dS)Nc@s4eZdZdZed�dd�Zdd�Zed�dd	�ZdS)
z)GenericTests.test_nested.<locals>.VisitorNr�cSs
||_dSr;r��r3r�r7r7r8�setsz-GenericTests.test_nested.<locals>.Visitor.setcSs|jSr;r�rNr7r7r8r�"sz-GenericTests.test_nested.<locals>.Visitor.getr�cSs|jSr;r�rNr7r7r8�visit%sz/GenericTests.test_nested.<locals>.Visitor.visit)r@rArBr�r
rDr�rEr7r7r7r8�VisitorsrFc@seZdZed�dd�ZdS)z0GenericTests.test_nested.<locals>.IntListVisitorr�cSs|j�|�dSr;)r��appendrLr7r7r8rG,sz7GenericTests.test_nested.<locals>.IntListVisitor.appendN)r@rArBrTrGr7r7r7r8�IntListVisitor*srHr�rJ)	rr
r<rrTrDrGrQr�)r3�GrFr~rHr�r7r7r8�test_nesteds



zGenericTests.test_nestedcsBtd��G�fdd�dt����d����fdd�}|d�dS)Nr
cs eZdZd�ddd�dd�ZdS)z,GenericTests.test_type_erasure.<locals>.NodeN�Node[T]�r�left�rightcSs||_||_||_dSr;rL)r3rrMrNr7r7r8r�9sz5GenericTests.test_type_erasure.<locals>.Node.__init__)NNrCr7rnr7r8r�8s��r�r�cs~�|�}��|�}�t|�}��t|�����t|�����t|�����|j|���|j|���|j|�dSr;)r	rqrYrQr)r�r�r�r��r�r
r3r7r8r�@sz+GenericTests.test_type_erasure.<locals>.foorJ)rrr�r7rOr8�test_type_erasure5szGenericTests.test_type_erasurec	Cs�td�}Gdd�dt|�}Gdd�d|�}|�|jd�|�t��|tW5QRX|�t��|tW5QRX|�t��||W5QRXdS)Nr
c@seZdZdS)z)GenericTests.test_implicit_any.<locals>.CNrDr7r7r7r8r�Psr�c@seZdZdS)z)GenericTests.test_implicit_any.<locals>.DNrDr7r7r7r8rSsrr7)rrrQrprKrArTr	r�r7r7r8�test_implicit_anyMszGenericTests.test_implicit_anycCsNGdd�dtt�}Gdd�d�}Gdd�d||�}|d�}|�|jd�dS)Nc@seZdZdS)z*GenericTests.test_new_with_args.<locals>.ANrDr7r7r7r8rWasrWcseZdZ�fdd�Z�ZS)z*GenericTests.test_new_with_args.<locals>.Bcst��|�}||_|Sr;)r��__new__r�r4rr�r�r7r8rResz2GenericTests.test_new_with_args.<locals>.B.__new__�r@rArBrRr�r7r7r�r8r*dsr*c@seZdZdS)z*GenericTests.test_new_with_args.<locals>.CNrDr7r7r7r8r�lsr�r�)rr
rQr�r3rWr*r�r�r7r7r8�test_new_with_args_s
zGenericTests.test_new_with_argscCsLGdd�d�}Gdd�dtt|�}|d�}|�|jd�|�|jd�dS)NcseZdZ�fdd�Z�ZS)z+GenericTests.test_new_with_args2.<locals>.Acs||_t���dSr;)�from_ar�r�rr�r7r8r�usz4GenericTests.test_new_with_args2.<locals>.A.__init__�r@rArBr�r�r7r7r�r8rWtsrWcseZdZ�fdd�Z�ZS)z+GenericTests.test_new_with_args2.<locals>.Ccs||_t��|�dSr;)�from_cr�r�rr�r7r8r�|sz4GenericTests.test_new_with_args2.<locals>.C.__init__rXr7r7r�r8r�{sr�r�)rr
rQrWrY)r3rWr�r�r7r7r8�test_new_with_args2rs
z GenericTests.test_new_with_args2c	Cs�Gdd�dtt�}|�t��|d�W5QRXGdd�d�}Gdd�d||�}|d�}|�|jd�|�|jd�|�|jd	�dS)
Nc@seZdZdS)z(GenericTests.test_new_no_args.<locals>.ANrDr7r7r7r8rW�srWr�cseZdZ�fdd�Z�ZS)z(GenericTests.test_new_no_args.<locals>.Bcst��|�}d|_|S)Nr�)r�rR�from_b)r4r�r�r7r8rR�sz0GenericTests.test_new_no_args.<locals>.B.__new__rTr7r7r�r8r*�sr*cs$eZdZdd�Z�fdd�Z�ZS)z(GenericTests.test_new_no_args.<locals>.CcSs
||_dSr;)rrr7r7r8r��sz1GenericTests.test_new_no_args.<locals>.C.__init__cst��|�}d|_|S)Nr�)r�rRrYrSr�r7r8rR�sz0GenericTests.test_new_no_args.<locals>.C.__new__)r@rArBr�rRr�r7r7r�r8r��sr�r�r�)rr
rKrLrQrr[rYrUr7r7r8�test_new_no_args�s
zGenericTests.test_new_no_argsN)3r@rArBr�r�r�r�rSr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr
rrrrr r&r(r-r1r5rUr8r9r:r;r<rBrJrPrQrVrZr\r7r7r7r8r�ws`
$+
	#

r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
ClassVarTestsc	Csf|�t��tdW5QRX|�t��tttfW5QRX|�t��tttW5QRXdSr�)rKrLrrTrurNr7r7r8r��szClassVarTests.test_basicscCsH|�tt�d�tt}|�t|�d�tt}|�t|�dt�dS)Nztyping.ClassVar�typing.ClassVar[int]ztyping.ClassVar[%s.Employee])rQrRrrTrCr@�r3Zcvr7r7r8rS�s
zClassVarTests.test_reprc	Cs\|�t��Gdd�dtt��}W5QRX|�t��Gdd�dttt��}W5QRXdS)Nc@seZdZdS�z-ClassVarTests.test_cannot_subclass.<locals>.CNrDr7r7r7r8r��sr�c@seZdZdSr`rDr7r7r7r8r��s)rKrLrYrrTr�r7r7r8r[�sz"ClassVarTests.test_cannot_subclassc	Csh|�t��t�W5QRX|�t��tt��W5QRX|�t��tttt��W5QRXdSr;)rKrLrrYrrTrNr7r7r8r��szClassVarTests.test_cannot_initc	CsH|�t��tdtt�W5QRX|�t��ttt�W5QRXdSr�)rKrLrMrrTr1rNr7r7r8�test_no_isinstance�sz ClassVarTests.test_no_isinstanceN)r@rArBr�rSr[r�rar7r7r7r8r]�s
r]c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
FinalTestsc	Cs�tt|�t��tdW5QRX|�t��tttfW5QRX|�t��tttW5QRX|�t��tttW5QRXdSr�)rrTrKrLrurrNr7r7r8r��szFinalTests.test_basicscCsH|�tt�d�tt}|�t|�d�tt}|�t|�dt�dS)Nztyping.Finalztyping.Final[int]ztyping.Final[%s.Employee])rQrRrrTrCr@r_r7r7r8rS�s
zFinalTests.test_reprc	Cs\|�t��Gdd�dtt��}W5QRX|�t��Gdd�dttt��}W5QRXdS)Nc@seZdZdS�z*FinalTests.test_cannot_subclass.<locals>.CNrDr7r7r7r8r��sr�c@seZdZdSrcrDr7r7r7r8r��s)rKrLrYrrTr�r7r7r8r[�szFinalTests.test_cannot_subclassc	Csh|�t��t�W5QRX|�t��tt��W5QRX|�t��tttt��W5QRXdSr;)rKrLrrYrrTrNr7r7r8r��szFinalTests.test_cannot_initc	CsH|�t��tdtt�W5QRX|�t��ttt�W5QRXdSr�)rKrLrMrrTr1rNr7r7r8ra�szFinalTests.test_no_isinstancecCsdd�}|�|t|��dS)NcSsdSr;r7r�r7r7r8�func�r�z.FinalTests.test_final_unmodified.<locals>.func)rqr)r3rdr7r7r8�test_final_unmodified�sz FinalTests.test_final_unmodifiedN)	r@rArBr�rSr[r�rarer7r7r7r8rb�srbc@seZdZdd�Zdd�ZdS)�	CastTestscCs�|�ttd�d�|�ttd�d�|�tttd��t�|�ttd�d�|�ttd�d�|�ttt	tfd�d�|�tt
d�d�|�tdd�d�dSrI)rQrrTr�rqrYr	r�rrurrNr7r7r8r��szCastTests.test_basicscCstdd�tdd�dS)NrJZhello)rrNr7r7r8rU	s
zCastTests.test_errorsN)r@rArBr�rUr7r7r7r8rf�s
rfc@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�Zd5S)6�ForwardRefTestscCs�Gdd�dtt�}|t}t|jt�t��}|�|dt|t�|�|dt|t�|�|d|d�|�|dtt�|�	d|�t|j
t�t��}|�|dt|t�t|jt�t��}|�|dt|t�dS)Nc@sPeZdZed�dd�Zddded�dd	�Zedd
�dd�Zddd
�d
d�Z	dS)z)ForwardRefTests.test_basics.<locals>.Node)rcSs||_d|_|_dSr;rL)r3rr7r7r8r�	sz2ForwardRefTests.test_basics.<locals>.Node.__init__NzOptional[Node[T]]rK)rMrN�stuffcSs||_||_dSr;)rMrN)r3rMrNrh�blahr7r7r8�add_both	sz2ForwardRefTests.test_basics.<locals>.Node.add_both)�nodecSs|�|d�dSr;�rj�r3rkr7r7r8�add_left 	sz2ForwardRefTests.test_basics.<locals>.Node.add_leftcSs|�d|�dSr;rlrmr7r7r8�	add_right#	sz3ForwardRefTests.test_basics.<locals>.Node.add_right)NNN)N)
r@rArBr
r�rTrjrrnror7r7r7r8r�	s��r�rMrNrhrirk)rr
rTrrjr�r�rQr�assertNotInrnro)r3r�r�Z
both_hintsZ
left_hintsZright_hintsr7r7r8r�	szForwardRefTests.test_basicsc	Cs.t�d�}|�t��td|�W5QRXdS)NrTrJ)r<�
ForwardRefrKrLrM�r3�frr7r7r8�#test_forwardref_instance_type_error4	s
z3ForwardRefTests.test_forwardref_instance_type_errorc	Cs.t�d�}|�t��tt|�W5QRXdS�NrT)r<rqrKrLr1rTrrr7r7r8�#test_forwardref_subclass_type_error9	s
z3ForwardRefTests.test_forwardref_subclass_type_errorcCs4t�d�}|�|t�d��|�tdtt�dSru)r<rqrQrnrrTrrr7r7r8�test_forward_equality>	s
z%ForwardRefTests.test_forward_equalitycCs�t�d�}t�d�}t�d�}t�d�}Gdd�d�}||d�dd�}|�t|t�t��||d��|�||�|�||�|�||�|�t|t|�|�t|t|�|�t|t|�|�t||ft|�|�t||t	ft|t	f�dS)Nr�c@seZdZdS)z4ForwardRefTests.test_forward_equality_gth.<locals>.CNrDr7r7r7r8r�I	s�r�r�cSsdSr;r7rxr7r7r8r�K	sz6ForwardRefTests.test_forward_equality_gth.<locals>.foo)
r<rqrQrr�r�rrnrrT)r3�c1�c1_gth�c2�c2_gthr�r�r7r7r8�test_forward_equality_gthC	s



z)ForwardRefTests.test_forward_equality_gthcCs�t�d�}t�d�}t�d�}t�d�}||d�dd�}t|t�t��|�t|�t|��|�t|�t|��|�t|�t|��dS)NrTrxcSsdSr;r7rxr7r7r8r�^	sz7ForwardRefTests.test_forward_equality_hash.<locals>.foo)r<rqrr�r�rQ�hash)r3ryrzr{r|r�r7r7r8�test_forward_equality_hashX	s



z*ForwardRefTests.test_forward_equality_hashcCsBGdd�d�}dd�}dd�}|�|�|��|�|�|��dS)Nc@seZdZdS)z:ForwardRefTests.test_forward_equality_namespace.<locals>.ANrDr7r7r7r8rWg	srWcSs,t�d�}|d�dd�}t|t�t��|S)NrWr�cSsdSr;r7r�r7r7r8r�k	szPForwardRefTests.test_forward_equality_namespace.<locals>.namespace1.<locals>.fun�r<rqrr�r�)r�r�r7r7r8�
namespace1i	s
zCForwardRefTests.test_forward_equality_namespace.<locals>.namespace1cSs:t�d�}Gdd�d�}|d�dd�}t|t�t��|S)NrWc@seZdZdS)zNForwardRefTests.test_forward_equality_namespace.<locals>.namespace2.<locals>.ANrDr7r7r7r8rWs	sr�cSsdSr;r7r�r7r7r8r�u	szPForwardRefTests.test_forward_equality_namespace.<locals>.namespace2.<locals>.funr�)r�rWr�r7r7r8�
namespace2p	s

zCForwardRefTests.test_forward_equality_namespace.<locals>.namespace2)rQrn)r3rWr�r�r7r7r8�test_forward_equality_namespacef	s
z/ForwardRefTests.test_forward_equality_namespacecCs|�ttd�d�dS)NrTztyping.List[ForwardRef('int')])rQrRrrNr7r7r8�test_forward_repr~	sz!ForwardRefTests.test_forward_reprcCs6tdd�dd�}|�t|t�t��dtti�dS)Nr
r�cSsdSr;r7r�r7r7r8r��	sz/ForwardRefTests.test_union_forward.<locals>.foor�)rrQrr�r�r
r�r7r7r8�test_union_forward�	s
�z"ForwardRefTests.test_union_forwardcCs6tdd�dd�}|�t|t�t��dtti�dS)Nr
r�cSsdSr;r7r�r7r7r8r��	sz/ForwardRefTests.test_tuple_forward.<locals>.foor�)rrQrr�r�r
r�r7r7r8�test_tuple_forward�	s
�z"ForwardRefTests.test_tuple_forwardcCsDdd�}dd�}dd�}|�}|�}|�||�|�t|||�dS)NcSs0t�d�}|}|d�dd�}t|t�t��}|S)NrWr�cSsdSr;r7r�r7r7r8r��	r�zPForwardRefTests.test_forward_recursion_actually.<locals>.namespace1.<locals>.funr��r�rWr��retr7r7r8r��	s

zCForwardRefTests.test_forward_recursion_actually.<locals>.namespace1cSs0t�d�}|}|d�dd�}t|t�t��}|S)NrWr�cSsdSr;r7r�r7r7r8r��	r�zPForwardRefTests.test_forward_recursion_actually.<locals>.namespace2.<locals>.funr�r�r7r7r8r��	s

zCForwardRefTests.test_forward_recursion_actually.<locals>.namespace2cSs||kSr;r7)Zo1Zo2r7r7r8�cmp�	sz<ForwardRefTests.test_forward_recursion_actually.<locals>.cmp)r'rK�RecursionError)r3r�r�r�Zr1Zr2r7r7r8�test_forward_recursion_actually�	sz/ForwardRefTests.test_forward_recursion_actuallycs�td�tt�f�G�fdd�d�}G��fdd�d�}G��fdd�d�}G��fdd	�d	�}|�t|t�t��t|t�t���|�t|t�t��d
tttttttdffi�|�t|t�t��d
ttttttdffi�|�t|t�t��d
ttttttttdffttttdffi�|�t|t�t��d
ttttttdftttttttdfffi�dS)N�ValuecseZdZUe�ed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.Cr�N)r@rArBrrr7)r�r7r8r��	s
r�cseZdZUe��fed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.Dr�N)r@rArBrrr7�r�Z	ValueListr7r8r�	s
rcs"eZdZUee��fed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.Er�N�r@rArBrrrr7r�r7r8r!�	s
r!cs$eZdZUe�e��fed<dS)z7ForwardRefTests.test_union_forward_recursion.<locals>.Fr�Nr�r7r�r7r8�F�	s
r�r�)rrrurQrr�r�)r3r�rr!r�r7r�r8�test_union_forward_recursion�	s8$"��������z,ForwardRefTests.test_union_forward_recursioncCsBtdgdfd�dd�}|�t|t�t��dttgtfi�dS)Nr
r�cSsdSr;r7r�r7r7r8r��	sz2ForwardRefTests.test_callable_forward.<locals>.foor�)rrQrr�r�r
r�r7r7r8�test_callable_forward�	s�z%ForwardRefTests.test_callable_forwardcCs6dd�dd�}|�t|t�t��dtdtfi�dS)NzCallable[..., T]r�cSsdSr;r7r�r7r7r8r��	sz@ForwardRefTests.test_callable_with_ellipsis_forward.<locals>.foor�.)rQrr�r�rr
r�r7r7r8�#test_callable_with_ellipsis_forward�	s�z3ForwardRefTests.test_callable_with_ellipsis_forwardc	Cs"|�t��tdW5QRXdS)Nz/T)rK�SyntaxErrorrrNr7r7r8�test_syntax_error�	sz!ForwardRefTests.test_syntax_errorc	Cs0dd�dd�}|�t��t|�W5QRXdS)NzNode[Tr�cSsdSr;r7r�r7r7r8r��	sz6ForwardRefTests.test_delayed_syntax_error.<locals>.foo)rKr�rr�r7r7r8�test_delayed_syntax_error�	sz)ForwardRefTests.test_delayed_syntax_errorc	Cs4tdd�dd�}|�t��t|�W5QRXdS)NZ42r�cSsdSr;r7r�r7r7r8r��	sz,ForwardRefTests.test_type_error.<locals>.foo)rrKrLrr�r7r7r8�test_type_error�	szForwardRefTests.test_type_errorc	Cs4dd�dd�}|�t��t|t��W5QRXdS)NzNoode[T]r�cSsdSr;r7r�r7r7r8r��	sz,ForwardRefTests.test_name_error.<locals>.foo)rK�	NameErrorrr�r�r7r7r8�test_name_error�	szForwardRefTests.test_name_errorcCs,tdid�dd��}t|�}|�|i�dS)N�	whatevers�r�r�cSsdSr;r7r�r7r7r8r��	sz/ForwardRefTests.test_no_type_check.<locals>.foo)r!rrQ)r3r��thr7r7r8�test_no_type_check�	sz"ForwardRefTests.test_no_type_checkcCsDtGdd�d��}t|j�}|�|i�t|�j�}|�|i�dS)Nc@seZdZdid�dd�ZdS)z3ForwardRefTests.test_no_type_check_class.<locals>.Cr�r�cSsdSr;r7r�r7r7r8r�
sz7ForwardRefTests.test_no_type_check_class.<locals>.C.fooN�r@rArBr�r7r7r7r8r�
sr�)r!rr�rQ)r3r��cth�ithr7r7r8�test_no_type_check_class
s
z(ForwardRefTests.test_no_type_check_classcs@Gdd�d��tG�fdd�d���}|�t�j�dti�dS)Nc@seZdZed�dd�ZdS)z6ForwardRefTests.test_no_type_check_no_bases.<locals>.Cr�cSsdSr;r7rLr7r7r8r

r�z;ForwardRefTests.test_no_type_check_no_bases.<locals>.C.methN�r@rArBrTr
r7r7r7r8r�
sr�cseZdZ�ZdS)z6ForwardRefTests.test_no_type_check_no_bases.<locals>.DN)r@rArBr�r7�r�r7r8r
srr�)r!rQrr
rT�r3rr7r�r8�test_no_type_check_no_bases
sz+ForwardRefTests.test_no_type_check_no_basescCslGdd�d�}Gdd�d�}Gdd�d�}Gdd�d�}d	tjti}||||fD]}|�t|�|�qRdS)
Nc@s eZdZUdZejeed<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.C�r�N)r@rArBr�r<rrTrr7r7r7r8r�
s
r�c@seZdZUdZeeed<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.Dr�r�N)r@rArBr�rrTrr7r7r7r8r
s
rc@seZdZUdZded<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.Er�r^r�N�r@rArBr�rr7r7r7r8r!
s
r!c@seZdZUdZded<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string.<locals>.Fr��
ClassVar[int]r�Nr�r7r7r7r8r�
s
r�r�)r<rrTrQr)r3r�rr!r�Zexpected_result�clazzr7r7r8�(test_no_type_check_forward_ref_as_string
sz8ForwardRefTests.test_no_type_check_forward_ref_as_stringc
CsLGdd�d�}Gdd�d�}||fD]"}|�t��t|�W5QRXq$dS)Nc@seZdZUdZded<dS)zGForwardRefTests.test_nested_classvar_fails_forward_ref_check.<locals>.Er�z%typing.ClassVar[typing.ClassVar[int]]r�Nr�r7r7r7r8r!$
s
r!c@seZdZUdZeded<dS)zGForwardRefTests.test_nested_classvar_fails_forward_ref_check.<locals>.Fr�r�r�N)r@rArBr�rrr7r7r7r8r�&
s
r�)rKrLr)r3r!r�r�r7r7r8�,test_nested_classvar_fails_forward_ref_check#
s
z<ForwardRefTests.test_nested_classvar_fails_forward_ref_checkcCs�tdd��}|�|jd�|did�dd��}|Gdd	�d	��}|�|jd
�t|�}|�|i�t|j�}|�|i�t|�j�}|�|i�dS)NcSs|Sr;r7)rdr7r7r8�magic_decorator/
sz@ForwardRefTests.test_meta_no_type_check.<locals>.magic_decoratorr�r�r�cSsdSr;r7r�r7r7r8r�5
sz4ForwardRefTests.test_meta_no_type_check.<locals>.fooc@seZdZdid�dd�ZdS)z2ForwardRefTests.test_meta_no_type_check.<locals>.Cr�r�cSsdSr;r7r�r7r7r8r�;
sz6ForwardRefTests.test_meta_no_type_check.<locals>.C.fooNr�r7r7r7r8r�9
sr�r�)r"rQr@rr�)r3r�r�r�r�r�r�r7r7r8�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�rr�)r�rr�rQ)r3r��nsZhintsr7r7r8�test_default_globalsF
s

z$ForwardRefTests.test_default_globalscCsT|�ttt��dtt�|�ttt��dtt�|�ttt��dt�dS)Nr	)rQ�gth�Loopr�rrnrTrNr7r7r8�test_final_forward_refQ
sz&ForwardRefTests.test_final_forward_refN)r@rArBr�rtrvrwr}rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r7r7r7r8rg	s4$ 		
rgc@seZdZdd�Zdd�ZdS)�
OverloadTestsc	Cs8ddlm}|�t��|dd��}|�W5QRXdS)Nr��overloadcSsdSr;r7r7r7r7r8ri^
sz/OverloadTests.test_overload_fails.<locals>.blah)r<r�rK�RuntimeError�r3r�rir7r7r8�test_overload_failsY
s

z!OverloadTests.test_overload_failscCs*ddlm}|dd��}dd�}|�dS)Nrr�cSsdSr;r7r7r7r7r8rig
sz2OverloadTests.test_overload_succeeds.<locals>.blahcSsdSr;r7r7r7r7r8rik
s)r<r�r�r7r7r8�test_overload_succeedsd
s

z$OverloadTests.test_overload_succeedsN)r@rArBr�r�r7r7r7r8r�W
sr�a�
import asyncio

T_a = TypeVar('T_a')

class AwaitableWrapper(typing.Awaitable[T_a]):

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

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

class AsyncIteratorWrapper(typing.AsyncIterator[T_a]):

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

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

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

class ACM:
    async def __aenter__(self) -> int:
        return 42
    async def __aexit__(self, etype, eval, tb):
        return None
FT)�
ann_module�ann_module2�ann_module3)�AsyncContextManagerc@seZdZUeed<dS)rWr�N)r@rArBr�rr7r7r7r8rW�
s
rWc@s2eZdZUdZeeded<eed<eed<dS)r*Nr�r�r�)r@rArBr�rrrrTr7r7r7r8r*�
s
r*c@s eZdZUe�Zeded<dS)�CSubr�N)r@rArBr*r�rrr7r7r7r8r��
s
r�c@s"eZdZUgZeeeed<dS)rI�lstN)r@rArBr�rrr
rr7r7r7r8rI�
s
rIc@seZdZUeded<dS)r�r	N)r@rArBrrr7r7r7r8r��
s
r�c@seZdZUded<ded<dS)�NoneAndForward�parentN�meaning�r@rArBrr7r7r7r8r��
s
r�c@seZdZUeed<eed<dS)�CoolEmployee�name�coolN�r@rArBrurrTr7r7r7r8r��
s
r�c@s"eZdZUeed<dZeed<dS)�CoolEmployeeWithDefaultr�rr�N)r@rArBrurr�rTr7r7r7r8r��
s
r�c@seZdZUeed<dd�ZdS)�XMethr�cCs
d|jS)Nr�r�rNr7r7r8�double�
szXMeth.doubleN)r@rArBrTrr�r7r7r7r8r��
s
r�c@s2eZdZUeed<dZeed<dd�Zdd�ZdS)	�XReprr�r�r�cCs|j�d|j��S)Nz -> rErNr7r7r8�__str__�
sz
XRepr.__str__cCsdSrIr7)r3rcr7r7r8�__add__�
sz
XRepr.__add__N)r@rArBrTrr�r�r�r7r7r7r8r��
s
r��Labelrc@seZdZUeed<eed<dS)�Point2Dr�r�Nr�r7r7r7r8r��
s
r�c@seZdZdS)�LabelPoint2DNrDr7r7r7r8r��
sr�c@seZdZUeed<eed<dS)�Options�	log_levelZlog_pathNrr7r7r7r8r��
s
r���totalc@seZdZUded<ded<dS)�HasForeignBaseClassr��
some_xreprzmod_generics_cache.A�other_aNr�r7r7r7r8r��
s
r�)�amc�s4|4IdH�}|W5QIdHR�SQIdHRXdSr;r7)r�r�r7r7r8�g_with�
sr�c@s:eZdZejdd�dd��Zejejdd�dd���ZdS)�
ForRefExamplerNcCsdSr;r7rNr7r7r8rd�
szForRefExample.funccCsdSr;r7rNr7r7r8�nested�
szForRefExample.nestedN)r@rArBr�Zdecrdr�r7r7r7r8r��
s
r�c@sdeZdZdd�Zdd�Zed�dd��Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�GetTypeHintTestsc	Cs^|�t��td�W5QRX|�t��td�W5QRX|�t��td�W5QRXdS)N�{r()rKrLr�rNr7r7r8�(test_get_type_hints_from_various_objects�
sz9GetTypeHintTests.test_get_type_hints_from_various_objectscCsJdtttfttd�}|�tt�|�|�tt�i�|�tt�i�dS)Nr�)r�r>r�r�)rrTrurQr�r�r�r�)r3Zann_module_type_hintsr7r7r8�test_get_type_hints_modules�
sz,GetTypeHintTests.test_get_type_hints_modulesz	known bugcCs*ttjttjd�}|�tt�|�dS)N)Z	default_aZ	default_b)rr-rWr*rQr�)r3Z	mgc_hintsr7r7r8�&test_get_type_hints_modules_forwardref�
s�z7GetTypeHintTests.test_get_type_hints_modules_forwardrefcCs<|�ttj�dttji�|�ttj�t�|�ttj�dt	d��|�ttj
�ttttjd��|�ttj�dt
i�|�ttj�dttji�|�ttj�ttd��|�ttj�dt
i�|�tt�tt	d�d��|�tt�ttjtjd	��|�ttj�t
t
d��|�ttj�tjjtjjtjd
��dS)Nr�r�)Z123r�)�jr�r�r�rEr�)r�r�)r�r�Zsome_b)Zmy_inner_a1Zmy_inner_a2Z
my_outer_a)rQr�r�r�rrfZj_classr��MrYrrurmrTZh_classrir�r�r�r�r-rWr*rRrNr7r7r8�test_get_type_hints_classess>���
�
�����z,GetTypeHintTests.test_get_type_hints_classescCs�tGdd�d��}|�|j�|�|jjj�|�ttjj	�i�Gdd�dt
t�}tGdd�d|��}|�t|j	�dti�dS)Nc@seZdZGdd�d�ZdS)z>GetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheckc@seZdZdd�dd�ZdS)zBGetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheck.Innz
not a typer�cSsdSr;r7rLr7r7r8r�$r�zKGetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheck.Inn.__init__NrCr7r7r7r8�Inn#sr�N)r@rArBr�r7r7r7r8�	NoTpCheck!sr�c@seZdZed�dd�ZdS)z:GetTypeHintTests.test_respect_no_type_check.<locals>.ABaser�cSsdSr;r7r�r7r7r8r
)r�z?GetTypeHintTests.test_respect_no_type_check.<locals>.ABase.methNr�r7r7r7r8�ABase(sr�c@seZdZdS)z8GetTypeHintTests.test_respect_no_type_check.<locals>.DerNrDr7r7r7r8�Der*sr�r�)
r!r�Z__no_type_check__r�r�rQr�r�ZNTCr
rr
rT)r3r�r�r�r7r7r8�test_respect_no_type_check sz+GetTypeHintTests.test_respect_no_type_checkcCs||�tt�i�|�tt�i�|�tt�i�|�tt�i�|�ttj�i�|�tt�j�i�|�ttj	�i�dSr;)
rQr�rTrY�dirr�r�r�ru�joinrNr7r7r8� test_get_type_hints_for_builtins.sz1GetTypeHintTests.test_get_type_hints_for_builtinscCsPdd�}d|jd<|�t|�dti�dd�dd�}|�t|�dtd�i�dS)NcSsdSr;r7rEr7r7r8�testf9r�z6GetTypeHintTests.test_previous_behavior.<locals>.testfrTr�r�cSsdSr;r7r�r7r7r8�testg<r�z6GetTypeHintTests.test_previous_behavior.<locals>.testg)rrQr�rTrY)r3r�r�r7r7r8�test_previous_behavior8s

z'GetTypeHintTests.test_previous_behaviorcCsHGdd�d�}Gdd�d�}|�}ddi|_|�t|t��d|i�dS)Nc@seZdZdS)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations.<locals>.ANrDr7r7r7r8rW@srWc@seZdZdS)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations.<locals>.BNrDr7r7r7r8r*Asr*r�)rrQr�r�)r3rWr*r�r7r7r8�/test_get_type_hints_for_object_with_annotations?s

z@GetTypeHintTests.test_get_type_hints_for_object_with_annotationsc	Cs�|�ttjtj�dtjtji�|�ttt��t	tt
tt	d��|�ttt��ttt	t	tt
td��|�tt�dtt
ti�dS)N�var)r�r�r�)r�r�r�r�r�)rQr�r�ZCVr�r<rr*r�rTrr�rIrr
rNr7r7r8�test_get_type_hints_ClassVarFs��

��z-GetTypeHintTests.test_get_type_hints_ClassVarcCs0dti}|�ttj�|�|�ttj�|�dS)Nr3)r�rQr�rdr�)r3Zexpectsr7r7r8�,test_get_type_hints_wrapped_decoratored_funcPsz=GetTypeHintTests.test_get_type_hints_wrapped_decoratored_funcN)r@rArBr�r�rr�r�r�r�r�r�r�r�r7r7r7r8r��
s	


r�c@seZdZdd�Zdd�ZdS)�GetUtilitiesTestCasecCs(td�}Gdd�dt|�}|�t|t�|�|�t||�|�|�tt�d�|�ttt�t�|�ttttf�t�|�ttd�t�|�tt	t
t�t	�|�tt�t�|�tt|�t�|�tt
t||ft�t�|�tt
�t�|�tt�t
�|�tt�tjj�dS)Nr
c@seZdZdS)z/GetUtilitiesTestCase.test_get_origin.<locals>.CNrDr7r7r7r8r�Ysr��rJ�+)rrrqrrTrrrurrrrr�r�rr�r(r�r7r7r8�test_get_originWs z$GetUtilitiesTestCase.test_get_originc	Cs
td�}Gdd�dt|�}|�t|t�tf�|�t||�|f�|�tt�d�|�ttt�tf�|�ttttf�ttf�|�ttd�d�|�tt	t
t�t
tf�|�tttt|tfft�ttttff�|�ttj
tt||fftt�ttttttff�|�ttg|ft�gtf�|�ttdtf�dtf�|�ttttt|dfgtff�ttt|dfgtff�|�tttdf�tdf�|�ttd�d�|�tt
�d�|�tt�d�|�tt�d�dS)Nr
c@seZdZdS)z-GetUtilitiesTestCase.test_get_args.<locals>.CNrDr7r7r7r8r�jsr�r7r�.)r7)rrrQr rTrrrurrrrr<r�rrr�r7r7r8�
test_get_argshs2�$� $�z"GetUtilitiesTestCase.test_get_argsN)r@rArBr�r�r7r7r7r8r�Vsr�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#ee$j%d@kdA�dBdC��Z&ee$j%d@kdA�dDdE��Z'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�Z8dhS)i�CollectionsAbcTestscCs |�dtj�|�gtj�dSrI)rfr<�Hashabler�rNr7r7r8�
test_hashable�sz!CollectionsAbcTests.test_hashablecCsX|�gtj�|�gtj�|�gtj�|�dtj�|�ttj�|�ttj�dSrI)rfr<r�r�r9r�rNr7r7r8�
test_iterable�sz!CollectionsAbcTests.test_iterablecCs(tg�}|�|tj�|�dtj�dSrI)r�rfr<�Iteratorr�)r3�itr7r7r8�
test_iterator�sz!CollectionsAbcTests.test_iteratorz&Python 3.5 and multithreading requiredcCsJi}tdt�|�|d}|�}|�|tj�|�|tj�|�d�dS)NzPasync def foo() -> typing.Awaitable[int]:
    return await AwaitableWrapper(42)
r�)r�r�rfr<�	Awaitabler��send�r3r�r��gr7r7r8�test_awaitable�s�z"CollectionsAbcTests.test_awaitablec	Cs�i}tdt�|�|d}|�}|�|tj�|�t��t|tjt�W5QRX|�	|tj�z|�
d�Wntk
r�YnXdS)Nzasync def foo():
    return
r�)r�r�rfr<�	CoroutinerKrLrMrTr�r��
StopIterationrr7r7r8�test_coroutine�s �z"CollectionsAbcTests.test_coroutinecCs>td�}t|�}|�|tj�|�|tj�|�dtj�dS�N�
rJ)r��AsyncIteratorWrapperrfr<�
AsyncIterabler��r3Zbase_itr�r7r7r8�test_async_iterable�s
z'CollectionsAbcTests.test_async_iterablecCs0td�}t|�}|�|tj�|�dtj�dSr)r�rrfr<�
AsyncIteratorr�r
r7r7r8�test_async_iterator�sz'CollectionsAbcTests.test_async_iteratorcCs |�gtj�|�dtj�dSrI)rfr<�Sizedr�rNr7r7r8�
test_sized�szCollectionsAbcTests.test_sizedcCs |�gtj�|�dtj�dSrI)rfr<�	Containerr�rNr7r7r8�test_container�sz"CollectionsAbcTests.test_containercCsJttd�rF|�t�tj�|�t�tj�|�ttj�|�dtj�dS)N�
CollectionrJ)	r�r<rfr�rr{r9r�r�rNr7r7r8�test_collection�s

z#CollectionsAbcTests.test_collectioncCs"|�t�tj�|�dtj�dSrI)rfrDr<rr�rNr7r7r8�test_abstractset�sz$CollectionsAbcTests.test_abstractsetcCs$|�t�tj�|�t�tj�dSr;)rfrDr<�
MutableSetr�r{rNr7r7r8�test_mutableset�sz#CollectionsAbcTests.test_mutablesetcCs |�itj�|�dtj�dSrI)rfr<r�r�rNr7r7r8�test_mapping�sz CollectionsAbcTests.test_mappingcCs |�itj�|�dtj�dSrI)rfr<rr�rNr7r7r8�test_mutablemapping�sz'CollectionsAbcTests.test_mutablemappingcCs |�gtj�|�dtj�dSrI)rfr<rr�rNr7r7r8�
test_sequence�sz!CollectionsAbcTests.test_sequencecCs |�gtj�|�dtj�dSr�)rfr<�MutableSequencer�rNr7r7r8�test_mutablesequence�sz(CollectionsAbcTests.test_mutablesequencecCs$|�dtj�|�td�tj�dSr�)rfr<�
ByteString�	bytearrayrNr7r7r8�test_bytestring�sz#CollectionsAbcTests.test_bytestringcCs|�ttj�dSr;)r9r�r<rrNr7r7r8�	test_list�szCollectionsAbcTests.test_listcCs:|�tjtj�Gdd�dtjt�}|�|�tj�dS)Nc@seZdZdS)z/CollectionsAbcTests.test_deque.<locals>.MyDequeNrDr7r7r7r8�MyDeque�sr )r9r��dequer<�DequerTrf)r3r r7r7r8�
test_deque�szCollectionsAbcTests.test_dequecCs|�tjtj�dSr;)r9r��Counterr<rNr7r7r8�test_counter�sz CollectionsAbcTests.test_countercCs |�ttj�|�ttj�dSr;)r9rDr<�Setr:r{rNr7r7r8�test_set�szCollectionsAbcTests.test_setcCs |�ttj�|�ttj�dSr;)r9r{r<r�r:rDrNr7r7r8�test_frozenset�sz"CollectionsAbcTests.test_frozensetcCs|�ttj�dSr;)r9r�r<r�rNr7r7r8r�szCollectionsAbcTests.test_dictc	Csf|�t��t��W5QRX|�t��tjt�W5QRX|�t��tjt�W5QRXdSr;)rKrLr<rr
rTrNr7r7r8�test_no_list_instantiationsz.CollectionsAbcTests.test_no_list_instantiationcCsRGdd�dtjt�}|�}|�||�|�|tj�|�|t�|�t|�dS)Nc@seZdZdS)z6CollectionsAbcTests.test_list_subclass.<locals>.MyListNrDr7r7r7r8�MyListsr*)r<rrTrfrr9r�r:)r3r*r�r7r7r8�test_list_subclasssz&CollectionsAbcTests.test_list_subclassc	Csn|�t��t��W5QRX|�t��tjttf�W5QRX|�t��tjttf�W5QRXdSr;)rKrLr<r�rrrurTrNr7r7r8�test_no_dict_instantiationsz.CollectionsAbcTests.test_no_dict_instantiationcCsVGdd�dtjttf�}|�}|�||�|�|tj�|�|t�|�t|�dS)Nc@seZdZdS)z6CollectionsAbcTests.test_dict_subclass.<locals>.MyDictNrDr7r7r7r8r$sr)	r<r�rurTrfrr9r�r:)r3rr4r7r7r8�test_dict_subclass"sz&CollectionsAbcTests.test_dict_subclasscCsV|�tt���tj�|�ttjttf��tj�|�ttjtt	f��tj�dSr;)
rqrYr<rr��defaultdictrrrurTrNr7r7r8�test_defaultdict_instantiation.sz2CollectionsAbcTests.test_defaultdict_instantiationcCsLGdd�dtjttf�}|�}|�||�|�|tj�|�tj|�dS)Nc@seZdZdS)z@CollectionsAbcTests.test_defaultdict_subclass.<locals>.MyDefDictNrDr7r7r7r8�	MyDefDict5sr0)	r<rrurTrfr9r�r.r:)r3r0�ddr7r7r8�test_defaultdict_subclass3s
z-CollectionsAbcTests.test_defaultdict_subclasscCsV|�tt���tj�|�ttjttf��tj�|�ttjttf��tj�dSr;)	rqrYr<�OrderedDictr�rrrurTrNr7r7r8�test_ordereddict_instantiation>sz2CollectionsAbcTests.test_ordereddict_instantiationcCsLGdd�dtjttf�}|�}|�||�|�|tj�|�tj|�dS)Nc@seZdZdS)z@CollectionsAbcTests.test_ordereddict_subclass.<locals>.MyOrdDictNrDr7r7r7r8�	MyOrdDictEsr5)r<r3rurTrfr9r�r:)r3r5Zodr7r7r8�test_ordereddict_subclassCs
z-CollectionsAbcTests.test_ordereddict_subclassrzChainMap was added in 3.3cCs�|�tt���tj�|�ttjttf��tj�|�ttjttf��tj�Gdd�dtjttf�}|�t|ttf��|�dS)Nc@seZdZdS)z;CollectionsAbcTests.test_chainmap_instantiation.<locals>.CMNrDr7r7r7r8�CMSsr7)	rqrYr<rr�rrrurT)r3r7r7r7r8�test_chainmap_instantiationNs
z/CollectionsAbcTests.test_chainmap_instantiationcCsLGdd�dtjttf�}|�}|�||�|�|tj�|�tj|�dS)Nc@seZdZdS)z>CollectionsAbcTests.test_chainmap_subclass.<locals>.MyChainMapNrDr7r7r7r8�
MyChainMapYsr9)r<rrurTrfr9r�r:)r3r9�cmr7r7r8�test_chainmap_subclassVs
z*CollectionsAbcTests.test_chainmap_subclasscCsz|�tt���tj�|�ttjt��tj�|�ttjt��tj�Gdd�dtjt�}|�t|t��|�dS)Nc@seZdZdS)z7CollectionsAbcTests.test_deque_instantiation.<locals>.DNrDr7r7r7r8rfsr)rqrYr<r"r�r!r
rTr�r7r7r8�test_deque_instantiationbs
z,CollectionsAbcTests.test_deque_instantiationcCsz|�tt���tj�|�ttjt��tj�|�ttjt��tj�Gdd�dtjt�}|�t|t��|�dS)Nc@seZdZdS)z9CollectionsAbcTests.test_counter_instantiation.<locals>.CNrDr7r7r7r8r�msr�)rqrYr<r$r�r
rTr�r7r7r8�test_counter_instantiationis
z.CollectionsAbcTests.test_counter_instantiationcCsHGdd�dtjt�}|�}|�||�|�|tj�|�|tj�dS)Nc@seZdZdS)zJCollectionsAbcTests.test_counter_subclass_instantiation.<locals>.MyCounterNrDr7r7r7r8�	MyCounterrsr>)r<r$rTrfr�)r3r>r4r7r7r8�#test_counter_subclass_instantiationps
z7CollectionsAbcTests.test_counter_subclass_instantiationc	Csf|�t��t��W5QRX|�t��tjt�W5QRX|�t��tjt�W5QRXdSr;)rKrLr<r&r
rTrNr7r7r8�test_no_set_instantiationzsz-CollectionsAbcTests.test_no_set_instantiationcCs,Gdd�dtjt�}|�}|�||�dS)Nc@seZdZdS)zBCollectionsAbcTests.test_set_subclass_instantiation.<locals>.MySetNrDr7r7r7r8�MySet�srA)r<r&rTrf)r3rAr4r7r7r8�test_set_subclass_instantiation�sz3CollectionsAbcTests.test_set_subclass_instantiationc	Csf|�t��t��W5QRX|�t��tjt�W5QRX|�t��tjt�W5QRXdSr;)rKrLr<r�r
rTrNr7r7r8�test_no_frozenset_instantiation�sz3CollectionsAbcTests.test_no_frozenset_instantiationcCs,Gdd�dtjt�}|�}|�||�dS)Nc@seZdZdS)zNCollectionsAbcTests.test_frozenset_subclass_instantiation.<locals>.MyFrozenSetNrDr7r7r7r8�MyFrozenSet�srD)r<r�rTrf)r3rDr4r7r7r8�%test_frozenset_subclass_instantiation�sz9CollectionsAbcTests.test_frozenset_subclass_instantiationc	Cs`|�t��t�W5QRX|�t��tt�W5QRX|�t��tt�W5QRXdSr;)rKrLrr
rTrNr7r7r8�test_no_tuple_instantiation�sz/CollectionsAbcTests.test_no_tuple_instantiationcCs$dd�}|�}|�t|�tj�dS)Ncss
dVdSrIr7r7r7r7r8r��sz/CollectionsAbcTests.test_generator.<locals>.foo)r9rYr<�	Generator)r3r�rr7r7r8�test_generator�sz"CollectionsAbcTests.test_generatorc	Csr|�t��t��W5QRX|�t��tjtttf�W5QRX|�t��tjtttf�W5QRXdSr;)rKrLr<rGr
rTrNr7r7r8�test_no_generator_instantiation�sz3CollectionsAbcTests.test_no_generator_instantiationcCs2i}tdt�|�|d�}|�t|�tj�dS)Nzasync def f():
    yield 42
r>)r�r�r9rYr<�AsyncGenerator)r3r�rr7r7r8�test_async_generator�s�
z(CollectionsAbcTests.test_async_generatorc	Csn|�t��t��W5QRX|�t��tjttf�W5QRX|�t��tjttf�W5QRXdSr;)rKrLr<rJr
rTrNr7r7r8�%test_no_async_generator_instantiation�sz9CollectionsAbcTests.test_no_async_generator_instantiationc	Cs,Gdd�dtj�}|�t��|�W5QRXGdd�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�W5QRX|�
||�Gdd	�d	tj�}|�t|�Gd
d�dtjtttf�}dd
�}|�
|tj�|�
|tj�|�
|tjj�|�
|tjj�|�t|�|�dS)Nc@seZdZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMANrDr7r7r7r8�MMA�srMc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMCcSsdSr;r7r�r7r7r8r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__getitem__cSsdSr;r7r�r7r7r8r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__setitem__cSsdSr;r7r�r7r7r8r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__delitem__cSstd�Sr�r�rNr7r7r8r��sz:CollectionsAbcTests.test_subclassing.<locals>.MMC.__iter__cSsdSrIr7rNr7r7r8r��sz9CollectionsAbcTests.test_subclassing.<locals>.MMC.__len__Nr�r7r7r7r8�MMC�s
rNrc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMBcSsdSr;r7r�r7r7r8r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__getitem__cSsdSr;r7r�r7r7r8r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__setitem__cSsdSr;r7r�r7r7r8r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__delitem__cSstd�Sr�r�rNr7r7r8r��sz:CollectionsAbcTests.test_subclassing.<locals>.MMB.__iter__cSsdSrIr7rNr7r7r8r��sz9CollectionsAbcTests.test_subclassing.<locals>.MMB.__len__Nr�r7r7r7r8�MMB�s
rOc@seZdZdS)z/CollectionsAbcTests.test_subclassing.<locals>.INrDr7r7r7r8�I�srPc@seZdZdS)z/CollectionsAbcTests.test_subclassing.<locals>.GNrDr7r7r7r8rI�srIcss
dVdSrIr7r7r7r7r8r�r�z/CollectionsAbcTests.test_subclassing.<locals>.g)r<rrKrLrQr�rfr�rrrur:r�r9r�r(r1r�r�rGrTrY)r3rMrNrOrPrIrr7r7r8�test_subclassing�s@z$CollectionsAbcTests.test_subclassingcCs�Gdd�dtjttf�}i}tdt�|�|d}|�|tj�|�|tj�|�|tjj�|�|tjj�|�	t
|�|�|�}|�|tj�|�|tj�|�|tjj�|�|tjj�|�t
|�|�|�||�dS)Nc@seZdZdd�Zddd�ZdS)z?CollectionsAbcTests.test_subclassing_async_generator.<locals>.GcSsdSr;r7)r3r�r7r7r8�asend
szECollectionsAbcTests.test_subclassing_async_generator.<locals>.G.asendNcSsdSr;r7)r3�typ�val�tbr7r7r8�athrow
szFCollectionsAbcTests.test_subclassing_async_generator.<locals>.G.athrow)NN)r@rArBrRrVr7r7r7r8rI
srIzasync def g(): yield 0r)
r<rJrTr�r�r9r	r�r(r:rYrfr�)r3rIr�r�instancer7r7r8� test_subclassing_async_generator
s z4CollectionsAbcTests.test_subclassing_async_generatorcCsfGdd�dtj�}Gdd�d|�}Gdd�d�}Gdd�d�}|�||�|�||�|�||�dS)	Nc@seZdZedd��ZdS)z?CollectionsAbcTests.test_subclassing_subclasshook.<locals>.BasecSs|jdkrdSdSdS)Nr�TF)r@rbr7r7r8rd
s
zPCollectionsAbcTests.test_subclassing_subclasshook.<locals>.Base.__subclasshook__Nrer7r7r7r8r�
sr�c@seZdZdS)z<CollectionsAbcTests.test_subclassing_subclasshook.<locals>.CNrDr7r7r7r8r�&
sr�c@seZdZdS)z>CollectionsAbcTests.test_subclassing_subclasshook.<locals>.FooNrDr7r7r7r8r�'
sr�c@seZdZdS)z>CollectionsAbcTests.test_subclassing_subclasshook.<locals>.BarNrDr7r7r7r8r�(
sr�)r<r�r9r:)r3r�r�r�r�r7r7r8�test_subclassing_subclasshook
sz1CollectionsAbcTests.test_subclassing_subclasshookcCs�Gdd�dtj�}Gdd�d|�}Gdd�d�}|�|�|�||�|�||�Gdd�d�}|�|�|�||�|�||�Gd	d
�d
�}tjj�|�|�|tj�dS)Nc@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.ANrDr7r7r7r8rW/
srWc@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.BNrDr7r7r7r8r*0
sr*c@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.CNrDr7r7r7r8r�2
sr�c@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.DNrDr7r7r7r8r7
src@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.MNrDr7r7r7r8r�<
sr�)	r<rr?r9r:r�r(rr�)r3rWr*r�rr�r7r7r8�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@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.MNrDr7r7r7r8r�B
sr�c@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.SNrDr7r7r7r8riF
sric@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.INrDr7r7r7r8rPJ
srPc@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.ANrDr7r7r7r8rWM
srW)�	metaclassc@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.BNrDr7r7r7r8r*N
sr*)	r�r(r�r9r<r�r�ABCMetar?)r3r�rirPrWr*r7r7r8�test_collections_as_base@
s
z,CollectionsAbcTests.test_collections_as_baseN)9r@rArBr�r�r�r�ASYNCIOrrrr
rrrrrrrrrrrr#r%r'r(r�r)r+r,r-r/r2r4r6r�r�r8r;r<r=r?r@rBrCrErFrHrIrKrLrQrXrYrZr]r7r7r7r8r��sp






Er�c@s&eZdZdd�Zeed�dd��ZdS)�
OtherABCTestscCs4tjdd��}|�}|�|tj�|�dtj�dS)Ncss
dVdSrIr7r7r7r7r8�managerV
sz2OtherABCTests.test_contextmanager.<locals>.managerrJ)�
contextlib�contextmanagerrfr<r�r�)r3r`r:r7r7r8�test_contextmanagerU
s

z!OtherABCTests.test_contextmanagerzPython 3.5 requiredc	Cs�Gdd�d�}|�t�tj�|�|�tj�tjdd��}|�}|�|tj�|�tjtj	tf�|�
t��tdtjt�W5QRX|�
t��tjtt
fW5QRXdS)Nc@seZdZdS)z7OtherABCTests.test_async_contextmanager.<locals>.NotACMNrDr7r7r7r8�NotACM`
srdcss
dVdSrIr7r7r7r7r8r`d
sz8OtherABCTests.test_async_contextmanager.<locals>.managerrJ)rf�ACMr<r�r�rarbrQrTrorKrLrMru)r3rdr`r:r7r7r8�test_async_contextmanager^
s
z'OtherABCTests.test_async_contextmanagerN)r@rArBrcrr^rfr7r7r7r8r_S
s	r_c@s$eZdZdd�Zdd�Zdd�ZdS)�	TypeTestscCsNGdd�d�}Gdd�d|�}Gdd�d|�}t||d�dd	�}||�dS)
Nc@seZdZdS)z'TypeTests.test_type_basic.<locals>.UserNrDr7r7r7r8�Useru
srhc@seZdZdS)z,TypeTests.test_type_basic.<locals>.BasicUserNrDr7r7r7r8�	BasicUserv
sric@seZdZdS)z*TypeTests.test_type_basic.<locals>.ProUserNrDr7r7r7r8�ProUserw
srj��
user_classr�cSs|�Sr;r7�rlr7r7r8�new_usery
sz+TypeTests.test_type_basic.<locals>.new_userr#)r3rhrirjrnr7r7r8�test_type_basics
s
zTypeTests.test_type_basiccCsZGdd�d�}Gdd�d|�}Gdd�d|�}td|d�}t||d	�d
d�}||�dS)Nc@seZdZdS)z)TypeTests.test_type_typevar.<locals>.UserNrDr7r7r7r8rh�
srhc@seZdZdS)z.TypeTests.test_type_typevar.<locals>.BasicUserNrDr7r7r7r8ri�
sric@seZdZdS)z,TypeTests.test_type_typevar.<locals>.ProUserNrDr7r7r7r8rj�
srjr�r�rkcSs|�Sr;r7rmr7r7r8rn�
sz-TypeTests.test_type_typevar.<locals>.new_user)rr$)r3rhrirjr�rnr7r7r8�test_type_typevar~
szTypeTests.test_type_typevarcCs$ttt}|ttd�dd�}dS)Nr�cSs|dkrdS|�SdSr;r7r�r7r7r8r��
sz)TypeTests.test_type_optional.<locals>.foo)rr$�
BaseException)r3rWr�r7r7r8�test_type_optional�
szTypeTests.test_type_optionalN)r@rArBrorprrr7r7r7r8rgq
s
rgc@seZdZdd�Zdd�ZdS)�NewTypeTestscCsLtdt�}tdt�}|�|d�t�|�|d�t�|�|d�dd�dS)N�UserId�UserNamer��Joer��)r%rTrurfrQ)r3rtrur7r7r8�
test_basic�
s


zNewTypeTests.test_basicc	Cs^tdt�}tdt�}|�t��t|t�W5QRX|�t��Gdd�d|�}W5QRXdS)Nrtruc@seZdZdS)z#NewTypeTests.test_errors.<locals>.DNrDr7r7r7r8r�
sr)r%rTrurKrLr1)r3rtrurr7r7r8rU�
s

zNewTypeTests.test_errorsN)r@rArBrxrUr7r7r7r8rs�
srsc@sdeZdZGdd�de�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)�NamedTupleTestsc@seZdZUeed<eed<dS)zNamedTupleTests.NestedEmployeer�r�Nr�r7r7r7r8�NestedEmployee�
s
rzcCs�tddtfdtfg�}|�|t�|dd�}|ddd�}|�||�|�|t�|�|jd�|�|jd�|�|jd�|�|jd�|�|j	d�|�|j
d�|�|jt�
dtfdtfg��|�|j|j�dS)	N�Empr��idrvrJ�Jimr��r�r|)r&rurTr9r�rfrQr�r|r@�_fieldsrr�r3rq�_field_types)r3r{Zjoe�jimr7r7r8r��
s 
�zNamedTupleTests.test_basicsc	Cs`tjdd�dkr\|�t��tdttd�W5QRX|�t��Gdd�dt�}W5QRXdS)Nr�)r�rw�Name)Zonercc@seZdZdZdS)z9NamedTupleTests.test_namedtuple_pyversion.<locals>.NotYetrN)r@rArBr)r7r7r7r8�NotYet�
sr�)r�r�rKrLr&rTru)r3r�r7r7r8�test_namedtuple_pyversion�
s
z)NamedTupleTests.test_namedtuple_pyversioncCs�tdd�}|�|t�|�|t�|�|jd�|�|jd�|�tjd�|�tjd�|�tjt	j
ttd��|�
tjtj�dS)NZTimi(#r��r�r�)r�rfr�rQr�r�r@rrr�r3rurTrqr�)r3Ztimr7r7r8�test_annotation_usage�
s
�z%NamedTupleTests.test_annotation_usagec	Cs�td�}|�|t�|�|t�|�|jd�|�|jd�tdd�}|�|jd�|�tjd�|�tjd�|�tjt	t
td��|�tjt	dd��|�
t��td�W5QRXdS)	NZJellerZSjoerdr�r�r�)r�zE
class NonDefaultAfterDefault(NamedTuple):
    x: int = 3
    y: int
)r�rfr�rQr�r�r@rr�r�rurT�_field_defaultsrKrLr�)r3ZjelleZcooler_employeer7r7r8�"test_annotation_usage_with_default�
s
z2NamedTupleTests.test_annotation_usage_with_defaultc	Cs�|�td���d�|�td�jtd�d�|�ttd��d�|�tdd�td�d�|�t��td�W5QRX|�t��td�W5QRXdS)	Nr�r�rJrz42 -> 1r�zc
class XMethBad(NamedTuple):
    x: int
    def _fields(self):
        return 'no chance for this'
zl
class XMethBad2(NamedTuple):
    x: int
    def _source(self):
        return 'no chance for this as well'
)	rQr�r�r�rur�rKr�r�rNr7r7r8�"test_annotation_usage_with_methods�
sz2NamedTupleTests.test_annotation_usage_with_methodsc	Cs�tdttd�}|dd�}|�|t�|�|jd�|�|jd�|�|jd�|�|j	t
ttd��|�|j|j	�|�
t��tddtfgtd�W5QRX|�
t��tddd	d
�W5QRXdS)N�
LocalEmployee)r�ZageZNick�r�r��r�r�r�rE)r&rurTrfr�rQr�r@rrr�rqr�rKrL)r3r�Znickr7r7r8�test_namedtuple_keyword_usages
z-NamedTupleTests.test_namedtuple_keyword_usagecCs�tdttttd�}|�|jd�|�|jd�|tdddtfgd�}|�|j	t�|�|j
d�|�|jd�|�|jdtfg�dS)Nr)r4r3�typename�fieldsrJr�r�)
r&rYr�rur�rQr@rr�r4r3r�r�)r3rr�r7r7r8�%test_namedtuple_special_keyword_namessz5NamedTupleTests.test_namedtuple_special_keyword_namesc	Cs|�t��t��W5QRX|�t��t�W5QRX|�t��tddtfgd�W5QRX|�t��tddtfg�W5QRX|�t��tdttd�}W5QRX|�	|j
d�|�	|jd�|�t��tddtfdtfgd�}W5QRX|�	|j
d�|�	|jd�dS)Nr{r��_name)r�r�r|r~r|)r�)rKrLr&rRrur�ZassertWarns�DeprecationWarningrTrQr@r)r3r{r7r7r8�test_namedtuple_errorss "z&NamedTupleTests.test_namedtuple_errorsc
Cs�tddtfdtfg�att|jfD]�}|j|d���|dd�}ttj	d�D]2}t�
||�}t�|�}|�||�|�
||�qLt|�}|�||�|�
||�t|�}|�||�|�
||�W5QRXq"dS)Nr{r�r�)r4�jane�%r�)r&rurTr{r�rzZsubTestr�r�r�r�r�rQrfrr)r3r4r�r�r��jane2r7r7r8�test_copy_and_pickle,s

z$NamedTupleTests.test_copy_and_pickleN)r@rArBr&rzr�r�r�r�r�r�r�r�r�r7r7r7r8ry�
s
ryc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�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'rurTr9r�r<rr:r�r(rrqrYrQr@rAr�r�	__total__�r3r{r�r7r7r8�test_basics_functional_syntaxBsz,TypedDictTests.test_basics_functional_syntaxcCs�tdttd�}|�|t�|�|tj�|�|tj	j
�|ddd�}|�t|�t�|�
|dd�|�
|dd�|�
|jd�|�
|jt�|�
|jtf�|�
|jttd��|�
|jd�dSr�r�r�r7r7r8�test_basics_keywords_syntaxQs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)r4r3r��	_typenamer�rrJr��5r�r�r4r3r�r�r�r)r'rYr�rurTr�r�rQr@rr�rD)r3r�r�r7r7r8�$test_typeddict_special_keyword_names`sz3TypedDictTests.test_typeddict_special_keyword_namesc	Cs�|�t��t��W5QRX|�t��t�W5QRX|�t��tddtfgd�W5QRX|�t��tdttd�W5QRX|�t��tdttd�d�W5QRXdS)Nr{r�)r�r�r|r~)r)rKrLr'rRrurTrNr7r7r8�test_typeddict_create_errorslsz+TypedDictTests.test_typeddict_create_errorsc	Cstdttd��}|�tjd�|ddd�}|�t��ti|�W5QRX|�t��t||�W5QRX|�t��tt	|�W5QRX|�t��tddd�W5QRX|�t��tddtfd	g�W5QRX|�t��tddtfgtd
�W5QRXdS)Nr{r~r<r}r�ZHir�r�)r�r�r�)
r'rurTrQrArKrLrMr1r�r�r7r7r8�test_typeddict_errorsxsz$TypedDictTests.test_typeddict_errorscCs�|�tjd�|�tjt�|�tjtttd��|�tjtf�|�tj	d�|�
ttj�t
ddd�}|�|dd�|�|dd�tddd	d�}|�|d
d	�dS)Nr�rBTrr�rEr�r��hir)rQr�r@rArrTrur�r�r�r:r<rr�)r3Z
not_originrcr7r7r8�test_py36_class_syntax_usage�sz+TypedDictTests.test_py36_class_syntax_usagecCs�tdttd�atddd��}ttjd�D]d}t�||�}t�|�}|�	||�|�	|ddd��t�t|�}t�|�}|�	|ddd��|�q*dS)N�EmpDr~r�r�r�)
r'rurTr�r�r�r�r�r�rQ)r3r�r�r�r�ZZZZEmpDnewr7r7r8r�s

zTypedDictTests.test_picklecCsFtdttd�}|�tj|tjd|f�|�tj|tj	|�dS)Nr�r~)
r'rurTrQr<rrrnrr)r3r�r7r7r8r��szTypedDictTests.test_optionalcCsztddtidd�}|�|�i�|�|dd�ddi�|�|jd�|�t�i�|�tdd�d	di�|�tjd�dS)
Nrr�Fr�r�r�r�)r�r�)r'rTrQr�r�r�r7r7r8�
test_total�szTypedDictTests.test_totalN)r@rArBr�r�r�r�r�r�rr�r�r7r7r7r8r�As

r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�IOTestscCs.ttd�dd�}|jd}|�|jtf�dS)Nr�cSs|��Sr;��readliner�r7r7r8rh�szIOTests.test_io.<locals>.stuffr�)r(rrrQrp�r3rhr�r7r7r8�test_io�s
zIOTests.test_iocCs,ttd�dd�}|jd}|�|jd�dS)Nr�cSs|��Sr;r�r�r7r7r8rh�sz"IOTests.test_textio.<locals>.stuffr�r7)r)rurrQrpr�r7r7r8�test_textio�s
zIOTests.test_textiocCs,ttd�dd�}|jd}|�|jd�dS)Nr�cSs|��Sr;r�r�r7r7r8rh�sz$IOTests.test_binaryio.<locals>.stuffr�r7)r*rvrrQrpr�r7r7r8�
test_binaryio�s
zIOTests.test_binaryiocCspddlm}m}m}m}m}|�|tj�|�|tj�|�|tj�|�t	|�t	dddg��|�|d�dS)Nr)r(r)r*rr@r(r)r*z	typing.io)
Z	typing.ior(r)r*rr@rqr<rQrD)r3r(r)r*rr@r7r7r8�test_io_submodule�szIOTests.test_io_submoduleN)r@rArBr�r�r�r�r7r7r7r8r��sr�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�RETestscCs�t�dtj�}|�|jt�|�t|�t�|�|t�|�d�}|�|jt	�|�t|�t	�|�|t	�tt
ttft	t
ttfdS)Nz[a-z]+z12345abcde.....)
r*�compilerPr9r�r+rYrf�searchr,rrurv)r3�patZmatr7r7r8r��s
zRETests.test_basicscCsP|�tttt�|�tttt�|�tttt�|�ttt�dSr;)rQr+rurnrvr,rNr7r7r8�test_alias_equality�szRETests.test_alias_equalityc	Cs~ttttf}|�t��|tW5QRX|�t��tdtt�W5QRX|�t��ttttt�W5QRXdSrI)	r,rrurvrKrLrMr+r1)r3�mr7r7r8rU�s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])rQrRr+rurvr,rNr7r7r8rS�szRETests.test_reprcCs\ddlm}m}m}m}|�|tj�|�|tj�|�t|�tddg��|�|d�dS)Nr)r,r+rr@r,r+z	typing.re)	Z	typing.rer,r+rr@rqr<rQrD)r3r,r+rr@r7r7r8�test_re_submodules
zRETests.test_re_submodulec	Cs>|�t��}Gdd�dtj�}W5QRX|�t|j�d�dS)Nc@seZdZdS)z'RETests.test_cannot_subclass.<locals>.ANrDr7r7r7r8rWsrWz.type 're.Match' is not an acceptable base type)rKrLr<r,rQru�	exception)r3�exrWr7r7r8r[	s
�zRETests.test_cannot_subclassN)	r@rArBr�r�rUrSr�r[r7r7r7r8r��sr�c@seZdZdd�Zdd�ZdS)�AllTestscCs�ddlm}|�d|�|�d|�|�d|�|�d|�ttd�rR|�d|�|�d	|�|�d
|�|�d|�|�d|�|�d
|�|�d|�|�d|�dS)Nr)rr�
ValuesViewrr��AbstractContextManagerr��ior*�osr�ZTextr�r�)r<rr�r�rarprCr7r7r8�test_alls
zAllTests.test_allcs>ddl�t�j����fdd�t����D�}|�|��dS)Nrcsnh|]f\}}|�ksf|�d�s|�jjkr|�jjkr|dkr|�d�s|��|kst|dd��jkr|�qS)�_>r�r*)r�Z_contraZ_corAN)rar�rr*rw�upperrr@r��Z
actual_allr<r7r8�	<setcomp>/s

�z3AllTests.test_all_exported_names.<locals>.<setcomp>)r<rDr�varsr�ZassertSetEqual)r3Zcomputed_allr7r�r8�test_all_exported_names+s

�z AllTests.test_all_exported_namesN)r@rArBr�r�r7r7r7r8r�sr��__main__)�rar�r�r*r�Zunittestrrrrrrrr<r	r
rrr
rrrrrrrrrrrrrrrrrrr r!r"r$r%r&r'r(r)r*r+r,r(r+rrrr-r.rCrErFrGrHr^rdr�r�r�r�rurvr�r�r�r�r�rrrrrrrrrrrr�r]rbrfrgr�Z
ASYNCIO_TESTSr�r�r^r�r�r�r�rWr*r�rIr�r�r�r�r�r�r�r�r�r�r�rTr�rer�r�er�r�r�r�r�r_rgrsryr�r�r�r�r@r7r7r7r8�<module>s�*"Y)N>w4(/K$
g+U's#<1