Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_typing.cpython-35.opt-1.pyc



��Yf�?�@s�ddlZddlZddlZddlZddlZddlmZmZmZm	Z	ddl
m
Z
mZddlm
Z
mZddlmZmZddlmZmZmZddlmZmZddlmZmZmZdd	lmZdd
lmZmZmZddlmZddlmZdd
lmZm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$m%Z%m&Z&ddlm'Z'm(Z(ddl)Z)ddlZddl*Z*yddl+j)Z,Wne-k
r	ddlZ,YnXGdd�de�Z.Gdd�d�Z/Gdd�de/�Z0Gdd�de/�Z1Gdd�de0e1�Z2Gdd�de.�Z3Gdd �d e.�Z4Gd!d"�d"e.�Z5Gd#d$�d$e.�Z6Gd%d&�d&e.�Z7Gd'd(�d(e.�Z8ed)e9e:�Z;ed*�Z<Gd+d,�d,ee;e<f�Z=Gd-d.�d.e=e;e<f�Z>Gd/d0�d0e.�Z?Gd1d2�d2e.�Z@Gd3d4�d4e.�ZAGd5d6�d6e.�ZBGd7d8�d8e.�ZCGd9d:�d:e.�ZDejEdd;�d<d=fkZFd>ZGeFr5yeHeG�Wne-k
r1d?ZFYnXndZIeJZKZLZMejEdd;�d<d@fkZNdAZOeNr�eHeO�n6dZPZQZReJZSZTZUZVZWZXeJZYZZZ[eZ\GdBdC�dCe.�Z]GdDdE�dEe.�Z^GdFdG�dGe.�Z_GdHdI�dIe.�Z`GdJdK�dKe.�ZaGdLdM�dMe.�ZbGdNdO�dOe.�ZcGdPdQ�dQe.�ZdGdRdS�dSe.�ZeefdTkr�e�dS)U�N)�TestCase�main�
skipUnless�SkipTest)�copy�deepcopy)�Any�NoReturn)�TypeVar�AnyStr)�T�KT�VT)�Union�Optional)�Tuple�List�MutableMapping)�Callable)�Generic�ClassVar�GenericMeta)�cast)�get_type_hints)�
no_type_check�no_type_check_decorator)�Type)�NewType)�
NamedTuple)�IO�TextIO�BinaryIO)�Pattern�Matchc@s:eZdZddd�Zddd�Zdd�ZdS)�BaseTestCaseNcCsLt||�sHd||f}|dk	r9|d|7}|j|��dS)Nz%r is not a subclass of %rz : %s)�
issubclass�failureException)�self�cls�class_or_tuple�msg�message�r,�5/opt/alt/python35/lib64/python3.5/test/test_typing.py�assertIsSubclass#s
zBaseTestCase.assertIsSubclasscCsLt||�rHd||f}|dk	r9|d|7}|j|��dS)Nz%r is a subclass of %rz : %s)r%r&)r'r(r)r*r+r,r,r-�assertNotIsSubclass*s
z BaseTestCase.assertNotIsSubclasscCsxtjD]
}|�q
WdS)N)�typingZ	_cleanups)r'�fr,r,r-�clear_caches1szBaseTestCase.clear_caches)�__name__�
__module__�__qualname__r.r/r2r,r,r,r-r$!sr$c@seZdZdS)�EmployeeN)r3r4r5r,r,r,r-r66sr6c@seZdZdS)�ManagerN)r3r4r5r,r,r,r-r7:sr7c@seZdZdS)�FounderN)r3r4r5r,r,r,r-r8>sr8c@seZdZdS)�ManagingFounderN)r3r4r5r,r,r,r-r9Bsr9c@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�AnyTestsc
Cs(|jt��tdt�WdQRXdS)N�*)�assertRaises�	TypeError�
isinstancer)r'r,r,r-�test_any_instance_type_errorHsz%AnyTests.test_any_instance_type_errorcCsL|jt��ttt�WdQRX|jt��ttt�WdQRXdS)N)r<r=r%r6r)r'r,r,r-�test_any_subclass_type_errorLsz%AnyTests.test_any_subclass_type_errorcCs|jtt�d�dS)Nz
typing.Any)�assertEqual�reprr)r'r,r,r-�	test_reprRszAnyTests.test_reprcCsG|jt��tdt�WdQRX|jt��
ttWdQRXdS)Nr;)r<r=r%r�int)r'r,r,r-�test_errorsUszAnyTests.test_errorscCsd|jt��Gdd�dt�}WdQRX|jt��!Gdd�dtt��}WdQRXdS)Nc@seZdZdS)z(AnyTests.test_cannot_subclass.<locals>.AN)r3r4r5r,r,r,r-�A]srFc@seZdZdS)z(AnyTests.test_cannot_subclass.<locals>.AN)r3r4r5r,r,r,r-rF`s)r<r=r�type)r'rFr,r,r-�test_cannot_subclass[szAnyTests.test_cannot_subclasscCsF|jt��t�WdQRX|jt��tt��WdQRXdS)N)r<r=rrG)r'r,r,r-�test_cannot_instantiatecsz AnyTests.test_cannot_instantiatecCs%tjttjttjtdS)N)r0r#rr"r)r'r,r,r-�test_any_works_with_aliasisz"AnyTests.test_any_works_with_aliasN)
r3r4r5r?r@rCrErHrIrJr,r,r,r-r:Fsr:c@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
NoReturnTestsc
Cs(|jt��tdt�WdQRXdS)Nr;)r<r=r>r	)r'r,r,r-�!test_noreturn_instance_type_errorrsz/NoReturnTests.test_noreturn_instance_type_errorcCsL|jt��ttt�WdQRX|jt��ttt�WdQRXdS)N)r<r=r%r6r	)r'r,r,r-�!test_noreturn_subclass_type_errorvsz/NoReturnTests.test_noreturn_subclass_type_errorcCs|jtt�d�dS)Nztyping.NoReturn)rArBr	)r'r,r,r-rC|szNoReturnTests.test_reprc	Cs#|jt��
ttWdQRXdS)N)r<r=r	rD)r'r,r,r-�test_not_genericszNoReturnTests.test_not_genericcCsd|jt��Gdd�dt�}WdQRX|jt��!Gdd�dtt��}WdQRXdS)Nc@seZdZdS)z-NoReturnTests.test_cannot_subclass.<locals>.AN)r3r4r5r,r,r,r-rF�srFc@seZdZdS)z-NoReturnTests.test_cannot_subclass.<locals>.AN)r3r4r5r,r,r,r-rF�s)r<r=r	rG)r'rFr,r,r-rH�sz"NoReturnTests.test_cannot_subclasscCsF|jt��t�WdQRX|jt��tt��WdQRXdS)N)r<r=r	rG)r'r,r,r-rI�sz%NoReturnTests.test_cannot_instantiateN)	r3r4r5rLrMrCrNrHrIr,r,r,r-rKpsrKc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�TypeVarTestscCs0td�}|j||�|j|t�dS)Nr)r
rA�assertIsInstance)r'rr,r,r-�test_basic_plain�szTypeVarTests.test_basic_plainc
Cs4td�}|jt��td|�WdQRXdS)Nrr;)r
r<r=r>)r'rr,r,r-� test_typevar_instance_type_error�sz-TypeVarTests.test_typevar_instance_type_errorcCsXtd�}|jt��tt|�WdQRX|jt��t|t�WdQRXdS)Nr)r
r<r=r%rD)r'rr,r,r-� test_typevar_subclass_type_error�s
z-TypeVarTests.test_typevar_subclass_type_errorc
Cs.|jt��tdt�}|WdQRXdS)N�X)r<r=r
rD)r'rTr,r,r-�test_constrained_error�sz#TypeVarTests.test_constrained_errorcCstd�}td�}|j||�|jt||�|jt|t||f�|jt||f|�|jt|tft|�|jt|tftt�|jt|tfj|tf�|jt|tfj|f�|jt|tfjt�dS)NrT�Y)	r
�assertNotEqualrArrD�__args__�__parameters__�assertIs�
__origin__)r'rTrVr,r,r-�test_union_unique�s# zTypeVarTests.test_union_uniquecCs4tdtt�}|jt|tft|�dS)NrF)r
�str�bytesrWr)r'rFr,r,r-�test_union_constrained�sz#TypeVarTests.test_union_constrainedcCs�|jtt�d�|jtt�d�|jtt�d�|jtt�d�tddd�}|jt|�d�td	d
d�}|jt|�d�dS)Nz~Tz~KTz~VTz~AnyStr�T_co�	covariantTz+T_co�T_contra�
contravariantz	-T_contra)rArBrr
rrr
)r'r`rbr,r,r-rC�szTypeVarTests.test_reprcCsH|jtd�td��|jtdtt�tdtt��dS)Nr)rWr
rDr])r'r,r,r-�test_no_redefinition�sz!TypeVarTests.test_no_redefinitioncCs7|jt��!Gdd�dtd��}WdQRXdS)Nc@seZdZdS)z1TypeVarTests.test_cannot_subclass_vars.<locals>.VN)r3r4r5r,r,r,r-�V�srer)r<r=r
)r'rer,r,r-�test_cannot_subclass_vars�sz&TypeVarTests.test_cannot_subclass_varscCs1|jt��Gdd�dt�}WdQRXdS)Nc@seZdZdS)z7TypeVarTests.test_cannot_subclass_var_itself.<locals>.VN)r3r4r5r,r,r,r-re�sre)r<r=r
)r'rer,r,r-�test_cannot_subclass_var_itself�sz,TypeVarTests.test_cannot_subclass_var_itselfc	Cs(|jt��td��WdQRXdS)NrF)r<r=r
)r'r,r,r-�test_cannot_instantiate_vars�sz)TypeVarTests.test_cannot_instantiate_varscCsX|jt��tddd�WdQRX|jt��tdttdt�WdQRXdS)NrT�boundr;)r<r=r
r]�floatr6)r'r,r,r-�test_bound_errors�szTypeVarTests.test_bound_errorsc
Cs1|jt��tddddd�WdQRXdS)NrraTrc)r<�
ValueErrorr
)r'r,r,r-�test_no_bivariant�szTypeVarTests.test_no_bivariantN)r3r4r5rQrRrSrUr\r_rCrdrfrgrhrkrmr,r,r,r-rO�s

rOc@seZdZdd�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)*�
UnionTestscCs$tttf}|j|t�dS)N)rrDrjrW)r'�ur,r,r-�test_basics�szUnionTests.test_basicsc Cs�|jt��ttt�WdQRX|jt��ttt�WdQRX|jt��tttttf�WdQRX|jt��ttttft�WdQRXdS)N)r<r=r%rDrr])r'r,r,r-�test_subclass_error�szUnionTests.test_subclass_errorcCs�tt}|j|t�tttf}tttf}tttf}|j||�|j|t�|j|t�|j|t�dS)N)rrrArD�objectrW)r'ro�u1�u2Zu3r,r,r-�test_union_any�s
zUnionTests.test_union_anycCs^tt}|j|t�tttf}|j|t�tttf}|j|t�dS)N)rrrrArD)r'ror,r,r-�test_union_object�s
zUnionTests.test_union_objectcCs4tttf}tttf}|j||�dS)N)rrDrjrA)r'rsrtr,r,r-�test_unorderedszUnionTests.test_unorderedcCstt}|j|t�dS)N)rr6rZ)r'�tr,r,r-�test_single_class_disappearss
z'UnionTests.test_single_class_disappearscCs~ttttf}|j|tttf�ttttf}|j|tttf�tttf}|j|t�dS)N)rr6r7rDrArZ)r'ror,r,r-�test_base_class_disappearssz%UnionTests.test_base_class_disappearscCsAtttf}t|tf}|j|ttttf�dS)N)rrDrjr6rA)r'ro�vr,r,r-�test_union_unionszUnionTests.test_union_unioncCs�|jtt�d�tttf}|jt|�dt�tttf}|jt|�dt�td�}t|tft}|jt|�tt��ttttf}|jt|�d�dS)Nztyping.Unionztyping.Union[%s.Employee, int]ztyping.Union[int, %s.Employee]rz#typing.Union[typing.List[int], int])rArBrr6rDr3r
r)r'rorr,r,r-rCszUnionTests.test_reprcCs�|jt��Gdd�dt�}WdQRX|jt��!Gdd�dtt��}WdQRX|jt��%Gdd�dtttf�}WdQRXdS)Nc@seZdZdS)z*UnionTests.test_cannot_subclass.<locals>.CN)r3r4r5r,r,r,r-�C+sr}c@seZdZdS)z*UnionTests.test_cannot_subclass.<locals>.CN)r3r4r5r,r,r,r-r}.sc@seZdZdS)z*UnionTests.test_cannot_subclass.<locals>.CN)r3r4r5r,r,r,r-r}1s)r<r=rrGrDr])r'r}r,r,r-rH)s#zUnionTests.test_cannot_subclasscCs�|jt��t�WdQRX|jt��tt��WdQRXtttf}|jt��|�WdQRX|jt��t|��WdQRXdS)N)r<r=rrGrDrj)r'ror,r,r-rI4sz"UnionTests.test_cannot_instantiatecCsv|jtttjtftk�|jtttjtftjtk�|jtttjftjk�dS)N)�assertFalserr]r0�IterablerD�
assertTrue)r'r,r,r-�test_union_generalization?s$+z$UnionTests.test_union_generalizationcCs�|jtt�|jtt�|jtt�|jtt�|jdgt�|jttj�|jttjt�dS)N)	rWrrrrrrr0�Mappingr)r'r,r,r-�test_union_compare_otherDsz#UnionTests.test_union_compare_othercCs.tt}ttdf}|j||�dS)N)rrDrrA)r'�oror,r,r-�
test_optionalMs
zUnionTests.test_optionalc	Cs#|jt��
tfWdQRXdS)N)r<r=r)r'r,r,r-�
test_emptyRszUnionTests.test_emptycCs2|jt��tdtttf�WdQRXdS)Nr;)r<r=r>rrDr])r'r,r,r-�test_union_instance_type_errorVsz)UnionTests.test_union_instance_type_errorcCsCtttf}|ddd��}|jt|�d|�dS)N)�xcSsddS)N.r,)r�r,r,r-r1\sz(UnionTests.test_no_eval_union.<locals>.fr�)rrDr]rZr)r'ror1r,r,r-�test_no_eval_unionZszUnionTests.test_no_eval_unioncCs9tddd��}|jtt|tf�d�dS)N)�returncSsddS)N.r,r,r,r,r-�fun`sz0UnionTests.test_function_repr_union.<locals>.funztyping.Union[fun, int])rDrArBr)r'r�r,r,r-�test_function_repr_union_sz#UnionTests.test_function_repr_unioncCstttf}|dS)N)rr]r")r'rFr,r,r-�test_union_str_patterncsz!UnionTests.test_union_str_patterncsgyddlm�Wntk
r4td��YnXt�tf�fdd�}t|tfdS)Nr)�ElementzcElementTree not foundcs
�|�S)Nr,)�args)r�r,r-�Elemqsz#UnionTests.test_etree.<locals>.Elem)Zxml.etree.cElementTreer��ImportErrorrrr])r'r�r,)r�r-�
test_etreehs
zUnionTests.test_etreeN)r3r4r5rprqrurvrwryrzr|rCrHrIr�r�r�r�r�r�r�r�r�r,r,r,r-rn�s(
	rnc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
TupleTestscCs�|jt��tttttf�WdQRX|jt��tttttf�WdQRXGdd�dt�}|jttt��|jt|t��dS)Nc@seZdZddS)z"TupleTests.test_basics.<locals>.TP.N)r3r4r5r,r,r,r-�TPsr�)r<r=r%rrDr]�tupler�)r'r�r,r,r-rpyszTupleTests.test_basicscCs||jtttt�|jttdfttdf�|jtttttf�|jttttdf�dS)N.)rArrDrW)r'r,r,r-�
test_equality�s$zTupleTests.test_equalitycCs0Gdd�dt�}|jt|t��dS)Nc@seZdZdS)z/TupleTests.test_tuple_subclass.<locals>.MyTupleN)r3r4r5r,r,r,r-�MyTuple�sr�)r�r�r%r)r'r�r,r,r-�test_tuple_subclass�szTupleTests.test_tuple_subclasscCsB|jt��tdtttf�WdQRX|jdt�dS)Nr)rr)rr)r<r=r>rrDrP)r'r,r,r-�test_tuple_instance_type_error�sz)TupleTests.test_tuple_instance_type_errorcCst|jtt�d�|jttf�d�|jttttf�d�|jtttdf�d�dS)Nztyping.Tupleztyping.Tuple[()]ztyping.Tuple[int, float].ztyping.Tuple[int, ...])rArBrrDrj)r'r,r,r-rC�s zTupleTests.test_reprcCsP|jt��tdt�WdQRX|jt��tdtt�WdQRXdS)Nr;)r<r=r%rrD)r'r,r,r-rE�szTupleTests.test_errorsN)	r3r4r5rpr�r�r�rCrEr,r,r,r-r�ws
r�c@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�
CallableTestsc
Csl|jt��4|jttdd��ttgtf��WdQRX|jttdd��t��dS)NcSs|S)Nr,)r�r,r,r-�<lambda>�sz2CallableTests.test_self_subclass.<locals>.<lambda>cSs|S)Nr,)r�r,r,r-r��s)r<r=r�r%rGrrD)r'r,r,r-�test_self_subclass�s6z CallableTests.test_self_subclasscCs)|jttgtfttgtf�|jtttgtfttgtfh�d�|jttgtfttgtf�|jttgtfttgtf�|jttgtftttgtf�|jttgtftgtf�|jttgtft�dS)N�)rArrD�lenrWr])r'r,r,r-�test_eq_hash�s*6**-'zCallableTests.test_eq_hashcCs�|jt��t�WdQRX|jt��tt��WdQRXttgtf}|jt��|�WdQRX|jt��t|��WdQRXdS)N)r<r=rrGrDr])r'�cr,r,r-rI�sz%CallableTests.test_cannot_instantiatec%Cs�|jt��tdgtfWdQRX|jt��tftfWdQRX|jt��tfgtfWdQRX|jt��ttdgdfWdQRX|jt��
ttWdQRXdS)N.r��)r<r=rrD)r'r,r,r-�test_callable_wrong_forms�sz'CallableTests.test_callable_wrong_formscCs0dd�}|j|t�|jdt�dS)NcSsdS)Nr,r,r,r,r-r1�sz5CallableTests.test_callable_instance_works.<locals>.f)rPr�assertNotIsInstance)r'r1r,r,r-�test_callable_instance_works�sz*CallableTests.test_callable_instance_worksc!Cs�dd�}|jt��|j|tgdf�WdQRX|jt��|j|tgtf�WdQRX|jt��|jdtgdf�WdQRX|jt��|jdtgtf�WdQRXdS)NcSsdS)Nr,r,r,r,r-r1�sz:CallableTests.test_callable_instance_type_error.<locals>.f)r<r=rPrrr�)r'r1r,r,r-�!test_callable_instance_type_error�s!!!z/CallableTests.test_callable_instance_type_errorcCs|tgtf}|jt|�d�tttgtf}|jt|�d�tdtf}|jt|�d�dS)Nztyping.Callable[[], bool]z"typing.Callable[[str, float], int].ztyping.Callable[..., str])r�boolrArBr]rjrD)r'Zct0Zct2Zctvr,r,r-rC�szCallableTests.test_reprcCsUtdtfddd��}|jt|t�t��dtdtfi�dS)N.)�acSsdS)Nr,)r�r,r,r-�foo�sz6CallableTests.test_callable_with_ellipsis.<locals>.foor�)rrrAr�globals�locals)r'r�r,r,r-�test_callable_with_ellipsis�sz)CallableTests.test_callable_with_ellipsiscCstjtdtfdS)N.)r0rrr])r'r,r,r-�test_ellipsis_in_generic�sz&CallableTests.test_ellipsis_in_genericN)r3r4r5r�r�rIr�r�r�rCr�r�r,r,r,r-r��s	r��XK�XVc@s^eZdZeeddd��Zeeddd��Zdeeedd	d
��ZdS)�
SimpleMapping)�keyr�cCsddS)N.r,)r'r�r,r,r-�__getitem__�szSimpleMapping.__getitem__)r��valuecCsddS)N.r,)r'r�r�r,r,r-�__setitem__�szSimpleMapping.__setitem__N)r��defaultr�cCsddS)N.r,)r'r�r�r,r,r-�get�szSimpleMapping.get)r3r4r5r�r�r�r�r�r,r,r,r-r��sr�c@s^eZdZdd�Zeddd��Zeddd��Zdedd	d
��ZdS)�MySimpleMappingcCs
i|_dS)N)�store)r'r,r,r-�__init__szMySimpleMapping.__init__)r�cCs|j|S)N)r�)r'r�r,r,r-r�szMySimpleMapping.__getitem__cCs||j|<dS)N)r�)r'r�r�r,r,r-r�szMySimpleMapping.__setitem__NcCs,y|j|SWntk
r'|SYnXdS)N)r��KeyError)r'r�r�r,r,r-r�	s
zMySimpleMapping.get)r3r4r5r�r]r�r�r�r,r,r,r-r��sr�c@speZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�
ProtocolTestscCs*|jttj�|jttj�dS)N)r.rDr0�SupportsIntr/r])r'r,r,r-�test_supports_intszProtocolTests.test_supports_intcCs*|jttj�|jttj�dS)N)r.rjr0Z
SupportsFloatr/r])r'r,r,r-�test_supports_floatsz!ProtocolTests.test_supports_floatcCs=Gdd�d�}|j|tj�|jttj�dS)Nc@seZdZdd�ZdS)z.ProtocolTests.test_supports_complex.<locals>.CcSsdS)Nyr,)r'r,r,r-�__complex__sz:ProtocolTests.test_supports_complex.<locals>.C.__complex__N)r3r4r5r�r,r,r,r-r}sr})r.r0�SupportsComplexr/r])r'r}r,r,r-�test_supports_complexsz#ProtocolTests.test_supports_complexcCs=Gdd�d�}|j|tj�|jttj�dS)Nc@seZdZdd�ZdS)z,ProtocolTests.test_supports_bytes.<locals>.BcSsdS)N�r,)r'r,r,r-�	__bytes__(sz6ProtocolTests.test_supports_bytes.<locals>.B.__bytes__N)r3r4r5r�r,r,r,r-�B'sr�)r.r0�
SupportsBytesr/r])r'r�r,r,r-�test_supports_bytes$sz!ProtocolTests.test_supports_bytescCs=|jttj�|jttj�|jttj�dS)N)r.rjr0�SupportsAbsrDr/r])r'r,r,r-�test_supports_abs.szProtocolTests.test_supports_abscCsMtttj�|jttj�|jttj�|jttj�dS)N)r%rjr0Z
SupportsRoundr.rDr/r])r'r,r,r-�test_supports_round3sz!ProtocolTests.test_supports_roundcCs*|jttj�|jttj�dS)N)r.�listr0Z
Reversibler/rD)r'r,r,r-�test_reversible9szProtocolTests.test_reversiblecCss|jt��tdtj�WdQRXGdd�dtj�}Gdd�d|�}|�}|j||�dS)Nrc@s%eZdZeddd��ZdS)z;ProtocolTests.test_protocol_instance_type_error.<locals>.C1)r�cSsdS)Nr;r,)r'r,r,r-�__int__AszCProtocolTests.test_protocol_instance_type_error.<locals>.C1.__int__N)r3r4r5rDr�r,r,r,r-�C1@sr�c@seZdZdS)z;ProtocolTests.test_protocol_instance_type_error.<locals>.C2N)r3r4r5r,r,r,r-�C2Csr�)r<r=r>r0r�r�rP)r'r�r�r�r,r,r-�!test_protocol_instance_type_error=s	z/ProtocolTests.test_protocol_instance_type_errorN)r3r4r5r�r�r�r�r�r�r�r�r,r,r,r-r�s

r�c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)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+dSS)T�GenericTestscCs�tttf}|j|jf�|jt��
|tWdQRX|jt��|ttfWdQRXtttf}|j|jtf�|t|jt��|ttfWdQRX|jttt	ft�dS)N)
r�r]rrArYr<r=r�r.rD)r'rTrVr,r,r-rpKszGenericTests.test_basicsc>Csqtd�}td�}|jt��t|�WdQRX|jt��t||WdQRX|jt��t||WdQRX|jt��tgtt�WdQRX|jt��tttt�WdQRX|jt��Gdd�dt�}WdQRX|jt��&Gdd�dt|t|�}WdQRX|jt��&Gdd�dt|t|�}WdQRXdS)Nr�Sc@seZdZddS)z4GenericTests.test_generic_errors.<locals>.NewGeneric.N)r3r4r5r,r,r,r-�
NewGenericgsr�c@seZdZddS)z3GenericTests.test_generic_errors.<locals>.MyGeneric.N)r3r4r5r,r,r,r-�	MyGenericisr�c@seZdZddS)z3GenericTests.test_generic_errors.<locals>.MyGeneric.N)r3r4r5r,r,r,r-r�ks)	r
r<r=rr>rrDr%r�)r'rr�r�r�r,r,r-�test_generic_errorsYs$(z GenericTests.test_generic_errorscCsitd�}td�}|jt��t||fWdQRX|jt��t|||fWdQRXdS)Nrr�)r
r<r=r)r'rr�r,r,r-�	test_initmszGenericTests.test_initcCs@|jtt�tdd�|jtt�tdd�dS)N�.r�r�)rArBr�r3r�)r'r,r,r-rCuszGenericTests.test_reprcCsFtd�}td�}Gdd�dt|�}|t||f}|j||t||f�|j||t||f�||tf}|j|||tf�|j|||tf�|j|||tf�|t}|j||t�|j||t�|j|||�|jt|�jd��dS)Nrr�c@seZdZdS)z'GenericTests.test_chain_repr.<locals>.CN)r3r4r5r,r,r,r-r}sr}z.C[typing.Tuple[str, int]])	r
rrrArWrDr]r��endswith)r'rr�r}rTrV�Zr,r,r-�test_chain_repr{s 
zGenericTests.test_chain_reprcCs�td�}tddd�}td�}|jtt�d�|jtt|�d�|jtt|�d�|jtt||t�d	�|jttt�d	�dS)
Nr�UraTr�ztyping.Listztyping.List[~T]ztyping.List[+U]ztyping.List[int])r
rArBrrD)r'rr�r�r,r,r-�
test_new_repr�s"zGenericTests.test_new_reprcCs�td�}td�}|jttj||f||f�d�|jttt||ft|f�d�|jttt||ftt�d�dS)Nr�TSztyping.Mapping[~TS, ~T]z"typing.List[typing.Tuple[int, ~T]]z=typing.List[typing.Tuple[typing.List[int], typing.List[int]]])r
rArBr0r�rrrD)r'rr�r,r,r-�test_new_repr_complex�s-'z"GenericTests.test_new_repr_complexcCswtd�}|jtt|�d�|jttj|�d�Gdd�dtjttf�}t|j�dS)Nrztyping.Generic[~T]ztyping.Protocol[~T]c@seZdZddS)z*GenericTests.test_new_repr_bare.<locals>.C.N)r3r4r5r,r,r,r-r}�sr})	r
rArBrr0�	_Protocol�Dictr�__mro__)r'rr}r,r,r-�test_new_repr_bare�s
#zGenericTests.test_new_repr_barecCs�td�}Gdd�dt|�}|�}d|_|j|jddi�Gdd�d|t�}|�}d|_|j|jd	di�dS)
Nrc@seZdZdS)z!GenericTests.test_dict.<locals>.BN)r3r4r5r,r,r,r-r��sr�r;r�c@seZdZdS)z!GenericTests.test_dict.<locals>.CN)r3r4r5r,r,r,r-r}�sr}�abc�bar)r
rr�rA�__dict__rDr�)r'rr��br}r�r,r,r-�	test_dict�s				zGenericTests.test_dictcCs�td�}Gdd�dt|�}|j|tjd�|j||tjd�d||t_|j|jd�|j|tjd�d|tt_|j|jd�|j|ttjd�|j|�jd�|j|tt�jd�Gdd�d||�}|j|tjd�|j|jd�d	|_d
|t_|j|jd�|j|tjd�|j|jd
�|j|tjd	�dS)Nrc@seZdZdZdS)z<GenericTests.test_subscripted_generics_as_proxies.<locals>.C�defN)r3r4r5r�r,r,r,r-r}�sr}r�Zchanged�newc@seZdZdS)z<GenericTests.test_subscripted_generics_as_proxies.<locals>.DN)r3r4r5r,r,r,r-�D�sr�zfrom derived zzfrom derived x)	r
rrArDr�r]r�zr)r'rr}r�r,r,r-�$test_subscripted_generics_as_proxies�s*	
z1GenericTests.test_subscripted_generics_as_proxiescCs_td�}Gdd�dt|�}|jt�|jd|�|t|jd|�dS)Nrc@seZdZddS)z.GenericTests.test_abc_registry_kept.<locals>.C.N)r3r4r5r,r,r,r-r}�sr}r�)r
r�registerrDrP)r'rr}r,r,r-�test_abc_registry_kept�s
z#GenericTests.test_abc_registry_keptcCsDGdd�dtttf�}|ji|�|jt|�dS)Nc@seZdZdS)z5GenericTests.test_false_subclasses.<locals>.MyMappingN)r3r4r5r,r,r,r-�	MyMapping�sr�)rr]r�r/�dict)r'r�r,r,r-�test_false_subclasses�s z"GenericTests.test_false_subclassescCs}Gdd�dtttf�}|�j�|j|�tj�|j|�t�|j|�t�|ji|�dS)Nc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z'GenericTests.test_abc_bases.<locals>.MMcSsdS)Nr,)r'�kr,r,r-r��sz3GenericTests.test_abc_bases.<locals>.MM.__getitem__cSsdS)Nr,)r'r�r{r,r,r-r��sz3GenericTests.test_abc_bases.<locals>.MM.__setitem__cSsdS)Nr,)r'r�r,r,r-�__delitem__�sz3GenericTests.test_abc_bases.<locals>.MM.__delitem__cSs
tf�S)N)�iter)r'r,r,r-�__iter__�sz0GenericTests.test_abc_bases.<locals>.MM.__iter__cSsdS)Nrr,)r'r,r,r-�__len__�sz/GenericTests.test_abc_bases.<locals>.MM.__len__N)r3r4r5r�r�r�r�r�r,r,r,r-�MM�s
r�)rr]�updaterP�collections_abcr�r)r'r�r,r,r-�test_abc_bases�s 
zGenericTests.test_abc_basescCsgGdd�dtttftj�}|jt��+Gdd�dtjtttf�}WdQRXdS)Nc@seZdZdS)z-GenericTests.test_multiple_bases.<locals>.MM1N)r3r4r5r,r,r,r-�MM1�sr�c@seZdZdS)z-GenericTests.test_multiple_bases.<locals>.MM2N)r3r4r5r,r,r,r-�MM2sr�)rr]r�r<r=)r'r�r�r,r,r-�test_multiple_bases�s&z GenericTests.test_multiple_basescCsVtd�}Gdd�dtjt|f�}|j|jtjt|ff�dS)Nrc@seZdZddS)z'GenericTests.test_orig_bases.<locals>.C.N)r3r4r5r,r,r,r-r}sr})r
r0r�r]rA�__orig_bases__)r'rr}r,r,r-�test_orig_basess#zGenericTests.test_orig_basescCs�dd�}|j|dditjttf��|j|dditjttf��|jt��%|dditjttf�WdQRXdd�}Gdd�dt	t�}|j||t�|t��|j||t�|t��|j||t�t
��|jt��|dd	d
g|t�WdQRXdd�}Gd
d�dt
t�}|j|dd	d
g|��|j|ddg|��dS)Ncs]t|j�dkrt�|jrY|j\��t��fdd�|j�D��SdS)Nrc3s3|])\}}t|��o*t|��VqdS)N)r>)�.0r�r{)r
rr,r-�	<genexpr>szSGenericTests.test_naive_runtime_checks.<locals>.naive_dict_check.<locals>.<genexpr>)r�rY�NotImplementedErrorrX�all�items)�obj�tpr,)r
rr-�naive_dict_checks	z@GenericTests.test_naive_runtime_checks.<locals>.naive_dict_checkr�r�cSs"t|d�st�|j|kS)N�__orig_class__)�hasattrrr)rrr,r,r-�naive_generic_checkszCGenericTests.test_naive_runtime_checks.<locals>.naive_generic_checkc@seZdZddS)z4GenericTests.test_naive_runtime_checks.<locals>.Node.N)r3r4r5r,r,r,r-�Node sr	r��cst�fdd�|D��S)Nc3s,|]"}t|�jdjd�VqdS)rN)r>r�rX)r�r�)rr,r-r�)szXGenericTests.test_naive_runtime_checks.<locals>.naive_list_base_check.<locals>.<genexpr>)r)rrr,)rr-�naive_list_base_check'szEGenericTests.test_naive_runtime_checks.<locals>.naive_list_base_checkc@seZdZddS)z1GenericTests.test_naive_runtime_checks.<locals>.C.N)r3r4r5r,r,r,r-r}+sr}r�r�)r�r0r�r]rDr~r<rrrr)r'rrr	rr}r,r,r-�test_naive_runtime_checkss 
))'!!!z&GenericTests.test_naive_runtime_checkscCsstd�}td�}td�}Gdd�dt|||�}Gdd�d|t|||�}|j|j|f�|j|j|f�|j|tjf�|j|tjf�|j|tjtf�|j|tjtf�|j|jtf�|j|j|tf�|j|jt|||f�|j|j|t|||f�dS)Nrr�rec@seZdZddS)z.GenericTests.test_multi_subscr_base.<locals>.C.N)r3r4r5r,r,r,r-r}3sr}c@seZdZddS)z.GenericTests.test_multi_subscr_base.<locals>.D.N)r3r4r5r,r,r,r-r�4sr�)r
rrArYrDrX�	__bases__r�)r'rr�rer}r�r,r,r-�test_multi_subscr_base/s"%"z#GenericTests.test_multi_subscr_basecCsstd�}|jtttt�|jt|tfttttf�|jtdtfjttf�dS)Nr.)	r
rArrrrDrrX�Ellipsis)r'rr,r,r-�test_subscript_meta@s(z GenericTests.test_subscript_metacCs�yddlm}Wntk
r4ddl}YnXGdd�dtt�}Gdd�dtt�}|j||�|j|jt|jt�|j|j|j�|j|jj|jt|jj|jt�|j	||j�|j	||j�|j	||jj�|j	|j|j�|j	|j|jj�|j	|t|jt�|j	|t
t|jt
t�|j	|t|jt�|j	|t|jjt�|j	|jt|jt�|j	|jt
t|jjt
t�|j	t
|tt
|jt�|j	t
|t
tt
|jt
t�|j	tt|tftt|jtf�|j	t|t|tft|t|jtf�|j	tj|ttj|jjt�tjdd�d
kr�|jtt
|t�jd	��|jtt
|jt�jd
��|jtt
|jt�jd��|jtt
|jjt�jd��dS)Nr)�mod_generics_cachec@seZdZddS)z+GenericTests.test_generic_hashes.<locals>.A.N)r3r4r5r,r,r,r-rFKsrFc@s*eZdZGdd�dee�ZdS)z+GenericTests.test_generic_hashes.<locals>.Bc@seZdZddS)z-GenericTests.test_generic_hashes.<locals>.B.A.N)r3r4r5r,r,r,r-rFOsrFN)r3r4r5rrrFr,r,r,r-r�Nsr�r�r
z<locals>.A[str]]z<locals>.B.A[str]]zmod_generics_cache.A[str]]zmod_generics_cache.B.A[str]])r
r�)Ztestrr�rrrArFr]r�rWrrrDrrr0�	FrozenSet�sys�version_infor�rBr�)r'rrFr�r,r,r-�test_generic_hashesFsH
#)#+/$'
 z GenericTests.test_generic_hashesc&CsZtd�}td�}|jt||fttttf�|jtjt||f|tjt||f�|jt��t|tffWdQRX|jt��t||f|dfWdQRX|jt|tftt�|jt||ftttt	ffttt	f�Gdd�d�}Gdd�d|�}|jt||f||�|jt��t|tfdWdQRX|jt
|g|ftt
tgtf�|jt
dt|ftt
dttf�|jt�� t
|g|fdtfWdQRX|jt�� t
|g|fgtfWdQRXdS)	Nrr�.c@seZdZddS)z9GenericTests.test_extended_generic_rules_eq.<locals>.Base.N)r3r4r5r,r,r,r-�Base�src@seZdZddS)z<GenericTests.test_extended_generic_rules_eq.<locals>.Derived.N)r3r4r5r,r,r,r-�Derived�srr�)
r
rArrDr0rr<r=rr]rr
r)r'rr�rrr,r,r-�test_extended_generic_rules_equs*(68.0"z+GenericTests.test_extended_generic_rules_eqcCs�td�}|jttttf�jdd�d�|jtttttf�jdd�d�|jttdt|ft�jdd�d�|jttgt	|ft�jdd�d�dS)	Nrztyping.�zUnion[Tuple, Callable]r.z#Callable[..., Union[int, NoneType]]zCallable[[], List[int]])
r
rArBrrr�replacerDrr)r'rr,r,r-� test_extended_generic_rules_repr�s%)--z-GenericTests.test_extended_generic_rules_reprcCs
ttdddd��}Gdd�d�}|jt|t�t��dtt|i�td�}t|df}|dd	d
��}|jt|t�t��d|�tdt|f}|ddd��}|jt|t�t��d|�dS)
N�CC)r�cSsddS)N.r,)r�r,r,r-�foobar�sz5GenericTests.test_generic_forward_ref.<locals>.foobarc@seZdZddS)z1GenericTests.test_generic_forward_ref.<locals>.CC.N)r3r4r5r,r,r,r-r�sr�r.cSsddS)N.r,)r�r,r,r-�barfoo�sz5GenericTests.test_generic_forward_ref.<locals>.barfoocSsddS)N.r,)r�r,r,r-�barfoo2�sz6GenericTests.test_generic_forward_ref.<locals>.barfoo2)	rrArr�r�r
rrZr)r'rrr�ATrZCTrr,r,r-�test_generic_forward_ref�s&z%GenericTests.test_generic_forward_refcCs
Gdd�dtttf�}Gdd�dttdf�}Gdd�dttgtf�}Gdd	�d	tdtf�}|j|jttf�|j|ttfjttf�|j|ttfj	|�|j|jtf�|j
t��
|tWdQRX|j
t��|ttfWdQRX|jt|t�j
d
�d
d�|j|jf�|j|�tj�|j|tj�|j|tj�|j|�t�|j|t�|jttdftj�|jttdftj�dS)Nc@seZdZddS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.T1.N)r3r4r5r,r,r,r-�T1�sr"c@seZdZddS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.T2.N)r3r4r5r,r,r,r-�T2�sr#.c@seZdZddS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.C1.N)r3r4r5r,r,r,r-r��sr�c@seZdZdd�ZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.C2cSsdS)Nr,)r'r,r,r-�__call__�szIGenericTests.test_extended_generic_rules_subclassing.<locals>.C2.__call__N)r3r4r5r$r,r,r,r-r��sr�r�r�zC1[int]���)rrr
rrDrArYr]rXr[r<r=rB�splitrPr�r.r�r0�Sequencer)r'r"r#r�r�r,r,r-�'test_extended_generic_rules_subclassing�s*  # #'z4GenericTests.test_extended_generic_rules_subclassingcCs�|jt��
ttWdQRX|jt��
ttWdQRX|jt��
ttWdQRX|jt��tttWdQRXdS)N)r<r=rrrrrrD)r'r,r,r-�test_fail_with_bare_union�sz&GenericTests.test_fail_with_bare_unioncCs�td�}|jt��
ttWdQRX|jt��tt|WdQRX|jt��ttjWdQRX|jt��tdt�WdQRXdS)Nrr�)	r
r<r=rrrr0r�r>)r'rr,r,r-�test_fail_with_bare_generic�sz(GenericTests.test_fail_with_bare_genericcCs�td�}|j�Gdd�dt||f�}|j|t�j|�|j|t�j|t�Gdd�dtd|f�}|j||�j|�|j||�j||�Gdd�dtj	||f�}|j|t�j|�|j|t�j|t�Gd	d
�d
tj
t|f�}|j|t�j|�|j|t�j|t�tj
dkr�Gdd
�d
tjt|f�}|j|t�j|�|j|t�j|t�dS)Nrc@seZdZddS)z5GenericTests.test_type_erasure_special.<locals>.MyTup.N)r3r4r5r,r,r,r-�MyTup�sr+c@seZdZdd�ZdS)z6GenericTests.test_type_erasure_special.<locals>.MyCallcSsdS)Nr,)r'r,r,r-r$�sz?GenericTests.test_type_erasure_special.<locals>.MyCall.__call__N)r3r4r5r$r,r,r,r-�MyCall�sr,.c@seZdZddS)z6GenericTests.test_type_erasure_special.<locals>.MyDict.N)r3r4r5r,r,r,r-�MyDict�sr-c@seZdZddS)z5GenericTests.test_type_erasure_special.<locals>.MyDef.N)r3r4r5r,r,r,r-�MyDef�sr.r
c@seZdZddS)z7GenericTests.test_type_erasure_special.<locals>.MyChain.N)r3r4r5r,r,r,r-�MyChain�sr/)r
r
)r
r2rrZrD�	__class__rrr0r��DefaultDictr]rr�ChainMap)r'rr+r,r-r.r/r,r,r-�test_type_erasure_special�s$
  ###z&GenericTests.test_type_erasure_specialcCs�dd�tjD�}x�|D]�}|jt|�d�|j||�t|dd�r�t|j�dkr�|j|tj	tf�t
|t�rx7|jD],}|jt|�d�|j||�q�WqWdS)Ncss|]}tt|�VqdS)N)�getattrr0)r�Zelr,r,r-r��sz4GenericTests.test_all_repr_eq_any.<locals>.<genexpr>rrYr�)
r0�__all__rWrBrAr4r�rYrrXr>rGr�)r'Zobjsr�baser,r,r-�test_all_repr_eq_any�s
'z!GenericTests.test_all_repr_eq_anycs�td�}td��td��G��fdd�dt��f�}|t|f}|t��tj�j����fdd��jjj	�D�}|j
|dtd	ti�dS)
Nrr
rcs(eZdZ��ddd��ZdS)z2GenericTests.test_substitution_helper.<locals>.Map)r�r{cSsddS)N.r,)r'r�r{r,r,r-�methsz7GenericTests.test_substitution_helper.<locals>.Map.methN)r3r4r5r8r,)r
rr,r-�Mapsr9cs7i|]-\}}tj|t��j��|�qSr,)r0Z_replace_argrGrY)r�r�r{)�new_argsrr,r-�
<dictcomp>s	z9GenericTests.test_substitution_helper.<locals>.<dictcomp>r�r{)r
rr]rDr0Z
_subs_treerr8�__annotations__rrA)r'rr9ZStrMapZ
new_annotsr,)r
rr:rr-�test_substitution_helper�s)
z%GenericTests.test_substitution_helperc	Csatd�}Gdd�dt|�}Gdd�d|t�at�}d|_d|_x�ttjd�D]l}tj	||�}tj
|�}|j|jd�|j|jd�|j|jd	dd
di�qoWt
ttttttjg}x]|D]U}xLttjd�D]7}tj	||�}tj
|�}|j||�qWqWdS)Nrc@seZdZdS)z#GenericTests.test_pickle.<locals>.BN)r3r4r5r,r,r,r-r�sr�c@seZdZdS)r}N)r3r4r5r,r,r,r-r}sr}r;r�r�r�r�)r
rrDr}r�r��range�pickle�HIGHEST_PROTOCOL�dumps�loadsrAr�rrrrrrr0r)	r'rr�r��protor�r�Zsimples�sr,r,r-�test_pickles$			#
zGenericTests.test_picklecCsHtd�}Gdd�dt|�}t|tft|tftd|fttgtftttf|||t|ttj|tjttjttj	tt
ftj	|tftttt|tdtdtftdtj
dtfg}xA|tgD]2}|j|t|��|j|t|��qWdS)Nrc@seZdZddS)z1GenericTests.test_copy_and_deepcopy.<locals>.Node.N)r3r4r5r,r,r,r-r	'sr	.)rr)r
rrrDrrrr0rr�r]rrr�rArr)r'rr	�thingsrxr,r,r-�test_copy_and_deepcopy%s7,$)*z#GenericTests.test_copy_and_deepcopyc	Cs�td�}tt|tftd|ftttfttttj	tt
ftjjt
tjdg}x*|D]"}|jtj|��|�quWdS)Nr.�whatever)r
rrrDrrrrr0r�r]�rer#r^rrA�weakref�ref)r'rrFrxr,r,r-�test_weakref_all1s*
zGenericTests.test_weakref_allcCs?td�}Gdd�dt|�}|�}|t�}|j|j|tj�d|_d|_|jt��d|_	WdQRX|jt��d|_	WdQRX|dddd��}|jt
|t�t��d||�|jt
|t�t��dj|j�|jt
|t�t|t��dS)	Nrc@seZdZdZdS)z0GenericTests.test_parameterized_slots.<locals>.C�potatoN)rM)r3r4r5�	__slots__r,r,r,r-r};sr}r)r�cSsddS)N.r,)r�r,r,r-r�Isz2GenericTests.test_parameterized_slots.<locals>.foor�)r
rrDrArNr]rMr<�AttributeErrorZtomatorr�r�rr)r'rr}r�Zc_intr�r,r,r-�test_parameterized_slots9s 	
		*"
z%GenericTests.test_parameterized_slotscCs�td�}Gdd�dt|�}|�}|t�}|j|j|tj�d|_d|_|jt��d|_	WdQRX|jt��d|_	WdQRXdS)Nrc@seZdZddiZdS)z5GenericTests.test_parameterized_slots_dict.<locals>.D�bananar;N)r3r4r5rNr,r,r,r-r�Qsr��yes�no)
r
rrDrArNr]rQr<rOr)r'rr��dZd_intr,r,r-�test_parameterized_slots_dictOs	
		z*GenericTests.test_parameterized_slots_dictcCsE|jt��/tttf}Gdd�dt|�}WdQRXdS)Nc@seZdZdS)z#GenericTests.test_errors.<locals>.CN)r3r4r5r,r,r,r-r}csr})r<r=r�r�rr)r'r�r}r,r,r-rE_szGenericTests.test_errorscCsNtjdd�d
k}Gdd�dtt�}|j|jt�|s_|j|jd�|jt|�j	d�dd�|t
}|j|jt�|s�|j|jjd��|jt|�j	d�dd	�Gd
d�d|t
�}|j|jt�|s'|j|jd�|jt|�j	d�dd�dS)Nr�r
c@seZdZdS)z#GenericTests.test_repr_2.<locals>.CN)r3r4r5r,r,r,r-r}isr}z#GenericTests.test_repr_2.<locals>.Cr�r�z.<locals>.CzC[int]c@seZdZdS)z#GenericTests.test_repr_2.<locals>.YN)r3r4r5r,r,r,r-rVwsrVz#GenericTests.test_repr_2.<locals>.Y)r
r
r%r%r%)
rrrrrAr4r3r5rBr&rDr�r�)r'ZPY32r}rTrVr,r,r-�test_repr_2fs$#
#zGenericTests.test_repr_2cCsD|jtt�|jtttt�|jtttt�dS)N)rArrrWr
r)r'r,r,r-�	test_eq_1�szGenericTests.test_eq_1cCs�Gdd�dtt�}Gdd�dtt�}|j||�|j||�|j|t|t�|j|t|t�dS)Nc@seZdZdS)z!GenericTests.test_eq_2.<locals>.AN)r3r4r5r,r,r,r-rF�srFc@seZdZdS)z!GenericTests.test_eq_2.<locals>.BN)r3r4r5r,r,r,r-r��sr�)rrrArW)r'rFr�r,r,r-�	test_eq_2�szGenericTests.test_eq_2cCs�Gdd�dtttf�}Gdd�dtttf�}Gdd�d|ttfttttf|ttf�}|j|jtttf�dS)Nc@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.AN)r3r4r5r,r,r,r-rF�srFc@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.BN)r3r4r5r,r,r,r-r��sr�c@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.CN)r3r4r5r,r,r,r-r}�sr})rrrr
rArY)r'rFr�r}r,r,r-�test_multiple_inheritance�s  =z&GenericTests.test_multiple_inheritancecCs�t}Gdd�d|t�}|tjt}Gdd�d|�}|�}|jg�|jd�|jd�|j|j�ddg�dS)Nc@sLeZdZdZeddd��Zdd�Zeddd	��ZdS)
z)GenericTests.test_nested.<locals>.VisitorN)r�cSs
||_dS)N)r�)r'r�r,r,r-�set�sz-GenericTests.test_nested.<locals>.Visitor.setcSs|jS)N)r�)r'r,r,r-r��sz-GenericTests.test_nested.<locals>.Visitor.get)r�cSs|jS)N)r�)r'r,r,r-�visit�sz/GenericTests.test_nested.<locals>.Visitor.visit)r3r4r5r�rrZr�r[r,r,r,r-�Visitor�sr\c@s%eZdZeddd��ZdS)z0GenericTests.test_nested.<locals>.IntListVisitor)r�cSs|jj|�dS)N)r��append)r'r�r,r,r-r]�sz7GenericTests.test_nested.<locals>.IntListVisitor.appendN)r3r4r5rDr]r,r,r,r-�IntListVisitor�sr^r�r;)	rrr0rrDrZr]rAr�)r'�Gr\rer^r�r,r,r-�test_nested�s
	


zGenericTests.test_nestedcs[td��G�fdd�dt����d���fdd��}|d�dS)Nrcs1eZdZdd�ddddd��ZdS)z,GenericTests.test_type_erasure.<locals>.NodeNzNode[T])�label�left�rightcSs||_||_||_dS)N)rarbrc)r'rarbrcr,r,r-r��s		z5GenericTests.test_type_erasure.<locals>.Node.__init__)r3r4r5r�r,)rr,r-r	�sr	)r�cs��|�}��|�}�t|�}�jt|����jt|����jt|����j|j|��j|j|��j|j|�dS)N)rrZrGrAra)r�r�r�r�)r	rr'r,r-r��sz+GenericTests.test_type_erasure.<locals>.foor;)r
r)r'r�r,)r	rr'r-�test_type_erasure�s !zGenericTests.test_type_erasurecCs�td�}Gdd�dt|�}Gdd�d|�}|j|jf�|jt��
|tWdQRX|jt��
|tWdQRX|jt��
||WdQRXdS)Nrc@seZdZdS)z)GenericTests.test_implicit_any.<locals>.CN)r3r4r5r,r,r,r-r}�sr}c@seZdZdS)z)GenericTests.test_implicit_any.<locals>.DN)r3r4r5r,r,r,r-r��sr�)r
rrArYr<�	ExceptionrDr)r'rr}r�r,r,r-�test_implicit_any�szGenericTests.test_implicit_anyN),r3r4r5rpr�r�rCr�r�r�r�r�r�r�r�r�r�r�rrrrrrr!r(r)r*r3r7r=rErGrLrPrUrErVrWrXrYr`rdrfr,r,r,r-r�IsR$/


r�c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
ClassVarTestscCsk|jt��
tdWdQRX|jt��tttfWdQRX|jt��tttWdQRXdS)Nr�)r<r=rrDr])r'r,r,r-rp�szClassVarTests.test_basicscCs^|jtt�d�tt}|jt|�d�tt}|jt|�dt�dS)Nztyping.ClassVarztyping.ClassVar[int]ztyping.ClassVar[%s.Employee])rArBrrDr6r3)r'Zcvr,r,r-rC�s


zClassVarTests.test_reprcCsn|jt��!Gdd�dtt��}WdQRX|jt��%Gdd�dttt��}WdQRXdS)Nc@seZdZdS)z-ClassVarTests.test_cannot_subclass.<locals>.CN)r3r4r5r,r,r,r-r}�sr}c@seZdZdS)z-ClassVarTests.test_cannot_subclass.<locals>.CN)r3r4r5r,r,r,r-r}�s)r<r=rGrrD)r'r}r,r,r-rH�s#z"ClassVarTests.test_cannot_subclasscCsr|jt��t�WdQRX|jt��tt��WdQRX|jt��tttt��WdQRXdS)N)r<r=rrGrrD)r'r,r,r-�test_cannot_initszClassVarTests.test_cannot_initcCsP|jt��tdtt�WdQRX|jt��ttt�WdQRXdS)Nr�)r<r=r>rrDr%)r'r,r,r-�test_no_isinstance	sz ClassVarTests.test_no_isinstanceN)r3r4r5rprCrHrhrir,r,r,r-rg�s
rgc@s(eZdZdd�Zdd�ZdS)�	CastTestscCs�|jttd�d�|jttd�d�|jtttd��t�|jttd�d�|jttd�d�|jttt	tfd�d�|jtt
d�d�|jtdd�d�dS)Nr;)rArrDrjrZrGrr�rr]r)r'r,r,r-rps#zCastTests.test_basicscCstdd�tdd�dS)Nr;Zhello)r)r'r,r,r-rEs
zCastTests.test_errorsN)r3r4r5rprEr,r,r,r-rjs
rjc@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%S)&�ForwardRefTestscCs)Gdd�dtt�}|t}t|jt�t��}|j|dt|t�|j|dt|t�|j|d|d�|j|dtt�|j	d|�t|j
t�t��}|j|dt|t�t|jt�t��}|j|dt|t�dS)Nc	@szeZdZeddd��Zdddddeddd	��Zedd
dd��Zddd
d
d��Z	dS)z)ForwardRefTests.test_basics.<locals>.Node)racSs||_d|_|_dS)N)rarbrc)r'rar,r,r-r�(s	z2ForwardRefTests.test_basics.<locals>.Node.__init__NzOptional[Node[T]]zNode[T])rbrc�stuffcSs||_||_dS)N)rbrc)r'rbrcrl�blahr,r,r-�add_both,s	z2ForwardRefTests.test_basics.<locals>.Node.add_both)�nodecSs|j|d�dS)N)rn)r'ror,r,r-�add_left4sz2ForwardRefTests.test_basics.<locals>.Node.add_leftcSs|jd|�dS)N)rn)r'ror,r,r-�	add_right7sz3ForwardRefTests.test_basics.<locals>.Node.add_right)
r3r4r5rr�rDrnrrprqr,r,r,r-r	&sr	rbrcrlrmro)rrrDrrnr�r�rAr�assertNotInrprq)r'r	rxZ
both_hintsZ
left_hintsZright_hintsr,r,r-rp$s
zForwardRefTests.test_basicsc
Cs7tjd�}|jt��td|�WdQRXdS)NrDr;)r0�_ForwardRefr<r=r>)r'�frr,r,r-�#test_forwardref_instance_type_errorHsz3ForwardRefTests.test_forwardref_instance_type_errorc
Cs7tjd�}|jt��tt|�WdQRXdS)NrD)r0rsr<r=r%rD)r'rtr,r,r-�#test_forwardref_subclass_type_errorMsz3ForwardRefTests.test_forwardref_subclass_type_errorcCsDtjd�}|j|tjd��|jtdtt�dS)NrD)r0rsrArWrrD)r'rtr,r,r-�test_forward_equalityRsz%ForwardRefTests.test_forward_equalitycCs|jttd�d�dS)NrDztyping.List[_ForwardRef('int')])rArBr)r'r,r,r-�test_forward_reprWsz!ForwardRefTests.test_forward_reprcCsItdddd��}|jt|t�t��dtti�dS)Nr)r�cSsdS)Nr,)r�r,r,r-r�\sz/ForwardRefTests.test_union_forward.<locals>.foor�)rrArr�r�r)r'r�r,r,r-�test_union_forwardZsz"ForwardRefTests.test_union_forwardcCsItdddd��}|jt|t�t��dtti�dS)Nr)r�cSsdS)Nr,)r�r,r,r-r�dsz/ForwardRefTests.test_tuple_forward.<locals>.foor�)rrArr�r�r)r'r�r,r,r-�test_tuple_forwardbsz"ForwardRefTests.test_tuple_forwardcCs[tdgdfddd��}|jt|t�t��dttgtfi�dS)Nr)r�cSsdS)Nr,)r�r,r,r-r�lsz2ForwardRefTests.test_callable_forward.<locals>.foor�)rrArr�r�r)r'r�r,r,r-�test_callable_forwardjs"z%ForwardRefTests.test_callable_forwardcCsKdddd��}|jt|t�t��dtdtfi�dS)NzCallable[..., T])r�cSsdS)Nr,)r�r,r,r-r�tsz@ForwardRefTests.test_callable_with_ellipsis_forward.<locals>.foor�.)rArr�r�rr)r'r�r,r,r-�#test_callable_with_ellipsis_forwardrsz3ForwardRefTests.test_callable_with_ellipsis_forwardc	Cs#|jt��
tdWdQRXdS)Nz/T)r<�SyntaxErrorr)r'r,r,r-�test_syntax_errorzsz!ForwardRefTests.test_syntax_errorc	Cs:dddd��}|jt��t|�WdQRXdS)NzNode[T)r�cSsdS)Nr,)r�r,r,r-r��sz6ForwardRefTests.test_delayed_syntax_error.<locals>.foo)r<r}r)r'r�r,r,r-�test_delayed_syntax_errorsz)ForwardRefTests.test_delayed_syntax_errorc	Cs>tdddd��}|jt��t|�WdQRXdS)NZ42)r�cSsdS)Nr,)r�r,r,r-r��sz,ForwardRefTests.test_type_error.<locals>.foo)rr<r=r)r'r�r,r,r-�test_type_error�szForwardRefTests.test_type_errorc
Cs@dddd��}|jt��t|t��WdQRXdS)NzNoode[T])r�cSsdS)Nr,)r�r,r,r-r��sz,ForwardRefTests.test_name_error.<locals>.foo)r<�	NameErrorrr�)r'r�r,r,r-�test_name_error�szForwardRefTests.test_name_errorcCs>tdiddd���}t|�}|j|i�dS)N�	whatevers)r�r�cSsdS)Nr,)r�r,r,r-r��sz/ForwardRefTests.test_no_type_check.<locals>.foo)rrrA)r'r��thr,r,r-�test_no_type_check�sz"ForwardRefTests.test_no_type_checkcCs^tGdd�d��}t|j�}|j|i�t|�j�}|j|i�dS)Nc@s(eZdZdiddd��ZdS)z3ForwardRefTests.test_no_type_check_class.<locals>.Cr�)r�r�cSsdS)Nr,)r�r,r,r-r��sz7ForwardRefTests.test_no_type_check_class.<locals>.C.fooN)r3r4r5r�r,r,r,r-r}�sr})rrr�rA)r'r}�cth�ithr,r,r-�test_no_type_check_class�s
z(ForwardRefTests.test_no_type_check_classcsXGdd�d��tG�fdd�d���}|jt�j�dti�dS)Nc@s%eZdZeddd��ZdS)z6ForwardRefTests.test_no_type_check_no_bases.<locals>.C)r�cSsddS)N.r,)r'r�r,r,r-r8�sz;ForwardRefTests.test_no_type_check_no_bases.<locals>.C.methN)r3r4r5rDr8r,r,r,r-r}�sr}cseZdZ�ZdS)z6ForwardRefTests.test_no_type_check_no_bases.<locals>.DN)r3r4r5r�r,)r}r,r-r��sr�r�)rrArr8rD)r'r�r,)r}r-�test_no_type_check_no_bases�sz+ForwardRefTests.test_no_type_check_no_basescCs�tdd��}|j|jd�|diddd���}|Gdd	�d	��}|j|jd
�t|�}|j|i�t|j�}|j|i�t|�j�}|j|i�dS)NcSs|S)Nr,)Zdecor,r,r-�magic_decorator�sz@ForwardRefTests.test_meta_no_type_check.<locals>.magic_decoratorr�r�)r�r�cSsdS)Nr,)r�r,r,r-r��sz4ForwardRefTests.test_meta_no_type_check.<locals>.fooc@s(eZdZdiddd��ZdS)z2ForwardRefTests.test_meta_no_type_check.<locals>.Cr�)r�r�cSsdS)Nr,)r�r,r,r-r��sz6ForwardRefTests.test_meta_no_type_check.<locals>.C.fooN)r3r4r5r�r,r,r,r-r}�sr}r�)rrAr3rr�)r'r�r�r}r�r�r�r,r,r-�test_meta_no_type_check�sz'ForwardRefTests.test_meta_no_type_checkcCsTd}i}t||�t|dj�}|j|d|dd|di�dS)Nz^class C:
    def foo(self, a: 'C') -> 'D': pass
class D:
    def bar(self, b: 'D') -> C: pass
r}r�r�r�)�execrr�rA)r'�code�nsZhintsr,r,r-�test_default_globals�s

z$ForwardRefTests.test_default_globalsN)r3r4r5rprurvrwrxryrzr{r|r~rr�r�r�r�r�r�r�r,r,r,r-rk"s$$		rkc@s(eZdZdd�Zdd�ZdS)�
OverloadTestsc
CsDddlm}|jt��|dd��}|�WdQRXdS)Nr)�overloadcSsdS)Nr,r,r,r,r-rm�sz/OverloadTests.test_overload_fails.<locals>.blah)r0r�r<�RuntimeError)r'r�rmr,r,r-�test_overload_fails�sz!OverloadTests.test_overload_failscCs9ddlm}|dd��}dd�}|�dS)Nr)r�cSsdS)Nr,r,r,r,r-rm�sz2OverloadTests.test_overload_succeeds.<locals>.blahcSsdS)Nr,r,r,r,r-rm�s)r0r�)r'r�rmr,r,r-�test_overload_succeeds�sz$OverloadTests.test_overload_succeedsN)r3r4r5r�r�r,r,r,r-r��sr�r�r
�a
import asyncio

T_a = TypeVar('T_a')

class AwaitableWrapper(typing.Awaitable[T_a]):

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

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

class AsyncIteratorWrapper(typing.AsyncIterator[T_a]):

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

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

    @asyncio.coroutine
    def __anext__(self) -> T_a:
        data = yield from 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
F�a�
from test import ann_module, ann_module2, ann_module3
from typing import AsyncContextManager

class A:
    y: float
class B(A):
    x: ClassVar[Optional['B']] = None
    y: int
    b: int
class CSub(B):
    z: ClassVar['CSub'] = B()
class G(Generic[T]):
    lst: ClassVar[List[T]] = []

class NoneAndForward:
    parent: 'NoneAndForward'
    meaning: None

class CoolEmployee(NamedTuple):
    name: str
    cool: int

class CoolEmployeeWithDefault(NamedTuple):
    name: str
    cool: int = 0

class XMeth(NamedTuple):
    x: int
    def double(self):
        return 2 * self.x

class XRepr(NamedTuple):
    x: int
    y: int = 1
    def __str__(self):
        return f'{self.x} -> {self.y}'
    def __add__(self, other):
        return 0

async def g_with(am: AsyncContextManager[int]):
    x: int
    async with am as x:
        return x

try:
    g_with(ACM()).send(None)
except StopIteration as e:
    assert e.args[0] == 42
c@s�eZdZdd�Zeed�dd��Zeed�dd��Zeed�dd	��Zd
d�Z	dd
�Z
dd�Zeed�dd��ZdS)�GetTypeHintTestscCsg|jt��td�WdQRX|jt��td�WdQRX|jt��td�WdQRXdS)N�{r�)r<r=�gth)r'r,r,r-�(test_get_type_hints_from_various_objectsfsz9GetTypeHintTests.test_get_type_hints_from_various_objectszPython 3.6 requiredcCsndddtttfdtdti}|jtt�|�|jtt�i�|jtt�i�dS)Nr�r�r1r��y)rrDr]rAr��
ann_module�ann_module2�ann_module3)r'Zann_module_type_hintsr,r,r-�test_get_type_hints_modulesos(z,GetTypeHintTests.test_get_type_hints_modulesc	CsW|jttjtj�dttji�|jttj�t�|jttj	�dddt
i�|jttj�dtdtdttji�|jttj
�dti�|jttj�dttji�|jttj�dtdti�|jttj�dti�|jttt��d	td
t
d�i�dS)Nr�Z123r�r��jr�r�r��parentZmeaning)rAr�r�r}r�rrPZj_classr��MrGr�r]rVrDZh_classr�r��NoneAndForwardr�)r'r,r,r-�test_get_type_hints_classesvs% %z,GetTypeHintTests.test_get_type_hints_classescCs�tGdd�d��}|j|j�|j|jjj�|jttjj	�i�Gdd�dt
t�}tGdd�d|��}|jt|j	�dti�dS)Nc@s#eZdZGdd�d�ZdS)z>GetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheckc@s%eZdZdddd��ZdS)zBGetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheck.Innz
not a type)r�cSsddS)N.r,)r'r�r,r,r-r��szKGetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheck.Inn.__init__N)r3r4r5r�r,r,r,r-�Inn�sr�N)r3r4r5r�r,r,r,r-�	NoTpCheck�sr�c@s%eZdZeddd��ZdS)z:GetTypeHintTests.test_respect_no_type_check.<locals>.ABase)r�cSsddS)N.r,)r�r,r,r-r8�sz?GetTypeHintTests.test_respect_no_type_check.<locals>.ABase.methN)r3r4r5rDr8r,r,r,r-�ABase�sr�c@seZdZddS)z8GetTypeHintTests.test_respect_no_type_check.<locals>.Der.N)r3r4r5r,r,r,r-�Der�sr�r�)
rr�Z__no_type_check__r�r�rAr�r�ZNTCr8rrrD)r'r�r�r�r,r,r-�test_respect_no_type_check�sz+GetTypeHintTests.test_respect_no_type_checkcCs�|jtt�i�|jtt�i�|jtt�i�|jtt�i�|jttj�i�|jtt�j�i�|jttj	�i�dS)N)
rAr�rDrG�dirr�rr�__str__r]�join)r'r,r,r-� test_get_type_hints_for_builtins�sz1GetTypeHintTests.test_get_type_hints_for_builtinscCspdd�}d|jd<|jt|�dti�dddd��}|jt|�dtd�i�dS)NcSsddS)N.r,)r�r�r,r,r-�testf�sz6GetTypeHintTests.test_previous_behavior.<locals>.testfrDr�)r�cSsddS)N.r,)r�r,r,r-�testg�sz6GetTypeHintTests.test_previous_behavior.<locals>.testg)r<rAr�rDrG)r'r�r�r,r,r-�test_previous_behavior�s

z'GetTypeHintTests.test_previous_behaviorcCsdGdd�d�}Gdd�d�}|�}ddi|_|jt|t��d|i�dS)Nc@seZdZddS)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations.<locals>.A.N)r3r4r5r,r,r,r-rF�srFc@seZdZddS)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations.<locals>.B.N)r3r4r5r,r,r,r-r��sr�r�)r<rAr�r�)r'rFr�r�r,r,r-�/test_get_type_hints_for_object_with_annotations�s
	z@GetTypeHintTests.test_get_type_hints_for_object_with_annotationscCs�|jttjtj�dtjtji�|jttt��dt	dtt
tdt	i�|jttt��dttdt	dt	dtt
ti�|jtt�dtt
ti�dS)N�varr�r�r�r�Zlst)rAr�r�ZCVr�r0rr�r�rDr�CSubr_rr)r'r,r,r-�test_get_type_hints_ClassVar�s!z-GetTypeHintTests.test_get_type_hints_ClassVarN)
r3r4r5r�r�PY36r�r�r�r�r�r�r�r,r,r,r-r�es	
r�c@s�eZdZdd�Zdd�Zdd�Zeed�dd	��Zeed�d
d��Z	eed�dd
��Z
eed�dd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!ee"j#dfkd=�d>d?��Z$ee"j#dgkd=�d@dA��Z%dBdC�Z&dDdE�Z'dFdG�Z(dHdI�Z)dJdK�Z*dLdM�Z+dNdO�Z,dPdQ�Z-dRdS�Z.dTdU�Z/ee0dV�dWdX��Z1ee0dV�dYdZ��Z2d[d\�Z3ee0dV�d]d^��Z4d_d`�Z5dadb�Z6dcdd�Z7deS)h�CollectionsAbcTestscCs*|jdtj�|jgtj�dS)Nr;)rPr0�Hashabler�)r'r,r,r-�
test_hashable�sz!CollectionsAbcTests.test_hashablecCsv|jgtj�|jgtj�|jgtj�|jdtj�|jttj�|jttj�dS)Nr;)rPr0rr�r.r�)r'r,r,r-�
test_iterable�sz!CollectionsAbcTests.test_iterablecCs6tg�}|j|tj�|jdtj�dS)Nr;)r�rPr0�Iteratorr�)r'�itr,r,r-�
test_iterator�sz!CollectionsAbcTests.test_iteratorz&Python 3.5 and multithreading requiredcCsci}tdt�|�|d}|�}|j|tj�|j|tj�|jd�dS)NzPasync def foo() -> typing.Awaitable[int]:
    return await AwaitableWrapper(42)
r�)r�r�rPr0�	Awaitabler��send)r'r�r��gr,r,r-�test_awaitable�s

	z"CollectionsAbcTests.test_awaitablecCs�i}tdt�|�|d}|�}|j|tj�|jt��t|tjt�WdQRX|j	|tj�y|j
d�Wntk
r�YnXdS)Nzasync def foo():
    return
r�)r�r�rPr0�	Coroutiner<r=r>rDr�r��
StopIteration)r'r�r�r�r,r,r-�test_coroutine�s

	
z"CollectionsAbcTests.test_coroutinecCsUtd�}t|�}|j|tj�|j|tj�|jdtj�dS)N�
r;)r>�AsyncIteratorWrapperrPr0�
AsyncIterabler�)r'�base_itr�r,r,r-�test_async_iterable�s
z'CollectionsAbcTests.test_async_iterablecCsBtd�}t|�}|j|tj�|jdtj�dS)Nr�r;)r>r�rPr0�
AsyncIteratorr�)r'r�r�r,r,r-�test_async_iterator�sz'CollectionsAbcTests.test_async_iteratorcCs*|jgtj�|jdtj�dS)Nr;)rPr0�Sizedr�)r'r,r,r-�
test_sized�szCollectionsAbcTests.test_sizedcCs*|jgtj�|jdtj�dS)Nr;)rPr0�	Containerr�)r'r,r,r-�test_containersz"CollectionsAbcTests.test_containercCsettd�ra|jt�tj�|jt�tj�|jttj�|jdtj�dS)N�
Collectionr;)	rr0rPr�r��	frozensetr.r�r�)r'r,r,r-�test_collections
z#CollectionsAbcTests.test_collectioncCs-|jt�tj�|jdtj�dS)Nr;)rPrZr0�AbstractSetr�)r'r,r,r-�test_abstractsetsz$CollectionsAbcTests.test_abstractsetcCs0|jt�tj�|jt�tj�dS)N)rPrZr0�
MutableSetr�r�)r'r,r,r-�test_mutablesetsz#CollectionsAbcTests.test_mutablesetcCs*|jitj�|jdtj�dS)Nr;)rPr0r�r�)r'r,r,r-�test_mappingsz CollectionsAbcTests.test_mappingcCs*|jitj�|jdtj�dS)Nr;)rPr0rr�)r'r,r,r-�test_mutablemappingsz'CollectionsAbcTests.test_mutablemappingcCs*|jgtj�|jdtj�dS)Nr;)rPr0r'r�)r'r,r,r-�
test_sequencesz!CollectionsAbcTests.test_sequencecCs*|jgtj�|jftj�dS)N)rPr0�MutableSequencer�)r'r,r,r-�test_mutablesequence sz(CollectionsAbcTests.test_mutablesequencecCs0|jdtj�|jtd�tj�dS)Nr�)rPr0�
ByteString�	bytearray)r'r,r,r-�test_bytestring$sz#CollectionsAbcTests.test_bytestringcCs|jttj�dS)N)r.r�r0r)r'r,r,r-�	test_list(szCollectionsAbcTests.test_listcCsM|jtjtj�Gdd�dtjt�}|j|�tj�dS)Nc@seZdZddS)z/CollectionsAbcTests.test_deque.<locals>.MyDeque.N)r3r4r5r,r,r,r-�MyDeque-sr�)r.�collections�dequer0�DequerDrP)r'r�r,r,r-�
test_deque+szCollectionsAbcTests.test_dequecCs|jtjtj�dS)N)r.r��Counterr0)r'r,r,r-�test_counter0sz CollectionsAbcTests.test_countercCs*|jttj�|jttj�dS)N)r.rZr0�Setr/r�)r'r,r,r-�test_set3szCollectionsAbcTests.test_setcCs*|jttj�|jttj�dS)N)r.r�r0rr/rZ)r'r,r,r-�test_frozenset7sz"CollectionsAbcTests.test_frozensetcCs|jttj�dS)N)r.r�r0r�)r'r,r,r-r�;szCollectionsAbcTests.test_dictcCso|jt��tj�WdQRX|jt��tjt�WdQRX|jt��tjt�WdQRXdS)N)r<r=r0rrrD)r'r,r,r-�test_no_list_instantiation>sz.CollectionsAbcTests.test_no_list_instantiationcCsmGdd�dtjt�}|�}|j||�|j|tj�|j|t�|jt|�dS)Nc@seZdZdS)z6CollectionsAbcTests.test_list_subclass.<locals>.MyListN)r3r4r5r,r,r,r-�MyListHsr�)r0rrDrPr'r.r�r/)r'r�r�r,r,r-�test_list_subclassFs	z&CollectionsAbcTests.test_list_subclasscCs{|jt��tj�WdQRX|jt��tjttf�WdQRX|jt��tjttf�WdQRXdS)N)r<r=r0r�r
rr]rD)r'r,r,r-�test_no_dict_instantiationRsz.CollectionsAbcTests.test_no_dict_instantiationcCssGdd�dtjttf�}|�}|j||�|j|tj�|j|t�|jt|�dS)Nc@seZdZdS)z6CollectionsAbcTests.test_dict_subclass.<locals>.MyDictN)r3r4r5r,r,r,r-r-\sr-)	r0r�r]rDrPrr.r�r/)r'r-rTr,r,r-�test_dict_subclassZs#	z&CollectionsAbcTests.test_dict_subclasscCsu|jttj��tj�|jttjttf��tj�|jttjtt	f��tj�dS)N)
rZrGr0r1r��defaultdictr
rr]rD)r'r,r,r-�test_defaultdict_instantiationfs)z2CollectionsAbcTests.test_defaultdict_instantiationcCsfGdd�dtjttf�}|�}|j||�|j|tj�|jtj|�dS)Nc@seZdZdS)z@CollectionsAbcTests.test_defaultdict_subclass.<locals>.MyDefDictN)r3r4r5r,r,r,r-�	MyDefDictmsr�)	r0r1r]rDrPr.r�r�r/)r'r�Zddr,r,r-�test_defaultdict_subclassks
#	z-CollectionsAbcTests.test_defaultdict_subclassr
zChainMap was added in 3.3cCs�|jttj��tj�|jttjttf��tj�|jttjttf��tj�Gdd�dtjttf�}|jt|ttf��|�dS)Nc@seZdZddS)z;CollectionsAbcTests.test_chainmap_instantiation.<locals>.CM.N)r3r4r5r,r,r,r-�CM{sr�)	rZrGr0r2r�r
rr]rD)r'r�r,r,r-�test_chainmap_instantiationvs
))#z/CollectionsAbcTests.test_chainmap_instantiationcCsfGdd�dtjttf�}|�}|j||�|j|tj�|jtj|�dS)Nc@seZdZdS)z>CollectionsAbcTests.test_chainmap_subclass.<locals>.MyChainMapN)r3r4r5r,r,r,r-�
MyChainMap�sr�)r0r2r]rDrPr.r�r/)r'r��cmr,r,r-�test_chainmap_subclass~s
#	z*CollectionsAbcTests.test_chainmap_subclasscCs�|jttj��tj�|jttjt��tj�|jttjt��tj�Gdd�dtjt�}|jt|t��|�dS)Nc@seZdZddS)z7CollectionsAbcTests.test_deque_instantiation.<locals>.D.N)r3r4r5r,r,r,r-r��sr�)rZrGr0r�r�r�rrD)r'r�r,r,r-�test_deque_instantiation�s
##z,CollectionsAbcTests.test_deque_instantiationcCs�|jttj��tj�|jttjt��tj�|jttjt��tj�Gdd�dtjt�}|jt|t��|�dS)Nc@seZdZddS)z9CollectionsAbcTests.test_counter_instantiation.<locals>.C.N)r3r4r5r,r,r,r-r}�sr})rZrGr0r�r�rrD)r'r}r,r,r-�test_counter_instantiation�s
##z.CollectionsAbcTests.test_counter_instantiationcCs`Gdd�dtjt�}|�}|j||�|j|tj�|j|tj�dS)Nc@seZdZdS)zJCollectionsAbcTests.test_counter_subclass_instantiation.<locals>.MyCounterN)r3r4r5r,r,r,r-�	MyCounter�sr�)r0r�rDrPr�)r'r�rTr,r,r-�#test_counter_subclass_instantiation�s
	z7CollectionsAbcTests.test_counter_subclass_instantiationcCso|jt��tj�WdQRX|jt��tjt�WdQRX|jt��tjt�WdQRXdS)N)r<r=r0r�rrD)r'r,r,r-�test_no_set_instantiation�sz-CollectionsAbcTests.test_no_set_instantiationcCs:Gdd�dtjt�}|�}|j||�dS)Nc@seZdZdS)zBCollectionsAbcTests.test_set_subclass_instantiation.<locals>.MySetN)r3r4r5r,r,r,r-�MySet�sr�)r0r�rDrP)r'r�rTr,r,r-�test_set_subclass_instantiation�s	z3CollectionsAbcTests.test_set_subclass_instantiationcCso|jt��tj�WdQRX|jt��tjt�WdQRX|jt��tjt�WdQRXdS)N)r<r=r0rrrD)r'r,r,r-�test_no_frozenset_instantiation�sz3CollectionsAbcTests.test_no_frozenset_instantiationcCs:Gdd�dtjt�}|�}|j||�dS)Nc@seZdZdS)zNCollectionsAbcTests.test_frozenset_subclass_instantiation.<locals>.MyFrozenSetN)r3r4r5r,r,r,r-�MyFrozenSet�sr�)r0rrDrP)r'r�rTr,r,r-�%test_frozenset_subclass_instantiation�s	z9CollectionsAbcTests.test_frozenset_subclass_instantiationcCsf|jt��t�WdQRX|jt��tt�WdQRX|jt��tt�WdQRXdS)N)r<r=rrrD)r'r,r,r-�test_no_tuple_instantiation�sz/CollectionsAbcTests.test_no_tuple_instantiationcCs2dd�}|�}|jt|�tj�dS)Ncss	dVdS)Nr;r,r,r,r,r-r��sz/CollectionsAbcTests.test_generator.<locals>.foo)r.rGr0�	Generator)r'r�r�r,r,r-�test_generator�s	z"CollectionsAbcTests.test_generatorcCs�|jt��tj�WdQRX|jt��tjtttf�WdQRX|jt��tjtttf�WdQRXdS)N)r<r=r0rrrD)r'r,r,r-�test_no_generator_instantiation�sz3CollectionsAbcTests.test_no_generator_instantiationzPython 3.6 requiredcCsCi}tdt�|�|d�}|jt|�tj�dS)Nzasync def f():
    yield 42
r1)r�r�r.rGr0�AsyncGenerator)r'r�r�r,r,r-�test_async_generator�s


z(CollectionsAbcTests.test_async_generatorcCs{|jt��tj�WdQRX|jt��tjttf�WdQRX|jt��tjttf�WdQRXdS)N)r<r=r0rrrD)r'r,r,r-�%test_no_async_generator_instantiation�sz9CollectionsAbcTests.test_no_async_generator_instantiationcCs�Gdd�dtj�}|jt��|�WdQRXGdd�d|�}|jt|��d�|j|�tj�Gdd�dtjtt	f�}|jt|��d�|jt|t
t
f��d�|jt|tt	f��d�|jt|�|jt|�|j
|tj�|j
|tj�|j
|tj�|j|tt	f�tj�|j|tt	f�tj�|j
|tj�|j
|tj�|j
|tj�|j
|t
t
ftj�|j
||�Gdd	�d	tj�}|jt|�Gd
d�dtjtttf�}dd
�}|j
|tj�|j
|tj�ttd�r�|j
|tj�|j
|tj�|jt|�|�dS)Nc@seZdZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMAN)r3r4r5r,r,r,r-�MMA�src@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMCcSsdS)Nr,)r'r�r,r,r-r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__getitem__cSsdS)Nr,)r'r�r{r,r,r-r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__setitem__cSsdS)Nr,)r'r�r,r,r-r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__delitem__cSs
tf�S)N)r�)r'r,r,r-r��sz:CollectionsAbcTests.test_subclassing.<locals>.MMC.__iter__cSsdS)Nrr,)r'r,r,r-r��sz9CollectionsAbcTests.test_subclassing.<locals>.MMC.__len__N)r3r4r5r�r�r�r�r�r,r,r,r-�MMC�s
r	rc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMBcSsdS)Nr,)r'r�r,r,r-r�sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__getitem__cSsdS)Nr,)r'r�r{r,r,r-r�sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__setitem__cSsdS)Nr,)r'r�r,r,r-r�sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__delitem__cSs
tf�S)N)r�)r'r,r,r-r�sz:CollectionsAbcTests.test_subclassing.<locals>.MMB.__iter__cSsdS)Nrr,)r'r,r,r-r�
sz9CollectionsAbcTests.test_subclassing.<locals>.MMB.__len__N)r3r4r5r�r�r�r�r�r,r,r,r-�MMBs
r
c@seZdZddS)z/CollectionsAbcTests.test_subclassing.<locals>.I.N)r3r4r5r,r,r,r-�I"src@seZdZddS)z/CollectionsAbcTests.test_subclassing.<locals>.G.N)r3r4r5r,r,r,r-r_%sr_css	dVdS)Nrr,r,r,r,r-r�&sz/CollectionsAbcTests.test_subclassing.<locals>.gr)r0rr<r=rAr�rPr�r
rr]r/r�r.r�rr�rrDrrG)r'rr	r
rr_r�r,r,r-�test_subclassing�s@###  &z$CollectionsAbcTests.test_subclassingcCs'Gdd�dtjttf�}i}tdt�|�|d}|j|tj�|j|tj�|j|tj�|j|tj�|jt	|�|�|�}|j
|tj�|j
|tj�|j
|tj�|j
|tj�|jt	|�|�|j||�dS)Nc@s.eZdZdd�Zdddd�ZdS)z?CollectionsAbcTests.test_subclassing_async_generator.<locals>.GcSsdS)Nr,)r'r�r,r,r-�asend1szECollectionsAbcTests.test_subclassing_async_generator.<locals>.G.asendNcSsdS)Nr,)r'�typ�val�tbr,r,r-�athrow3szFCollectionsAbcTests.test_subclassing_async_generator.<locals>.G.athrow)r3r4r5r
rr,r,r,r-r_0sr_zasync def g(): yield 0r�)r0rrDr�r�r.r�r�r/rGrPr�)r'r_r�r��instancer,r,r-� test_subclassing_async_generator.s #
	z4CollectionsAbcTests.test_subclassing_async_generatorcCs�Gdd�dtj�}Gdd�d|�}Gdd�d�}Gdd�d�}|j||�|j||�|j||�dS)	Nc@s"eZdZedd��ZdS)z?CollectionsAbcTests.test_subclassing_subclasshook.<locals>.BasecSs|jdkrdSdSdS)N�FooTF)r3)r(�otherr,r,r-�__subclasshook__JszPCollectionsAbcTests.test_subclassing_subclasshook.<locals>.Base.__subclasshook__N)r3r4r5�classmethodrr,r,r,r-rIsrc@seZdZddS)z<CollectionsAbcTests.test_subclassing_subclasshook.<locals>.C.N)r3r4r5r,r,r,r-r}Qsr}c@seZdZddS)z>CollectionsAbcTests.test_subclassing_subclasshook.<locals>.Foo.N)r3r4r5r,r,r,r-rRsrc@seZdZddS)z>CollectionsAbcTests.test_subclassing_subclasshook.<locals>.Bar.N)r3r4r5r,r,r,r-�BarSsr)r0rr.r/)r'rr}rrr,r,r-�test_subclassing_subclasshookGsz1CollectionsAbcTests.test_subclassing_subclasshookcCs�Gdd�dtj�}Gdd�d|�}Gdd�d�}|j|�|j||�|j||�Gdd�d�}|j|�|j||�|j||�Gd	d
�d
�}tjj|�|j|tj�dS)Nc@seZdZddS)z8CollectionsAbcTests.test_subclassing_register.<locals>.A.N)r3r4r5r,r,r,r-rFZsrFc@seZdZddS)z8CollectionsAbcTests.test_subclassing_register.<locals>.B.N)r3r4r5r,r,r,r-r�[sr�c@seZdZddS)z8CollectionsAbcTests.test_subclassing_register.<locals>.C.N)r3r4r5r,r,r,r-r}]sr}c@seZdZddS)z8CollectionsAbcTests.test_subclassing_register.<locals>.D.N)r3r4r5r,r,r,r-r�bsr�c@seZdZddS)z8CollectionsAbcTests.test_subclassing_register.<locals>.M.N)r3r4r5r,r,r,r-r�gsr�)r0r�r�r.r/r�rr�)r'rFr�r}r�r�r,r,r-�test_subclassing_registerXs

z-CollectionsAbcTests.test_subclassing_registercCsGdd�dtj�}|j|tj�|j|tj�Gdd�dtj�}|j|tj�|j|tj�Gdd�dtj�}|j|tj�Gdd�dtjd	tj�}Gd
d�d�}|j|�|j|tj�dS)Nc@seZdZddS)z7CollectionsAbcTests.test_collections_as_base.<locals>.M.N)r3r4r5r,r,r,r-r�msr�c@seZdZddS)z7CollectionsAbcTests.test_collections_as_base.<locals>.S.N)r3r4r5r,r,r,r-r�qsr�c@seZdZddS)z7CollectionsAbcTests.test_collections_as_base.<locals>.I.N)r3r4r5r,r,r,r-rusrc@seZdZddS)z7CollectionsAbcTests.test_collections_as_base.<locals>.A.N)r3r4r5r,r,r,r-rFxsrF�	metaclassc@seZdZddS)z7CollectionsAbcTests.test_collections_as_base.<locals>.B.N)r3r4r5r,r,r,r-r�ysr�)	r�r�r.r0rr�r��ABCMetar�)r'r�r�rrFr�r,r,r-�test_collections_as_baseks"
z,CollectionsAbcTests.test_collections_as_baseN)r
r
)r
r
)8r3r4r5r�r�r�r�ASYNCIOr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�r�r�r�r�r�r�r�rrrrr�rrrrrrrr,r,r,r-r��s`
$$
	Er�c@s7eZdZdd�Zeed�dd��ZdS)�
OtherABCTestscCsHtjdd��}|�}|j|tj�|jdtj�dS)Ncss	dVdS)Nr;r,r,r,r,r-�manager�sz2OtherABCTests.test_contextmanager.<locals>.managerr;)�
contextlib�contextmanagerrPr0�ContextManagerr�)r'r r�r,r,r-�test_contextmanager�s	z!OtherABCTests.test_contextmanagerzPython 3.5 requiredcCs�Gdd�d�}|jt�tj�|j|�tj�tjdd��}|�}|j|tj�|jtjtj	tf�|j
t��tdtjt�WdQRX|j
t��tjtt
fWdQRXdS)Nc@seZdZdS)z7OtherABCTests.test_async_contextmanager.<locals>.NotACMN)r3r4r5r,r,r,r-�NotACM�sr%css	dVdS)Nr;r,r,r,r,r-r �sz8OtherABCTests.test_async_contextmanager.<locals>.managerr;)rP�ACMr0ZAsyncContextManagerr�r!r"rArDrXr<r=r>r])r'r%r r�r,r,r-�test_async_contextmanager�s	z'OtherABCTests.test_async_contextmanagerN)r3r4r5r$rrr'r,r,r,r-r~s	rc@s4eZdZdd�Zdd�Zdd�ZdS)�	TypeTestscCsiGdd�d�}Gdd�d|�}Gdd�d|�}t||ddd	��}||�dS)
Nc@seZdZdS)z'TypeTests.test_type_basic.<locals>.UserN)r3r4r5r,r,r,r-�User�sr)c@seZdZdS)z,TypeTests.test_type_basic.<locals>.BasicUserN)r3r4r5r,r,r,r-�	BasicUser�sr*c@seZdZdS)z*TypeTests.test_type_basic.<locals>.ProUserN)r3r4r5r,r,r,r-�ProUser�sr+)�
user_classr�cSs|�S)Nr,)r,r,r,r-�new_user�sz+TypeTests.test_type_basic.<locals>.new_user)r)r'r)r*r+r-r,r,r-�test_type_basic�s
zTypeTests.test_type_basiccCs{Gdd�d�}Gdd�d|�}Gdd�d|�}tdd|�}t||d	d
d��}||�dS)Nc@seZdZdS)z)TypeTests.test_type_typevar.<locals>.UserN)r3r4r5r,r,r,r-r)�sr)c@seZdZdS)z.TypeTests.test_type_typevar.<locals>.BasicUserN)r3r4r5r,r,r,r-r*�sr*c@seZdZdS)z,TypeTests.test_type_typevar.<locals>.ProUserN)r3r4r5r,r,r,r-r+�sr+r�ri)r,r�cSs|�S)Nr,)r,r,r,r-r-�sz-TypeTests.test_type_typevar.<locals>.new_user)r
r)r'r)r*r+r�r-r,r,r-�test_type_typevar�szTypeTests.test_type_typevarcCs.ttt}|ttddd��}dS)N)r�r�cSs|dkrdS|�SdS)Nr,)r�r,r,r-r��sz)TypeTests.test_type_optional.<locals>.foo)rr�
BaseException)r'rFr�r,r,r-�test_type_optional�szTypeTests.test_type_optionalN)r3r4r5r.r/r1r,r,r,r-r(�s
r(c@s(eZdZdd�Zdd�ZdS)�NewTypeTestscCshtdt�}tdt�}|j|d�t�|j|d�t�|j|d�dd�dS)N�UserId�UserNamer��Joer�r�)rrDr]rPrA)r'r3r4r,r,r-�
test_basic�s
zNewTypeTests.test_basiccCsstdt�}tdt�}|jt��t|t�WdQRX|jt��Gdd�d|�}WdQRXdS)Nr3r4c@seZdZdS)z#NewTypeTests.test_errors.<locals>.DN)r3r4r5r,r,r,r-r��sr�)rrDr]r<r=r%)r'r3r4r�r,r,r-rE�szNewTypeTests.test_errorsN)r3r4r5r6rEr,r,r,r-r2�sr2c@s�eZdZdd�Zdd�Zeed�dd��Zeed�dd	��Zeed�d
d��Z	eed�dd
��Z
dd�ZdS)�NamedTupleTestscCs/tddtfdtfg�}|j|t�|dd�}|dddd�}|j||�|j|t�|j|jd�|j|jd�|j|jd�|j|jd�|j|j	d�|j|j
d�|j|jtj
dtfdtfg��|j|j|j�dS)	N�Emp�name�idr5r;ZJimr�)r9r:)rr]rDr.r�rPrAr9r:r3�_fieldsr<r��OrderedDictrZ�_field_types)r'r8ZjoeZjimr,r,r-rp�s!"zNamedTupleTests.test_basicscCswtjdd�d	krs|jt��tddtdt�WdQRX|jt��Gdd�dt�}WdQRXdS)
Nr�r
r��NameZonerc@seZdZdZdS)z9NamedTupleTests.test_namedtuple_pyversion.<locals>.NotYetrN)r3r4r5rHr,r,r,r-�NotYet�sr?)r
r�)rrr<r=rrDr])r'r?r,r,r-�test_namedtuple_pyversion�s
z)NamedTupleTests.test_namedtuple_pyversionzPython 3.6 requiredcCs�tdd�}|j|t�|j|t�|j|jd�|j|jd�|jtjd�|jtjd�|jtjt	j
dtdt��|j
tjtj�dS)NZTimi(#�CoolEmployeer9�cool)r9rB)rArPr�rAr9rBr3r;r<r�r<r]rDrZr=)r'Ztimr,r,r-�test_annotation_usage�sz%NamedTupleTests.test_annotation_usagec	Cs�td�}|j|t�|j|t�|j|jd�|j|jd�tdd�}|j|jd�|jtjd�|jtjd	�|jtjt	dt
dt��|jtjt	dd��|j
t��td�WdQRXdS)
NZJellerZSjoerdr��CoolEmployeeWithDefaultr9rBzE
class NonDefaultAfterDefault(NamedTuple):
    x: int = 3
    y: int
)r9rB)rDrPr�rAr9rBr3r;r=r�r]rDZ_field_defaultsr<r=r�)r'ZjelleZcooler_employeer,r,r-�"test_annotation_usage_with_default�s"z2NamedTupleTests.test_annotation_usage_with_defaultcCs�|jtd�j�d�|jtd�jtd�d�|jttd��d�|jtdd�td�d�|jt��td�WdQRX|jt��td�WdQRXdS)	Nr�r�r;rz42 -> 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'
)	rA�XMethZdoubler�r]�XReprr<rOr�)r'r,r,r-�"test_annotation_usage_with_methods	s##z2NamedTupleTests.test_annotation_usage_with_methodscCstddtdt�}|dd�}|j|t�|j|jd�|j|jd�|j|jd�|j|j	t
dtdt��|j|j|j	�|j
t��!tddtfgdt�WdQRX|j
t��tddd	dd
�WdQRXdS)N�
LocalEmployeer9�ageZNick�r>r�r�r�r�)r9rJ)rr]rDrPr�rAr9r3r;r<r�rZr=r<r=)r'rIZnickr,r,r-�test_namedtuple_keyword_usage+	s"#z-NamedTupleTests.test_namedtuple_keyword_usagecCs�tddtfdtfg�atdd�}xLttjd�D]7}tj||�}tj|�}|j	||�qDWdS)Nr8r9r:�jane�%r�)
rr]rDr8r>r?r@rArBrA)r'rMrCr�Zjane2r,r,r-rE:	s!zNamedTupleTests.test_pickleN)r3r4r5rpr@rr�rCrErHrLrEr,r,r,r-r7�s
r7c@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�IOTestscCs?ttddd��}|jd}|j|jtf�dS)N)r�r�cSs
|j�S)N)�readline)r�r,r,r-rlH	szIOTests.test_io.<locals>.stuffr�)rrr<rArY)r'rlr�r,r,r-�test_ioF	s
zIOTests.test_iocCs<ttddd��}|jd}|j|jf�dS)N)r�r�cSs
|j�S)N)rP)r�r,r,r-rlP	sz"IOTests.test_textio.<locals>.stuffr�)r r]r<rArY)r'rlr�r,r,r-�test_textioN	s
zIOTests.test_textiocCs<ttddd��}|jd}|j|jf�dS)N)r�r�cSs
|j�S)N)rP)r�r,r,r-rlX	sz$IOTests.test_binaryio.<locals>.stuffr�)r!r^r<rArY)r'rlr�r,r,r-�
test_binaryioV	s
zIOTests.test_binaryiocCs�ddlm}m}m}m}m}|j|tj�|j|tj�|j|tj�|jt	|�t	dddg��|j|d�dS)Nr)rr r!r5r3rr r!z	typing.io)
Z	typing.iorr r!r5r3rZr0rArZ)r'rr r!r5r3r,r,r-�test_io_submodule^	s(%zIOTests.test_io_submoduleN)r3r4r5rQrRrSrTr,r,r,r-rOD	srOc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�RETestscCs�tjdtj�}|j|jt�|jt|�t�|j|t�|jd�}|j|jt	�|jt|�t	�|j|t	�tt
ttft	t
ttfdS)Nz[a-z]+z12345abcde.....)
rI�compilerr.r0r"rGrP�searchr#rr]r^)r'ZpatZmatr,r,r-rpj	szRETests.test_basicscCs`|jtttt�|jtttt�|jtttt�|jttt�dS)N)rAr"r]rWr^r#)r'r,r,r-�test_alias_equalityy	szRETests.test_alias_equalityc'Cs�|jt��
ttWdQRX|jt��
ttWdQRXttttf}|jt��
|tWdQRX|jt��t	dtt�WdQRX|jt��t
tttt�WdQRXdS)Nr;)r<r=r"rDr#rrr]r^r>r%)r'�mr,r,r-rE	szRETests.test_errorscCs�|jtt�d�|jttt�d�|jttt�d�|jtt�d�|jttt�d�|jttt�d�dS)NzPattern[~AnyStr]zPattern[str]zPattern[bytes]zMatch[~AnyStr]z
Match[str]zMatch[bytes])rArBr"r]r^r#)r'r,r,r-rC�	szRETests.test_reprcCs~ddlm}m}m}m}|j|tj�|j|tj�|jt|�tddg��|j|d�dS)Nr)r#r"r5r3r#r"z	typing.re)	Z	typing.rer#r"r5r3rZr0rArZ)r'r#r"r5r3r,r,r-�test_re_submodule�	s
""zRETests.test_re_submodulecCsO|jt�� }Gdd�dtj�}WdQRX|jt|j�d�dS)Nc@seZdZdS)z'RETests.test_cannot_subclass.<locals>.AN)r3r4r5r,r,r,r-rF�	srFz!Cannot subclass typing._TypeAlias)r<r=r0r#rAr]Z	exception)r'ZexrFr,r,r-rH�	s zRETests.test_cannot_subclassN)	r3r4r5rprXrErCrZrHr,r,r,r-rUg	srUc@s"eZdZdZdd�ZdS)�AllTestszTests for __all__.cCs�ddlm}|jd|�|jd|�|jd|�|jd|�ttd�ro|jd|�|jd	|�|jd
|�|jd|�|jd|�|jd
|�|jd|�|jd|�dS)Nr)r5r��
ValuesViewrr�ZAbstractContextManagerr#�iorI�osrZTextr�r�)r0r5ZassertInrr!rr)r'r�r,r,r-�test_all�	szAllTests.test_allN)r3r4r5�__doc__r_r,r,r,r-r[�	sr[�__main__)gr!r�r?rIrZunittestrrrrrrr0rr	r
rrr
rrrrrrrrrrrrrrrrrrr r!r"r#r�rJ�collections.abcr�r�r$r6r7r8r9r:rKrOrnr�r�r]r^r�r�r�r�r�r�rgrjrkr�rrZ
ASYNCIO_TESTSr�ZasynciorrZAwaitableWrapperr�r&r�Z
PY36_TESTSr�r�r�rFr�r�r_rArDrFrGr�r�r�r�rr(r2r7rOrUr[r3r,r,r,r-�<module>s�"
*"R�)N  9���(�%
3
T��'n#C