403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_typing.cpython-36.pyc
3

x2_,R�@sZddlZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZmZddl
mZmZddl
mZmZddl
mZmZmZddl
mZmZddl
mZmZmZdd	l
mZdd
l
mZmZmZddl
mZddl
mZdd
l
m Z m!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-YnXyddl/Z/Wn"e.k
�r�ddl0m/Z/YnXej1dd�dVkZ2Gdd�de�Z3Gdd�d�Z4Gdd�de4�Z5Gdd�de4�Z6Gdd �d e5e6�Z7Gd!d"�d"e3�Z8Gd#d$�d$e3�Z9Gd%d&�d&e3�Z:Gd'd(�d(e3�Z;Gd)d*�d*e3�Z<Gd+d,�d,e3�Z=ed-e>e?�Z@ed.�ZAGd/d0�d0ee@eAf�ZBGd1d2�d2eBe@eAf�ZCGd3d4�d4e3�ZDGd5d6�d6e3�ZEGd7d8�d8e3�ZFGd9d:�d:e3�ZGGd;d<�d<e3�ZHGd=d>�d>e3�ZIej1dd�dWkZJd@ZKeJ�r^yeLeK�Wne.k
�rZdAZJYnXndZMeNZOZPZQdBZRe2�r�eLeR�n0dZSZTZUeNZVZWZXZYZZZ[eNZ\Z]Z^eZ_GdCdD�dDe3�Z`GdEdF�dFe3�ZaGdGdH�dHe3�ZbGdIdJ�dJe3�ZcGdKdL�dLe3�ZdGdMdN�dNe3�ZeGdOdP�dPe3�ZfGdQdR�dRe3�ZgGdSdT�dTe3�ZheidUk�rVe�dS)X�N)�TestCase�main�
skipUnless�SkipTest�expectedFailure)�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�Match)�mod_generics_cache���c@s(eZdZddd�Zd	dd�Zdd�ZdS)
�BaseTestCaseNcCs8t||�s4d||f}|dk	r*|d|7}|j|��dS)Nz%r is not a subclass of %rz : %s)�
issubclass�failureException)�self�cls�class_or_tuple�msg�message�r1�5/opt/alt/python36/lib64/python3.6/test/test_typing.py�assertIsSubclass-s

zBaseTestCase.assertIsSubclasscCs8t||�r4d||f}|dk	r*|d|7}|j|��dS)Nz%r is a subclass of %rz : %s)r*r+)r,r-r.r/r0r1r1r2�assertNotIsSubclass4s

z BaseTestCase.assertNotIsSubclasscCsxtjD]
}|�qWdS)N)�typingZ	_cleanups)r,�fr1r1r2�clear_caches;szBaseTestCase.clear_caches)N)N)�__name__�
__module__�__qualname__r3r4r7r1r1r1r2r)+s

r)c@seZdZdS)�EmployeeN)r8r9r:r1r1r1r2r;@sr;c@seZdZdS)�ManagerN)r8r9r:r1r1r1r2r<Dsr<c@seZdZdS)�FounderN)r8r9r:r1r1r1r2r=Hsr=c@seZdZdS)�ManagingFounderN)r8r9r:r1r1r1r2r>Lsr>c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�AnyTestsc
Cs$|jt��tdt�WdQRXdS)N�*)�assertRaises�	TypeError�
isinstancer	)r,r1r1r2�test_any_instance_type_errorRsz%AnyTests.test_any_instance_type_errorcCsD|jt��ttt�WdQRX|jt��ttt�WdQRXdS)N)rArBr*r;r	)r,r1r1r2�test_any_subclass_type_errorVsz%AnyTests.test_any_subclass_type_errorcCs|jtt�d�dS)Nz
typing.Any)�assertEqual�reprr	)r,r1r1r2�	test_repr\szAnyTests.test_reprcCsB|jt��tdt�WdQRX|jt��ttWdQRXdS)Nr@)rArBr*r	�int)r,r1r1r2�test_errors_szAnyTests.test_errorscCsT|jt��Gdd�dt�}WdQRX|jt��Gdd�dtt��}WdQRXdS)Nc@seZdZdS)z(AnyTests.test_cannot_subclass.<locals>.AN)r8r9r:r1r1r1r2�AgsrKc@seZdZdS)z(AnyTests.test_cannot_subclass.<locals>.AN)r8r9r:r1r1r1r2rKjs)rArBr	�type)r,rKr1r1r2�test_cannot_subclasseszAnyTests.test_cannot_subclasscCs@|jt��t�WdQRX|jt��tt��WdQRXdS)N)rArBr	rL)r,r1r1r2�test_cannot_instantiatemsz AnyTests.test_cannot_instantiatecCs"tjttjttjtdS)N)r5r$r	r#r )r,r1r1r2�test_any_works_with_aliasss

z"AnyTests.test_any_works_with_aliasN)
r8r9r:rDrErHrJrMrNrOr1r1r1r2r?Psr?c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
NoReturnTestsc
Cs$|jt��tdt�WdQRXdS)Nr@)rArBrCr
)r,r1r1r2�!test_noreturn_instance_type_error|sz/NoReturnTests.test_noreturn_instance_type_errorcCsD|jt��ttt�WdQRX|jt��ttt�WdQRXdS)N)rArBr*r;r
)r,r1r1r2�!test_noreturn_subclass_type_error�sz/NoReturnTests.test_noreturn_subclass_type_errorcCs|jtt�d�dS)Nztyping.NoReturn)rFrGr
)r,r1r1r2rH�szNoReturnTests.test_reprc	Cs"|jt��ttWdQRXdS)N)rArBr
rI)r,r1r1r2�test_not_generic�szNoReturnTests.test_not_genericcCsT|jt��Gdd�dt�}WdQRX|jt��Gdd�dtt��}WdQRXdS)Nc@seZdZdS)z-NoReturnTests.test_cannot_subclass.<locals>.AN)r8r9r:r1r1r1r2rK�srKc@seZdZdS)z-NoReturnTests.test_cannot_subclass.<locals>.AN)r8r9r:r1r1r1r2rK�s)rArBr
rL)r,rKr1r1r2rM�sz"NoReturnTests.test_cannot_subclasscCs@|jt��t�WdQRX|jt��tt��WdQRXdS)N)rArBr
rL)r,r1r1r2rN�sz%NoReturnTests.test_cannot_instantiateN)	r8r9r:rQrRrHrSrMrNr1r1r1r2rPzsrPc@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�TypeVarTestscCs$td�}|j||�|j|t�dS)Nr
)rrF�assertIsInstance)r,r
r1r1r2�test_basic_plain�szTypeVarTests.test_basic_plainc
Cs,td�}|jt��td|�WdQRXdS)Nr
r@)rrArBrC)r,r
r1r1r2� test_typevar_instance_type_error�sz-TypeVarTests.test_typevar_instance_type_errorcCsLtd�}|jt��tt|�WdQRX|jt��t|t�WdQRXdS)Nr
)rrArBr*rI)r,r
r1r1r2� test_typevar_subclass_type_error�s
z-TypeVarTests.test_typevar_subclass_type_errorc
Cs(|jt��tdt�}|WdQRXdS)N�X)rArBrrI)r,rYr1r1r2�test_constrained_error�s
z#TypeVarTests.test_constrained_errorcCs�td�}td�}|j||�|jt||�|jt|t||f�|jt||f|�|jt|tft|�|jt|tftt�|jt|tfj|tf�|jt|tfj|f�|jt|tfjt�dS)NrY�Y)	r�assertNotEqualrFrrI�__args__�__parameters__�assertIs�
__origin__)r,rYr[r1r1r2�test_union_unique�szTypeVarTests.test_union_uniquecCs(tdtt�}|jt|tft|�dS)NrK)r�str�bytesr\r)r,rKr1r1r2�test_union_constrained�sz#TypeVarTests.test_union_constrainedcCs||jtt�d�|jtt�d�|jtt�d�|jtt�d�tddd�}|jt|�d�td	dd
�}|jt|�d�dS)Nz~Tz~KTz~VTz~AnyStr�T_coT)�	covariantz+T_co�T_contra)�
contravariantz	-T_contra)rFrGr
rrrr)r,rergr1r1r2rH�szTypeVarTests.test_reprcCs4|jtd�td��|jtdtt�tdtt��dS)Nr
)r\rrIrb)r,r1r1r2�test_no_redefinition�sz!TypeVarTests.test_no_redefinitioncCs.|jt��Gdd�dtd��}WdQRXdS)Nc@seZdZdS)z1TypeVarTests.test_cannot_subclass_vars.<locals>.VN)r8r9r:r1r1r1r2�V�srjr
)rArBr)r,rjr1r1r2�test_cannot_subclass_vars�sz&TypeVarTests.test_cannot_subclass_varscCs*|jt��Gdd�dt�}WdQRXdS)Nc@seZdZdS)z7TypeVarTests.test_cannot_subclass_var_itself.<locals>.VN)r8r9r:r1r1r1r2rj�srj)rArBr)r,rjr1r1r2�test_cannot_subclass_var_itself�sz,TypeVarTests.test_cannot_subclass_var_itselfc	Cs$|jt��td��WdQRXdS)NrK)rArBr)r,r1r1r2�test_cannot_instantiate_vars�sz)TypeVarTests.test_cannot_instantiate_varscCsL|jt��tddd�WdQRX|jt��tdtttd�WdQRXdS)NrYr@)�bound)rArBrrb�floatr;)r,r1r1r2�test_bound_errors�szTypeVarTests.test_bound_errorscCs(|jt��tdddd�WdQRXdS)Nr
T)rfrh)rA�
ValueErrorr)r,r1r1r2�test_no_bivariant�szTypeVarTests.test_no_bivariantN)r8r9r:rVrWrXrZrardrHrirkrlrmrprrr1r1r1r2rT�s

rTc@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}|j|t�dS)N)rrIror\)r,�ur1r1r2�test_basics�szUnionTests.test_basicsc Cs�|jt��ttt�WdQRX|jt��ttt�WdQRX|jt��tttttf�WdQRX|jt��ttttft�WdQRXdS)N)rArBr*rIrrb)r,r1r1r2�test_subclass_error�szUnionTests.test_subclass_errorcCsltt}|j|t�tttf}tttf}tttf}|j||�|j|t�|j|t�|j|t�dS)N)rr	rFrI�objectr\)r,rt�u1�u2Zu3r1r1r2�test_union_any�szUnionTests.test_union_anycCsHtt}|j|t�tttf}|j|t�tttf}|j|t�dS)N)rrwrFrI)r,rtr1r1r2�test_union_object	szUnionTests.test_union_objectcCs(tttf}tttf}|j||�dS)N)rrIrorF)r,rxryr1r1r2�test_unorderedszUnionTests.test_unorderedcCstt}|j|t�dS)N)rr;r_)r,�tr1r1r2�test_single_class_disappearssz'UnionTests.test_single_class_disappearscCs`ttttf}|j|tttf�ttttf}|j|tttf�tttf}|j|t�dS)N)rr;r<rIrFr_)r,rtr1r1r2�test_base_class_disappearssz%UnionTests.test_base_class_disappearscCs2tttf}t|tf}|j|ttttf�dS)N)rrIror;rF)r,rt�vr1r1r2�test_union_union"szUnionTests.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])rFrGrr;rIr8rr)r,rtr
r1r1r2rH'szUnionTests.test_reprcCs�|jt��Gdd�dt�}WdQRX|jt��Gdd�dtt��}WdQRX|jt��Gdd�dtttf�}WdQRXdS)Nc@seZdZdS)z*UnionTests.test_cannot_subclass.<locals>.CN)r8r9r:r1r1r1r2�C5sr�c@seZdZdS)z*UnionTests.test_cannot_subclass.<locals>.CN)r8r9r:r1r1r1r2r�8sc@seZdZdS)z*UnionTests.test_cannot_subclass.<locals>.CN)r8r9r:r1r1r1r2r�;s)rArBrrLrIrb)r,r�r1r1r2rM3szUnionTests.test_cannot_subclasscCs�|jt��t�WdQRX|jt��tt��WdQRXtttf}|jt��|�WdQRX|jt��t|��WdQRXdS)N)rArBrrLrIro)r,rtr1r1r2rN>sz"UnionTests.test_cannot_instantiatecCs\|jtttjtftk�|jtttjtftjtk�|jtttjftjk�dS)N)�assertFalserrbr5�IterablerI�
assertTrue)r,r1r1r2�test_union_generalizationIs"z$UnionTests.test_union_generalizationcCsb|jtt�|jtt�|jtt�|jtt�|jdgt�|jttj�|jttjt�dS)N)	r\rrwr	rrr5�Mappingr)r,r1r1r2�test_union_compare_otherNsz#UnionTests.test_union_compare_othercCs$tt}ttdf}|j||�dS)N)rrIrrF)r,�ortr1r1r2�
test_optionalWszUnionTests.test_optionalc	Cs"|jt��tfWdQRXdS)N)rArBr)r,r1r1r2�
test_empty\szUnionTests.test_emptycCs,|jt��tdtttf�WdQRXdS)Nr@)rArBrCrrIrb)r,r1r1r2�test_union_instance_type_error`sz)UnionTests.test_union_instance_type_errorcCs2tttf}|d�dd�}|jt|�d|�dS)N)�xcSsdS)Nr1)r�r1r1r2r6fsz(UnionTests.test_no_eval_union.<locals>.fr�)rrIrbr_r)r,rtr6r1r1r2�test_no_eval_uniondszUnionTests.test_no_eval_unioncCs*td�dd�}|jtt|tf�d�dS)N)�returncSsdS)Nr1r1r1r1r2�funjsz0UnionTests.test_function_repr_union.<locals>.funztyping.Union[fun, int])rIrFrGr)r,r�r1r1r2�test_function_repr_unionisz#UnionTests.test_function_repr_unioncCstttf}|dS)N)rrbr#)r,rKr1r1r2�test_union_str_patternmsz!UnionTests.test_union_str_patterncsVyddlm�Wntk
r,td��YnXt�tf�fdd�}t|tfdS)Nr)�ElementzcElementTree not foundcs�|�S)Nr1)�args)r�r1r2�Elem{sz#UnionTests.test_etree.<locals>.Elem)Zxml.etree.cElementTreer��ImportErrorrrrb)r,r�r1)r�r2�
test_etreerszUnionTests.test_etreeN)r8r9r:rurvrzr{r|r~rr�rHrMrNr�r�r�r�r�r�r�r�r�r1r1r1r2rs�s(
	rsc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
TupleTestscCs�|jt��tttttf�WdQRX|jt��tttttf�WdQRXGdd�dt�}|jttt��|jt|t��dS)Nc@seZdZdS)z"TupleTests.test_basics.<locals>.TPN)r8r9r:r1r1r1r2�TP�sr�)rArBr*rrIrb�tupler�)r,r�r1r1r2ru�szTupleTests.test_basicscCsd|jtttt�|jttdfttdf�|jtttttf�|jttttdf�dS)N.)rFrrIr\)r,r1r1r2�
test_equality�szTupleTests.test_equalitycCs$Gdd�dt�}|jt|t��dS)Nc@seZdZdS)z/TupleTests.test_tuple_subclass.<locals>.MyTupleN)r8r9r:r1r1r1r2�MyTuple�sr�)r�r�r*r)r,r�r1r1r2�test_tuple_subclass�szTupleTests.test_tuple_subclasscCs8|jt��tdtttf�WdQRX|jdt�dS)Nr)rr)rr)rArBrCrrIrU)r,r1r1r2�test_tuple_instance_type_error�sz)TupleTests.test_tuple_instance_type_errorcCsX|jtt�d�|jttf�d�|jttttf�d�|jtttdf�d�dS)Nztyping.Tupleztyping.Tuple[()]ztyping.Tuple[int, float].ztyping.Tuple[int, ...])rFrGrrIro)r,r1r1r2rH�szTupleTests.test_reprcCsH|jt��tdt�WdQRX|jt��tdtt�WdQRXdS)Nr@)rArBr*rrI)r,r1r1r2rJ�szTupleTests.test_errorsN)	r8r9r:rur�r�r�rHrJr1r1r1r2r��s
r�c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�
CallableTestsc
CsT|jt��(|jttdd��ttgtf��WdQRX|jttdd��t��dS)NcSs|S)Nr1)r�r1r1r2�<lambda>�sz2CallableTests.test_self_subclass.<locals>.<lambda>cSs|S)Nr1)r�r1r1r2r��s)rArBr�r*rLrrI)r,r1r1r2�test_self_subclass�s,z CallableTests.test_self_subclasscCs�|jttgtfttgtf�|jtttgtfttgtfh�d�|jttgtfttgtf�|jttgtfttgtf�|jttgtftttgtf�|jttgtftgtf�|jttgtft�dS)N�)rFrrI�lenr\rb)r,r1r1r2�test_eq_hash�s (  "zCallableTests.test_eq_hashcCs�|jt��t�WdQRX|jt��tt��WdQRXttgtf}|jt��|�WdQRX|jt��t|��WdQRXdS)N)rArBrrLrIrb)r,�cr1r1r2rN�sz%CallableTests.test_cannot_instantiatec%Cs�|jt��tdgtfWdQRX|jt��tftfWdQRX|jt��tfgtfWdQRX|jt��ttdgdfWdQRX|jt��ttWdQRXdS)N.r�r&)rArBrrI)r,r1r1r2�test_callable_wrong_forms�sz'CallableTests.test_callable_wrong_formscCs$dd�}|j|t�|jdt�dS)NcSsdS)Nr1r1r1r1r2r6�sz5CallableTests.test_callable_instance_works.<locals>.f)rUr�assertNotIsInstance)r,r6r1r1r2�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)Nr1r1r1r1r2r6�sz:CallableTests.test_callable_instance_type_error.<locals>.f)rArBrUrr	r�)r,r6r1r1r2�!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�boolrFrGrbrorI)r,Zct0Zct2Zctvr1r1r2rH�szCallableTests.test_reprcCs>tdtfd�dd�}|jt|t�t��dtdtfi�dS)N.)�acSsdS)Nr1)r�r1r1r2�foo�sz6CallableTests.test_callable_with_ellipsis.<locals>.foor�)rr
rFr�globals�locals)r,r�r1r1r2�test_callable_with_ellipsis�sz)CallableTests.test_callable_with_ellipsiscCstjtdtfdS)N.)r5rrrb)r,r1r1r2�test_ellipsis_in_generic�sz&CallableTests.test_ellipsis_in_genericN)r8r9r:r�r�rNr�r�r�rHr�r�r1r1r1r2r��s	r��XK�XVc@s@eZdZeed�dd�Zeed�dd�Zdeeed�d	d
�ZdS)�
SimpleMapping)�keyr�cCsdS)Nr1)r,r�r1r1r2�__getitem__�szSimpleMapping.__getitem__)r��valuecCsdS)Nr1)r,r�r�r1r1r2�__setitem__szSimpleMapping.__setitem__N)r��defaultr�cCsdS)Nr1)r,r�r�r1r1r2�getszSimpleMapping.get)N)r8r9r:r�r�r�r�r�r1r1r1r2r��sr�c@s@eZdZdd�Zed�dd�Zed�dd�Zded�d	d
�ZdS)�MySimpleMappingcCs
i|_dS)N)�store)r,r1r1r2�__init__
szMySimpleMapping.__init__)r�cCs
|j|S)N)r�)r,r�r1r1r2r�
szMySimpleMapping.__getitem__cCs||j|<dS)N)r�)r,r�r�r1r1r2r�szMySimpleMapping.__setitem__NcCs$y
|j|Stk
r|SXdS)N)r��KeyError)r,r�r�r1r1r2r�s
zMySimpleMapping.get)N)r8r9r:r�rbr�r�r�r1r1r1r2r�sr�c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�
ProtocolTestscCs |jttj�|jttj�dS)N)r3rIr5�SupportsIntr4rb)r,r1r1r2�test_supports_intszProtocolTests.test_supports_intcCs |jttj�|jttj�dS)N)r3ror5Z
SupportsFloatr4rb)r,r1r1r2�test_supports_float sz!ProtocolTests.test_supports_floatcCs.Gdd�d�}|j|tj�|jttj�dS)Nc@seZdZdd�ZdS)z.ProtocolTests.test_supports_complex.<locals>.CcSsdS)Nyr1)r,r1r1r2�__complex__(sz:ProtocolTests.test_supports_complex.<locals>.C.__complex__N)r8r9r:r�r1r1r1r2r�'sr�)r3r5�SupportsComplexr4rb)r,r�r1r1r2�test_supports_complex$sz#ProtocolTests.test_supports_complexcCs.Gdd�d�}|j|tj�|jttj�dS)Nc@seZdZdd�ZdS)z,ProtocolTests.test_supports_bytes.<locals>.BcSsdS)N�r1)r,r1r1r2�	__bytes__2sz6ProtocolTests.test_supports_bytes.<locals>.B.__bytes__N)r8r9r:r�r1r1r1r2�B1sr�)r3r5�
SupportsBytesr4rb)r,r�r1r1r2�test_supports_bytes.sz!ProtocolTests.test_supports_bytescCs.|jttj�|jttj�|jttj�dS)N)r3ror5�SupportsAbsrIr4rb)r,r1r1r2�test_supports_abs8szProtocolTests.test_supports_abscCs:tttj�|jttj�|jttj�|jttj�dS)N)r*ror5Z
SupportsRoundr3rIr4rb)r,r1r1r2�test_supports_round=sz!ProtocolTests.test_supports_roundcCs |jttj�|jttj�dS)N)r3�listr5�
Reversibler4rI)r,r1r1r2�test_reversibleCszProtocolTests.test_reversiblecCsZ|jt��tdtj�WdQRXGdd�dtj�}Gdd�d|�}|�}|j||�dS)Nrc@seZdZed�dd�ZdS)z;ProtocolTests.test_protocol_instance_type_error.<locals>.C1)r�cSsdS)Nr@r1)r,r1r1r2�__int__KszCProtocolTests.test_protocol_instance_type_error.<locals>.C1.__int__N)r8r9r:rIr�r1r1r1r2�C1Jsr�c@seZdZdS)z;ProtocolTests.test_protocol_instance_type_error.<locals>.C2N)r8r9r:r1r1r1r2�C2Msr�)rArBrCr5r�r�rU)r,r�r�r�r1r1r2�!test_protocol_instance_type_errorGsz/ProtocolTests.test_protocol_instance_type_errorN)r8r9r:r�r�r�r�r�r�r�r�r1r1r1r2r�s

r�c@s�eZdZdd�Zdd�Zdd�Zeed�dd	��Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@dA�Z$dBdC�Z%dDdE�Z&dFdG�Z'dHdI�Z(dJdK�Z)dLdM�Z*dNdO�Z+dPdQ�Z,dRdS�Z-dTdU�Z.dVdW�Z/dXdY�Z0dZd[�Z1d\d]�Z2d^S)_�GenericTestscCs�tttf}|j|jf�|jt��|tWdQRX|jt��|ttfWdQRXtttf}|j|jtf�|t|jt��|ttfWdQRX|jttt	ft�dS)N)
r�rbr	rFr^rArBr�r3rI)r,rYr[r1r1r2ruUszGenericTests.test_basicsc>CsFtd�}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@seZdZdS)z4GenericTests.test_generic_errors.<locals>.NewGenericN)r8r9r:r1r1r1r2�
NewGenericqsr�c@seZdZdS)z3GenericTests.test_generic_errors.<locals>.MyGenericN)r8r9r:r1r1r1r2�	MyGenericssr�c@seZdZdS)z3GenericTests.test_generic_errors.<locals>.MyGenericN)r8r9r:r1r1r1r2r�us)	rrArBrrCrrIr*r�)r,r
r�r�r�r1r1r2�test_generic_errorscs$$z GenericTests.test_generic_errorscCsZtd�}td�}|jt��t||fWdQRX|jt��t|||fWdQRXdS)Nr
r�)rrArBr)r,r
r�r1r1r2�	test_initwszGenericTests.test_initz"__init_subclass__ support requiredcCs�Gdd�dtjt�}Gdd�d|�}|j|jd�|jt��|jWdQRXd|_d|_Gdd	�d	|�}Gd
d�d|t�}|j|jd�|j|jd�|j|jd�dS)NcseZdZ�fdd�Z�ZS)z*GenericTests.test_init_subclass.<locals>.Xcst�jf|�d|_dS)Nr@)�super�__init_subclass__�attr)r-�kwargs)�	__class__r1r2r��sz<GenericTests.test_init_subclass.<locals>.X.__init_subclass__)r8r9r:r��
__classcell__r1r1)r�r2rY�srYc@seZdZdS)z*GenericTests.test_init_subclass.<locals>.YN)r8r9r:r1r1r1r2r[�sr[r@r�r&c@seZdZdS)z*GenericTests.test_init_subclass.<locals>.ZN)r8r9r:r1r1r1r2�Z�sr�c@seZdZdS)z*GenericTests.test_init_subclass.<locals>.WN)r8r9r:r1r1r1r2�W�sr�)r5rr
rFr�rA�AttributeErrorrI)r,rYr[r�r�r1r1r2�test_init_subclassszGenericTests.test_init_subclasscCs4|jtt�tdd�|jtt�tdd�dS)N�.r�r�)rFrGr�r8r�)r,r1r1r2rH�s

zGenericTests.test_reprcCs�td�}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@seZdZdS)z'GenericTests.test_chain_repr.<locals>.CN)r8r9r:r1r1r1r2r��sr�z.C[typing.Tuple[str, int]])	rrrrFr\rIrbr��endswith)r,r
r�r�rYr[r�r1r1r2�test_chain_repr�s zGenericTests.test_chain_reprcCs�td�}tddd�}td�}|jtt�d�|jtt|�d�|jtt|�d�|jtt||t�d	�|jttt�d	�dS)
Nr
�UT)rfr�ztyping.Listztyping.List[~T]ztyping.List[+U]ztyping.List[int])rrFrGrrI)r,r
r�r�r1r1r2�
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]]])rrFrGr5r�rrrI)r,r
r�r1r1r2�test_new_repr_complex�s"z"GenericTests.test_new_repr_complexcCsZtd�}|jtt|�d�|jttj|�d�Gdd�dtjttf�}t|j�dS)Nr
ztyping.Generic[~T]ztyping.Protocol[~T]c@seZdZdS)z*GenericTests.test_new_repr_bare.<locals>.CN)r8r9r:r1r1r1r2r��sr�)	rrFrGrr5�	_Protocol�Dictr	�__mro__)r,r
r�r1r1r2�test_new_repr_bare�s
zGenericTests.test_new_repr_barecCsptd�}Gdd�dt|�}|�}d|_|j|jddi�Gdd�d|t�}|�}d|_|j|jd	di�dS)
Nr
c@seZdZdS)z!GenericTests.test_dict.<locals>.BN)r8r9r:r1r1r1r2r��sr�r@r�c@seZdZdS)z!GenericTests.test_dict.<locals>.CN)r8r9r:r1r1r1r2r��sr��abc�bar)rrr�rF�__dict__rIr�)r,r
r��br�r�r1r1r2�	test_dict�szGenericTests.test_dictcCsTtd�}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)r8r9r:r�r1r1r1r2r��sr�r�Zchanged�newc@seZdZdS)z<GenericTests.test_subscripted_generics_as_proxies.<locals>.DN)r8r9r:r1r1r1r2�D�sr�zfrom derived zzfrom derived x)	rrrFrIr�rbr�zr)r,r
r�r�r1r1r2�$test_subscripted_generics_as_proxies�s*
z1GenericTests.test_subscripted_generics_as_proxiescCsJtd�}Gdd�dt|�}|jt�|jd|�|t|jd|�dS)Nr
c@seZdZdS)z.GenericTests.test_abc_registry_kept.<locals>.CN)r8r9r:r1r1r1r2r��sr�r�)rr�registerrIrU)r,r
r�r1r1r2�test_abc_registry_kept�s
z#GenericTests.test_abc_registry_keptcCs4Gdd�dtttf�}|ji|�|jt|�dS)Nc@seZdZdS)z5GenericTests.test_false_subclasses.<locals>.MyMappingN)r8r9r:r1r1r1r2�	MyMappingsr�)rrbr�r4�dict)r,r�r1r1r2�test_false_subclassessz"GenericTests.test_false_subclassescCs^Gdd�dtttf�}|�j�|j|�tj�|j|�t�|j|�t�|ji|�dS)Nc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z'GenericTests.test_abc_bases.<locals>.MMcSsdS)Nr1)r,�kr1r1r2r�sz3GenericTests.test_abc_bases.<locals>.MM.__getitem__cSsdS)Nr1)r,r�r�r1r1r2r�sz3GenericTests.test_abc_bases.<locals>.MM.__setitem__cSsdS)Nr1)r,r�r1r1r2�__delitem__sz3GenericTests.test_abc_bases.<locals>.MM.__delitem__cSstf�S)N)�iter)r,r1r1r2�__iter__sz0GenericTests.test_abc_bases.<locals>.MM.__iter__cSsdS)Nrr1)r,r1r1r2�__len__sz/GenericTests.test_abc_bases.<locals>.MM.__len__N)r8r9r:r�r�r�rrr1r1r1r2�MMs
r)rrb�updaterU�collections_abcr�r)r,rr1r1r2�test_abc_bases
s
zGenericTests.test_abc_basescCsRGdd�dtttftj�}|jt��"Gdd�dtjtttf�}WdQRXdS)Nc@seZdZdS)z-GenericTests.test_multiple_bases.<locals>.MM1N)r8r9r:r1r1r1r2�MM1src@seZdZdS)z-GenericTests.test_multiple_bases.<locals>.MM2N)r8r9r:r1r1r1r2�MM2"sr)rrbrrArB)r,rrr1r1r2�test_multiple_basessz GenericTests.test_multiple_basescCs@td�}Gdd�dtjt|f�}|j|jtjt|ff�dS)Nr
c@seZdZdS)z'GenericTests.test_orig_bases.<locals>.CN)r8r9r:r1r1r1r2r�'sr�)rr5r�rbrF�__orig_bases__)r,r
r�r1r1r2�test_orig_bases%szGenericTests.test_orig_basescCsLdd�}|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)NcsBt|j�dkrt�|jr>|j\��t��fdd�|j�D��SdS)Nrc3s&|]\}}t|��ot|��VqdS)N)rC)�.0r�r�)rrr1r2�	<genexpr>2szSGenericTests.test_naive_runtime_checks.<locals>.naive_dict_check.<locals>.<genexpr>)r�r^�NotImplementedErrorr]�all�items)�obj�tpr1)rrr2�naive_dict_check+s
z@GenericTests.test_naive_runtime_checks.<locals>.naive_dict_checkr�r�cSst|d�st�|j|kS)N�__orig_class__)�hasattrrr)rrr1r1r2�naive_generic_check:s
zCGenericTests.test_naive_runtime_checks.<locals>.naive_generic_checkc@seZdZdS)z4GenericTests.test_naive_runtime_checks.<locals>.NodeN)r8r9r:r1r1r1r2�Node?srr&r'cst�fdd�|D��S)Nc3s$|]}t|�jdjd�VqdS)rN)rCr
r])rr�)rr1r2r
HszXGenericTests.test_naive_runtime_checks.<locals>.naive_list_base_check.<locals>.<genexpr>)r)rrr1)rr2�naive_list_base_checkFszEGenericTests.test_naive_runtime_checks.<locals>.naive_list_base_checkc@seZdZdS)z1GenericTests.test_naive_runtime_checks.<locals>.CN)r8r9r:r1r1r1r2r�Jsr�r�r�)r�r5r�rbrIr�rArr
rr)r,rrrrr�r1r1r2�test_naive_runtime_checks*s 
"z&GenericTests.test_naive_runtime_checkscCstd�}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�rjc@seZdZdS)z.GenericTests.test_multi_subscr_base.<locals>.CN)r8r9r:r1r1r1r2r�Rsr�c@seZdZdS)z.GenericTests.test_multi_subscr_base.<locals>.DN)r8r9r:r1r1r1r2r�Ssr�)rrrFr^rIr]�	__bases__r
)r,r
r�rjr�r�r1r1r2�test_multi_subscr_baseNsz#GenericTests.test_multi_subscr_basecCsZtd�}|jtttt�|jt|tfttttf�|jtdtfjttf�dS)Nr
.)	rrFrrrrIrr]�Ellipsis)r,r
r1r1r2�test_subscript_meta_s z GenericTests.test_subscript_metacCs�Gdd�dtt�}Gdd�dtt�}|j||�|jtjttjt�|j|j|j�|jtjj|jttjj|jt�|j||j�|j|tj�|j|tjj�|j|jtj�|j|jtjj�|j|t|jt�|j|tt	|jtt	�|j|ttjt�|j|ttjjt�|j|jt
tjt
�|j|jtt	tjjtt	�|jt|tt|jt�|jt|tt	t|jtt	�|jtt|tftttjtf�|jt|t|tft|ttjtf�|jt
j|tt
jtjjt�tjdd�dk�r�|jtt|t�jd��|jtt|jt�jd��|jtttjt�jd	��|jtttjjt�jd
��dS)Nc@seZdZdS)z+GenericTests.test_generic_hashes.<locals>.AN)r8r9r:r1r1r1r2rKfsrKc@s eZdZGdd�dee�ZdS)z+GenericTests.test_generic_hashes.<locals>.Bc@seZdZdS)z-GenericTests.test_generic_hashes.<locals>.B.AN)r8r9r:r1r1r1r2rKjsrKN)r8r9r:rr
rKr1r1r1r2r�isr�r&r'z<locals>.A[str]]z<locals>.B.A[str]]zmod_generics_cache.A[str]]zmod_generics_cache.B.A[str]])r'r&)rr
rFr%rKrbr�r\rr	rIrrr5�	FrozenSet�sys�version_infor�rGr�)r,rKr�r1r1r2�test_generic_hasheses@"&&z GenericTests.test_generic_hashesc&Cs�td�}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@seZdZdS)z9GenericTests.test_extended_generic_rules_eq.<locals>.BaseN)r8r9r:r1r1r1r2�Base�sr"c@seZdZdS)z<GenericTests.test_extended_generic_rules_eq.<locals>.DerivedN)r8r9r:r1r1r1r2�Derived�sr#r�)
rrFrrIr5r�rArBrrbrrr)r,r
r�r"r#r1r1r2�test_extended_generic_rules_eq�s* ,,$( 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]])
rrFrGrrr�replacerIrr)r,r
r1r1r2� test_extended_generic_rules_repr�s""z-GenericTests.test_extended_generic_rules_reprcCs�ttdd�dd�}Gdd�d�}|jt|t�t��dtt|i�td�}t|df}|d�d	d
�}|jt|t�t��d|�tdt|f}|d�dd�}|jt|t�t��d|�dS)
N�CC)r�cSsdS)Nr1)r�r1r1r2�foobar�sz5GenericTests.test_generic_forward_ref.<locals>.foobarc@seZdZdS)z1GenericTests.test_generic_forward_ref.<locals>.CCN)r8r9r:r1r1r1r2r(�sr�r
.cSsdS)Nr1)r�r1r1r2�barfoo�sz5GenericTests.test_generic_forward_ref.<locals>.barfoocSsdS)Nr1)r�r1r1r2�barfoo2�sz6GenericTests.test_generic_forward_ref.<locals>.barfoo2)	rrFrr�r�rrr_r)r,r)r(r
�ATr*ZCTr+r1r1r2�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@seZdZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.T1N)r8r9r:r1r1r1r2�T1�sr.c@seZdZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.T2N)r8r9r:r1r1r1r2�T2�sr/.c@seZdZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.C1N)r8r9r:r1r1r1r2r��sr�c@seZdZdd�ZdS)z@GenericTests.test_extended_generic_rules_subclassing.<locals>.C2cSsdS)Nr1)r,r1r1r2�__call__�szIGenericTests.test_extended_generic_rules_subclassing.<locals>.C2.__call__N)r8r9r:r0r1r1r1r2r��sr�r�r�zC1[int]���)rr
rrrIrFr^rbr]r`rArBrG�splitrUrr3r�r5�Sequencer�)r,r.r/r�r�r1r1r2�'test_extended_generic_rules_subclassing�s*z4GenericTests.test_extended_generic_rules_subclassingcCs�|jt��ttWdQRX|jt��ttWdQRX|jt��ttWdQRX|jt��tttWdQRXdS)N)rArBrrrrrrI)r,r1r1r2�test_fail_with_bare_union�sz&GenericTests.test_fail_with_bare_unioncCs�td�}|jt��ttWdQRX|jt��tt|WdQRX|jt��ttjWdQRX|jt��tdt�WdQRXdS)Nr
r�)	rrArBrrrr5r�rC)r,r
r1r1r2�test_fail_with_bare_generic�sz(GenericTests.test_fail_with_bare_genericcCsztd�}|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
dk�rvGdd
�d
tjt|f�}|j|t�j|�|j|t�j|t�dS)Nr
c@seZdZdS)z5GenericTests.test_type_erasure_special.<locals>.MyTupN)r8r9r:r1r1r1r2�MyTup�sr7c@seZdZdd�ZdS)z6GenericTests.test_type_erasure_special.<locals>.MyCallcSsdS)Nr1)r,r1r1r2r0�sz?GenericTests.test_type_erasure_special.<locals>.MyCall.__call__N)r8r9r:r0r1r1r1r2�MyCall�sr8.c@seZdZdS)z6GenericTests.test_type_erasure_special.<locals>.MyDictN)r8r9r:r1r1r1r2�MyDict�sr9c@seZdZdS)z5GenericTests.test_type_erasure_special.<locals>.MyDefN)r8r9r:r1r1r1r2�MyDefsr:r'c@seZdZdS)z7GenericTests.test_type_erasure_special.<locals>.MyChainN)r8r9r:r1r1r1r2�MyChainsr;)r'r')rr7rr_rIr�rrr5r��DefaultDictrbrr �ChainMap)r,r
r7r8r9r:r;r1r1r2�test_type_erasure_special�s$z&GenericTests.test_type_erasure_specialcCs�dd�tjD�}x�|D]�}|jt|�d�|j||�t|dd�rdt|j�dkrd|j|tj	tf�t
|t�rx*|jD] }|jt|�d�|j||�qvWqWdS)Ncss|]}tt|�VqdS)N)�getattrr5)rZelr1r1r2r
sz4GenericTests.test_all_repr_eq_any.<locals>.<genexpr>r%r^r�)
r5�__all__r\rGrFr?r�r^r	r]rCrLr�)r,Zobjsr�baser1r1r2�test_all_repr_eq_anys

z!GenericTests.test_all_repr_eq_anycs�td�}td��td��G��fdd�dt��f�}|t|f}|t��tj�j����fdd��jjj	�D�}|j
|ttd��dS)	Nr
rrcseZdZ��d�dd�ZdS)z2GenericTests.test_substitution_helper.<locals>.Map)r�r�cSsdS)Nr1)r,r�r�r1r1r2�methsz7GenericTests.test_substitution_helper.<locals>.Map.methN)r8r9r:rCr1)rrr1r2�MapsrDcs&i|]\}}tj|t��j��|�qSr1)r5Z_replace_argrLr^)rr�r�)�new_argsrr1r2�
<dictcomp>!sz9GenericTests.test_substitution_helper.<locals>.<dictcomp>)r�r�)rrrbrIr5Z
_subs_treerrC�__annotations__rrF)r,r
rDZStrMapZ
new_annotsr1)rrrErr2�test_substitution_helpers
z%GenericTests.test_substitution_helperc	Cstd�}Gdd�dt|�}Gdd�d|t�at�}d|_d|_x\ttjd�D]J}tj	||�}tj
|�}|j|jd�|j|jd�|j|jddd	��qRWt
ttttttjg}xF|D]>}x8ttjd�D]&}tj	||�}tj
|�}|j||�q�Wq�WdS)
Nr
c@seZdZdS)z#GenericTests.test_pickle.<locals>.BN)r8r9r:r1r1r1r2r�*sr�c@seZdZdS)r�N)r8r9r:r1r1r1r2r�-sr�r@r�r�)r�r�)rrrIr�r�r��range�pickle�HIGHEST_PROTOCOL�dumps�loadsrFr�r	rrrrrr5r�)	r,r
r�r��protor�r�Zsimples�sr1r1r2�test_pickle&s$


zGenericTests.test_picklecCs.td�}Gdd�dt|�}t|tft|tftd|fttgtftttf|||t|ttj|tjttjttj	tt
ftj	|tftttt|tdtdtftdtj
dtfg}x`|tgD]R}|j|t|��|j|t|��tjdkr�|j|t|�k�|j|t|�k�q�WdS)Nr
c@seZdZdS)z1GenericTests.test_copy_and_deepcopy.<locals>.NodeN)r8r9r:r1r1r1r2rBsr.r')r
r
)r'r')rrrrIrrr	r5r�r�rbrrr�rFrrrr r�)r,r
r�thingsr}r1r1r2�test_copy_and_deepcopy@s*$" 
z#GenericTests.test_copy_and_deepcopycs&td��G�fdd�dt��}|d�}|jt|�jd�|jt|�jd�|jt|�|�|jt|�|�d|_|jt|�jd�|jt|�jd�|td�}|jt|�jd�|jt|�jd�|jt|�|�|jt|�|�d|_|jt|�jd�|jt|�jd�|j|j|t�dS)Nr
cseZdZ�dd�dd�ZdS)z3GenericTests.test_copy_generic_instances.<locals>.CN)r�r�cSs
||_dS)N)r�)r,r�r1r1r2r�Vsz<GenericTests.test_copy_generic_instances.<locals>.C.__init__)r8r9r:r�r1)r
r1r2r�Usr�r@r�)	rrrFrr�rZassertIsNotrIr)r,r�r�Zcir1)r
r2�test_copy_generic_instancesSs&z(GenericTests.test_copy_generic_instancesc	Csztd�}tt|tftd|ftttfttttj	tt
ftjjt
tjdg}x |D]}|jtj|��|�qZWdS)Nr
.�whatever)rr	rrIrrrrr5r�rb�rer$rcr�rF�weakref�ref)r,r
rQr}r1r1r2�test_weakref_allks 
zGenericTests.test_weakref_allcCs�td�}Gdd�dt|�}|�}|t�}|j|j|tj�d|_d|_|jt��d|_	WdQRX|jt��d|_	WdQRX|dd�dd�}|jt
|t�t��d||�|jt
|t�t��dj|j�|jt
|t�t|t��dS)	Nr
c@seZdZdZdS)z0GenericTests.test_parameterized_slots.<locals>.C�potatoN)rY)r8r9r:�	__slots__r1r1r1r2r�usr�r)r�cSsdS)Nr1)r�r1r1r2r��sz2GenericTests.test_parameterized_slots.<locals>.foor�)rrrIrFrZrbrYrAr�Ztomatorr�r�rr)r,r
r�r�Zc_intr�r1r1r2�test_parameterized_slotsss 
 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)r8r9r:rZr1r1r1r2r��sr��yes�no)
rrrIrFrZrbr\rAr�r))r,r
r��dZd_intr1r1r2�test_parameterized_slots_dict�s
z*GenericTests.test_parameterized_slots_dictcCs:|jt��&tttf}Gdd�dt|�}WdQRXdS)Nc@seZdZdS)z#GenericTests.test_errors.<locals>.CN)r8r9r:r1r1r1r2r��sr�)rArBr�r�r	r)r,r�r�r1r1r2rJ�szGenericTests.test_errorscCs�tjdd�d
k}Gdd�dtt�}|j|jt�|sF|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@seZdZdS)z#GenericTests.test_repr_2.<locals>.CN)r8r9r:r1r1r1r2r��sr�z#GenericTests.test_repr_2.<locals>.Cr�r�z.<locals>.CzC[int]c@seZdZdS)z#GenericTests.test_repr_2.<locals>.YN)r8r9r:r1r1r1r2r[�sr[z#GenericTests.test_repr_2.<locals>.Y)r'r'r1r1r1)
rr rr
rFr9r8r:rGr2rIr�r�)r,ZPY32r�rYr[r1r1r2�test_repr_2�s$zGenericTests.test_repr_2cCs8|jtt�|jtttt�|jtttt�dS)N)rFrr
r\rr)r,r1r1r2�	test_eq_1�szGenericTests.test_eq_1cCslGdd�dtt�}Gdd�dtt�}|j||�|j||�|j|t|t�|j|t|t�dS)Nc@seZdZdS)z!GenericTests.test_eq_2.<locals>.AN)r8r9r:r1r1r1r2rK�srKc@seZdZdS)z!GenericTests.test_eq_2.<locals>.BN)r8r9r:r1r1r1r2r��sr�)rr
rFr\)r,rKr�r1r1r2�	test_eq_2�szGenericTests.test_eq_2cCsvGdd�dtttf�}Gdd�dtttf�}Gdd�d|ttfttttf|ttf�}|j|jtttf�dS)Nc@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.AN)r8r9r:r1r1r1r2rK�srKc@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.BN)r8r9r:r1r1r1r2r��sr�c@seZdZdS)z1GenericTests.test_multiple_inheritance.<locals>.CN)r8r9r:r1r1r1r2r��sr�)rr
rrrFr^)r,rKr�r�r1r1r2�test_multiple_inheritance�s.z&GenericTests.test_multiple_inheritancecCsrt}Gdd�d|t�}|tjt}Gdd�d|�}|�}|jg�|jd�|jd�|j|j�ddg�dS)Nc@s4eZdZdZed�dd�Zdd�Zed�dd	�ZdS)
z)GenericTests.test_nested.<locals>.VisitorN)r�cSs
||_dS)N)r�)r,r�r1r1r2�set�sz-GenericTests.test_nested.<locals>.Visitor.setcSs|jS)N)r�)r,r1r1r2r��sz-GenericTests.test_nested.<locals>.Visitor.get)r�cSs|jS)N)r�)r,r1r1r2�visit�sz/GenericTests.test_nested.<locals>.Visitor.visit)r8r9r:r�r
rer�rfr1r1r1r2�Visitor�srgc@seZdZed�dd�ZdS)z0GenericTests.test_nested.<locals>.IntListVisitor)r�cSs|jj|�dS)N)r��append)r,r�r1r1r2rh�sz7GenericTests.test_nested.<locals>.IntListVisitor.appendN)r8r9r:rIrhr1r1r1r2�IntListVisitor�srir�r@)	rr
r5rrIrerhrFr�)r,�Grgrjrir�r1r1r2�test_nested�s



zGenericTests.test_nestedcsBtd��G�fdd�dt����d����fdd�}|d�dS)Nr
cs eZdZd�ddd�dd�ZdS)z,GenericTests.test_type_erasure.<locals>.NodeNzNode[T])�label�left�rightcSs||_||_||_dS)N)rlrmrn)r,rlrmrnr1r1r2r��sz5GenericTests.test_type_erasure.<locals>.Node.__init__)NN)r8r9r:r�r1)r
r1r2r�sr)r�cs~�|�}��|�}�t|�}�jt|����jt|����jt|����j|j|��j|j|��j|j|�dS)N)r	r_rLrFrl)r�r�r�r�)rr
r,r1r2r�sz+GenericTests.test_type_erasure.<locals>.foor@)rr)r,r�r1)rr
r,r2�test_type_erasure�szGenericTests.test_type_erasurecCs�td�}Gdd�dt|�}Gdd�d|�}|j|jf�|jt��|tWdQRX|jt��|tWdQRX|jt��||WdQRXdS)Nr
c@seZdZdS)z)GenericTests.test_implicit_any.<locals>.CN)r8r9r:r1r1r1r2r�sr�c@seZdZdS)z)GenericTests.test_implicit_any.<locals>.DN)r8r9r:r1r1r1r2r�sr�)rrrFr^rA�	ExceptionrIr	)r,r
r�r�r1r1r2�test_implicit_anyszGenericTests.test_implicit_anycCsNGdd�dtt�}Gdd�d�}Gdd�d||�}|d�}|j|jd�dS)Nc@seZdZdS)z*GenericTests.test_new_with_args.<locals>.AN)r8r9r:r1r1r1r2rK#srKcseZdZ�fdd�Z�ZS)z*GenericTests.test_new_with_args.<locals>.Bcst�j|�}||_|S)N)r��__new__�arg)r-rsr)r�r1r2rr'sz2GenericTests.test_new_with_args.<locals>.B.__new__)r8r9r:rrr�r1r1)r�r2r�&sr�c@seZdZdS)z*GenericTests.test_new_with_args.<locals>.CN)r8r9r:r1r1r1r2r�.sr�r�)rr
rFrs)r,rKr�r�r�r1r1r2�test_new_with_args!s
zGenericTests.test_new_with_argscCsLGdd�d�}Gdd�dtt|�}|d�}|j|jd�|j|jd�dS)NcseZdZ�fdd�Z�ZS)z+GenericTests.test_new_with_args2.<locals>.Acs||_t�j�dS)N)�from_ar�r�)r,rs)r�r1r2r�7sz4GenericTests.test_new_with_args2.<locals>.A.__init__)r8r9r:r�r�r1r1)r�r2rK6srKcseZdZ�fdd�Z�ZS)z+GenericTests.test_new_with_args2.<locals>.Ccs||_t�j|�dS)N)�from_cr�r�)r,rs)r�r1r2r�>sz4GenericTests.test_new_with_args2.<locals>.C.__init__)r8r9r:r�r�r1r1)r�r2r�=sr�r�)rr
rFrurv)r,rKr�r�r1r1r2�test_new_with_args24s
z GenericTests.test_new_with_args2cCs�Gdd�dtt�}|jt��|d�WdQRXGdd�d�}Gdd�d||�}|d�}|j|jd�|j|jd�|j|jd	�dS)
Nc@seZdZdS)z(GenericTests.test_new_no_args.<locals>.AN)r8r9r:r1r1r1r2rKIsrKr�cseZdZ�fdd�Z�ZS)z(GenericTests.test_new_no_args.<locals>.Bcst�j|�}d|_|S)Nr�)r�rr�from_b)r-r)r�r1r2rrPsz0GenericTests.test_new_no_args.<locals>.B.__new__)r8r9r:rrr�r1r1)r�r2r�Osr�cs$eZdZdd�Z�fdd�Z�ZS)z(GenericTests.test_new_no_args.<locals>.CcSs
||_dS)N)rs)r,rsr1r1r2r�Xsz1GenericTests.test_new_no_args.<locals>.C.__init__cst�j|�}d|_|S)Nr�)r�rrrv)r-rsr)r�r1r2rr[sz0GenericTests.test_new_no_args.<locals>.C.__new__)r8r9r:r�rrr�r1r1)r�r2r�Wsr�r�r�)rr
rArBrFrsrxrv)r,rKr�r�r�r1r1r2�test_new_no_argsGs
zGenericTests.test_new_no_argsN)3r8r9r:rur�r�r�PY36r�rHr�r�r�r�r�r�r�r�rr	rrrrr!r$r'r-r4r5r6r>rBrHrPrRrSrXr[r`rJrarbrcrdrkrorqrtrwryr1r1r1r2r�Ss\$+


r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
ClassVarTestscCsf|jt��tdWdQRX|jt��tttfWdQRX|jt��tttWdQRXdS)Nr�)rArBrrIrb)r,r1r1r2ruhszClassVarTests.test_basicscCsH|jtt�d�tt}|jt|�d�tt}|jt|�dt�dS)Nztyping.ClassVarztyping.ClassVar[int]ztyping.ClassVar[%s.Employee])rFrGrrIr;r8)r,Zcvr1r1r2rHps
zClassVarTests.test_reprcCs\|jt��Gdd�dtt��}WdQRX|jt��Gdd�dttt��}WdQRXdS)Nc@seZdZdS)z-ClassVarTests.test_cannot_subclass.<locals>.CN)r8r9r:r1r1r1r2r�ysr�c@seZdZdS)z-ClassVarTests.test_cannot_subclass.<locals>.CN)r8r9r:r1r1r1r2r�|s)rArBrLrrI)r,r�r1r1r2rMwsz"ClassVarTests.test_cannot_subclasscCsh|jt��t�WdQRX|jt��tt��WdQRX|jt��tttt��WdQRXdS)N)rArBrrLrrI)r,r1r1r2�test_cannot_initszClassVarTests.test_cannot_initcCsH|jt��tdtt�WdQRX|jt��ttt�WdQRXdS)Nr�)rArBrCrrIr*)r,r1r1r2�test_no_isinstance�sz ClassVarTests.test_no_isinstanceN)r8r9r:rurHrMr|r}r1r1r1r2r{fs
r{c@seZdZdd�Zdd�ZdS)�	CastTestscCs�|jttd�d�|jttd�d�|jtttd��t�|jttd�d�|jttd�d�|jttt	tfd�d�|jtt
d�d�|jtdd�d�dS)Nr@)rFrrIror_rLr	r�rrbr)r,r1r1r2ru�szCastTests.test_basicscCstdd�tdd�dS)Nr@Zhello)r)r,r1r1r2rJ�s
zCastTests.test_errorsN)r8r9r:rurJr1r1r1r2r~�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%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@sPeZdZed�dd�Zddded�dd	�Zedd
�dd�Zddd
�d
d�Z	dS)z)ForwardRefTests.test_basics.<locals>.Node)rlcSs||_d|_|_dS)N)rlrmrn)r,rlr1r1r2r��sz2ForwardRefTests.test_basics.<locals>.Node.__init__NzOptional[Node[T]]zNode[T])rmrn�stuffcSs||_||_dS)N)rmrn)r,rmrnr��blahr1r1r2�add_both�sz2ForwardRefTests.test_basics.<locals>.Node.add_both)�nodecSs|j|d�dS)N)r�)r,r�r1r1r2�add_left�sz2ForwardRefTests.test_basics.<locals>.Node.add_leftcSs|jd|�dS)N)r�)r,r�r1r1r2�	add_right�sz3ForwardRefTests.test_basics.<locals>.Node.add_right)NNN)N)
r8r9r:r
r�rIr�rr�r�r1r1r1r2r�srrmrnr�r�r�)rr
rIrr�r�r�rFr�assertNotInr�r�)r,rr}Z
both_hintsZ
left_hintsZright_hintsr1r1r2ru�szForwardRefTests.test_basicsc
Cs.tjd�}|jt��td|�WdQRXdS)NrIr@)r5�_ForwardRefrArBrC)r,�frr1r1r2�#test_forwardref_instance_type_error�s
z3ForwardRefTests.test_forwardref_instance_type_errorc
Cs.tjd�}|jt��tt|�WdQRXdS)NrI)r5r�rArBr*rI)r,r�r1r1r2�#test_forwardref_subclass_type_error�s
z3ForwardRefTests.test_forwardref_subclass_type_errorcCs4tjd�}|j|tjd��|jtdtt�dS)NrI)r5r�rFr\rrI)r,r�r1r1r2�test_forward_equality�s
z%ForwardRefTests.test_forward_equalitycCs|jttd�d�dS)NrIztyping.List[_ForwardRef('int')])rFrGr)r,r1r1r2�test_forward_repr�sz!ForwardRefTests.test_forward_reprcCs6tdd�dd�}|jt|t�t��dtti�dS)Nr
)r�cSsdS)Nr1)r�r1r1r2r��sz/ForwardRefTests.test_union_forward.<locals>.foor�)rrFrr�r�r
)r,r�r1r1r2�test_union_forward�sz"ForwardRefTests.test_union_forwardcCs6tdd�dd�}|jt|t�t��dtti�dS)Nr
)r�cSsdS)Nr1)r�r1r1r2r��sz/ForwardRefTests.test_tuple_forward.<locals>.foor�)rrFrr�r�r
)r,r�r1r1r2�test_tuple_forward�sz"ForwardRefTests.test_tuple_forwardcCsBtdgdfd�dd�}|jt|t�t��dttgtfi�dS)Nr
)r�cSsdS)Nr1)r�r1r1r2r��sz2ForwardRefTests.test_callable_forward.<locals>.foor�)rrFrr�r�r
)r,r�r1r1r2�test_callable_forward�sz%ForwardRefTests.test_callable_forwardcCs6dd�dd�}|jt|t�t��dtdtfi�dS)NzCallable[..., T])r�cSsdS)Nr1)r�r1r1r2r��sz@ForwardRefTests.test_callable_with_ellipsis_forward.<locals>.foor�.)rFrr�r�rr
)r,r�r1r1r2�#test_callable_with_ellipsis_forward�sz3ForwardRefTests.test_callable_with_ellipsis_forwardc	Cs"|jt��tdWdQRXdS)Nz/T)rA�SyntaxErrorr)r,r1r1r2�test_syntax_error�sz!ForwardRefTests.test_syntax_errorc	Cs0dd�dd�}|jt��t|�WdQRXdS)NzNode[T)r�cSsdS)Nr1)r�r1r1r2r��sz6ForwardRefTests.test_delayed_syntax_error.<locals>.foo)rAr�r)r,r�r1r1r2�test_delayed_syntax_error�sz)ForwardRefTests.test_delayed_syntax_errorc	Cs4tdd�dd�}|jt��t|�WdQRXdS)NZ42)r�cSsdS)Nr1)r�r1r1r2r�sz,ForwardRefTests.test_type_error.<locals>.foo)rrArBr)r,r�r1r1r2�test_type_errorszForwardRefTests.test_type_errorc
Cs4dd�dd�}|jt��t|t��WdQRXdS)NzNoode[T])r�cSsdS)Nr1)r�r1r1r2r�sz,ForwardRefTests.test_name_error.<locals>.foo)rA�	NameErrorrr�)r,r�r1r1r2�test_name_error
szForwardRefTests.test_name_errorcCs,tdid�dd��}t|�}|j|i�dS)N�	whatevers)r�r�cSsdS)Nr1)r�r1r1r2r�sz/ForwardRefTests.test_no_type_check.<locals>.foo)rrrF)r,r��thr1r1r2�test_no_type_checksz"ForwardRefTests.test_no_type_checkcCsDtGdd�d��}t|j�}|j|i�t|�j�}|j|i�dS)Nc@seZdZdid�dd�ZdS)z3ForwardRefTests.test_no_type_check_class.<locals>.Cr�)r�r�cSsdS)Nr1)r�r1r1r2r�"sz7ForwardRefTests.test_no_type_check_class.<locals>.C.fooN)r8r9r:r�r1r1r1r2r� sr�)rrr�rF)r,r��cth�ithr1r1r2�test_no_type_check_classs

z(ForwardRefTests.test_no_type_check_classcs@Gdd�d��tG�fdd�d���}|jt�j�dti�dS)Nc@seZdZed�dd�ZdS)z6ForwardRefTests.test_no_type_check_no_bases.<locals>.C)r�cSsdS)Nr1)r,r�r1r1r2rC,sz;ForwardRefTests.test_no_type_check_no_bases.<locals>.C.methN)r8r9r:rIrCr1r1r1r2r�+sr�cseZdZ�ZdS)z6ForwardRefTests.test_no_type_check_no_bases.<locals>.DN)r8r9r:r�r1)r�r1r2r�-sr�r�)rrFrrCrI)r,r�r1)r�r2�test_no_type_check_no_bases*sz+ForwardRefTests.test_no_type_check_no_basescCs�tdd��}|j|jd�|did�dd��}|Gdd	�d	��}|j|jd
�t|�}|j|i�t|j�}|j|i�t|�j�}|j|i�dS)NcSs|S)Nr1)�funcr1r1r2�magic_decorator5sz@ForwardRefTests.test_meta_no_type_check.<locals>.magic_decoratorr�r�)r�r�cSsdS)Nr1)r�r1r1r2r�;sz4ForwardRefTests.test_meta_no_type_check.<locals>.fooc@seZdZdid�dd�ZdS)z2ForwardRefTests.test_meta_no_type_check.<locals>.Cr�)r�r�cSsdS)Nr1)r�r1r1r2r�Asz6ForwardRefTests.test_meta_no_type_check.<locals>.C.fooN)r8r9r:r�r1r1r1r2r�?sr�r�)rrFr8rr�)r,r�r�r�r�r�r�r1r1r2�test_meta_no_type_check3s
z'ForwardRefTests.test_meta_no_type_checkcCs>d}i}t||�t|dj�}|j||d|dd��dS)Nz^class C:
    def foo(self, a: 'C') -> 'D': pass
class D:
    def bar(self, b: 'D') -> C: pass
r�r�)r�r�)�execrr�rF)r,�code�nsZhintsr1r1r2�test_default_globalsLs

z$ForwardRefTests.test_default_globalsN)r8r9r:rur�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r1r1r1r2r�s$$		rc@seZdZdd�Zdd�ZdS)�
OverloadTestsc
Cs8ddlm}|jt��|dd��}|�WdQRXdS)Nr)�overloadcSsdS)Nr1r1r1r1r2r�_sz/OverloadTests.test_overload_fails.<locals>.blah)r5r�rA�RuntimeError)r,r�r�r1r1r2�test_overload_failsZsz!OverloadTests.test_overload_failscCs*ddlm}|dd��}dd�}|�dS)Nr)r�cSsdS)Nr1r1r1r1r2r�hsz2OverloadTests.test_overload_succeeds.<locals>.blahcSsdS)Nr1r1r1r1r2r�ls)r5r�)r,r�r�r1r1r2�test_overload_succeedsesz$OverloadTests.test_overload_succeedsN)r8r9r:r�r�r1r1r1r2r�Xsr��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
Fa
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

class HasForeignBaseClass(mod_generics_cache.A):
    some_xrepr: 'XRepr'
    other_a: 'mod_generics_cache.A'

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�edd���Zeed�dd	��Z	eed�d
d��Z
dd
�Zdd�Zdd�Z
eed�dd��ZdS)�GetTypeHintTestscCs^|jt��td�WdQRX|jt��td�WdQRX|jt��td�WdQRXdS)N�{r�)rArB�gth)r,r1r1r2�(test_get_type_hints_from_various_objects�sz9GetTypeHintTests.test_get_type_hints_from_various_objectszPython 3.6 requiredcCsJdtttfttd�}|jtt�|�|jtt�i�|jtt�i�dS)Nr&)r�r6r��y)rrIrbrFr��
ann_module�ann_module2�ann_module3)r,Zann_module_type_hintsr1r1r2�test_get_type_hints_modules�sz,GetTypeHintTests.test_get_type_hints_modulescCs*ttjttjd�}|jtt�|�dS)N)Z	default_aZ	default_b)rr%rKr�rFr�)r,Z	mgc_hintsr1r1r2�&test_get_type_hints_modules_forwardref�sz7GetTypeHintTests.test_get_type_hints_modules_forwardrefcCs<|jttj�dttji�|jttj�t�|jttj�dt	d��|jttj
�ttttjd��|jttj�dt
i�|jttj�dttji�|jttj�ttd��|jttj�dt
i�|jtt�tt	d�d��|jtt�ttjtjd	��|jttj�t
t
d��|jttj�tjjtjjtjd
��dS)Nr�r�)Z123r�)�jr�r�r�)r�r�r�)�parentZmeaning)Z
some_xreprZother_aZsome_b)Zmy_inner_a1Zmy_inner_a2Z
my_outer_a)rFr�r�r�rrUZj_classr��MrLr�rbr[rIZh_classr�r��NoneAndForwardZHasForeignBaseClass�XReprr%rKr�rr)r,r1r1r2�test_get_type_hints_classess,

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@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 type)r�cSsdS)Nr1)r,r�r1r1r2r�szKGetTypeHintTests.test_respect_no_type_check.<locals>.NoTpCheck.Inn.__init__N)r8r9r:r�r1r1r1r2�Innsr�N)r8r9r:r�r1r1r1r2�	NoTpChecksr�c@seZdZed�dd�ZdS)z:GetTypeHintTests.test_respect_no_type_check.<locals>.ABase)r�cSsdS)Nr1)r�r1r1r2rC#sz?GetTypeHintTests.test_respect_no_type_check.<locals>.ABase.methN)r8r9r:rIrCr1r1r1r2�ABase"sr�c@seZdZdS)z8GetTypeHintTests.test_respect_no_type_check.<locals>.DerN)r8r9r:r1r1r1r2�Der$sr�r�)
rr�Z__no_type_check__r�r�rFr�r�ZNTCrCrr
rI)r,r�r�r�r1r1r2�test_respect_no_type_checksz+GetTypeHintTests.test_respect_no_type_checkcCs||jtt�i�|jtt�i�|jtt�i�|jtt�i�|jttj�i�|jtt�j�i�|jttj	�i�dS)N)
rFr�rIrL�dirr�rw�__str__rb�join)r,r1r1r2� test_get_type_hints_for_builtins(sz1GetTypeHintTests.test_get_type_hints_for_builtinscCsPdd�}d|jd<|jt|�dti�dd�dd�}|jt|�dtd�i�dS)NcSsdS)Nr1)r�r�r1r1r2�testf3sz6GetTypeHintTests.test_previous_behavior.<locals>.testfrIr�)r�cSsdS)Nr1)r�r1r1r2�testg6sz6GetTypeHintTests.test_previous_behavior.<locals>.testg)rGrFr�rIrL)r,r�r�r1r1r2�test_previous_behavior2s

z'GetTypeHintTests.test_previous_behaviorcCsHGdd�d�}Gdd�d�}|�}ddi|_|jt|t��d|i�dS)Nc@seZdZdS)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations.<locals>.AN)r8r9r:r1r1r1r2rK:srKc@seZdZdS)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations.<locals>.BN)r8r9r:r1r1r1r2r�;sr�r�)rGrFr�r�)r,rKr�r�r1r1r2�/test_get_type_hints_for_object_with_annotations9s

z@GetTypeHintTests.test_get_type_hints_for_object_with_annotationscCs�|jttjtj�dtjtji�|jttt��t	tt
tt	d��|jttt��ttt	t	tt
td��|jtt�dtt
ti�dS)N�var)r�r�r�)r�r�r�r�Zlst)rFr�r�ZCVr�r5rr�r�rIr�CSubrjrr
)r,r1r1r2�test_get_type_hints_ClassVar@s
z-GetTypeHintTests.test_get_type_hints_ClassVarN)r8r9r:r�rrzr�rr�r�r�r�r�r�r�r1r1r1r2r��s		
r�c@s�eZdZdd�Zdd�Zdd�Zeed�dd	��Zeed�d
d��Z	eed�dd
��Z
eed�dd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!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@)rUr5�Hashabler�)r,r1r1r2�
test_hashableNsz!CollectionsAbcTests.test_hashablecCsX|jgtj�|jgtj�|jgtj�|jdtj�|jttj�|jttj�dS)Nr@)rUr5r�r�r3r�)r,r1r1r2�
test_iterableRsz!CollectionsAbcTests.test_iterablecCs(tg�}|j|tj�|jdtj�dS)Nr@)rrUr5�Iteratorr�)r,�itr1r1r2�
test_iterator]sz!CollectionsAbcTests.test_iteratorz&Python 3.5 and multithreading requiredcCsJi}tdt�|�|d}|�}|j|tj�|j|tj�|jd�dS)NzPasync def foo() -> typing.Awaitable[int]:
    return await AwaitableWrapper(42)
r�)r�r�rUr5�	Awaitabler��send)r,r�r��gr1r1r2�test_awaitablebs
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�rUr5�	CoroutinerArBrCrIr�r��
StopIteration)r,r�r�r�r1r1r2�test_coroutineos
z"CollectionsAbcTests.test_coroutinecCs>td�}t|�}|j|tj�|j|tj�|jdtj�dS)N�
r@)rI�AsyncIteratorWrapperrUr5�
AsyncIterabler�)r,�base_itr�r1r1r2�test_async_iterable�s
z'CollectionsAbcTests.test_async_iterablecCs0td�}t|�}|j|tj�|jdtj�dS)Nr�r@)rIr�rUr5�
AsyncIteratorr�)r,r�r�r1r1r2�test_async_iterator�sz'CollectionsAbcTests.test_async_iteratorcCs |jgtj�|jdtj�dS)Nr@)rUr5�Sizedr�)r,r1r1r2�
test_sized�szCollectionsAbcTests.test_sizedcCs |jgtj�|jdtj�dS)Nr@)rUr5�	Containerr�)r,r1r1r2�test_container�sz"CollectionsAbcTests.test_containercCsJttd�rF|jt�tj�|jt�tj�|jttj�|jdtj�dS)N�
Collectionr@)	rr5rUr�r��	frozensetr3r�r�)r,r1r1r2�test_collection�s

z#CollectionsAbcTests.test_collectioncCs"|jt�tj�|jdtj�dS)Nr@)rUrer5�AbstractSetr�)r,r1r1r2�test_abstractset�sz$CollectionsAbcTests.test_abstractsetcCs$|jt�tj�|jt�tj�dS)N)rUrer5�
MutableSetr�r�)r,r1r1r2�test_mutableset�sz#CollectionsAbcTests.test_mutablesetcCs |jitj�|jdtj�dS)Nr@)rUr5r�r�)r,r1r1r2�test_mapping�sz CollectionsAbcTests.test_mappingcCs |jitj�|jdtj�dS)Nr@)rUr5rr�)r,r1r1r2�test_mutablemapping�sz'CollectionsAbcTests.test_mutablemappingcCs |jgtj�|jdtj�dS)Nr@)rUr5r3r�)r,r1r1r2�
test_sequence�sz!CollectionsAbcTests.test_sequencecCs |jgtj�|jftj�dS)N)rUr5�MutableSequencer�)r,r1r1r2�test_mutablesequence�sz(CollectionsAbcTests.test_mutablesequencecCs$|jdtj�|jtd�tj�dS)Nr�)rUr5�
ByteString�	bytearray)r,r1r1r2�test_bytestring�sz#CollectionsAbcTests.test_bytestringcCs|jttj�dS)N)r3r�r5r)r,r1r1r2�	test_list�szCollectionsAbcTests.test_listcCs:|jtjtj�Gdd�dtjt�}|j|�tj�dS)Nc@seZdZdS)z/CollectionsAbcTests.test_deque.<locals>.MyDequeN)r8r9r:r1r1r1r2�MyDeque�sr�)r3�collections�dequer5�DequerIrU)r,r�r1r1r2�
test_deque�szCollectionsAbcTests.test_dequecCs|jtjtj�dS)N)r3r��Counterr5)r,r1r1r2�test_counter�sz CollectionsAbcTests.test_countercCs |jttj�|jttj�dS)N)r3rer5�Setr4r�)r,r1r1r2�test_set�szCollectionsAbcTests.test_setcCs |jttj�|jttj�dS)N)r3r�r5rr4re)r,r1r1r2�test_frozenset�sz"CollectionsAbcTests.test_frozensetcCs|jttj�dS)N)r3r�r5r�)r,r1r1r2r��szCollectionsAbcTests.test_dictcCsf|jt��tj�WdQRX|jt��tjt�WdQRX|jt��tjt�WdQRXdS)N)rArBr5rr
rI)r,r1r1r2�test_no_list_instantiation�sz.CollectionsAbcTests.test_no_list_instantiationcCsRGdd�dtjt�}|�}|j||�|j|tj�|j|t�|jt|�dS)Nc@seZdZdS)z6CollectionsAbcTests.test_list_subclass.<locals>.MyListN)r8r9r:r1r1r1r2�MyList�sr�)r5rrIrUr3r3r�r4)r,r�r�r1r1r2�test_list_subclass�sz&CollectionsAbcTests.test_list_subclasscCsn|jt��tj�WdQRX|jt��tjttf�WdQRX|jt��tjttf�WdQRXdS)N)rArBr5r�rrrbrI)r,r1r1r2�test_no_dict_instantiation�sz.CollectionsAbcTests.test_no_dict_instantiationcCsVGdd�dtjttf�}|�}|j||�|j|tj�|j|t�|jt|�dS)Nc@seZdZdS)z6CollectionsAbcTests.test_dict_subclass.<locals>.MyDictN)r8r9r:r1r1r1r2r9�sr9)	r5r�rbrIrUrr3r�r4)r,r9r_r1r1r2�test_dict_subclass�sz&CollectionsAbcTests.test_dict_subclasscCsV|jttj��tj�|jttjttf��tj�|jttjtt	f��tj�dS)N)
r_rLr5r<r��defaultdictrrrbrI)r,r1r1r2�test_defaultdict_instantiation�sz2CollectionsAbcTests.test_defaultdict_instantiationcCsLGdd�dtjttf�}|�}|j||�|j|tj�|jtj|�dS)Nc@seZdZdS)z@CollectionsAbcTests.test_defaultdict_subclass.<locals>.MyDefDictN)r8r9r:r1r1r1r2�	MyDefDictsr)	r5r<rbrIrUr3r�rr4)r,rZddr1r1r2�test_defaultdict_subclass�s
z-CollectionsAbcTests.test_defaultdict_subclassr'zChainMap was added in 3.3cCs�|jttj��tj�|jttjttf��tj�|jttjttf��tj�Gdd�dtjttf�}|jt|ttf��|�dS)Nc@seZdZdS)z;CollectionsAbcTests.test_chainmap_instantiation.<locals>.CMN)r8r9r:r1r1r1r2�CMsr)	r_rLr5r=r�rrrbrI)r,rr1r1r2�test_chainmap_instantiation	s
z/CollectionsAbcTests.test_chainmap_instantiationcCsLGdd�dtjttf�}|�}|j||�|j|tj�|jtj|�dS)Nc@seZdZdS)z>CollectionsAbcTests.test_chainmap_subclass.<locals>.MyChainMapN)r8r9r:r1r1r1r2�
MyChainMapsr	)r5r=rbrIrUr3r�r4)r,r	�cmr1r1r2�test_chainmap_subclasss
z*CollectionsAbcTests.test_chainmap_subclasscCsz|jttj��tj�|jttjt��tj�|jttjt��tj�Gdd�dtjt�}|jt|t��|�dS)Nc@seZdZdS)z7CollectionsAbcTests.test_deque_instantiation.<locals>.DN)r8r9r:r1r1r1r2r�!sr�)r_rLr5r�r�r�r
rI)r,r�r1r1r2�test_deque_instantiations
z,CollectionsAbcTests.test_deque_instantiationcCsz|jttj��tj�|jttjt��tj�|jttjt��tj�Gdd�dtjt�}|jt|t��|�dS)Nc@seZdZdS)z9CollectionsAbcTests.test_counter_instantiation.<locals>.CN)r8r9r:r1r1r1r2r�(sr�)r_rLr5r�r�r
rI)r,r�r1r1r2�test_counter_instantiation$s
z.CollectionsAbcTests.test_counter_instantiationcCsHGdd�dtjt�}|�}|j||�|j|tj�|j|tj�dS)Nc@seZdZdS)zJCollectionsAbcTests.test_counter_subclass_instantiation.<locals>.MyCounterN)r8r9r:r1r1r1r2�	MyCounter-sr)r5r�rIrUr�)r,rr_r1r1r2�#test_counter_subclass_instantiation+s
z7CollectionsAbcTests.test_counter_subclass_instantiationcCsf|jt��tj�WdQRX|jt��tjt�WdQRX|jt��tjt�WdQRXdS)N)rArBr5r�r
rI)r,r1r1r2�test_no_set_instantiation5sz-CollectionsAbcTests.test_no_set_instantiationcCs,Gdd�dtjt�}|�}|j||�dS)Nc@seZdZdS)zBCollectionsAbcTests.test_set_subclass_instantiation.<locals>.MySetN)r8r9r:r1r1r1r2�MySet?sr)r5r�rIrU)r,rr_r1r1r2�test_set_subclass_instantiation=sz3CollectionsAbcTests.test_set_subclass_instantiationcCsf|jt��tj�WdQRX|jt��tjt�WdQRX|jt��tjt�WdQRXdS)N)rArBr5rr
rI)r,r1r1r2�test_no_frozenset_instantiationEsz3CollectionsAbcTests.test_no_frozenset_instantiationcCs,Gdd�dtjt�}|�}|j||�dS)Nc@seZdZdS)zNCollectionsAbcTests.test_frozenset_subclass_instantiation.<locals>.MyFrozenSetN)r8r9r:r1r1r1r2�MyFrozenSetOsr)r5rrIrU)r,rr_r1r1r2�%test_frozenset_subclass_instantiationMsz9CollectionsAbcTests.test_frozenset_subclass_instantiationcCs`|jt��t�WdQRX|jt��tt�WdQRX|jt��tt�WdQRXdS)N)rArBrr
rI)r,r1r1r2�test_no_tuple_instantiationUsz/CollectionsAbcTests.test_no_tuple_instantiationcCs$dd�}|�}|jt|�tj�dS)Ncss
dVdS)Nr@r1r1r1r1r2r�^sz/CollectionsAbcTests.test_generator.<locals>.foo)r3rLr5�	Generator)r,r�r�r1r1r2�test_generator]sz"CollectionsAbcTests.test_generatorcCsr|jt��tj�WdQRX|jt��tjtttf�WdQRX|jt��tjtttf�WdQRXdS)N)rArBr5rr
rI)r,r1r1r2�test_no_generator_instantiationcsz3CollectionsAbcTests.test_no_generator_instantiationzPython 3.6 requiredcCs2i}tdt�|�|d�}|jt|�tj�dS)Nzasync def f():
    yield 42
r6)r�r�r3rLr5�AsyncGenerator)r,r�r�r1r1r2�test_async_generatorks


z(CollectionsAbcTests.test_async_generatorcCsn|jt��tj�WdQRX|jt��tjttf�WdQRX|jt��tjttf�WdQRXdS)N)rArBr5rr
rI)r,r1r1r2�%test_no_async_generator_instantiationssz9CollectionsAbcTests.test_no_async_generator_instantiationcCs&Gdd�dtj�}|jt��|�WdQRXGdd�d|�}|jt|��d�t|j�s^t�|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@seZdZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMAN)r8r9r:r1r1r1r2�MMA~src@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMCcSsdS)Nr1)r,r�r1r1r2r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__getitem__cSsdS)Nr1)r,r�r�r1r1r2r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__setitem__cSsdS)Nr1)r,r�r1r1r2r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMC.__delitem__cSstf�S)N)r)r,r1r1r2r�sz:CollectionsAbcTests.test_subclassing.<locals>.MMC.__iter__cSsdS)Nrr1)r,r1r1r2r�sz9CollectionsAbcTests.test_subclassing.<locals>.MMC.__len__N)r8r9r:r�r�r�rrr1r1r1r2�MMC�s
rrc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)z1CollectionsAbcTests.test_subclassing.<locals>.MMBcSsdS)Nr1)r,r�r1r1r2r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__getitem__cSsdS)Nr1)r,r�r�r1r1r2r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__setitem__cSsdS)Nr1)r,r�r1r1r2r��sz=CollectionsAbcTests.test_subclassing.<locals>.MMB.__delitem__cSstf�S)N)r)r,r1r1r2r�sz:CollectionsAbcTests.test_subclassing.<locals>.MMB.__iter__cSsdS)Nrr1)r,r1r1r2r�sz9CollectionsAbcTests.test_subclassing.<locals>.MMB.__len__N)r8r9r:r�r�r�rrr1r1r1r2�MMB�s
rc@seZdZdS)z/CollectionsAbcTests.test_subclassing.<locals>.IN)r8r9r:r1r1r1r2�I�sr c@seZdZdS)z/CollectionsAbcTests.test_subclassing.<locals>.GN)r8r9r:r1r1r1r2rj�srjcss
dVdS)Nrr1r1r1r1r2r��sz/CollectionsAbcTests.test_subclassing.<locals>.gr)r5rrArBrFr��callabler�AssertionErrorrUr�rrrbr4r�r3r�r�r�rrIrrL)r,rrrr rjr�r1r1r2�test_subclassing|sB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@seZdZdd�Zddd�ZdS)z?CollectionsAbcTests.test_subclassing_async_generator.<locals>.GcSsdS)Nr1)r,r�r1r1r2�asend�szECollectionsAbcTests.test_subclassing_async_generator.<locals>.G.asendNcSsdS)Nr1)r,�typ�val�tbr1r1r2�athrow�szFCollectionsAbcTests.test_subclassing_async_generator.<locals>.G.athrow)NN)r8r9r:r$r(r1r1r1r2rj�srjzasync def g(): yield 0r�)r5rrIr�r�r3r�r�r4rLrUr�)r,rjr�r��instancer1r1r2� test_subclassing_async_generator�s z4CollectionsAbcTests.test_subclassing_async_generatorcCsfGdd�dtj�}Gdd�d|�}Gdd�d�}Gdd�d�}|j||�|j||�|j||�dS)	Nc@seZdZedd��ZdS)z?CollectionsAbcTests.test_subclassing_subclasshook.<locals>.BasecSs|jdkrdSdSdS)N�FooTF)r8)r-�otherr1r1r2�__subclasshook__�s
zPCollectionsAbcTests.test_subclassing_subclasshook.<locals>.Base.__subclasshook__N)r8r9r:�classmethodr-r1r1r1r2r"�sr"c@seZdZdS)z<CollectionsAbcTests.test_subclassing_subclasshook.<locals>.CN)r8r9r:r1r1r1r2r��sr�c@seZdZdS)z>CollectionsAbcTests.test_subclassing_subclasshook.<locals>.FooN)r8r9r:r1r1r1r2r+�sr+c@seZdZdS)z>CollectionsAbcTests.test_subclassing_subclasshook.<locals>.BarN)r8r9r:r1r1r1r2�Bar�sr/)r5r�r3r4)r,r"r�r+r/r1r1r2�test_subclassing_subclasshook�sz1CollectionsAbcTests.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@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.AN)r8r9r:r1r1r1r2rK�srKc@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.BN)r8r9r:r1r1r1r2r��sr�c@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.CN)r8r9r:r1r1r1r2r��sr�c@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.DN)r8r9r:r1r1r1r2r��sr�c@seZdZdS)z8CollectionsAbcTests.test_subclassing_register.<locals>.MN)r8r9r:r1r1r1r2r��sr�)r5r�r�r3r4r�rr�)r,rKr�r�r�r�r1r1r2�test_subclassing_register�s

z-CollectionsAbcTests.test_subclassing_registercCs�Gdd�dtj�}|j|tj�|j|tj�Gdd�dtj�}|j|tj�|j|tj�Gdd�dtj�}|j|tj�Gdd�dtjtjd	�}Gd
d�d�}|j|�|j|tj�dS)Nc@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.MN)r8r9r:r1r1r1r2r�	sr�c@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.SN)r8r9r:r1r1r1r2r�	sr�c@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.IN)r8r9r:r1r1r1r2r 	sr c@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.AN)r8r9r:r1r1r1r2rK	srK)�	metaclassc@seZdZdS)z7CollectionsAbcTests.test_collections_as_base.<locals>.BN)r8r9r:r1r1r1r2r�	sr�)	r�r�r3r5r�r�r��ABCMetar�)r,r�r�r rKr�r1r1r2�test_collections_as_base�s
z,CollectionsAbcTests.test_collections_as_baseN)r'r')r'r')8r8r9r:r�r�r�r�ASYNCIOr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrr rrrr
rrrrrrrrrzrrr#r*r0r1r4r1r1r1r2r�Ls`

	Er�c@s&eZdZdd�Zeed�dd��ZdS)�
OtherABCTestscCs4tjdd��}|�}|j|tj�|jdtj�dS)Ncss
dVdS)Nr@r1r1r1r1r2�manager	sz2OtherABCTests.test_contextmanager.<locals>.managerr@)�
contextlib�contextmanagerrUr5�ContextManagerr�)r,r7r
r1r1r2�test_contextmanager	sz!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@seZdZdS)z7OtherABCTests.test_async_contextmanager.<locals>.NotACMN)r8r9r:r1r1r1r2�NotACM	sr<css
dVdS)Nr@r1r1r1r1r2r7"	sz8OtherABCTests.test_async_contextmanager.<locals>.managerr@)rU�ACMr5ZAsyncContextManagerr�r8r9rFrIr]rArBrCrb)r,r<r7r
r1r1r2�test_async_contextmanager	sz'OtherABCTests.test_async_contextmanagerN)r8r9r:r;rr5r>r1r1r1r2r6	s	r6c@s$eZdZdd�Zdd�Zdd�ZdS)�	TypeTestscCsNGdd�d�}Gdd�d|�}Gdd�d|�}t||d�dd	�}||�dS)
Nc@seZdZdS)z'TypeTests.test_type_basic.<locals>.UserN)r8r9r:r1r1r1r2�User3	sr@c@seZdZdS)z,TypeTests.test_type_basic.<locals>.BasicUserN)r8r9r:r1r1r1r2�	BasicUser4	srAc@seZdZdS)z*TypeTests.test_type_basic.<locals>.ProUserN)r8r9r:r1r1r1r2�ProUser5	srB)�
user_classr�cSs|�S)Nr1)rCr1r1r2�new_user7	sz+TypeTests.test_type_basic.<locals>.new_user)r)r,r@rArBrDr1r1r2�test_type_basic1	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>.UserN)r8r9r:r1r1r1r2r@>	sr@c@seZdZdS)z.TypeTests.test_type_typevar.<locals>.BasicUserN)r8r9r:r1r1r1r2rA?	srAc@seZdZdS)z,TypeTests.test_type_typevar.<locals>.ProUserN)r8r9r:r1r1r1r2rB@	srBr�)rn)rCr�cSs|�S)Nr1)rCr1r1r2rDD	sz-TypeTests.test_type_typevar.<locals>.new_user)rr)r,r@rArBr�rDr1r1r2�test_type_typevar<	szTypeTests.test_type_typevarcCsFttt}|ttd�dd�}t|t�t�s2t�|d�dksBt�dS)N)r�r�cSs|dkrdS|�SdS)Nr1)r�r1r1r2r�L	sz)TypeTests.test_type_optional.<locals>.foo)rr�
BaseExceptionrC�KeyboardInterruptr")r,rKr�r1r1r2�test_type_optionalI	szTypeTests.test_type_optionalN)r8r9r:rErFrIr1r1r1r2r?/	s
r?c@seZdZdd�Zdd�ZdS)�NewTypeTestscCsLtdt�}tdt�}|j|d�t�|j|d�t�|j|d�dd�dS)N�UserId�UserNamer��Joer�r()rrIrbrUrF)r,rKrLr1r1r2�
test_basicX	s


zNewTypeTests.test_basiccCs^tdt�}tdt�}|jt��t|t�WdQRX|jt��Gdd�d|�}WdQRXdS)NrKrLc@seZdZdS)z#NewTypeTests.test_errors.<locals>.DN)r8r9r:r1r1r1r2r�e	sr�)rrIrbrArBr*)r,rKrLr�r1r1r2rJ_	s

zNewTypeTests.test_errorsN)r8r9r:rNrJr1r1r1r2rJV	srJc@sleZdZdd�Zdd�Zeed�dd��Zeed�dd	��Zeed�d
d��Z	eed�dd
��Z
dd�ZdS)�NamedTupleTestscCs�tddtfdtfg�}|j|t�|dd�}|ddd�}|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�idrMr@ZJimr�)rQrR)rQrR)rrbrIr3r�rUrFrQrRr8�_fieldsrGr��OrderedDictr_�_field_types)r,rPZjoeZjimr1r1r2ruk	s
zNamedTupleTests.test_basicscCs`tjdd�dkr\|jt��tdttd�WdQRX|jt��Gdd�dt�}WdQRXdS)	Nr&r'r(�Name)Zoner,c@seZdZdZdS)z9NamedTupleTests.test_namedtuple_pyversion.<locals>.NotYetrN)r8r9r:rTr1r1r1r2�NotYet�	srW)r'r()rr rArBrrIrb)r,rWr1r1r2�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
ttd��|j
tjtj�dS)NZTimi(#�CoolEmployeerQ�cool)rQrZ)rQrZ)rYrUr�rFrQrZr8rSrGr�rTrbrIr_rU)r,Ztimr1r1r2�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	t
td��|jtjt	dd	��|j
t��td
�WdQRXdS)NZJellerZSjoerdr��CoolEmployeeWithDefaultrQrZ)rQrZ)rZzE
class NonDefaultAfterDefault(NamedTuple):
    x: int = 3
    y: int
)rQrZ)r\rUr�rFrQrZr8rSrUr�rbrIZ_field_defaultsrArBr�)r,ZjelleZcooler_employeer1r1r2�"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'
)	rF�XMethZdoubler�rbr�rAr�r�)r,r1r1r2�"test_annotation_usage_with_methods�	sz2NamedTupleTests.test_annotation_usage_with_methodscCs�tdttd�}|dd�}|j|t�|j|jd�|j|jd�|j|jd
�|j|j	t
ttd��|j|j|j	�|j
t��tddtfgtd	�WdQRX|j
t��tdd
dd�WdQRXdS)N�
LocalEmployee)rQ�ageZNick�rQrarVr�)r�r�r�)r�r�)rQra)rrbrIrUr�rFrQr8rSrGr�r_rUrArB)r,r`Znickr1r1r2�test_namedtuple_keyword_usage�	s
z-NamedTupleTests.test_namedtuple_keyword_usagecCs^tddtfdtfg�atdd�}x8ttjd�D]&}tj||�}tj|�}|j	||�q0WdS)NrPrQrR�jane�%r�)
rrbrIrPrIrJrKrLrMrF)r,rdrNr�Zjane2r1r1r2rP�	s

zNamedTupleTests.test_pickleN)r8r9r:rurXrrzr[r]r_rcrPr1r1r1r2rOi	s
rOc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�IOTestscCs.ttd�dd�}|jd}|j|jtf�dS)N)r�r�cSs|j�S)N)�readline)r�r1r1r2r��	szIOTests.test_io.<locals>.stuffr�)r rrGrFr^)r,r�r�r1r1r2�test_io�	s
zIOTests.test_iocCs,ttd�dd�}|jd}|j|jf�dS)N)r�r�cSs|j�S)N)rg)r�r1r1r2r��	sz"IOTests.test_textio.<locals>.stuffr�)r!rbrGrFr^)r,r�r�r1r1r2�test_textio�	s
zIOTests.test_textiocCs,ttd�dd�}|jd}|j|jf�dS)N)r�r�cSs|j�S)N)rg)r�r1r1r2r��	sz$IOTests.test_binaryio.<locals>.stuffr�)r"rcrGrFr^)r,r�r�r1r1r2�
test_binaryio�	s
zIOTests.test_binaryiocCspddlm}m}m}m}m}|j|tj�|j|tj�|j|tj�|jt	|�t	dddg��|j|d�dS)Nr)r r!r"r@r8r r!r"z	typing.io)
Z	typing.ior r!r"r@r8r_r5rFre)r,r r!r"r@r8r1r1r2�test_io_submodule�	szIOTests.test_io_submoduleN)r8r9r:rhrirjrkr1r1r1r2rf�	srfc@s<eZdZdd�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.....)
rU�compiler r3r�r#rLrU�searchr$rrbrc)r,ZpatZmatr1r1r2ru�	s
zRETests.test_basicscCsP|jtttt�|jtttt�|jtttt�|jttt�dS)N)rFr#rbr\rcr$)r,r1r1r2�test_alias_equality
szRETests.test_alias_equalityc'Cs�|jt��ttWdQRX|jt��ttWdQRXttttf}|jt��|tWdQRX|jt��t	dtt�WdQRX|jt��t
tttt�WdQRXdS)Nr@)rArBr#rIr$r
rrbrcrCr*)r,�mr1r1r2rJ
szRETests.test_errorscCst|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])rFrGr#rbrcr$)r,r1r1r2rH$
szRETests.test_reprcCs\ddlm}m}m}m}|j|tj�|j|tj�|jt|�tddg��|j|d�dS)Nr)r$r#r@r8r$r#z	typing.re)	Z	typing.rer$r#r@r8r_r5rFre)r,r$r#r@r8r1r1r2�test_re_submodule,
s
zRETests.test_re_submodulecCs>|jt��}Gdd�dtj�}WdQRX|jt|j�d�dS)Nc@seZdZdS)z'RETests.test_cannot_subclass.<locals>.AN)r8r9r:r1r1r1r2rK6
srKz!Cannot subclass typing._TypeAlias)rArBr5r$rFrbZ	exception)r,ZexrKr1r1r2rM3
szRETests.test_cannot_subclassN)	r8r9r:rurorJrHrqrMr1r1r1r2rl�	srlc@seZdZdZdd�ZdS)�AllTestszTests for __all__.cCs�ddlm}|jd|�|jd|�|jd|�|jd|�ttd�rR|jd|�|jd	|�|jd
|�|jd|�|jd|�|jd
|�|jd|�|jd|�dS)Nr)r@r��
ValuesViewrr��AbstractContextManagerr:�iorU�osrZTextr�r�)r5r@ZassertInrr8r�)r,r�r1r1r2�test_all@
s
zAllTests.test_allN)r8r9r:�__doc__rwr1r1r1r2rr=
srr�__main__)r'r()r'r�)jr8r�rJrUrZunittestrrrrrrrr5r	r
rrr
rrrrrrrrrrrrrrrrrrr r!r"r#r$r�rV�collections.abcrr�r%Ztestr rzr)r;r<r=r>r?rPrTrsr�r�rbrcr�r�r�r�r�r�r{r~rr�r5Z
ASYNCIO_TESTSr�ZasynciorwZAwaitableWrapperr�r=Z
PY36_TESTSr�r�r�rKr�r�rjrYr\r^r�r�r�r�r�r6r?rJrOrfrlrrr8r1r1r1r2�<module>s�*"R)N9(9%7
gH'n#C


Youez - 2016 - github.com/yon3zu
LinuXploit