a 5dg8 @s^ddlZddlZddlZddlZddlZddlmZmZmZm Z ddl m Z m Z ddl m Z mZddl mZmZddl mZmZmZddl mZmZmZddl mZmZmZmZdd l mZdd l mZmZmZmZm Z dd l m!Z!m"Z"dd l m#Z#dd l m$Z$m%Z%ddl m&Z&m'Z'ddl m(Z(ddl m)Z)ddl m*Z*m+Z+ddl m,Z,m-Z-m.Z.ddl m/Z/m0Z0ddl m1Z1m2Z2ddl3Z3ddl Z ddl4Z4ddl5Z5ddl6m7Z7GdddeZ8GdddZ9Gddde9Z:Gddde9Z;Gddde:e;ZGd$d%d%e8Z?Gd&d'd'e8Z@Gd(d)d)e8ZAGd*d+d+e8ZBGd,d-d-e8ZCed.eDeEZFed/ZGGd0d1d1eeFeGfZHGd2d3d3eHeFeGfZIGd4d5d5e ZJe"Gd6d7d7eJe ZKGd8d9d9ZLGd:d;d;e ZMGdd?d?eMeNe ZOe"Gd@dAdAe ZPGdBdCdCePZQGdDdEdEZRGdFdGdGe*ZSe"GdHdIdIe ZTGdJdKdKe8ZUGdLdMdMe8ZVGdNdOdOe8ZWGdPdQdQe8ZXGdRdSdSe8ZYGdTdUdUe8ZZGdVdWdWe8Z[dXZ\z e]e\Wne^ydYZ_Yn0dZZ_dd[l6m`Z`maZambZbdd\l mcZcGd]d^d^ZdGd_d`d`edZeGdadbdbeeZfGdcddddeeZgGdedfdfZhGdgdhdhZiGdidjdje*ZjGdkdldle*ZkGdmdndne*ZlGdodpdpe*Zme+dqdreDfgZnGdsdtdte+ZoGdudvdveoenZpGdwdxdxe+dYdyZqGdzd{d{e7jdZrecesd|d}d~ZtzeteuvdWn:ewyvZxz exjyddksbJWYdZx[xn dZx[x00e#ZzGdddZ{Gddde8Z|GdddeZ}Gddde8Z~Gddde8ZGddde8ZGddde8ZGddde8ZGddde8ZGddde8ZGddde8ZGddde8ZGddde8ZedkrZedS)N)TestCasemain skipUnlessskip)copydeepcopy)AnyNoReturn)TypeVarAnyStr)TKTVT)UnionOptionalLiteral)TupleListDictMutableMapping)Callable)GenericClassVarFinalfinalProtocol)castruntime_checkable)get_type_hints) get_originget_args) no_type_checkno_type_check_decoratorType)NewType) NamedTuple TypedDictIOTextIOBinaryIO)PatternMatch) Annotated ForwardRef)mod_generics_cachec@s(eZdZdddZd ddZddZdS) BaseTestCaseNcCs8t||s4d||f}|dur*|d|7}||dS)Nz%r is not a subclass of %r : %s issubclassZfailureExceptionselfclsZclass_or_tuplemsgmessager:,/usr/local/lib/python3.9/test/test_typing.pyassertIsSubclass$s    zBaseTestCase.assertIsSubclasscCs8t||r4d||f}|dur*|d|7}||dS)Nz%r is a subclass of %rr2r3r5r:r:r;assertNotIsSubclass+s    z BaseTestCase.assertNotIsSubclasscCstjD] }|qdSN)typing _cleanupsr6fr:r:r; clear_caches2s zBaseTestCase.clear_caches)N)N)__name__ __module__ __qualname__r<r=rCr:r:r:r;r1"s  r1c@s eZdZdS)EmployeeNrDrErFr:r:r:r;rG7srGc@s eZdZdS)ManagerNrHr:r:r:r;rI;srIc@s eZdZdS)FounderNrHr:r:r:r;rJ?srJc@s eZdZdS)ManagingFounderNrHr:r:r:r;rKCsrKc@sDeZdZddZddZddZddZd d Zd d Zd dZ dS)AnyTestscCs8|ttdtWdn1s*0YdSN*) assertRaises TypeError isinstancerr6r:r:r;test_any_instance_type_errorIs z%AnyTests.test_any_instance_type_errorcCsl|ttttWdn1s*0Y|ttttWdn1s^0YdSr>)rOrPr4rGrrRr:r:r;test_any_subclass_type_errorMs ( z%AnyTests.test_any_subclass_type_errorcCs|ttddS)Nz typing.Any) assertEqualreprrrRr:r:r; test_reprSszAnyTests.test_reprcCsj|ttdtWdn1s*0Y|tttWdn1s\0YdSrM)rOrPr4rintrRr:r:r; test_errorsVs ( zAnyTests.test_errorscCs||t Gdddt}Wdn1s00Y|t$Gdddtt}Wdn1sn0YdS)Nc@s eZdZdSz(AnyTests.test_cannot_subclass..ANrHr:r:r:r;A^sr[c@s eZdZdSrZrHr:r:r:r;r[asrOrPrtyper6r[r:r:r;test_cannot_subclass\s . zAnyTests.test_cannot_subclasscCsh|ttWdn1s&0Y|tttWdn1sZ0YdSr>r\rRr:r:r;test_cannot_instantiateds $ z AnyTests.test_cannot_instantiatecCs"tjttjttjtdSr>)r?r-rr,r)rRr:r:r;test_any_works_with_aliasjs  z"AnyTests.test_any_works_with_aliasN) rDrErFrSrTrWrYr_r`rar:r:r:r;rLGsrLc@s<eZdZddZddZddZddZd d Zd d Zd S) NoReturnTestscCs8|ttdtWdn1s*0YdSrM)rOrPrQr rRr:r:r;!test_noreturn_instance_type_errorss z/NoReturnTests.test_noreturn_instance_type_errorcCsl|ttttWdn1s*0Y|ttttWdn1s^0YdSr>)rOrPr4rGr rRr:r:r;!test_noreturn_subclass_type_errorws ( z/NoReturnTests.test_noreturn_subclass_type_errorcCs|ttddS)Nztyping.NoReturn)rUrVr rRr:r:r;rW}szNoReturnTests.test_reprcCs6|tttWdn1s(0YdSr>)rOrPr rXrRr:r:r;test_not_generics zNoReturnTests.test_not_genericcCs||t Gdddt}Wdn1s00Y|t$Gdddtt}Wdn1sn0YdS)Nc@s eZdZdSz-NoReturnTests.test_cannot_subclass..ANrHr:r:r:r;r[sr[c@s eZdZdSrfrHr:r:r:r;r[srOrPr r]r^r:r:r;r_s . z"NoReturnTests.test_cannot_subclasscCsh|ttWdn1s&0Y|tttWdn1sZ0YdSr>rgrRr:r:r;r`s $ z%NoReturnTests.test_cannot_instantiateN) rDrErFrcrdrWrer_r`r:r:r:r;rbqs rbc@s|eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS) TypeVarTestscCs$td}|||||tdSNr )r rUassertIsInstancer6r r:r:r;test_basic_plains zTypeVarTests.test_basic_plaincCs@td}|ttd|Wdn1s20YdS)Nr rN)r rOrPrQrkr:r:r; test_typevar_instance_type_errors z-TypeVarTests.test_typevar_instance_type_errorcCsttd}|ttt|Wdn1s20Y|tt|tWdn1sf0YdSri)r rOrPr4rXrkr:r:r; test_typevar_subclass_type_errors  ( z-TypeVarTests.test_typevar_subclass_type_errorcCs<|ttdt}|Wdn1s.0YdS)NX)rOrPr rXr6ror:r:r;test_constrained_errors  z#TypeVarTests.test_constrained_errorcCstd}td}||||t|||t|t||f|t||f||t|tft||t|tftt|t|tfj|tf|t|tfj|f|t|tfjtdS)NroY) r assertNotEqualrUrrX__args____parameters__assertIs __origin__)r6rorrr:r:r;test_union_uniques zTypeVarTests.test_union_uniquecCs(tdtt}|t|tft|dSNr[)r strbytesrsrr^r:r:r;test_union_constraineds z#TypeVarTests.test_union_constrainedcCs||ttd|ttd|ttd|ttdtddd}|t|dtd dd }|t|d dS) Nz~Tz~KTz~VTz~AnyStrT_coT covariantz+T_coT_contra) contravariantz -T_contra)rUrVr r rr r )r6r}rr:r:r;rWs  zTypeVarTests.test_reprcCs4|tdtd|tdtttdttdSri)rsr rXrzrRr:r:r;test_no_redefinitionsz!TypeVarTests.test_no_redefinitioncCsB|t$Gdddtd}Wdn1s40YdS)Nc@s eZdZdS)z1TypeVarTests.test_cannot_subclass_vars..VNrHr:r:r:r;Vsrr rOrPr r6rr:r:r;test_cannot_subclass_varss z&TypeVarTests.test_cannot_subclass_varscCs>|t Gdddt}Wdn1s00YdS)Nc@s eZdZdS)z7TypeVarTests.test_cannot_subclass_var_itself..VNrHr:r:r:r;rsrrrr:r:r;test_cannot_subclass_var_itselfs z,TypeVarTests.test_cannot_subclass_var_itselfcCs8|ttdWdn1s*0YdSryrrRr:r:r;test_cannot_instantiate_varss z)TypeVarTests.test_cannot_instantiate_varscCst|ttdddWdn1s,0Y|t tdtttdWdn1sf0YdS)NrorNbound)rOrPr rzfloatrGrRr:r:r;test_bound_errorss * zTypeVarTests.test_bound_errorscCsd}t|idS)Nz&import typing T = typing.TypeVar('T') )exec)r6coder:r:r;test_missing__name__sz!TypeVarTests.test_missing__name__cCs<|ttddddWdn1s.0YdS)Nr T)rr)rO ValueErrorr rRr:r:r;test_no_bivariants zTypeVarTests.test_no_bivariantN)rDrErFrlrmrnrqrxr|rWrrrrrrrr:r:r:r;rhs  rhc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)S)* UnionTestscCstttf}||tdSr>)rrXrrsr6ur:r:r; test_basicss zUnionTests.test_basicscCs|ttttWdn1s*0Y|ttttWdn1s^0Y|t"tttttfWdn1s0Y|t"ttttftWdn1s0YdSr>)rOrPr4rXrrzrRr:r:r;test_subclass_errors ( ( 0 zUnionTests.test_subclass_errorcCsltt}||ttttf}tttf}tttf}|||||t||t||tdSr>)rrrUrXobjectrs)r6ru1u2u3r:r:r;test_union_anys       zUnionTests.test_union_anycCsTtt}||ttttf}tttf}|||||t||tdSr>)rrrUrXrs)r6rrrr:r:r;test_union_objects     zUnionTests.test_union_objectcCs(tttf}tttf}|||dSr>)rrXrrU)r6rrr:r:r;test_unordereds  zUnionTests.test_unorderedcCstt}||tdSr>)rrGrv)r6tr:r:r;test_single_class_disappearssz'UnionTests.test_single_class_disappearscCs8tttf}||t|t|j|t|jdSr>)rrGrIrsassertInrtrr:r:r;test_base_class_kepts  zUnionTests.test_base_class_keptcCs2tttf}t|tf}||ttttfdSr>)rrXrrGrU)r6rvr:r:r;test_union_unions  zUnionTests.test_union_unioncCs|ttdtttf}|t|dttttf}|t|dttd}t|tft}|t|ttttttf}|t|dtttt t t ff}|t|ddS)Nz typing.Unionztyping.Union[%s.Employee, int]ztyping.Union[int, %s.Employee]r z#typing.Union[typing.List[int], int]z)typing.Union[list[int], dict[str, float]]) rUrVrrGrXrDr rlistdictrzr)r6rr r:r:r;rW$s  zUnionTests.test_reprcCs|t Gdddt}Wdn1s00Y|t$Gdddtt}Wdn1sn0Y|t(Gdddtttf}Wdn1s0YdS)Nc@s eZdZdSz*UnionTests.test_cannot_subclass..CNrHr:r:r:r;C4src@s eZdZdSrrHr:r:r:r;r7sc@s eZdZdSrrHr:r:r:r;r:s)rOrPrr]rXrzr6rr:r:r;r_2s  . 2 zUnionTests.test_cannot_subclasscCs|ttWdn1s&0Y|tttWdn1sZ0Ytttf}|t|Wdn1s0Y|tt|Wdn1s0YdSr>)rOrPrr]rXrrr:r:r;r`=s $ (  $ z"UnionTests.test_cannot_instantiatecCs|tttjtftk|tttjtftjtk|ttttjtfj|tjttttjtfjdSr>) assertFalserrzr?IterablerXrrtrRr:r:r;test_union_generalizationHs"z$UnionTests.test_union_generalizationcCsb|tt|tt|tt|tt|dgt|ttj|ttjtdSr>) rsrrrrrr?MappingrrRr:r:r;test_union_compare_otherNs    z#UnionTests.test_union_compare_othercCs$tt}ttdf}|||dSr>)rrXrrU)r6orr:r:r; test_optionalWs zUnionTests.test_optionalcCs6|ttdWdn1s(0YdSNr:)rOrPrrRr:r:r; test_empty\s zUnionTests.test_emptycCs@|t"tdtttfWdn1s20YdSrM)rOrPrQrrXrzrRr:r:r;test_union_instance_type_error`s z)UnionTests.test_union_instance_type_errorcCs2tttf}|ddd}|t|d|dS)NxcSsdSr>r:rr:r:r;rBfz(UnionTests.test_no_eval_union..fr)rrXrzrvr)r6rrBr:r:r;test_no_eval_unionds zUnionTests.test_no_eval_unioncCs*tddd}|tt|tfddS)NreturncSsdSr>r:r:r:r:r;funjrz0UnionTests.test_function_repr_union..funztyping.Union[fun, int])rXrUrVr)r6rr:r:r;test_function_repr_unionisz#UnionTests.test_function_repr_unioncCstttf}|dSr>)rrzr,r^r:r:r;test_union_str_patternms z!UnionTests.test_union_str_patterncs4ddlmttffdd}t|tfdS)NrElementcs|Sr>r:)argsrr:r;Elemysz#UnionTests.test_etree..Elem)Zxml.etree.ElementTreerrrz)r6rr:rr; test_etreers   zUnionTests.test_etreeN)rDrErFrrrrrrrrrWr_r`rrrrrrrrrr:r:r:r;rs(      rc@s<eZdZddZddZddZddZd d Zd d Zd S) TupleTestscCs|t"tttttfWdn1s20Y|t"tttttfWdn1sn0YGdddt}|ttt|t|tdS)Nc@s eZdZdS)z"TupleTests.test_basics..TPNrHr:r:r:r;TPrr)rOrPr4rrXrztuple assertTrue)r6rr:r:r;rs 0 0zTupleTests.test_basicscCsd|tttt|ttdfttdf|tttttf|ttttdfdSN.)rUrrXrsrRr:r:r; test_equalityszTupleTests.test_equalitycCs$Gdddt}|t|tdS)Nc@s eZdZdS)z/TupleTests.test_tuple_subclass..MyTupleNrHr:r:r:r;MyTuplesr)rrr4r)r6rr:r:r;test_tuple_subclassszTupleTests.test_tuple_subclasscCsL|t"tdtttfWdn1s20Y|dtdS)N)rr)rOrPrQrrXrjrRr:r:r;test_tuple_instance_type_errors 0z)TupleTests.test_tuple_instance_type_errorcCsp|ttd|ttdd|ttttfd|tttdfd|ttttddS)Nz typing.Tupler:ztyping.Tuple[()]ztyping.Tuple[int, float].ztyping.Tuple[int, ...]ztyping.Tuple[list[int]])rUrVrrXrrrRr:r:r;rWs zTupleTests.test_reprcCsp|ttdtWdn1s*0Y|ttdttWdn1sb0YdSrM)rOrPr4rrXrRr:r:r;rYs ( zTupleTests.test_errorsN) rDrErFrrrrrWrYr:r:r:r;rs  rc@sTeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS) CallableTestscCsh|t2|ttddttgtfWdn1sB0Y|ttddtdS)NcSs|Sr>r:rr:r:r;rz2CallableTests.test_self_subclass..cSs|Sr>r:rr:r:r;rr)rOrPrr4r]rrXrRr:r:r;test_self_subclasss @z CallableTests.test_self_subclasscCs|ttgtfttgtf|tttgtfttgtfhd|ttgtfttgtf|ttgtfttgtf|ttgtftttgtf|ttgtftgtf|ttgtftdSN)rUrrXlenrsrzrRr:r:r; test_eq_hashs (  "zCallableTests.test_eq_hashcCs|ttWdn1s&0Y|tttWdn1sZ0Yttgtf}|t|Wdn1s0Y|tt|Wdn1s0YdSr>)rOrPrr]rXrz)r6cr:r:r;r`s $ ( $ z%CallableTests.test_cannot_instantiatecCs6|tttWdn1s(0YdSr>)rOrPrrXrRr:r:r;test_callable_wrong_formss z'CallableTests.test_callable_wrong_formscCs$dd}||t|dtdS)NcSsdSr>r:r:r:r:r;rBsz5CallableTests.test_callable_instance_works..f)rjrassertNotIsInstancerAr:r:r;test_callable_instance_workss z*CallableTests.test_callable_instance_workscCsdd}|t$||tgdfWdn1s<0Y|t$||tgtfWdn1sz0Y|t$|dtgdfWdn1s0Y|t$|dtgtfWdn1s0YdS)NcSsdSr>r:r:r:r:r;rBsz:CallableTests.test_callable_instance_type_error..f)rOrPrjrrrrAr:r:r;!test_callable_instance_type_errors 2 2 2 z/CallableTests.test_callable_instance_type_errorcCstgtf}|t|dtttgtf}|t|dtdtf}|t|dtttgttf}|t|ddS)Nztyping.Callable[[], bool]z"typing.Callable[[str, float], int].ztyping.Callable[..., str]z(typing.Callable[[str, float], list[int]])rboolrUrVrzrrXr)r6Zct0Zct2ZctvZct3r:r:r;rWs  zCallableTests.test_reprcCs>tdtfddd}|t|ttdtdtfidS)N.acSsdSr>r:rr:r:r;foosz6CallableTests.test_callable_with_ellipsis..foor)rr rUrglobalslocalsr6rr:r:r;test_callable_with_ellipsissz)CallableTests.test_callable_with_ellipsiscCstjtdtfdSr)r?rrrzrRr:r:r;test_ellipsis_in_genericsz&CallableTests.test_ellipsis_in_genericN) rDrErFrrr`rrrrWrrr:r:r:r;rs    rc@sleZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS) LiteralTestscCsPtdtdtdtdtdtdttdtdftddS) Nrr)ryzT)r2Frr)sfoobar)rrRr:r:r;rszLiteralTests.test_basicscCs*tttdtdddttdS)N)y@@.r:rrrr)rrXr rRr:r:r;3test_illegal_parameters_do_not_raise_runtime_errorssz@LiteralTests.test_illegal_parameters_do_not_raise_runtime_errorscCsttdttddS)Nr)rrbaz)rrrRr:r:r; test_literals_inside_other_typess z-LiteralTests.test_literals_inside_other_typescCsx|ttdd|ttdd|tttd|ttd|ttdd|ttdd dS) Nrztyping.Literal[1])rTrztyping.Literal[1, True, 'foo']ztyping.Literal[int]ztyping.Literalztyping.Literal[None]rrrrztyping.Literal[1, 2, 3])rUrVrrXrRr:r:r;rW s zLiteralTests.test_reprcCs|ttWdn1s&0Y|ttdWdn1sZ0Y|tttWdn1s0Y|tttdWdn1s0YdSr)rOrPrr]rRr:r:r;test_cannot_inits $ ( ( zLiteralTests.test_cannot_initcCs|ttdtdWdn1s.0Y|ttttdWdn1sf0Y|ttdtdWdn1s0Y|ttttdWdn1s0YdSr)rOrPrQrrXr4rRr:r:r; test_no_isinstance_or_issubclasss , , , z-LiteralTests.test_no_isinstance_or_issubclasscCs||t$Gdddtd}Wdn1s40Y|t Gdddt}Wdn1sn0YdS)Nc@s eZdZdS)z-LiteralTests.test_no_subclassing..FooNrHr:r:r:r;Foo'rrrc@s eZdZdS)z-LiteralTests.test_no_subclassing..BarNrHr:r:r:r;Bar)rrrOrPr)r6rrr:r:r;test_no_subclassing%s 2 z LiteralTests.test_no_subclassingcCs:|ttddWdn1s,0YdSrrrRr:r:r;test_no_multiple_subscripts+s z(LiteralTests.test_no_multiple_subscriptscCs|tdtd|tdtd|tdtd|tdtd|tdtd|tdtd|td td dS) NrFTrr)rTrrrrr)rsrrUrRr:r:r; test_equal/szLiteralTests.test_equalcCsX|ttdttd|ttdttd|ttdttddS)Nrrrrr)rUhashrrRr:r:r; test_hash8szLiteralTests.test_hashcCsb|tdjd|tdjd|tdtdtdfjd|tggfjggfdS)Nrrrr)rr)rrrr)rUrrtrRr:r:r; test_args=s zLiteralTests.test_argscCshttdtdtdf}ttddf}ttd}|||fD]"}||td||jdq@dS)Nrrrrr)rrUrt)r6l1l2l3lr:r:r; test_flattenDs  zLiteralTests.test_flattenN)rDrErFrrrrWrrrrrrrrr:r:r:r;rs    rXKXVc@s@eZdZeedddZeedddZd eeedd d ZdS) SimpleMapping)keyrcCsdSr>r:r6rr:r:r; __getitem__SszSimpleMapping.__getitem__)rvaluecCsdSr>r:r6rrr:r:r; __setitem__VszSimpleMapping.__setitem__N)rdefaultrcCsdSr>r:r6rr r:r:r;getYszSimpleMapping.get)N)rDrErFrrrr r r:r:r:r;rQsrc@s@eZdZddZedddZedddZd edd d ZdS) MySimpleMappingcCs i|_dSr>storerRr:r:r;__init___szMySimpleMapping.__init__)rcCs |j|Sr>rrr:r:r;rbszMySimpleMapping.__getitem__cCs||j|<dSr>rrr:r:r;r eszMySimpleMapping.__setitem__NcCs(z |j|WSty"|YS0dSr>)rKeyErrorr r:r:r;r hs  zMySimpleMapping.get)N)rDrErFrrzrr r r:r:r:r;r ]sr c@seZdZUeed<eed<dS) CoordinaterrNrDrErFrX__annotations__r:r:r:r;ros rc@seZdZUeed<dS)PointlabelNrDrErFrzrr:r:r:r;rss rc@s&eZdZUeed<eed<eed<dS)MyPointrrrNrDrErFrXrrzr:r:r:r;rws rc@seZdZUeed<dS)XAxisrNrr:r:r:r;r|s rc@seZdZUeed<dS)YAxisrNrr:r:r:r;rs rc@s eZdZdS)PositionNrHr:r:r:r;rsrc@s&eZdZUeed<eedddZdS)ProtoattrargrcCsdSr>r:r6r r:r:r;methsz Proto.methN)rDrErFrXrrzr"r:r:r:r;rs rc@s eZdZdS)ConcreteNrHr:r:r:r;r#sr#c@s*eZdZUdZeed<eedddZdS)OtherrrrcCs|dkr dSdS)Nthisrrr:r!r:r:r;r"sz Other.methN)rDrErFrrXrrzr"r:r:r:r;r$s  r$c@seZdZUeed<eed<dS)NTrrNrr:r:r:r;r&s r&c@seZdZUejed<dS)HasCallProtocol__call__N)rDrErFr?rrr:r:r:r;r's r'c@sdeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPZ*dQdRZ+dSdTZ,dUdVZ-dWS)X ProtocolTestscCstGdddt}Gddd}Gddd}dd}|||||||||||||tj||||dS) Nc@seZdZddZdS)z,ProtocolTests.test_basic_protocol..PcSsdSr>r:rRr:r:r;r"sz1ProtocolTests.test_basic_protocol..P.methNrDrErFr"r:r:r:r;Psr+c@s eZdZdS)z,ProtocolTests.test_basic_protocol..CNrHr:r:r:r;rrrc@seZdZddZdS)z,ProtocolTests.test_basic_protocol..DcSsdSr>r:rRr:r:r;r"sz1ProtocolTests.test_basic_protocol..D.methNr*r:r:r:r;Dsr,cSsdSr>r:r:r:r:r;rBsz,ProtocolTests.test_basic_protocol..f)rrr<rjr=rtypes FunctionType)r6r+rr,rBr:r:r;test_basic_protocols  z!ProtocolTests.test_basic_protocolcCsrtGdddt}Gddd}dd}ttt|tjfD]}|||q:tddt|fD]}| ||q\dS) Nc@s eZdZdS)zFProtocolTests.test_everything_implements_empty_protocol..EmptyNrHr:r:r:r;Emptysr0c@s eZdZdS)zBProtocolTests.test_everything_implements_empty_protocol..CNrHr:r:r:r;rsrcSsdSr>r:r:r:r:r;rBszBProtocolTests.test_everything_implements_empty_protocol..frr:) rrrr]rr-r.r<r?rj)r6r0rrBthingr:r:r;)test_everything_implements_empty_protocolsz7ProtocolTests.test_everything_implements_empty_protocolcCsdd}||tdS)NcSsdSr>r:r:r:r:r;rBsz:ProtocolTests.test_function_implements_protocol..f)rjr'rAr:r:r;!test_function_implements_protocolsz/ProtocolTests.test_function_implements_protocolcCsGddd}Gdddt}|t"Gddd|t}Wdn1sP0Y|t"Gdddt|}Wdn1s0Y|t$Gddd||t}Wdn1s0YGd d d ||}Gd d d ||}||||||dS) Nc@s eZdZdS)z9ProtocolTests.test_no_inheritance_from_nominal..CNrHr:r:r:r;rrrc@s eZdZdS)z:ProtocolTests.test_no_inheritance_from_nominal..BPNrHr:r:r:r;BPrr4c@s eZdZdSz9ProtocolTests.test_no_inheritance_from_nominal..PNrHr:r:r:r;r+sr+c@s eZdZdSr5rHr:r:r:r;r+sc@s eZdZdSr5rHr:r:r:r;r+sc@s eZdZdS)z9ProtocolTests.test_no_inheritance_from_nominal..DNrHr:r:r:r;r,rr,c@s eZdZdS)z9ProtocolTests.test_no_inheritance_from_nominal..ENrHr:r:r:r;Err6)rrOrPr)r6rr4r+r,r6r:r:r; test_no_inheritance_from_nominals 0 0 2z.ProtocolTests.test_no_inheritance_from_nominalcCs>Gdddt}|t|Wdn1s60YGddd|}|||td}Gdddt|}|t|Wdn1s0Y|t|tWdn1s0Y|t||Wdn1s 0YGdd d ||}||t|dS) Nc@s eZdZdS)z.ProtocolTests.test_no_instantiation..PNrHr:r:r:r;r+rr+c@s eZdZdS)z.ProtocolTests.test_no_instantiation..CNrHr:r:r:r;rrrr c@s eZdZdS)z/ProtocolTests.test_no_instantiation..PGNrHr:r:r:r;PGrr8c@s eZdZdS)z/ProtocolTests.test_no_instantiation..CGNrHr:r:r:r;CGrr9)rrOrPrjr rX)r6r+rr r8r9r:r:r;test_no_instantiations $ $ ( *z#ProtocolTests.test_no_instantiationcCsvtGdddt}Gddd|}Gddd|}|t|Wdn1sZ0Y|||dS)Nc@s eZdZejedddZdS)z9ProtocolTests.test_cannot_instantiate_abstract..PrcSstdSr>)NotImplementedErrorrRr:r:r;amethsz?ProtocolTests.test_cannot_instantiate_abstract..P.amethN)rDrErFabcabstractmethodrXr<r:r:r:r;r+sr+c@s eZdZdS)z9ProtocolTests.test_cannot_instantiate_abstract..BNrHr:r:r:r;Bsr?c@seZdZedddZdS)z9ProtocolTests.test_cannot_instantiate_abstract..CrcSsdS)Nr:rRr:r:r;r<sz?ProtocolTests.test_cannot_instantiate_abstract..C.amethN)rDrErFrXr<r:r:r:r;rsr)rrrOrPrj)r6r+r?rr:r:r; test_cannot_instantiate_abstracts $z.ProtocolTests.test_cannot_instantiate_abstractcCsGdddt}tGddd|t}Gddd}Gddd}Gd d d }||||||||||||||||||dS) Nc@seZdZddZdS)z5ProtocolTests.test_subprotocols_extending..P1cSsdSr>r:rRr:r:r;meth1sz;ProtocolTests.test_subprotocols_extending..P1.meth1NrDrErFrBr:r:r:r;P1 srDc@seZdZddZdS)z5ProtocolTests.test_subprotocols_extending..P2cSsdSr>r:rRr:r:r;meth2sz;ProtocolTests.test_subprotocols_extending..P2.meth2NrDrErFrEr:r:r:r;P2srGc@seZdZddZddZdS)z4ProtocolTests.test_subprotocols_extending..CcSsdSr>r:rRr:r:r;rBsz:ProtocolTests.test_subprotocols_extending..C.meth1cSsdSr>r:rRr:r:r;rEsz:ProtocolTests.test_subprotocols_extending..C.meth2NrDrErFrBrEr:r:r:r;rsrc@seZdZddZdS)z5ProtocolTests.test_subprotocols_extending..C1cSsdSr>r:rRr:r:r;rBsz;ProtocolTests.test_subprotocols_extending..C1.meth1NrCr:r:r:r;C1srIc@seZdZddZdS)z5ProtocolTests.test_subprotocols_extending..C2cSsdSr>r:rRr:r:r;rE"sz;ProtocolTests.test_subprotocols_extending..C2.meth2NrFr:r:r:r;C2!srJrrrr=rjr<)r6rDrGrrIrJr:r:r;test_subprotocols_extending s  z)ProtocolTests.test_subprotocols_extendingcCsGdddt}Gdddt}tGddd||t}Gddd}Gd d d }Gd d d }||||||||||||||||||dS) Nc@seZdZddZdS)z3ProtocolTests.test_subprotocols_merging..P1cSsdSr>r:rRr:r:r;rB.sz9ProtocolTests.test_subprotocols_merging..P1.meth1NrCr:r:r:r;rD-srDc@seZdZddZdS)z3ProtocolTests.test_subprotocols_merging..P2cSsdSr>r:rRr:r:r;rE2sz9ProtocolTests.test_subprotocols_merging..P2.meth2NrFr:r:r:r;rG1srGc@s eZdZdS)z2ProtocolTests.test_subprotocols_merging..PNrHr:r:r:r;r+5sr+c@seZdZddZddZdS)z2ProtocolTests.test_subprotocols_merging..CcSsdSr>r:rRr:r:r;rB:sz8ProtocolTests.test_subprotocols_merging..C.meth1cSsdSr>r:rRr:r:r;rE=sz8ProtocolTests.test_subprotocols_merging..C.meth2NrHr:r:r:r;r9src@seZdZddZdS)z3ProtocolTests.test_subprotocols_merging..C1cSsdSr>r:rRr:r:r;rBAsz9ProtocolTests.test_subprotocols_merging..C1.meth1NrCr:r:r:r;rI@srIc@seZdZddZdS)z3ProtocolTests.test_subprotocols_merging..C2cSsdSr>r:rRr:r:r;rEEsz9ProtocolTests.test_subprotocols_merging..C2.meth2NrFr:r:r:r;rJDsrJrK)r6rDrGr+rrIrJr:r:r;test_subprotocols_merging,s  z'ProtocolTests.test_subprotocols_mergingcCstd}tGdddt}tGdddt|}Gdddt}Gdd d t|}Gd d d }||||||||||tt|||Wdn1s0Y|tt|||Wdn1s0Y|tt||Wdn1s&0Y|tt||Wdn1s\0Y|tt|||Wdn1s0Y|tt||tWdn1s0YdS) Nr c@seZdZddZdS)z2ProtocolTests.test_protocols_issubclass..PcSsdSr>r:rRr:r:r;rTrz4ProtocolTests.test_protocols_issubclass..P.xNrDrErFrr:r:r:r;r+Rsr+c@seZdZddZdS)z3ProtocolTests.test_protocols_issubclass..PGcSsdSr>r:rRr:r:r;rXrz5ProtocolTests.test_protocols_issubclass..PG.xNrNr:r:r:r;r8Vsr8c@seZdZddZdS)z5ProtocolTests.test_protocols_issubclass..BadPcSsdSr>r:rRr:r:r;r[rz7ProtocolTests.test_protocols_issubclass..BadP.xNrNr:r:r:r;BadPZsrOc@seZdZddZdS)z6ProtocolTests.test_protocols_issubclass..BadPGcSsdSr>r:rRr:r:r;r^rz8ProtocolTests.test_protocols_issubclass..BadPG.xNrNr:r:r:r;BadPG]srPc@seZdZddZdS)z2ProtocolTests.test_protocols_issubclass..CcSsdSr>r:rRr:r:r;rarz4ProtocolTests.test_protocols_issubclass..C.xNrNr:r:r:r;r`sr)r rrr<rOrPr4rXr6r r+r8rOrPrr:r:r;test_protocols_issubclassOs.    , , * * . z'ProtocolTests.test_protocols_issubclasscCs8Gddd}tGdddt}|tt||Wdn1sL0Y||||||tt||Wdn1s0Y|||Gddd|}||||||||| ||||||tt||Wdn1s*0YdS)Nc@seZdZdZdS)z?ProtocolTests.test_protocols_issubclass_non_callable..CrNrNr:r:r:r;rusrc@seZdZdZdS)zFProtocolTests.test_protocols_issubclass_non_callable..PNonCallrNrNr:r:r:r;PNonCallxsrSc@s eZdZdS)z?ProtocolTests.test_protocols_issubclass_non_callable..DNrHr:r:r:r;r,rr,) rrrOrPr4rjregisterr=rr<)r6rrSr,r:r:r;&test_protocols_issubclass_non_callablets$ (  (    z4ProtocolTests.test_protocols_issubclass_non_callablecCsjtd}tGdddt}tGdddt|}Gdddt}Gdd d t|}Gd d d }|||||||t t|||Wdn1s0Y|t t|||Wdn1s0Y|tt||Wdn1s$0Y|tt||Wdn1s\0YdS) Nr c@seZdZddZdS)z2ProtocolTests.test_protocols_isinstance..PcSsdSr>r:rr:r:r;r"rz7ProtocolTests.test_protocols_isinstance..P.methNr*r:r:r:r;r+sr+c@seZdZddZdS)z3ProtocolTests.test_protocols_isinstance..PGcSsdSr>r:rr:r:r;r"rz8ProtocolTests.test_protocols_isinstance..PG.methNr*r:r:r:r;r8sr8c@seZdZddZdS)z5ProtocolTests.test_protocols_isinstance..BadPcSsdSr>r:rr:r:r;r"rz:ProtocolTests.test_protocols_isinstance..BadP.methNr*r:r:r:r;rOsrOc@seZdZddZdS)z6ProtocolTests.test_protocols_isinstance..BadPGcSsdSr>r:rr:r:r;r"rz;ProtocolTests.test_protocols_isinstance..BadPG.methNr*r:r:r:r;rPsrPc@seZdZddZdS)z2ProtocolTests.test_protocols_isinstance..CcSsdSr>r:rr:r:r;r"rz7ProtocolTests.test_protocols_isinstance..C.methNr*r:r:r:r;rsr)r rrrjrOrPrQrQr:r:r;test_protocols_isinstances$ . . , z'ProtocolTests.test_protocols_isinstancecCsGddd}Gddd}Gddd}Gddd}||d d d t||d d t|tt||d d t|tt|tt||d t||t||t||t||t|tt|td d tdS) Nc@seZdZddZdS)z.APointcSs||_||_||_dSr>rrr)r6rrrr:r:r;rszEProtocolTests.test_protocols_isinstance_py36..APoint.__init__NrDrErFrr:r:r:r;APointsrYc@seZdZdZddZdS)z.BPointr?cSs||_||_dSr>rr)r6rrr:r:r;rszEProtocolTests.test_protocols_isinstance_py36..BPoint.__init__N)rDrErFrrr:r:r:r;BPointsr[c@seZdZddZddZdS)z7ProtocolTests.test_protocols_isinstance_py36..CcSs ||_dSr>rr6rr:r:r;rsz@ProtocolTests.test_protocols_isinstance_py36..C.__init__cSsdSNrr:r!r:r:r;r"sz.C.methN)rDrErFrr"r:r:r:r;rsrc@s eZdZdS)z9ProtocolTests.test_protocols_isinstance_py36..BadNrHr:r:r:r;Badrr_rrr[rN) rjrrrrr$rr#r&)r6rYr[rr_r:r:r;test_protocols_isinstance_py36s"z,ProtocolTests.test_protocols_isinstance_py36cCsftd}tGdddt}tGdddt|}Gddd}||d|||d|dS) Nr c@seZdZdZdS)z7ProtocolTests.test_protocols_isinstance_init..PrNrNr:r:r:r;r+sr+c@seZdZdZdS)z8ProtocolTests.test_protocols_isinstance_init..PGrNrNr:r:r:r;r8sr8c@seZdZddZdS)z7ProtocolTests.test_protocols_isinstance_init..CcSs ||_dSr>rr6rr:r:r;rsz@ProtocolTests.test_protocols_isinstance_init..C.__init__NrXr:r:r:r;rsrr)r rrrj)r6r r+r8rr:r:r;test_protocols_isinstance_initsz,ProtocolTests.test_protocols_isinstance_initc CsGdddtt}Gddd|t}Gddd}Gddd}|t}||||||Gd d d |t}Gd d d |t}|t}||||||dS) Nc@s eZdZdS)z=ProtocolTests.test_protocol_checks_after_subscript..PNrHr:r:r:r;r+rr+c@s eZdZdS)z=ProtocolTests.test_protocol_checks_after_subscript..CNrHr:r:r:r;rrrc@s eZdZdS)zBProtocolTests.test_protocol_checks_after_subscript..Other1NrHr:r:r:r;Other1rrcc@s eZdZdS)zBProtocolTests.test_protocol_checks_after_subscript..Other2NrHr:r:r:r;Other2rrdc@s eZdZdS)z>ProtocolTests.test_protocol_checks_after_subscript..D1NrHr:r:r:r;D1rrec@s eZdZdS)z>ProtocolTests.test_protocol_checks_after_subscript..D2NrHr:r:r:r;D2rrf)rr rrr=rXrjr<) r6r+rrcrdZCArerfCIr:r:r;$test_protocol_checks_after_subscripts z2ProtocolTests.test_protocol_checks_after_subscriptcCsvtGdddt}Gdddt}Gddd|}Gddd}||||||||||dS) Nc@seZdZdZdS)z8ProtocolTests.test_protocols_support_register..PrNrNr:r:r:r;r+sr+c@seZdZddZdS)z9ProtocolTests.test_protocols_support_register..PMcSsdSr>r:rRr:r:r;r"rz>ProtocolTests.test_protocols_support_register..PM.methNr*r:r:r:r;PMsric@s eZdZdS)z8ProtocolTests.test_protocols_support_register..DNrHr:r:r:r;r,rr,c@s eZdZdS)z8ProtocolTests.test_protocols_support_register..CNrHr:r:r:r;rrr)rrrTrj)r6r+rir,rr:r:r;test_protocols_support_registers  z-ProtocolTests.test_protocols_support_registercCs`tGdddt}Gddd}Gddd|}Gddd}||||||dS) Nc@seZdZdZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation..PrNrNr:r:r:r;r+sr+c@seZdZdZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation..ArNrNr:r:r:r;r[ sr[c@seZdZdZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation..BNrNr:r:r:r;r?sr?c@seZdZddZdS)zNProtocolTests.test_none_on_non_callable_doesnt_block_implementation..CcSs d|_dSr>rrRr:r:r;rszWProtocolTests.test_none_on_non_callable_doesnt_block_implementation..C.__init__NrXr:r:r:r;rsr)rrrjr6r+r[r?rr:r:r;5test_none_on_non_callable_doesnt_block_implementationszCProtocolTests.test_none_on_non_callable_doesnt_block_implementationcCs`tGdddt}Gddd}Gddd|}Gddd}||||||dS) Nc@seZdZddZdS)zDProtocolTests.test_none_on_callable_blocks_implementation..PcSsdSr>r:rRr:r:r;rrzFProtocolTests.test_none_on_callable_blocks_implementation..P.xNrNr:r:r:r;r+sr+c@seZdZddZdS)zDProtocolTests.test_none_on_callable_blocks_implementation..AcSsdSr>r:rRr:r:r;rrzFProtocolTests.test_none_on_callable_blocks_implementation..A.xNrNr:r:r:r;r[sr[c@seZdZdZdS)zDProtocolTests.test_none_on_callable_blocks_implementation..BNrNr:r:r:r;r?!sr?c@seZdZddZdS)zDProtocolTests.test_none_on_callable_blocks_implementation..CcSs d|_dSr>rrRr:r:r;r%szMProtocolTests.test_none_on_callable_blocks_implementation..C.__init__NrXr:r:r:r;r$sr)rrrrkr:r:r;+test_none_on_callable_blocks_implementationsz9ProtocolTests.test_none_on_callable_blocks_implementationcCsGdddt}tGdddt}Gddd|}Gddd|}Gd d d }Gd d d }||||||||||||||||||dS) Nc@seZdZdZdS)z5ProtocolTests.test_non_protocol_subclasses..PrNrNr:r:r:r;r+,sr+c@seZdZddZdS)z6ProtocolTests.test_non_protocol_subclasses..PRcSsdSr>r:rRr:r:r;r"1rz;ProtocolTests.test_non_protocol_subclasses..PR.methNr*r:r:r:r;PR/srnc@seZdZdZdS)z8ProtocolTests.test_non_protocol_subclasses..NonPrNrNr:r:r:r;NonP3sroc@s eZdZdS)z9ProtocolTests.test_non_protocol_subclasses..NonPRNrHr:r:r:r;NonPR6rrpc@seZdZdZdS)z5ProtocolTests.test_non_protocol_subclasses..CrNrNr:r:r:r;r8src@seZdZddZdS)z5ProtocolTests.test_non_protocol_subclasses..DcSsdSr>r:rRr:r:r;r"<rz:ProtocolTests.test_non_protocol_subclasses..D.methNr*r:r:r:r;r,;sr,rK)r6r+rnrorprr,r:r:r;test_non_protocol_subclasses+s  z*ProtocolTests.test_non_protocol_subclassescCstGdddt}Gddd}Gddd}Gddd|}||||||||||||dS) Nc@seZdZdZdS)z1ProtocolTests.test_custom_subclasshook..PrNrNr:r:r:r;r+Fsr+c@s eZdZdS)z7ProtocolTests.test_custom_subclasshook..OKClassNrHr:r:r:r;OKClassIrrrc@seZdZdZdS)z8ProtocolTests.test_custom_subclasshook..BadClassrNrNr:r:r:r;BadClassKsrsc@seZdZeddZdS)z1ProtocolTests.test_custom_subclasshook..CcSs |jdSNOK)rD startswithr7otherr:r:r;__subclasshook__OszBProtocolTests.test_custom_subclasshook..C.__subclasshook__NrDrErF classmethodryr:r:r:r;rNsr)rrjrr<r=)r6r+rrrsrr:r:r;test_custom_subclasshookEs z&ProtocolTests.test_custom_subclasshookcCs\tGdddt}Gddd}|tt||Wdn1sN0YdS)Nc@seZdZdZdS)z8ProtocolTests.test_issubclass_fails_correctly..PrNrNr:r:r:r;r+Ysr+c@s eZdZdS)z8ProtocolTests.test_issubclass_fails_correctly..CNrHr:r:r:r;r]rr)rrrOrPr4)r6r+rr:r:r;test_issubclass_fails_correctlyXs  z-ProtocolTests.test_issubclass_fails_correctlycCsNtd}td}tGdddt||f}Gddd|t|ft|}|t|tWdn1sr0Y|t|ttfWdn1s0Y|t|tdfWdn1s0Y|t|ttfWdn1s0YGdd d |t|f}||t|dS) Nr Sc@seZdZddZdS)z9ProtocolTests.test_defining_generic_protocols..PRcSsdSr>r:rRr:r:r;r"hrz>ProtocolTests.test_defining_generic_protocols..PR.methNr*r:r:r:r;rnfsrnc@seZdZdZdS)z8ProtocolTests.test_defining_generic_protocols..PrNrDrErFrr:r:r:r;r+jsr+rc@s eZdZdS)z8ProtocolTests.test_defining_generic_protocols..CNrHr:r:r:r;rvrr) r rrrXrOrPrzrrj)r6r r~rnr+rr:r:r;test_defining_generic_protocolsbs & * * ,z-ProtocolTests.test_defining_generic_protocolscstdtd}tGdddtt|f}Gddd|ttft}|t"t|ttf|Wdn1sz0Y| |||t|tWdn1s0Y|t|tdfWdn1s0YGfdd d tt}Gfd d d tt}tGd d d |tt}Gddd}| |||t|tt fWdn1s0YdS)Nr r~c@seZdZddZdS)zCProtocolTests.test_defining_generic_protocols_old_style..PRcSsdSr>r:rRr:r:r;r"rzHProtocolTests.test_defining_generic_protocols_old_style..PR.methNr*r:r:r:r;rn~srnc@seZdZdZdS)zBProtocolTests.test_defining_generic_protocols_old_style..PrNrr:r:r:r;r+sr+rcseZdZedddZdS)zCProtocolTests.test_defining_generic_protocols_old_style..P1rrcSsdSr>r:rar:r:r;rrzGProtocolTests.test_defining_generic_protocols_old_style..P1.barNrDrErFrzrr:r r:r;rDsrDcseZdZedddZdS)zCProtocolTests.test_defining_generic_protocols_old_style..P2rcSsdSr>r:rar:r:r;rrzGProtocolTests.test_defining_generic_protocols_old_style..P2.barNrr:rr:r;rGsrGc@seZdZdZdS)zEProtocolTests.test_defining_generic_protocols_old_style..PSubrNrNr:r:r:r;PSubsrc@s eZdZdZeedddZdS)zEProtocolTests.test_defining_generic_protocols_old_style..TestrrcSs|Sr>r:rar:r:r;rszIProtocolTests.test_defining_generic_protocols_old_style..Test.barN)rDrErFrrzrr:r:r:r;Testsr) r rrrrXrzrOrPr4r<rjr)r6r~rnr+rDrGrrr:rr;)test_defining_generic_protocols_old_stylezs( 0  & * z7ProtocolTests.test_defining_generic_protocols_old_stylecCsHtd}Gdddt|}Gddd||}||tjddS)Nr c@s eZdZdS)z)ProtocolTests.test_init_called..PNrHr:r:r:r;r+rr+c@seZdZddZdS)z)ProtocolTests.test_init_called..CcSs d|_dSrt)testrRr:r:r;rsz2ProtocolTests.test_init_called..C.__init__NrXr:r:r:r;rsrru)r rrUrXr)r6r r+rr:r:r;test_init_calledszProtocolTests.test_init_calledcCs$td}td}|t(Gdddt||f}Wdn1sH0Y|t$Gdddtt}Wdn1s0Y|t*Gdddt|t|}Wdn1s0Y|t0Gdddtj||ft|}Wdn1s0YdS)Nr r~c@s eZdZdSz6ProtocolTests.test_protocols_bad_subscripts..PNrHr:r:r:r;r+rr+c@s eZdZdSrrHr:r:r:r;r+rc@s eZdZdSrrHr:r:r:r;r+rc@s eZdZdSrrHr:r:r:r;r+r)r rOrPrrXr?rr6r r~r+r:r:r;test_protocols_bad_subscriptss 6 2 8 z+ProtocolTests.test_protocols_bad_subscriptscCsdtd}td}Gdddt||f}|t|||fd|t|ttfddS)Nr r~c@s eZdZdS)z4ProtocolTests.test_generic_protocols_repr..PNrHr:r:r:r;r+rr+z P[~T, ~S]z P[int, str])r rrrVendswithrXrzrr:r:r;test_generic_protocols_reprs z)ProtocolTests.test_generic_protocols_reprcCstd}td}Gdddt||f}|||||t|f|t|f||||ft||fttf|tttftttffdS)Nr r~c@s eZdZdS)z2ProtocolTests.test_generic_protocols_eq..PNrHr:r:r:r;r+rr+)r rrUrXrrzrr:r:r;test_generic_protocols_eqs "z'ProtocolTests.test_generic_protocols_eqcCshtd}Gdddt|}||j|f||tjd||tjtf||tj|dS)Nr c@s eZdZdS)zDProtocolTests.test_generic_protocols_special_from_generic..PNrHr:r:r:r;r+rr+r:)r rrUrurXrtrvrw)r6r r+r:r:r;+test_generic_protocols_special_from_generics z9ProtocolTests.test_generic_protocols_special_from_genericcCstGdddt}Gdddt}td}Gdddt|}||j||j||j||j||j||tj|t |dh|t |d h|t t |t d dhdS) Nc@seZdZdZdS)zFProtocolTests.test_generic_protocols_special_from_protocol..PRrNrNr:r:r:r;rnsrnc@seZdZddZdS)zEProtocolTests.test_generic_protocols_special_from_protocol..PcSsdSr>r:rRr:r:r;r"szJProtocolTests.test_generic_protocols_special_from_protocol..P.methNr*r:r:r:r;r+sr+r c@seZdZdZddZdS)zFProtocolTests.test_generic_protocols_special_from_protocol..PGrcSsdSr>r:rRr:r:r;r"szKProtocolTests.test_generic_protocols_special_from_protocol..PG.methN)rDrErFrr"r:r:r:r;r8sr8r"r) rrr r _is_protocolr_is_runtime_protocolrXrUr?_get_protocol_attrs frozenset)r6rnr+r r8r:r:r;,test_generic_protocols_special_from_protocols       z:ProtocolTests.test_generic_protocols_special_from_protocolcCs|t"tGddd}Wdn1s20YGdddt}|t$tGddd|}Wdn1s0YdS)Nc@s eZdZdS)z8ProtocolTests.test_no_runtime_deco_on_nominal..CNrHr:r:r:r;rsrc@seZdZdZdS)z.ProtorNrNr:r:r:r;rsrc@s eZdZdS)z?ProtocolTests.test_no_runtime_deco_on_nominal..ConcreteNrHr:r:r:r;r#sr#)rOrPrr)r6rrr#r:r:r;test_no_runtime_deco_on_nominals . z-ProtocolTests.test_no_runtime_deco_on_nominalcCstGdddt}Gdddt}|||Gddd}Gddd}||||||Gd d d }Gd d d }||||||dS) Nc@seZdZdZdS)z4ProtocolTests.test_none_treated_correctly..PNrNr:r:r:r;r+sr+c@s eZdZdS)z4ProtocolTests.test_none_treated_correctly..BNrHr:r:r:r;r?rr?c@seZdZdZdS)z4ProtocolTests.test_none_treated_correctly..CrNrNr:r:r:r;rsrc@seZdZdZdS)z4ProtocolTests.test_none_treated_correctly..DNrNr:r:r:r;r, sr,c@seZdZddZdS)z5ProtocolTests.test_none_treated_correctly..CIcSs d|_dSrrrRr:r:r;rsz>ProtocolTests.test_none_treated_correctly..CI.__init__NrXr:r:r:r;rgsrgc@seZdZddZdS)z5ProtocolTests.test_none_treated_correctly..DIcSs d|_dSr>rrRr:r:r;rsz>ProtocolTests.test_none_treated_correctly..DI.__init__NrXr:r:r:r;DIsr)rrrrrj)r6r+r?rr,rgrr:r:r;test_none_treated_correctlysz)ProtocolTests.test_none_treated_correctlycCs@Gdddt}tjtj|f}tj|tjf}|||dS)Nc@seZdZdZdS)z1ProtocolTests.test_protocols_in_unions..PNrNr:r:r:r;r+sr+)rr?rrrU)r6r+ZAliasZAlias2r:r:r;test_protocols_in_unionssz&ProtocolTests.test_protocols_in_unionsc Cstd}tGdddt|aGdddttat}d|_d|_tt j dD]}t ||}t |}| |jd| |jd| |jd| |jddd t t}t |}Gd d d }|||qTdS) Nr c@seZdZdZdS)r+rNrNr:r:r:r;r+(sr+c@s eZdZdS)CPNrHr:r:r:r;r,srrNr=rrc@seZdZdZdS)z2ProtocolTests.test_protocols_pickleable..ErNrNr:r:r:r;r6<sr6)r rrr+rXrrrrangepickleHIGHEST_PROTOCOLdumpsloadsrUr__dict__rj) r6r rprotorrsr,r6r:r:r;test_protocols_pickleable$s$    z'ProtocolTests.test_protocols_pickleablecCs |ttj|ttjdSr>)r<rXr? SupportsIntr=rzrRr:r:r;test_supports_intAszProtocolTests.test_supports_intcCs |ttj|ttjdSr>)r<rr? SupportsFloatr=rzrRr:r:r;test_supports_floatEsz!ProtocolTests.test_supports_floatcCs.Gddd}||tj|ttjdS)Nc@seZdZddZdS)z.ProtocolTests.test_supports_complex..CcSsdS)Nyr:rRr:r:r; __complex__Msz:ProtocolTests.test_supports_complex..C.__complex__N)rDrErFrr:r:r:r;rLsr)r<r?SupportsComplexr=rzrr:r:r;test_supports_complexIsz#ProtocolTests.test_supports_complexcCs.Gddd}||tj|ttjdS)Nc@seZdZddZdS)z,ProtocolTests.test_supports_bytes..BcSsdSNrr:rRr:r:r; __bytes__Wsz6ProtocolTests.test_supports_bytes..B.__bytes__N)rDrErFrr:r:r:r;r?Vsr?)r<r? SupportsBytesr=rz)r6r?r:r:r;test_supports_bytesSsz!ProtocolTests.test_supports_bytescCs.|ttj|ttj|ttjdSr>)r<rr? SupportsAbsrXr=rzrRr:r:r;test_supports_abs]szProtocolTests.test_supports_abscCs:tttj|ttj|ttj|ttjdSr>)r4rr? SupportsRoundr<rXr=rzrRr:r:r;test_supports_roundbs z!ProtocolTests.test_supports_roundcCs |ttj|ttjdSr>)r<rr? Reversibler=rXrRr:r:r;test_reversiblehszProtocolTests.test_reversiblecCs |ttj|ttjdSr>)r<rXr? SupportsIndexr=rzrRr:r:r;test_supports_indexlsz!ProtocolTests.test_supports_indexcCsF|dtjGdddtj}Gddd|}|}|||dS)Nrc@seZdZedddZdS)z>ProtocolTests.test_bundled_protocol_instance_works..C1rcSsdSrMr:rRr:r:r;__int__sszFProtocolTests.test_bundled_protocol_instance_works..C1.__int__N)rDrErFrXrr:r:r:r;rIrsrIc@s eZdZdS)z>ProtocolTests.test_bundled_protocol_instance_works..C2NrHr:r:r:r;rJusrJ)rjr?rr)r6rIrJrr:r:r;$test_bundled_protocol_instance_worksps z2ProtocolTests.test_bundled_protocol_instance_workscCsRtGdddtjjt}Gddd}Gddd}||||||dS)Nc@seZdZddZdS)z@ProtocolTests.test_collections_protocols_allowed..CustomcSsdSr>r:rRr:r:r;close}rzFProtocolTests.test_collections_protocols_allowed..Custom.closeN)rDrErFrr:r:r:r;Custom{src@s eZdZdS)z;ProtocolTests.test_collections_protocols_allowed..ANrHr:r:r:r;r[rr[c@seZdZddZddZdS)z;ProtocolTests.test_collections_protocols_allowed..BcSsgSr>r:rRr:r:r;__iter__szDProtocolTests.test_collections_protocols_allowed..B.__iter__cSsdSr^r:rRr:r:r;rszAProtocolTests.test_collections_protocols_allowed..B.closeN)rDrErFrrr:r:r:r;r?sr?)r collectionsr=rrr<r=)r6rr[r?r:r:r;"test_collections_protocols_allowedzs  z0ProtocolTests.test_collections_protocols_allowedcCsT|t"Gdddtt}Wdn1s20YGdddtjt}dS)Nc@s eZdZdS)zEProtocolTests.test_builtin_protocol_whitelist..CustomProtocolNrHr:r:r:r;CustomProtocolsrc@s eZdZdS)zKProtocolTests.test_builtin_protocol_whitelist..CustomContextManagerNrHr:r:r:r;CustomContextManagersr)rOrPrrr?ContextManager)r6rrr:r:r;test_builtin_protocol_whitelists 0z-ProtocolTests.test_builtin_protocol_whitelistN).rDrErFr/r2r3r7r:rArLrMrRrUrVr`rbrhrjrlrmrqr|r}rrrrrrrrrrrrrrrrrrrrrrrr:r:r:r;r)sV #%% '         r)c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPZ*dQdRZ+dSdTZ,dUdVZ-dWdXZ.dYdZZ/d[d\Z0d]d^Z1d_d`Z2daS)b GenericTestscCs0tttf}||jd|t|tWdn1sB0Y|t|ttfWdn1sx0Ytttf}||jtf|t|t|ttfWdn1s0Ytttf}|tt |tWdn1s0Y| |tdSr) rrzrrUrurOrPrrXr4rj)r6rorrZSM1r:r:r;rs  & *  *  *zGenericTests.test_basicscCstd}td}|tt||Wdn1s<0Y|tt||Wdn1sr0Y|t*Gdddt|t|}Wdn1s0Y|ttgttWdn1s0Y|tttttWdn1s(0Y|t Gdddt}Wdn1sd0Y|t*Gdddt|t|}Wdn1s0Y|t*Gd ddt|t|}Wdn1s0YdS) Nr r~c@s eZdZdS)z+GenericTests.test_generic_errors..CNrHr:r:r:r;rrrc@s eZdZdS)z4GenericTests.test_generic_errors..NewGenericNrHr:r:r:r; NewGenericrrc@s eZdZdSz3GenericTests.test_generic_errors..MyGenericNrHr:r:r:r; MyGenericrrc@s eZdZdSrrHr:r:r:r;rr) r rOrPrrQrrXr4r)r6r r~rrrr:r:r;test_generic_errorss$ * * 8 , . 0 : z GenericTests.test_generic_errorscCstd}td}|tt||fWdn1s<0Y|tt|||fWdn1st0YdS)Nr r~)r rOrPr)r6r r~r:r:r; test_inits  * zGenericTests.test_initcCsGdddtjt}Gddd|}||jd|t|jWdn1sZ0Yd|_d|_Gdd d |}Gd d d |t}||jd||jd||jddS) NcseZdZfddZZS)z*GenericTests.test_init_subclass..Xcstjfi|d|_dSrM)super__init_subclass__r)r7kwargs __class__r:r;rsz.X.__init_subclass__rDrErFr __classcell__r:r:rr;rosroc@s eZdZdS)z*GenericTests.test_init_subclass..YNrHr:r:r:r;rrsrrrNrrc@s eZdZdS)z*GenericTests.test_init_subclass..ZNrHr:r:r:r;Zsrc@s eZdZdS)z*GenericTests.test_init_subclass..WNrHr:r:r:r;Wsr)r?rr rUrrOAttributeErrorrX)r6rorrrrr:r:r;test_init_subclasss $zGenericTests.test_init_subclasscCs4|ttdtd|ttdtddS)Nzz.MySimpleMapping'>)rUrVrrDr rRr:r:r;rWs     zGenericTests.test_reprcCstd}td}Gdddt|}|t||f}|||t||f|||t||f||tf}||||tf||||tf||||tf|t}|||t|||t|||||t|ddS)Nr r~c@s eZdZdS)z'GenericTests.test_chain_repr..CNrHr:r:r:r;rsrz.C[typing.Tuple[str, int]]) r rrrUrsrXrzrr)r6r r~rrorrrr:r:r;test_chain_reprs"  zGenericTests.test_chain_reprcCstd}tddd}td}|ttd|tt|d|tt|d|tt||td |tttd dS) Nr UTr~r~z typing.Listztyping.List[~T]ztyping.List[+U]ztyping.List[int])r rUrVrrX)r6r rr~r:r:r; test_new_reprs zGenericTests.test_new_reprcCs~td}td}|ttj||f||fd|ttt||ft|fd|ttt||fttddS)Nr TSztyping.Mapping[~TS, ~T]z"typing.List[typing.Tuple[int, ~T]]z=typing.List[typing.Tuple[typing.List[int], typing.List[int]]])r rUrVr?rrrrX)r6r rr:r:r;test_new_repr_complexs"z"GenericTests.test_new_repr_complexcCsZtd}|tt|d|ttj|dGdddtjttf}t|jdS)Nr ztyping.Generic[~T]ztyping.Protocol[~T]c@s eZdZdS)z*GenericTests.test_new_repr_bare..CNrHr:r:r:r;r rr) r rUrVrr?rrr__mro__r6r rr:r:r;test_new_repr_bare s zGenericTests.test_new_repr_barecCsptd}Gdddt|}|}d|_||jddiGddd|t}|}d|_||jd didS) Nr c@s eZdZdS)z!GenericTests.test_dict..BNrHr:r:r:r;r?sr?rNrc@s eZdZdS)z!GenericTests.test_dict..CNrHr:r:r:r;rsrr=r)r rrrUrrXr)r6r r?brrr:r:r; test_dictszGenericTests.test_dictcCsTtd}Gdddt|}||tjd|||tjdd||t_||jd||tjdd|tt_||jd||ttjd||jd||ttjdGddd||}||tjd||jdd |_d |t_||jd||tjd||jd ||tjd dS) Nr c@seZdZdZdS)z.CdefNrNr:r:r:r;r$srrchangednewc@s eZdZdS)z.DNrHr:r:r:r;r,2sr,zfrom derived zzfrom derived x) r rrUrXrrzrrrr6r rr,r:r:r;$test_subscripted_generics_as_proxies"s* z1GenericTests.test_subscripted_generics_as_proxiescCs`td}Gdddtjjt|}|t|d||t|d||| dS)Nr c@s eZdZdS)z.GenericTests.test_abc_registry_kept..CNrHr:r:r:r;r?rrr) r rr=rrrTrXrj_abc_registry_clear_abc_caches_clearrr:r:r;test_abc_registry_kept=s   z#GenericTests.test_abc_registry_keptcCs4Gdddtttf}|i||t|dS)Nc@s eZdZdS)z5GenericTests.test_false_subclasses..MyMappingNrHr:r:r:r; MyMappingHrr)rrzrr=r)r6rr:r:r;test_false_subclassesGs z"GenericTests.test_false_subclassescCs`Gdddtttf}|||tjj||t||t|i|dS)Nc@s4eZdZddZddZddZddZd d Zd S) z'GenericTests.test_abc_bases..MMcSsdSr>r:r6kr:r:r;rNsz3GenericTests.test_abc_bases..MM.__getitem__cSsdSr>r:r6rrr:r:r;r Psz3GenericTests.test_abc_bases..MM.__setitem__cSsdSr>r:rr:r:r; __delitem__Rsz3GenericTests.test_abc_bases..MM.__delitem__cSstdSriterrRr:r:r;rTsz0GenericTests.test_abc_bases..MM.__iter__cSsdSr^r:rRr:r:r;__len__Vsz/GenericTests.test_abc_bases..MM.__len__NrDrErFrr rrrr:r:r:r;MMMs r)rrzupdaterjrr=rr)r6rr:r:r;test_abc_basesLs  zGenericTests.test_abc_basescCsVGdddtttftjj}Gdddtjjtttf}||jtjjtfdS)Nc@s eZdZdS)z-GenericTests.test_multiple_bases..MM1NrHr:r:r:r;MM1`src@s eZdZdS)z-GenericTests.test_multiple_bases..MM2NrHr:r:r:r;MM2bsr)rrzrr=rU __bases__r)r6rrr:r:r;test_multiple_bases_sz GenericTests.test_multiple_basescCs@td}Gdddtjt|f}||jtjt|ffdS)Nr c@s eZdZdS)z'GenericTests.test_orig_bases..CNrHr:r:r:r;rhrr)r r?rrzrU__orig_bases__rr:r:r;test_orig_basesfszGenericTests.test_orig_basescCsrdd}||dditjttf||dditjttf|t(|dditjttfWdn1s|0Ydd}Gdddt t}|||t|t|||t|t|||tt |t"|gd |tWdn1s 0Yd d }Gd d d t t}||gd |||ddg|dS)NcsBt|jdkrt|jr>|j\tfdd|DSdS)Nrc3s&|]\}}t|ot|VqdSr>)rQ.0rrr rr:r; rszSGenericTests.test_naive_runtime_checks..naive_dict_check..)rrur;rtallitemsobjtpr:rr;naive_dict_checkls z@GenericTests.test_naive_runtime_checks..naive_dict_checkrrcSst|dst|j|kS)N__orig_class__)hasattrr;rrr:r:r;naive_generic_check{s zCGenericTests.test_naive_runtime_checks..naive_generic_checkc@s eZdZdS)z4GenericTests.test_naive_runtime_checks..NodeNrHr:r:r:r;Noderrrcstfdd|DS)Nc3s$|]}t|jdjdVqdS)rN)rQrrt)rrrr:r;rszXGenericTests.test_naive_runtime_checks..naive_list_base_check..)rrr:rr;naive_list_base_checks zEGenericTests.test_naive_runtime_checks..naive_list_base_checkc@s eZdZdS)z1GenericTests.test_naive_runtime_checks..CNrHr:r:r:r;rrrrr) rr?rrzrXrrOr;r rr)r6rrrrrr:r:r;test_naive_runtime_checksks   6 2z&GenericTests.test_naive_runtime_checkscCs"td}td}td}Gdddt|||}Gddd|t|||}||j|f||j|f||tjd||tjd||tjtf||tjtf||jttf||j|ttf||j t|||f||j |t|||fdS) Nr rrc@s eZdZdS)z.GenericTests.test_multi_subscr_base..CNrHr:r:r:r;rrrc@s eZdZdS)z.GenericTests.test_multi_subscr_base..DNrHr:r:r:r;r,rr,r:) r rrUrurXrtrrrr)r6r rrrr,r:r:r;test_multi_subscr_basesz#GenericTests.test_multi_subscr_basecCsjtd}Gdddt}|t|t||t|tf|t|tf|td|fjt|fdS)Nr c@s eZdZdS)z.GenericTests.test_subscript_meta..MetaNrHr:r:r:r;Metarr .) r r]rUr$rrXrrtEllipsis)r6r r r:r:r;test_subscript_metas  z GenericTests.test_subscript_metacCsGdddtt}Gdddtt}||||tjttjt||j|j|tjj|jttjj|jt|||j||tj||tjj||jtj||jtjj||t|jt||tt |jtt ||ttjt||ttjjt||jt tjt ||jtt tjjtt |t |tt |jt|t |tt t |jtt |t t|tft ttjtf|t |t|tft |ttjtf|t j|tt jtjjttjdddkr|tt |td|tt |jtd|tt tjtd |tt tjjtd dS) Nc@s eZdZdS)z+GenericTests.test_generic_hashes..ANrHr:r:r:r;r[sr[c@s eZdZGdddeeZdS)z+GenericTests.test_generic_hashes..Bc@s eZdZdS)z-GenericTests.test_generic_hashes..B.ANrHr:r:r:r;r[sr[N)rDrErFrr r[r:r:r:r;r?sr?r)rrz.A[str]]z.B.A[str]]zmod_generics_cache.A[str]]zmod_generics_cache.B.A[str]])rr rUr0r[rzr?rsrrrXrrr? FrozenSetsys version_inforrVrr6r[r?r:r:r;test_generic_hashessJ "&&z GenericTests.test_generic_hashescCsntd}td}|t||fttttf|tjt||f|tjt||f|t t|tfdWdn1s0Y|t$t||f|dfWdn1s0Y|t|tftt|t||ftttt ffttt fGddd}Gddd|}|t||ft||ft||f|t t|tfd Wdn1s0Y|t |g|ft t t gt f|t dt |ftt dt tf|t&t |g|fdtfWdn1s0Y|t&t |g|fgtfWdn1s`0YdS) Nr rr:.c@s eZdZdS)z9GenericTests.test_extended_generic_rules_eq..BaseNrHr:r:r:r;Baserrc@s eZdZdS)z.DerivedNrHr:r:r:r;Derivedrrr) r rUrrXr?rrOrPrrzrr r)r6r rrrr:r:r;test_extended_generic_rules_eqs* , . 2,( 0$( 6 z+GenericTests.test_extended_generic_rules_eqcCstd}|ttttfddd|tttttfddd|ttdt|ftddd|ttgt |ftddddS) Nr ztyping.zUnion[Tuple, Callable]zUnion[Tuple, Tuple[int]].zCallable[..., Optional[int]]zCallable[[], List[int]]) r rUrVrrrreplacerXrrrkr:r:r; test_extended_generic_rules_reprs""z-GenericTests.test_extended_generic_rules_reprc Csttdddd}tttdddd}Gddd}|t|ttdtt|i|t|ttdtt|itd }t|d f}|dd d }| t|ttd|t d t|f}|dd d}| t|ttd|dS)NCCrcSsdSr>r:rr:r:r;foobarrz5GenericTests.test_generic_forward_ref..foobarcSsdSr>r:rr:r:r;foobar2rz6GenericTests.test_generic_forward_ref..foobar2c@s eZdZdS)z1GenericTests.test_generic_forward_ref..CCNrHr:r:r:r;rrrr .cSsdSr>r:rr:r:r;barfoorz5GenericTests.test_generic_forward_ref..barfoocSsdSr>r:rr:r:r;barfoo2rz6GenericTests.test_generic_forward_ref..barfoo2) rrr/rUrrrr rrvr) r6rrrr ATrZCTrr:r:r;test_generic_forward_refs$ z%GenericTests.test_generic_forward_refcCsGdddtttf}Gdddttdf}Gdddttgtf}Gdd d tdtf}||jttf||ttfjttf||ttfj |||jtf|t |t d d d ||jd | |t jj||t jj||t jj| |t||t|t$tttdftjWdn1sb0Y|t$tttdftjWdn1s0YdS)Nc@s eZdZdS)z@GenericTests.test_extended_generic_rules_subclassing..T1NrHr:r:r:r;T1 rrc@s eZdZdS)z@GenericTests.test_extended_generic_rules_subclassing..T2NrHr:r:r:r;T2 rr.c@s eZdZdS)z@GenericTests.test_extended_generic_rules_subclassing..C1NrHr:r:r:r;rIrrIc@seZdZddZdS)z@GenericTests.test_extended_generic_rules_subclassing..C2cSsdSr>r:rRr:r:r;r(szIGenericTests.test_extended_generic_rules_subclassing..C2.__call__NrDrErFr(r:r:r:r;rJsrJ.zC1[int]r:)rr r rrXrUrurzrtrwrVsplitrjrr=r<rrOrPr4r?Sequencer)r6rrrIrJr:r:r;'test_extended_generic_rules_subclassing s&  4 z4GenericTests.test_extended_generic_rules_subclassingcCs|tttWdn1s(0Y|tttWdn1sZ0Y|tttWdn1s0Y|ttttWdn1s0YdSr>)rOrPrrrrrrXrRr:r:r;test_fail_with_bare_union*s & & & z&GenericTests.test_fail_with_bare_unioncCstd}|tttWdn1s00Y|ttt|Wdn1sf0Y|tttjWdn1s0YdSri)r rOrPrrrr?rrkr:r:r;test_fail_with_bare_generic4s & * z(GenericTests.test_fail_with_bare_genericcCsztd}|Gdddt||f}||tj|||tj|tGdddtd|f}|||j||||j||Gdddt j ||f}||tj|||tj|tGd d d t j t |f}||tj|||tj|tt jd krvGd d d t jt |f}||tj|||tj|tdS)Nr c@s eZdZdS)z5GenericTests.test_type_erasure_special..MyTupNrHr:r:r:r;MyTupArr(c@seZdZddZdS)z6GenericTests.test_type_erasure_special..MyCallcSsdSr>r:rRr:r:r;r(Erz?GenericTests.test_type_erasure_special..MyCall.__call__Nr r:r:r:r;MyCallDsr).c@s eZdZdS)z6GenericTests.test_type_erasure_special..MyDictNrHr:r:r:r;MyDictHrr*c@s eZdZdS)z5GenericTests.test_type_erasure_special..MyDefNrHr:r:r:r;MyDefKrr+rrc@s eZdZdS)z7GenericTests.test_type_erasure_special..MyChainNrHr:r:r:r;MyChainPrr-)r rCrrvrXrrUrrr?r DefaultDictrzr rChainMap)r6r r(r)r*r+r-r:r:r;test_type_erasure_special=s$ z&GenericTests.test_type_erasure_specialcCsddtjD}|D]}|t|d|||t|ddrbt|jdkrb||tj tft |t r|j D] }|t|d|||qrqdS)Ncss|]}tt|VqdSr>)getattrr?)relr:r:r;rUrz4GenericTests.test_all_repr_eq_any..rrur) r?__all__rsrVrUr1rrurrtrQr]r)r6Zobjsrbaser:r:r;test_all_repr_eq_anyTs   z!GenericTests.test_all_repr_eq_anyc Cstd}Gdddt|}Gddd|tat}d|_d|_ttjdD]J}t ||}t |}| |jd| |jd| |j ddd qPt tttttttfttttd fttgtftjtjtg }|D]:}ttjdD]&}t ||}t |}| ||qqttjtjtttjtjtjtttfg} | D]>}ttjdD](}t ||}t |}| ||q`qNdS) Nr c@s eZdZdS)z#GenericTests.test_pickle..BNrHr:r:r:r;r?dsr?c@s eZdZdS)rNrHr:r:r:r;rgsrrNr=rr.)r rrXrrrrrrrrrUrrrrrrrzrr{r?r.r rr$r AbstractSet) r6r r?rrrrsamplesrZ more_samplesr:r:r; test_pickle`s:   &     zGenericTests.test_picklecCstd}Gdddt|}t|tft|tftd|fttgtftttf|||t|ttj|tjttjttj tt ftj |tft tt t |tdtdtft dtj dtfg}|tgD]$}||t|||t|qdS)Nr c@s eZdZdS)z1GenericTests.test_copy_and_deepcopy..NodeNrHr:r:r:r;rrr.)r r )r rrrXrrrr?rrrzrrrrUrr)r6r rthingsrr:r:r;test_copy_and_deepcopys*$"z#GenericTests.test_copy_and_deepcopyc Cstdatdtdatdttatttttj t tj t t ttf D]<}|t|||t|||tt||q>td}tdtd}tdtt}|||fD]$}|t|||t||qdS)NrTPBrTPVTLTLBTLV)r rrXr;r{rzr<rr?rrrrrrrrvrrrrr)r6ror=r>r?r:r:r;$test_immutability_by_copy_and_pickles    z1GenericTests.test_immutability_by_copy_and_picklecs&tdGfdddt}|d}|t|jd|t|jd|t|||t||d|_|t|jd|t|jd|td}|t|jd|t|jd|t|||t||d|_|t|jd|t|jd||j|tdS)Nr cseZdZddddZdS)z3GenericTests.test_copy_generic_instances..CN)rrcSs ||_dSr>r\r]r:r:r;rsz.C.__init__rXr:rr:r;rsrrNr) r rrUrrr assertIsNotrXr)r6rrZcir:rr;test_copy_generic_instancess& z(GenericTests.test_copy_generic_instancesc Csvtd}tt|tftd|ftttfttttj tt ftj j t tjdg}|D]}|t||qXdS)Nr .whatever)r rrrXrrrrr?rrzrer-r{rrUweakrefref)r6r r9rr:r:r;test_weakref_alls zGenericTests.test_weakref_allcCstd}Gdddt|}|}|t}d|_d|_|td|_Wdn1s^0Y|td|_Wdn1s0Y|dddd}|t|t t d|||t |tt |tdS) Nr c@seZdZdZdS)z0GenericTests.test_parameterized_slots..C)potatoNrDrErF __slots__r:r:r:r;rsrrrcSsdSr>r:rr:r:r;rrz2GenericTests.test_parameterized_slots..foor) r rrXrHrOrZtomatorUrrrrr)r6r rrZc_intrr:r:r;test_parameterized_slotss  $ $ z%GenericTests.test_parameterized_slotscCstd}Gdddt|}|}|t}d|_d|_|td|_Wdn1s^0Y|td|_Wdn1s0YdS)Nr c@seZdZddiZdS)z5GenericTests.test_parameterized_slots_dict..DbananarNNrIr:r:r:r;r,sr,Zyesno)r rrXrLrOrr)r6r r,dZd_intr:r:r;test_parameterized_slots_dicts  $ z*GenericTests.test_parameterized_slots_dictcCsN|t0tttf}Gdddt|}Wdn1s@0YdS)Nc@s eZdZdS)z#GenericTests.test_errors..CNrHr:r:r:r;rsr)rOrPrrrr)r6r?rr:r:r;rYs  zGenericTests.test_errorscCsGdddtt}||jt||jd|t}||jt|t|dddGddd|t}||jt||jd dS) Nc@s eZdZdS)#GenericTests.test_repr_2..CNrHr:r:r:r;rsrrPr!r"zC[int]c@s eZdZdS)#GenericTests.test_repr_2..YNrHr:r:r:r;rrsrrrQ) rr rUrErDrFrXrVr#)r6rrorrr:r:r; test_repr_2szGenericTests.test_repr_2cCs8|tt|tttt|ttttdSr>)rUrr rsr rrRr:r:r; test_eq_1s zGenericTests.test_eq_1cCslGdddtt}Gdddtt}||||||||t|t||t|tdS)Nc@s eZdZdS)z!GenericTests.test_eq_2..ANrHr:r:r:r;r[sr[c@s eZdZdS)z!GenericTests.test_eq_2..BNrHr:r:r:r;r?sr?)rr rUrsrr:r:r; test_eq_2s   zGenericTests.test_eq_2cCsvGdddtttf}Gdddtttf}Gddd|ttfttttf|ttf}||jtttfdS)Nc@s eZdZdS)z1GenericTests.test_multiple_inheritance..ANrHr:r:r:r;r[sr[c@s eZdZdS)z1GenericTests.test_multiple_inheritance..BNrHr:r:r:r;r?sr?c@s eZdZdS)z1GenericTests.test_multiple_inheritance..CNrHr:r:r:r;rsr)rr rr rUru)r6r[r?rr:r:r;test_multiple_inheritances.z&GenericTests.test_multiple_inheritancecCsNtd}Gdddt|}Gdddtt|}||j|t|ttfdS)Nr~c@s eZdZdS)z9GenericTests.test_multiple_inheritance_special..BNrHr:r:r:r;r?rr?c@s eZdZdS)z9GenericTests.test_multiple_inheritance_special..CNrHr:r:r:r;r rr)r rrrXrUrrr)r6r~r?rr:r:r;!test_multiple_inheritance_specialsz.GenericTests.test_multiple_inheritance_specialcsGdddtGfdddGdddtt}| Gddd|}Wdn1sj0Y|$Gd dd|t}Wdn1s0YdS) Nc@s eZdZdS)zDGenericTests.test_init_subclass_super_called..FinalExceptionNrHr:r:r:r;FinalException$srWcs&eZdZddfdd ZZS)z;GenericTests.test_init_subclass_super_called..FinalNrcs<|jD]}|urt|r|qtjfi|dSr>)rr4rr)r7rr4)rrWrr:r;r(s  zMGenericTests.test_init_subclass_super_called..Final.__init_subclass__rr:rrWrr;r'src@s eZdZdS)z:GenericTests.test_init_subclass_super_called..TestNrHr:r:r:r;r-src@s eZdZdSz>GenericTests.test_init_subclass_super_called..SubclassNrHr:r:r:r;Subclass0srZc@s eZdZdSrYrHr:r:r:r;rZ3s) Exceptionrr rOrX)r6rrZr:rXr;test_init_subclass_super_called#s . z,GenericTests.test_init_subclass_super_calledcCsrt}Gddd|t}|tjt}Gddd|}|}|g|d|d||ddgdS)Nc@s4eZdZdZedddZddZeddd ZdS) z)GenericTests.test_nested..VisitorNrcSs ||_dSr>rr6rr:r:r;set>sz-GenericTests.test_nested..Visitor.setcSs|jSr>rrRr:r:r;r Asz-GenericTests.test_nested..Visitor.getrcSs|jSr>rrRr:r:r;visitDsz/GenericTests.test_nested..Visitor.visit)rDrErFrr r^r r_r:r:r:r;Visitor:sr`c@seZdZedddZdS)z0GenericTests.test_nested..IntListVisitorrcSs|j|dSr>)rappendrar:r:r;raKsz7GenericTests.test_nested..IntListVisitor.appendN)rDrErFrXrar:r:r:r;IntListVisitorIsrbrrN) rr r?rrXr^rarUr )r6Gr`rrbrr:r:r; test_nested6s    zGenericTests.test_nestedcsBtdGfdddtdfdd }|ddS)Nr cs eZdZddddddZdS)z,GenericTests.test_type_erasure..NodeNNode[T]rleftrightcSs||_||_||_dSr>rf)r6rrgrhr:r:r;rXsz5GenericTests.test_type_erasure..Node.__init__)NNrXr:rr:r;rWs rrcs~|}|}t|}t|t|t||j||j||j|dSr>)rrvr]rUr)rrrrrr r6r:r;r_s  z+GenericTests.test_type_erasure..foorN)r rrr:rir;test_type_erasureTs zGenericTests.test_type_erasurecCstd}Gdddt|}Gddd|}||jd|t|tWdn1sb0Y|t|tWdn1s0Y|t||Wdn1s0YdS)Nr c@s eZdZdS)z)GenericTests.test_implicit_any..CNrHr:r:r:r;rosrc@s eZdZdS)z)GenericTests.test_implicit_any..DNrHr:r:r:r;r,rsr,r:)r rrUrurOr[rXrrr:r:r;test_implicit_anyls & & zGenericTests.test_implicit_anycCsNGdddtt}Gddd}Gddd||}|d}||jddS)Nc@s eZdZdS)z*GenericTests.test_new_with_args..ANrHr:r:r:r;r[sr[cseZdZfddZZS)z*GenericTests.test_new_with_args..Bcst|}||_|Sr>)r__new__r r7r rrr:r;rls z2GenericTests.test_new_with_args..B.__new__rDrErFrlrr:r:rr;r?sr?c@s eZdZdS)z*GenericTests.test_new_with_args..CNrHr:r:r:r;rsrr)rr rUr r6r[r?rrr:r:r;test_new_with_args~s zGenericTests.test_new_with_argscCsLGddd}Gdddtt|}|d}||jd||jddS)NcseZdZfddZZS)z+GenericTests.test_new_with_args2..Acs||_tdSr>)from_arrr!rr:r;rsz4GenericTests.test_new_with_args2..A.__init__rDrErFrrr:r:rr;r[sr[cseZdZfddZZS)z+GenericTests.test_new_with_args2..Ccs||_t|dSr>)from_crrr!rr:r;rsz4GenericTests.test_new_with_args2..C.__init__rrr:r:rr;rsrr)rr rUrqrs)r6r[rrr:r:r;test_new_with_args2s z GenericTests.test_new_with_args2cCsGdddtt}|t|dWdn1s<0YGddd}Gddd||}|d}||jd||jd||jd dS) Nc@s eZdZdS)z(GenericTests.test_new_no_args..ANrHr:r:r:r;r[sr[rcseZdZfddZZS)z(GenericTests.test_new_no_args..Bcst|}d|_|S)Nr)rrlfrom_b)r7rrr:r;rls z0GenericTests.test_new_no_args..B.__new__rnr:r:rr;r?sr?cs$eZdZddZfddZZS)z(GenericTests.test_new_no_args..CcSs ||_dSr>)r r!r:r:r;rsz1GenericTests.test_new_no_args..C.__init__cst|}d|_|S)Nr)rrlrsrmrr:r;rls z0GenericTests.test_new_no_args..C.__new__)rDrErFrrlrr:r:rr;rsrrr)rr rOrPrUr rursror:r:r;test_new_no_argss & zGenericTests.test_new_no_argsN)3rDrErFrrrrrWrrrrrrrrrrrrrr rrrrr%r&r'r0r5r8r:r@rBrGrKrOrYrRrSrTrUrVr\rdrjrkrprtrvr:r:r:r;rs`   $+    #   rc@s4eZdZddZddZddZddZd d Zd S) ClassVarTestscCs|ttdWdn1s(0Y|ttttfWdn1s^0Y|ttttWdn1s0YdSr)rOrPrrXrzrRr:r:r;rs  & * zClassVarTests.test_basicscCsH|ttdtt}|t|dtt}|t|dtdS)Nztyping.ClassVartyping.ClassVar[int]ztyping.ClassVar[%s.Employee])rUrVrrXrGrDr6Zcvr:r:r;rWs zClassVarTests.test_reprcCs|t$Gdddtt}Wdn1s40Y|t(Gdddttt}Wdn1sv0YdS)Nc@s eZdZdSz-ClassVarTests.test_cannot_subclass..CNrHr:r:r:r;rsrc@s eZdZdSrzrHr:r:r:r;rs)rOrPr]rrXrr:r:r;r_s 2 z"ClassVarTests.test_cannot_subclasscCs|ttWdn1s&0Y|tttWdn1sZ0Y|t"ttttWdn1s0YdSr>)rOrPrr]rrXrRr:r:r;rs  $ ( zClassVarTests.test_cannot_initcCsp|ttdttWdn1s.0Y|ttttWdn1sb0YdSr)rOrPrQrrXr4rRr:r:r;test_no_isinstances , z ClassVarTests.test_no_isinstanceN)rDrErFrrWr_rr{r:r:r:r;rws rwc@s<eZdZddZddZddZddZd d Zd d Zd S) FinalTestscCstt|ttdWdn1s00Y|ttttfWdn1sf0Y|ttttWdn1s0Y|ttttWdn1s0YdSr)rrXrOrPrzrrRr:r:r;rs & * * zFinalTests.test_basicscCsd|ttdtt}|t|dtt}|t|dtttt}|t|ddS)Nz typing.Finalztyping.Final[int]ztyping.Final[%s.Employee]ztyping.Final[tuple[int]])rUrVrrXrGrDrryr:r:r;rWs zFinalTests.test_reprcCs|t$Gdddtt}Wdn1s40Y|t(Gdddttt}Wdn1sv0YdS)Nc@s eZdZdSz*FinalTests.test_cannot_subclass..CNrHr:r:r:r;r src@s eZdZdSr}rHr:r:r:r;r s)rOrPr]rrXrr:r:r;r_ s 2 zFinalTests.test_cannot_subclasscCs|ttWdn1s&0Y|tttWdn1sZ0Y|t"ttttWdn1s0YdSr>)rOrPrr]rrXrRr:r:r;r s  $ ( zFinalTests.test_cannot_initcCsp|ttdttWdn1s.0Y|ttttWdn1sb0YdSr)rOrPrQrrXr4rRr:r:r;r{ s , zFinalTests.test_no_isinstancecCsdd}||t|dS)NcSsdSr>r:rr:r:r;func rz.FinalTests.test_final_unmodified..func)rvr)r6r~r:r:r;test_final_unmodified sz FinalTests.test_final_unmodifiedN) rDrErFrrWr_rr{rr:r:r:r;r|s   r|c@seZdZddZddZdS) CastTestscCs|ttdd|ttdd|tttdt|ttdd|ttdd|ttt tfdd|tt dd|tddddSrM) rUrrXrrvr]rrrrzr rRr:r:r;r szCastTests.test_basicscCstddtdddS)NrNZhello)rrRr:r:r;rY) s zCastTests.test_errorsN)rDrErFrrYr:r:r:r;r s rc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7S)8ForwardRefTestscCsGdddtt}|t}t|jtt}||dt|t||dt|t||d|d||dtt| d|t|j tt}||dt|tt|j tt}||dt|tdS)Nc@sPeZdZedddZdddeddd Zedd d d Zddd d dZ dS)z)ForwardRefTests.test_basics..Node)rcSs||_d|_|_dSr>rf)r6rr:r:r;r5 sz2ForwardRefTests.test_basics..Node.__init__NzOptional[Node[T]]re)rgrhstuffcSs||_||_dSr>)rgrh)r6rgrhrblahr:r:r;add_both9 sz2ForwardRefTests.test_basics..Node.add_both)nodecSs||ddSr>rr6rr:r:r;add_leftA sz2ForwardRefTests.test_basics..Node.add_leftcSs|d|dSr>rrr:r:r; add_rightD sz3ForwardRefTests.test_basics..Node.add_right)NNN)N) rDrErFr rrXrrrrr:r:r:r;r3 s rrgrhrrr) rr rXrrrrrUr assertNotInrr)r6rrZ both_hintsZ left_hintsZ right_hintsr:r:r;r1 s zForwardRefTests.test_basicscCsBtd}|ttd|Wdn1s40YdS)NrXrN)r?r/rOrPrQr6frr:r:r;#test_forwardref_instance_type_errorU s  z3ForwardRefTests.test_forwardref_instance_type_errorcCsBtd}|ttt|Wdn1s40YdSNrX)r?r/rOrPr4rXrr:r:r;#test_forwardref_subclass_type_errorZ s  z3ForwardRefTests.test_forwardref_subclass_type_errorcCs4td}||td|tdttdSr)r?r/rUrsrrXrr:r:r;test_forward_equality_ s z%ForwardRefTests.test_forward_equalitycCstd}td}td}td}Gddd}||ddd}|t|tt||d||||||||||t|t||t|t||t|t||t||ft||t||t ft|t fdS)Nrc@s eZdZdS)z4ForwardRefTests.test_forward_equality_gth..CNrHr:r:r:r;rj srrcSsdSr>r:rr:r:r;rl sz6ForwardRefTests.test_forward_equality_gth..foo) r?r/rUrrrrrsrrX)r6c1c1_gthc2c2_gthrrr:r:r;test_forward_equality_gthd s       z)ForwardRefTests.test_forward_equality_gthcCstd}td}td}td}||ddd}t|tt|t|t||t|t||t|t|dS)NrXrcSsdSr>r:rr:r:r;r sz7ForwardRefTests.test_forward_equality_hash..foo)r?r/rrrrUr)r6rrrrrr:r:r;test_forward_equality_hashy s    z*ForwardRefTests.test_forward_equality_hashcCsBGddd}dd}dd}||||||dS)Nc@s eZdZdS)z:ForwardRefTests.test_forward_equality_namespace..ANrHr:r:r:r;r[ sr[cSs,td}|ddd}t|tt|S)Nr[rcSsdSr>r:rr:r:r;r szPForwardRefTests.test_forward_equality_namespace..namespace1..funr?r/rrr)rrr:r:r; namespace1 s zCForwardRefTests.test_forward_equality_namespace..namespace1cSs:td}Gddd}|ddd}t|tt|S)Nr[c@s eZdZdS)zNForwardRefTests.test_forward_equality_namespace..namespace2..ANrHr:r:r:r;r[ srcSsdSr>r:rr:r:r;r szPForwardRefTests.test_forward_equality_namespace..namespace2..funr)rr[rr:r:r; namespace2 s  zCForwardRefTests.test_forward_equality_namespace..namespace2)rUrs)r6r[rrr:r:r;test_forward_equality_namespace s  z/ForwardRefTests.test_forward_equality_namespacecCs|ttdddS)NrXztyping.List[ForwardRef('int')])rUrVrrRr:r:r;test_forward_repr sz!ForwardRefTests.test_forward_reprcCs6tdddd}|t|ttdttidS)Nr rcSsdSr>r:rr:r:r;r sz/ForwardRefTests.test_union_forward..foor)rrUrrrr rr:r:r;test_union_forward s z"ForwardRefTests.test_union_forwardcCsltdddd}|t|ttdttittdddd}|t|ttdttidS)Nr rcSsdSr>r:rr:r:r;r sz/ForwardRefTests.test_tuple_forward..foorcSsdSr>r:rr:r:r;r s)rrUrrrr rr/rr:r:r;test_tuple_forward s  z"ForwardRefTests.test_tuple_forwardcCs2dddd}|t|ttdttidS)Nz List['int']rcSsdSr>r:rr:r:r;r sz0ForwardRefTests.test_double_forward..foor)rUrrrrrXrr:r:r;test_double_forward s z#ForwardRefTests.test_double_forwardcCsDdd}dd}dd}|}|}||||t|||dS)NcSs0td}|}|ddd}t|tt}|S)Nr[rcSsdSr>r:rr:r:r;r rzPForwardRefTests.test_forward_recursion_actually..namespace1..funrrr[rretr:r:r;r s  zCForwardRefTests.test_forward_recursion_actually..namespace1cSs0td}|}|ddd}t|tt}|S)Nr[rcSsdSr>r:rr:r:r;r rzPForwardRefTests.test_forward_recursion_actually..namespace2..funrrr:r:r;r s  zCForwardRefTests.test_forward_recursion_actually..namespace2cSs||kSr>r:)Zo1Zo2r:r:r;cmp sz.cmp)rArORecursionError)r6rrrZr1Zr2r:r:r;test_forward_recursion_actually s z/ForwardRefTests.test_forward_recursion_actuallycstdttfGfddd}Gfddd}Gfddd}Gfdd d }|t|ttt|tt|t|ttd tttttttdffi|t|ttd ttttttdffi|t|ttd ttttttttdffttttdffi|t|ttd ttttttdftttttttdfffidS) NValuecseZdZUeed<dS)z7ForwardRefTests.test_union_forward_recursion..CrN)rDrErFrrr:)rr:r;r s rcseZdZUefed<dS)z7ForwardRefTests.test_union_forward_recursion..DrN)rDrErFrrr:rZ ValueListr:r;r, s r,cs"eZdZUeefed<dS)z7ForwardRefTests.test_union_forward_recursion..ErNrDrErFrrrr:rr:r;r6 s r6cs$eZdZUeefed<dS)z7ForwardRefTests.test_union_forward_recursion..FrNrr:rr:r;F s rr)rrrzrUrrr)r6rr,r6rr:rr;test_union_forward_recursion s8 $"z,ForwardRefTests.test_union_forward_recursioncCsBtdgdfddd}|t|ttdttgtfidS)Nr rcSsdSr>r:rr:r:r;r sz2ForwardRefTests.test_callable_forward..foor)rrUrrrr rr:r:r;test_callable_forward sz%ForwardRefTests.test_callable_forwardcCs6dddd}|t|ttdtdtfidS)NzCallable[..., T]rcSsdSr>r:rr:r:r;r sz@ForwardRefTests.test_callable_with_ellipsis_forward..foor.)rUrrrrr rr:r:r;#test_callable_with_ellipsis_forward sz3ForwardRefTests.test_callable_with_ellipsis_forwardcCs6|ttdWdn1s(0YdS)Nz/T)rO SyntaxErrorrrRr:r:r;test_syntax_error s z!ForwardRefTests.test_syntax_errorcCsDdddd}|tt|Wdn1s60YdS)NzNode[TrcSsdSr>r:rr:r:r;r sz6ForwardRefTests.test_delayed_syntax_error..foo)rOrrrr:r:r;test_delayed_syntax_error s z)ForwardRefTests.test_delayed_syntax_errorcCsHtdddd}|tt|Wdn1s:0YdS)NZ42rcSsdSr>r:rr:r:r;r sz,ForwardRefTests.test_type_error..foo)rrOrPrrr:r:r;test_type_error s zForwardRefTests.test_type_errorcCsHdddd}|tt|tWdn1s:0YdS)NzNoode[T]rcSsdSr>r:rr:r:r;r sz,ForwardRefTests.test_name_error..foo)rO NameErrorrrrr:r:r;test_name_error s zForwardRefTests.test_name_errorcCs,tdiddd}t|}||idS)N whateversrrcSsdSr>r:rr:r:r;r& sz/ForwardRefTests.test_no_type_check..foo)r!rrU)r6rthr:r:r;test_no_type_check$ sz"ForwardRefTests.test_no_type_checkcCsDtGddd}t|j}||it|j}||idS)Nc@seZdZdidddZdS)z3ForwardRefTests.test_no_type_check_class..CrrcSsdSr>r:rr:r:r;r1 sz7ForwardRefTests.test_no_type_check_class..C.fooNrDrErFrr:r:r:r;r/ sr)r!rrrU)r6rcthithr:r:r;test_no_type_check_class- s    z(ForwardRefTests.test_no_type_check_classcs@GdddtGfddd}|tjdtidS)Nc@seZdZedddZdS)z6ForwardRefTests.test_no_type_check_no_bases..CrcSsdSr>r:rar:r:r;r"; rz;ForwardRefTests.test_no_type_check_no_bases..C.methNrDrErFrXr"r:r:r:r;r: srcseZdZZdS)z6ForwardRefTests.test_no_type_check_no_bases..DN)rDrErFrr:rr:r;r,< sr,r)r!rUrr"rXr6r,r:rr;test_no_type_check_no_bases9 sz+ForwardRefTests.test_no_type_check_no_basescCslGddd}Gddd}Gddd}Gddd}d tjti}||||fD]}|t||qRdS) Nc@s eZdZUdZejeed<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string..CrN)rDrErFrr?rrXrr:r:r:r;rC s rc@seZdZUdZeeed<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string..DrrN)rDrErFrrrXrr:r:r:r;r,E s r,c@seZdZUdZded<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string..ErrxrNrDrErFrrr:r:r:r;r6G s r6c@seZdZUdZded<dS)zCForwardRefTests.test_no_type_check_forward_ref_as_string..Fr ClassVar[int]rNrr:r:r:r;rI s rr)r?rrXrUr)r6rr,r6rZexpected_resultclazzr:r:r;(test_no_type_check_forward_ref_as_stringB sz8ForwardRefTests.test_no_type_check_forward_ref_as_stringc Cs`Gddd}Gddd}||fD]6}|tt|Wdq$1sP0Yq$dS)Nc@seZdZUdZded<dS)zGForwardRefTests.test_nested_classvar_fails_forward_ref_check..Erz%typing.ClassVar[typing.ClassVar[int]]rNrr:r:r:r;r6Q s r6c@seZdZUdZeded<dS)zGForwardRefTests.test_nested_classvar_fails_forward_ref_check..FrrrN)rDrErFrrrr:r:r:r;rS s r)rOrPr)r6r6rrr:r:r;,test_nested_classvar_fails_forward_ref_checkP s   zr:)r~r:r:r;magic_decorator\ sz@ForwardRefTests.test_meta_no_type_check..magic_decoratorrrrcSsdSr>r:rr:r:r;rb sz4ForwardRefTests.test_meta_no_type_check..fooc@seZdZdidddZdS)z2ForwardRefTests.test_meta_no_type_check..CrrcSsdSr>r:rr:r:r;rh sz6ForwardRefTests.test_meta_no_type_check..C.fooNrr:r:r:r;rf srr)r"rUrDrr)r6rrrrrrr:r:r;test_meta_no_type_checkZ s     z'ForwardRefTests.test_meta_no_type_checkcCs>d}i}t||t|dj}|||d|dddS)Nz^class C: def foo(self, a: 'C') -> 'D': pass class D: def bar(self, b: 'D') -> C: pass rr,r)rrrrU)r6rnshintsr:r:r;test_default_globalss s  z$ForwardRefTests.test_default_globalscCsT|tttdtt|tttdtt|tttdtdS)Nr)rUgthLooprrrsrXrRr:r:r;test_final_forward_ref~ sz&ForwardRefTests.test_final_forward_refN)rDrErFrrrrrrrrrrrrrrrrrrrrrrrrrrrr:r:r:r;r/ s6$      rc@seZdZddZddZdS) OverloadTestscCsLddlm}|t"|dd}|Wdn1s>0YdS)NroverloadcSsdSr>r:r:r:r:r;r sz/OverloadTests.test_overload_fails..blah)r?rrO RuntimeErrorr6rrr:r:r;test_overload_fails s    z!OverloadTests.test_overload_failscCs*ddlm}|dd}dd}|dS)NrrcSsdSr>r:r:r:r:r;r sz2OverloadTests.test_overload_succeeds..blahcSsdSr>r:r:r:r:r;r s)r?rrr:r:r;test_overload_succeeds s   z$OverloadTests.test_overload_succeedsN)rDrErFrrr:r:r:r;r s ra import asyncio T_a = TypeVar('T_a') class AwaitableWrapper(typing.Awaitable[T_a]): def __init__(self, value): self.value = value def __await__(self) -> typing.Iterator[T_a]: yield return self.value class AsyncIteratorWrapper(typing.AsyncIterator[T_a]): def __init__(self, value: typing.Iterable[T_a]): self.value = value def __aiter__(self) -> typing.AsyncIterator[T_a]: return self async def __anext__(self) -> T_a: data = await self.value if data: return data else: raise StopAsyncIteration class ACM: async def __aenter__(self) -> int: return 42 async def __aexit__(self, etype, eval, tb): return None FT) ann_module ann_module2 ann_module3)AsyncContextManagerc@seZdZUeed<dS)r[rN)rDrErFrrr:r:r:r;r[ s r[c@s2eZdZUdZeeded<eed<eed<dS)r?Nrrr)rDrErFrrrrrXr:r:r:r;r? s r?c@s eZdZUeZeded<dS)CSubrN)rDrErFr?rrrr:r:r:r;r s rc@s"eZdZUgZeeeed<dS)rclstN)rDrErFrrrr rr:r:r:r;rc s rcc@seZdZUeded<dS)rrN)rDrErFrrr:r:r:r;r s rc@seZdZUded<ded<dS)NoneAndForwardparentNmeaningrDrErFrr:r:r:r;r s rc@seZdZUeed<eed<dS) CoolEmployeenamecoolNrDrErFrzrrXr:r:r:r;r s rc@s"eZdZUeed<dZeed<dS)CoolEmployeeWithDefaultrrrN)rDrErFrzrrrXr:r:r:r;r s rc@seZdZUeed<ddZdS)XMethrcCs d|jS)NrrrRr:r:r;double sz XMeth.doubleN)rDrErFrXrrr:r:r:r;r s rc@s2eZdZUeed<dZeed<ddZddZdS) XReprrrrcCs|jd|jS)Nz -> rZrRr:r:r;__str__ sz XRepr.__str__cCsdSr^r:r6rxr:r:r;__add__ sz XRepr.__add__N)rDrErFrXrrrrr:r:r:r;r s  rLabelrc@seZdZUeed<eed<dS)Point2DrrNrr:r:r:r;r s rc@s eZdZdS) LabelPoint2DNrHr:r:r:r;r rrc@seZdZUeed<eed<dS)Options log_levellog_pathNrr:r:r:r;r s rtotalc@seZdZUded<ded<dS)HasForeignBaseClassr some_xreprzmod_generics_cache.Aother_aNrr:r:r:r;r s r)amc s@|4IdH}|WdIdHS1IdHs20YdSr>r:)rrr:r:r;g_with srrNc@s:eZdZejddddZejejddddZdS) ForRefExamplerRcCsdSr>r:rRr:r:r;r~ szForRefExample.funccCsdSr>r:rRr:r:r;nested szForRefExample.nestedN)rDrErFrdecr~rr:r:r:r;r s rc@steZdZddZddZedddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZdS)GetTypeHintTestscCs|ttdWdn1s(0Y|ttdWdn1sZ0Y|ttdWdn1s0YdS)N{r=)rOrPrrRr:r:r;(test_get_type_hints_from_various_objects s  & & z9GetTypeHintTests.test_get_type_hints_from_various_objectscCsJdtttfttd}|tt||tti|ttidS)Nr)rrBrr)rrXrzrUrrrr)r6Zann_module_type_hintsr:r:r;test_get_type_hints_modules& sz,GetTypeHintTests.test_get_type_hints_modulesz known bugcCs*ttjttjd}|tt|dS)N)Z default_aZ default_b)rr0r[r?rUr)r6Z mgc_hintsr:r:r;&test_get_type_hints_modules_forwardref, sz7GetTypeHintTests.test_get_type_hints_modules_forwardrefcCs<|ttjdttji|ttjt|ttjdt d|ttj t t ttjd|ttj dt i|ttjdttji|ttjt t d|ttjdt i|tttt dd|ttttjtjd |ttjt t d|ttjtjjtjjtjd dS) Nrr)Z123r)jrrrrZr)rr)rrZsome_b)Z my_inner_a1Z my_inner_a2Z my_outer_a)rUrrrrrjZj_classrMr]r,rzrrrXZh_classr~rrrrr0r[r?rlrRr:r:r;test_get_type_hints_classes5 s>          z,GetTypeHintTests.test_get_type_hints_classescCstGddd}||j||jjj|ttjj iGdddt t }tGddd|}|t|j dt idS)Nc@seZdZGdddZdS)z>GetTypeHintTests.test_respect_no_type_check..NoTpCheckc@seZdZddddZdS)zBGetTypeHintTests.test_respect_no_type_check..NoTpCheck.Innz not a typercSsdSr>r:rar:r:r;rQ rzKGetTypeHintTests.test_respect_no_type_check..NoTpCheck.Inn.__init__NrXr:r:r:r;InnP srN)rDrErFrr:r:r:r; NoTpCheckN src@seZdZedddZdS)z:GetTypeHintTests.test_respect_no_type_check..ABasercSsdSr>r:rr:r:r;r"V rz?GetTypeHintTests.test_respect_no_type_check..ABase.methNrr:r:r:r;ABaseU src@s eZdZdS)z8GetTypeHintTests.test_respect_no_type_check..DerNrHr:r:r:r;DerW srr) r!r__no_type_check__rrrUrrZNTCr"rr rX)r6rrrr:r:r;test_respect_no_type_checkM s z+GetTypeHintTests.test_respect_no_type_checkcCs||tti|tti|tti|tti|ttji|ttji|ttj idSr>) rUrrXr]dirrrrrzjoinrRr:r:r; test_get_type_hints_for_builtins[ sz1GetTypeHintTests.test_get_type_hints_for_builtinscCsPdd}d|jd<|t|dtidddd}|t|dtdidS)NcSsdSr>r:rZr:r:r;testff rz6GetTypeHintTests.test_previous_behavior..testfrXrrcSsdSr>r:rr:r:r;testgi rz6GetTypeHintTests.test_previous_behavior..testg)rrUrrXr])r6r r r:r:r;test_previous_behaviore s  z'GetTypeHintTests.test_previous_behaviorcCsHGddd}Gddd}|}ddi|_|t|td|idS)Nc@s eZdZdS)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations..ANrHr:r:r:r;r[m rr[c@s eZdZdS)zKGetTypeHintTests.test_get_type_hints_for_object_with_annotations..BNrHr:r:r:r;r?n rr?r)rrUrr)r6r[r?rr:r:r;/test_get_type_hints_for_object_with_annotationsl s  z@GetTypeHintTests.test_get_type_hints_for_object_with_annotationsc Cs|ttjtjdtjtji|tttt tt tt d|tt ttt t t tt td|tt dtt tidS)Nvar)rrr)rrrrr)rUrrZCVrr?rr?rrXrrrcrr rRr:r:r;test_get_type_hints_ClassVars s  z-GetTypeHintTests.test_get_type_hints_ClassVarcCs0dti}|ttj||ttj|dS)Nr6)rrUrr~r)r6Zexpectsr:r:r;,test_get_type_hints_wrapped_decoratored_func} sz=GetTypeHintTests.test_get_type_hints_wrapped_decoratored_funccCsVtdddd}ttdf}|t|ttdtti|t|ttdddtttdfittddd d}ttdf}|t|ttdtti|t|ttdddtttdfit tt d fd f}|dd d }|t|ttdt t d f| t|ttddd|t tt d fd f}|ddd }|t|ttdt t d f| t|ttddd|t jd ttt dfft jttt dffddd}|t|ttt jd tt ft jtt fdt jd tt f}|ddd}| t|ttddd|dS)NrorcSsdSr>r:rr:r:r;r rz>GetTypeHintTests.test_get_type_hints_annotated..foobar)r rTinclude_extrascSsdSr>r:rr:r:r;r r)rr.cSsdSr>r:rr:r:r;r rz>GetTypeHintTests.test_get_type_hints_annotated..barfoocSsdSr>r:rr:r:r;r rconstZmutablerZcSsdSr>r:rZr:r:r;r sz?GetTypeHintTests.test_get_type_hints_annotated..barfoo2cSsdSr>r:rr:r:r;barfoo3 rz?GetTypeHintTests.test_get_type_hints_annotated..barfoo3)rr.rXrUrrrrr/rr rvrr?rr)r6rroZBArrZBA2rr:r:r;test_get_type_hints_annotated s^    $$  z.GetTypeHintTests.test_get_type_hints_annotatedcsttdfGfdddtt}|t|jtt|t|td|t|jttdd|t|td|t|jtt|t|tddS)NConstcs0eZdZdddddZdddddZdS) zBGetTypeHintTests.test_get_type_hints_annotated_refs..MySetzConst[MySet[T]]zMySet[T]rxrcSsdSr>r:rr:r:r;__ior__ szJGetTypeHintTests.test_get_type_hints_annotated_refs..MySet.__ior__cSsdSr>r:rr:r:r;__iand__ szKGetTypeHintTests.test_get_type_hints_annotated_refs..MySet.__iand__N)rDrErFrrr:rr:r;MySet srrTr) r.r rrUrrrrr)r6rr:rr;"test_get_type_hints_annotated_refs s z3GetTypeHintTests.test_get_type_hints_annotated_refsN)rDrErFrrrrrrrr r rrrrr:r:r:r;r s    5rc@seZdZddZddZdS)GetUtilitiesTestCasecCsdtd}Gdddt|}|t|t||t||||ttd|tttt|ttttft|ttdt|tt t tt |ttt|tt|t|tt t ||ftt |tt |dft |tt t |tt t|tttjj|tt tt |tt ddS)Nr c@s eZdZdS)z/GetUtilitiesTestCase.test_get_origin..CNrHr:r:r:r;r rrrN+r1)r rrvrrXrrrzrrrrrr.rrrr=rr:r:r;test_get_origin s$ z$GetUtilitiesTestCase.test_get_originc Cstd}Gdddt|}|t|ttf|t|||f|ttd|ttttf|ttttfttf|ttdd|tt t tt tf|tttt |tffttt ttff|tt j tt ||fftttt ttttff|ttg|ftgtf|ttdtfdtf|ttttt |dfgtffttt |dfgtff|tt tdftdf|tt dd|tt|dd d gf|dd d gf|tt d|tt d|ttd|ttttf|ttd|ttjjtgtftgtf|ttjjdtfdtf|ttjjgtfgtf|ttjjtgtftttgtfdS) Nr c@s eZdZdS)z-GetUtilitiesTestCase.test_get_args..CNrHr:r:r:r;r rrr:r.)r:onerZthree)r rrUr rXrrrzrrrrr?rrrr.rrr=rr:r:r; test_get_args sD$ $($  z"GetUtilitiesTestCase.test_get_argsN)rDrErFr r"r:r:r:r;r src@seZdZddZddZddZeeddd Zeedd d Z eedd d Z eedddZ ddZ ddZ ddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Z d:d;Z!dd?Z#d@dAZ$ee%j&dBkdCdDdEZ'ee%j&dBkdCdFdGZ(dHdIZ)dJdKZ*dLdMZ+dNdOZ,dPdQZ-dRdSZ.dTdUZ/dVdWZ0dXdYZ1dZd[Z2d\d]Z3d^d_Z4d`daZ5dbdcZ6dddeZ7dfdgZ8dhdiZ9djS)kCollectionsAbcTestscCs |dtj|gtjdSrM)rjr?HashablerrRr:r:r; test_hashable sz!CollectionsAbcTests.test_hashablecCsX|gtj|gtj|gtj|dtj|ttj|ttjdSrM)rjr?rrr<rrRr:r:r; test_iterable s z!CollectionsAbcTests.test_iterablecCs(tg}||tj|dtjdSrM)rrjr?Iteratorr)r6itr:r:r; test_iterator sz!CollectionsAbcTests.test_iteratorz&Python 3.5 and multithreading requiredcCsJi}tdt||d}|}||tj||tj|ddS)NzPasync def foo() -> typing.Awaitable[int]: return await AwaitableWrapper(42) r)rrrjr? Awaitablersendr6rrgr:r:r;test_awaitable sz"CollectionsAbcTests.test_awaitablecCsi}tdt||d}|}||tj|t t|tjtWdn1s^0Y| |tjz| dWnt yYn0dS)Nzasync def foo(): return r) rrrjr? CoroutinerOrPrQrXrr+ StopIterationr,r:r:r;test_coroutine, s . z"CollectionsAbcTests.test_coroutinecCs>td}t|}||tj||tj|dtjdSNrrN)rAsyncIteratorWrapperrjr? AsyncIterablerr6Zbase_itr(r:r:r;test_async_iterable> s z'CollectionsAbcTests.test_async_iterablecCs0td}t|}||tj|dtjdSr2)rr3rjr? AsyncIteratorrr5r:r:r;test_async_iteratorF sz'CollectionsAbcTests.test_async_iteratorcCs |gtj|dtjdSrM)rjr?SizedrrRr:r:r; test_sizedM szCollectionsAbcTests.test_sizedcCs |gtj|dtjdSrM)rjr? ContainerrrRr:r:r;test_containerQ sz"CollectionsAbcTests.test_containercCsJttdrF|ttj|ttj|ttj|dtjdS)N CollectionrN) rr?rjrr=rr<rrrRr:r:r;test_collectionU s  z#CollectionsAbcTests.test_collectioncCs"|ttj|dtjdSrM)rjr^r?r6rrRr:r:r;test_abstractset\ sz$CollectionsAbcTests.test_abstractsetcCs$|ttj|ttjdSr>)rjr^r? MutableSetrrrRr:r:r;test_mutableset` sz#CollectionsAbcTests.test_mutablesetcCs |itj|dtjdSrM)rjr?rrrRr:r:r; test_mappingd sz CollectionsAbcTests.test_mappingcCs |itj|dtjdSrM)rjr?rrrRr:r:r;test_mutablemappingh sz'CollectionsAbcTests.test_mutablemappingcCs |gtj|dtjdSrM)rjr?r$rrRr:r:r; test_sequencel sz!CollectionsAbcTests.test_sequencecCs |gtj|dtjdSr)rjr?MutableSequencerrRr:r:r;test_mutablesequencep sz(CollectionsAbcTests.test_mutablesequencecCs$|dtj|tdtjdSr)rjr? ByteString bytearrayrRr:r:r;test_bytestringt sz#CollectionsAbcTests.test_bytestringcCs|ttjdSr>)r<rr?rrRr:r:r; test_listx szCollectionsAbcTests.test_listcCs:|tjtjGdddtjt}||tjdS)Nc@s eZdZdS)z/CollectionsAbcTests.test_deque..MyDequeNrHr:r:r:r;MyDeque} rrK)r<rdequer?DequerXrj)r6rKr:r:r; test_deque{ szCollectionsAbcTests.test_dequecCs|tjtjdSr>)r<rCounterr?rRr:r:r; test_counter sz CollectionsAbcTests.test_countercCs |ttj|ttjdSr>)r<r^r?Setr=rrRr:r:r;test_set szCollectionsAbcTests.test_setcCs |ttj|ttjdSr>)r<rr?r r=r^rRr:r:r;test_frozenset sz"CollectionsAbcTests.test_frozensetcCs|ttjdSr>)r<rr?rrRr:r:r;r szCollectionsAbcTests.test_dictcCs td}td}|t||fttftttf|t|tfttttf|tt|fttttf|t|t|fttfttttf|t|ttftttttf|t|t|fttfttttf|t|ttftttttfdS)NKr)r rUrrzrXrr)r6rTrr:r:r;test_dict_subscribe s$  ,(,z'CollectionsAbcTests.test_dict_subscribecCs|ttWdn1s(0Y|ttjtWdn1s^0Y|ttjtWdn1s0YdSr>)rOrPr?rr rXrRr:r:r;test_no_list_instantiation s  & * z.CollectionsAbcTests.test_no_list_instantiationcCsRGdddtjt}|}|||||tj||t|t|dS)Nc@s eZdZdS)z6CollectionsAbcTests.test_list_subclass..MyListNrHr:r:r:r;MyList srW)r?rrXrjr$r<rr=)r6rWrr:r:r;test_list_subclass s   z&CollectionsAbcTests.test_list_subclasscCs|ttWdn1s(0Y|t tjttfWdn1sb0Y|t tjttfWdn1s0YdSr>)rOrPr?rr rrzrXrRr:r:r;test_no_dict_instantiation s  & . z.CollectionsAbcTests.test_no_dict_instantiationcCsVGdddtjttf}|}|||||tj||t|t|dS)Nc@s eZdZdS)z6CollectionsAbcTests.test_dict_subclass..MyDictNrHr:r:r:r;r* sr*) r?rrzrXrjrr<rr=)r6r*rNr:r:r;test_dict_subclass s   z&CollectionsAbcTests.test_dict_subclasscCsV|tttj|ttjttftj|ttjtt ftjdSr>) rvr]r?r.r defaultdictr rrzrXrRr:r:r;test_defaultdict_instantiation sz2CollectionsAbcTests.test_defaultdict_instantiationcCsLGdddtjttf}|}|||||tj|tj|dS)Nc@s eZdZdS)z@CollectionsAbcTests.test_defaultdict_subclass..MyDefDictNrHr:r:r:r; MyDefDict sr]) r?r.rzrXrjr<rr[r=)r6r]ddr:r:r;test_defaultdict_subclass s  z-CollectionsAbcTests.test_defaultdict_subclasscCsV|tttj|ttjttftj|ttjttftjdSr>) rvr]r? OrderedDictrr rrzrXrRr:r:r;test_ordereddict_instantiation sz2CollectionsAbcTests.test_ordereddict_instantiationcCsLGdddtjttf}|}|||||tj|tj|dS)Nc@s eZdZdS)z@CollectionsAbcTests.test_ordereddict_subclass..MyOrdDictNrHr:r:r:r; MyOrdDict srb)r?r`rzrXrjr<rr=)r6rbZodr:r:r;test_ordereddict_subclass s  z-CollectionsAbcTests.test_ordereddict_subclassr,zChainMap was added in 3.3cCs|tttj|ttjttftj|ttjttftjGdddtjttf}|t|ttf|dS)Nc@s eZdZdS)z;CollectionsAbcTests.test_chainmap_instantiation..CMNrHr:r:r:r;CM rrd) rvr]r?r/rr rrzrX)r6rdr:r:r;test_chainmap_instantiation s z/CollectionsAbcTests.test_chainmap_instantiationcCsLGdddtjttf}|}|||||tj|tj|dS)Nc@s eZdZdS)z>CollectionsAbcTests.test_chainmap_subclass..MyChainMapNrHr:r:r:r; MyChainMap srf)r?r/rzrXrjr<rr=)r6rfcmr:r:r;test_chainmap_subclass s  z*CollectionsAbcTests.test_chainmap_subclasscCsz|tttj|ttjttj|ttjttjGdddtjt}|t|t|dS)Nc@s eZdZdS)z7CollectionsAbcTests.test_deque_instantiation..DNrHr:r:r:r;r, rr,)rvr]r?rMrrLr rXrr:r:r;test_deque_instantiation s z,CollectionsAbcTests.test_deque_instantiationcCsz|tttj|ttjttj|ttjttjGdddtjt}|t|t|dS)Nc@s eZdZdS)z9CollectionsAbcTests.test_counter_instantiation..CNrHr:r:r:r;r rr)rvr]r?rOrr rXrr:r:r;test_counter_instantiation s z.CollectionsAbcTests.test_counter_instantiationcCsHGdddtjt}|}|||||tj||tjdS)Nc@s eZdZdS)zJCollectionsAbcTests.test_counter_subclass_instantiation..MyCounterNrHr:r:r:r; MyCounter srk)r?rOrXrjr)r6rkrNr:r:r;#test_counter_subclass_instantiation s  z7CollectionsAbcTests.test_counter_subclass_instantiationcCs|ttWdn1s(0Y|ttjtWdn1s^0Y|ttjtWdn1s0YdSr>)rOrPr?rQr rXrRr:r:r;test_no_set_instantiation s  & * z-CollectionsAbcTests.test_no_set_instantiationcCs,Gdddtjt}|}|||dS)Nc@s eZdZdS)zBCollectionsAbcTests.test_set_subclass_instantiation..MySetNrHr:r:r:r;r sr)r?rQrXrj)r6rrNr:r:r;test_set_subclass_instantiation sz3CollectionsAbcTests.test_set_subclass_instantiationcCs|ttWdn1s(0Y|ttjtWdn1s^0Y|ttjtWdn1s0YdSr>)rOrPr?r r rXrRr:r:r;test_no_frozenset_instantiation s  & * z3CollectionsAbcTests.test_no_frozenset_instantiationcCs,Gdddtjt}|}|||dS)Nc@s eZdZdS)zNCollectionsAbcTests.test_frozenset_subclass_instantiation..MyFrozenSetNrHr:r:r:r; MyFrozenSet' srp)r?r rXrj)r6rprNr:r:r;%test_frozenset_subclass_instantiation% sz9CollectionsAbcTests.test_frozenset_subclass_instantiationcCs|ttWdn1s&0Y|tttWdn1sZ0Y|tttWdn1s0YdSr>)rOrPrr rXrRr:r:r;test_no_tuple_instantiation- s  $ ( z/CollectionsAbcTests.test_no_tuple_instantiationcCs$dd}|}|t|tjdS)Ncss dVdSrMr:r:r:r:r;r6 sz/CollectionsAbcTests.test_generator..foo)r<r]r? Generator)r6rr-r:r:r;test_generator5 sz"CollectionsAbcTests.test_generatorcCs|ttWdn1s(0Y|t"tjtttfWdn1sd0Y|t"tjtttfWdn1s0YdSr>)rOrPr?rsr rXrRr:r:r;test_no_generator_instantiation; s  & 0 z3CollectionsAbcTests.test_no_generator_instantiationcCs2i}tdt||d}|t|tjdS)Nzasync def f(): yield 42 rB)rrr<r]r?AsyncGenerator)r6rr-r:r:r;test_async_generatorC s  z(CollectionsAbcTests.test_async_generatorcCs|ttWdn1s(0Y|t tjttfWdn1sb0Y|t tjttfWdn1s0YdSr>)rOrPr?rvr rXrRr:r:r;%test_no_async_generator_instantiationJ s  & . z9CollectionsAbcTests.test_no_async_generator_instantiationcCsdGdddtj}|t|Wdn1s80YGddd|}|t|dt|jsrJ||tj Gdddtjt t f}|t|d|t|t t fd|t|t t fd| t|| t|||tj ||tj ||tj ||t t ftj ||t t ftjj ||tjj ||tjj ||tjj |t$t|t t ftj Wdn1s0Y|||Gdd d tj}| t|Gd d d tjtttf}d d }||tj||tj||tjj||tjj| t||dS)Nc@s eZdZdS)z1CollectionsAbcTests.test_subclassing..MMANrHr:r:r:r;MMAT sryc@s4eZdZddZddZddZddZd d Zd S) z1CollectionsAbcTests.test_subclassing..MMCcSsdSr>r:rr:r:r;r[ sz=CollectionsAbcTests.test_subclassing..MMC.__getitem__cSsdSr>r:rr:r:r;r ] sz=CollectionsAbcTests.test_subclassing..MMC.__setitem__cSsdSr>r:rr:r:r;r_ sz=CollectionsAbcTests.test_subclassing..MMC.__delitem__cSstdSrrrRr:r:r;ra sz:CollectionsAbcTests.test_subclassing..MMC.__iter__cSsdSr^r:rRr:r:r;rc sz9CollectionsAbcTests.test_subclassing..MMC.__len__Nrr:r:r:r;MMCZ s rzrc@s4eZdZddZddZddZddZd d Zd S) z1CollectionsAbcTests.test_subclassing..MMBcSsdSr>r:rr:r:r;rk sz=CollectionsAbcTests.test_subclassing..MMB.__getitem__cSsdSr>r:rr:r:r;r m sz=CollectionsAbcTests.test_subclassing..MMB.__setitem__cSsdSr>r:rr:r:r;ro sz=CollectionsAbcTests.test_subclassing..MMB.__delitem__cSstdSrrrRr:r:r;rq sz:CollectionsAbcTests.test_subclassing..MMB.__iter__cSsdSr^r:rRr:r:r;rs sz9CollectionsAbcTests.test_subclassing..MMB.__len__Nrr:r:r:r;MMBj s r{c@s eZdZdS)z/CollectionsAbcTests.test_subclassing..INrHr:r:r:r;I rr|c@s eZdZdS)z/CollectionsAbcTests.test_subclassing..GNrHr:r:r:r;rc rrccss dVdSr^r:r:r:r:r;r- rz/CollectionsAbcTests.test_subclassing..g)r?rrOrPrUrcallablerrjrr rrzr=rr<rr=r4rrrsrXr])r6ryrzr{r|rcr-r:r:r;test_subclassingR sB $     4  z$CollectionsAbcTests.test_subclassingcCsGdddtjttf}i}tdt||d}||tj||tj||tjj||tjj| t |||}| |tj| |tj| |tjj| |tjj| t ||| ||dS)Nc@seZdZddZdddZdS)z?CollectionsAbcTests.test_subclassing_async_generator..GcSsdSr>r:)r6rr:r:r;asend szECollectionsAbcTests.test_subclassing_async_generator..G.asendNcSsdSr>r:)r6typvaltbr:r:r;athrow szFCollectionsAbcTests.test_subclassing_async_generator..G.athrow)NN)rDrErFrrr:r:r:r;rc srczasync def g(): yield 0r-) r?rvrXrrr<r4rr=r=r]rjr)r6rcrr-instancer:r:r; test_subclassing_async_generator s z4CollectionsAbcTests.test_subclassing_async_generatorcCsfGdddtj}Gddd|}Gddd}Gddd}|||||||||dS) Nc@seZdZeddZdS)z?CollectionsAbcTests.test_subclassing_subclasshook..BasecSs|jdkrdSdSdS)NrTF)rDrwr:r:r;ry s zPCollectionsAbcTests.test_subclassing_subclasshook..Base.__subclasshook__Nrzr:r:r:r;r src@s eZdZdS)z.CNrHr:r:r:r;r rrc@s eZdZdS)z>CollectionsAbcTests.test_subclassing_subclasshook..FooNrHr:r:r:r;r rrc@s eZdZdS)z>CollectionsAbcTests.test_subclassing_subclasshook..BarNrHr:r:r:r;r rr)r?rr<r=)r6rrrrr:r:r;test_subclassing_subclasshook s  z1CollectionsAbcTests.test_subclassing_subclasshookcCsGdddtj}Gddd|}Gddd}||||||||Gddd}||||||||Gd d d }tjj|||tjdS) Nc@s eZdZdS)z8CollectionsAbcTests.test_subclassing_register..ANrHr:r:r:r;r[ rr[c@s eZdZdS)z8CollectionsAbcTests.test_subclassing_register..BNrHr:r:r:r;r? rr?c@s eZdZdS)z8CollectionsAbcTests.test_subclassing_register..CNrHr:r:r:r;r rrc@s eZdZdS)z8CollectionsAbcTests.test_subclassing_register..DNrHr:r:r:r;r, rr,c@s eZdZdS)z8CollectionsAbcTests.test_subclassing_register..MNrHr:r:r:r;r rr) r?r;rTr<r=rr=rr)r6r[r?rr,rr:r:r;test_subclassing_register s      z-CollectionsAbcTests.test_subclassing_registercCsGdddtjj}||tj||tjGdddtjj}||tj||tjGdddtjj}||tjGdddtjjtjd }Gd d d }||||tjdS) Nc@s eZdZdS)z7CollectionsAbcTests.test_collections_as_base..MNrHr:r:r:r;r rrc@s eZdZdS)z7CollectionsAbcTests.test_collections_as_base..SNrHr:r:r:r;r~ rr~c@s eZdZdS)z7CollectionsAbcTests.test_collections_as_base..INrHr:r:r:r;r| rr|c@s eZdZdS)z7CollectionsAbcTests.test_collections_as_base..ANrHr:r:r:r;r[ rr[) metaclassc@s eZdZdS)z7CollectionsAbcTests.test_collections_as_base..BNrHr:r:r:r;r? rr?) rr=rr<r?rrEABCMetarT)r6rr~r|r[r?r:r:r;test_collections_as_base s z,CollectionsAbcTests.test_collections_as_baseN):rDrErFr%r&r)rASYNCIOr.r1r6r8r:r<r>r?rArBrCrDrFrIrJrNrPrRrSrrUrVrXrYrZr\r_rarcr rrerhrirjrlrmrnrorqrrrtrurwrxr~rrrrr:r:r:r;r# sr             Er#c@s&eZdZddZeedddZdS) OtherABCTestscCs4tjdd}|}||tj|dtjdS)Ncss dVdSrMr:r:r:r:r;manager sz2OtherABCTests.test_contextmanager..managerrN) contextlibcontextmanagerrjr?rr)r6rrgr:r:r;test_contextmanager s  z!OtherABCTests.test_contextmanagerzPython 3.5 requiredcCsGddd}|ttj||tjtjdd}|}||tj|tjtj tf| t  t dtjtWdn1s0Y| t tjtt fWdn1s0YdS)Nc@s eZdZdS)z7OtherABCTests.test_async_contextmanager..NotACMNrHr:r:r:r;NotACM srcss dVdSrMr:r:r:r:r;r sz8OtherABCTests.test_async_contextmanager..managerrN)rjACMr?rrrrrUrXrtrOrPrQrz)r6rrrgr:r:r;test_async_contextmanager s  . z'OtherABCTests.test_async_contextmanagerN)rDrErFrrrrr:r:r:r;r s rc@s$eZdZddZddZddZdS) TypeTestscCsNGddd}Gddd|}Gddd|}t||ddd }||dS) Nc@s eZdZdS)z'TypeTests.test_type_basic..UserNrHr:r:r:r;Userrrc@s eZdZdS)z,TypeTests.test_type_basic..BasicUserNrHr:r:r:r; BasicUser rrc@s eZdZdS)z*TypeTests.test_type_basic..ProUserNrHr:r:r:r;ProUser rr user_classrcSs|Sr>r:rr:r:r;new_user sz+TypeTests.test_type_basic..new_userr#)r6rrrrr:r:r;test_type_basics zTypeTests.test_type_basiccCsZGddd}Gddd|}Gddd|}td|d}t||d d d }||dS) Nc@s eZdZdS)z)TypeTests.test_type_typevar..UserNrHr:r:r:r;rrrc@s eZdZdS)z.TypeTests.test_type_typevar..BasicUserNrHr:r:r:r;rrrc@s eZdZdS)z,TypeTests.test_type_typevar..ProUserNrHr:r:r:r;rrrrrrcSs|Sr>r:rr:r:r;rsz-TypeTests.test_type_typevar..new_user)r r$)r6rrrrrr:r:r;test_type_typevars  zTypeTests.test_type_typevarcCsFttt}|ttddd}t|tts2J|ddusBJdS)NrcSs|dur dS|SdSr>r:rr:r:r;r!sz)TypeTests.test_type_optional..foo)rr$ BaseExceptionrQKeyboardInterrupt)r6r[rr:r:r;test_type_optionals zTypeTests.test_type_optionalN)rDrErFrrrr:r:r:r;rs  rc@seZdZddZddZdS) NewTypeTestscCsLtdt}tdt}||dt||dt||ddddS)NUserIdUserNamerJoer)r%rXrzrjrU)r6rrr:r:r; test_basic-s   zNewTypeTests.test_basiccCstdt}tdt}|tt|tWdn1s>0Y|t Gddd|}Wdn1sx0YdS)Nrrc@s eZdZdS)z#NewTypeTests.test_errors..DNrHr:r:r:r;r,:sr,)r%rXrzrOrPr4)r6rrr,r:r:r;rY4s    ( zNewTypeTests.test_errorsN)rDrErFrrYr:r:r:r;r+src@sleZdZGdddeZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ ddZdS)NamedTupleTestsc@seZdZUeed<eed<dS)zNamedTupleTests.NestedEmployeerrNrr:r:r:r;NestedEmployee?s rcCstddtfdtfg}||t|dd}|ddd}|||||t||jd||jd||jd||jd||j d||j d||j t dtfdtfgdS) NEmpridrrNJimrrr)r&rzrXr<rrjrUrrrD_fieldsrrr`)r6rZjoejimr:r:r;rCs     zNamedTupleTests.test_basicscCstjdddkr|ttdttdWdn1s@0Y|t Gdddt}Wdn1sz0YdS)Nr)rrName)r!rxc@seZdZdZdS)z9NamedTupleTests.test_namedtuple_pyversion..NotYetrN)rDrErFrCr:r:r:r;NotYetXsr)r rrOrPr&rXrz)r6rr:r:r;test_namedtuple_pyversionSs  , z)NamedTupleTests.test_namedtuple_pyversioncCsvtdd}||t||t||jd||jd|tjd|tjd|tjt j t t ddS)NZTimi(#rrr) rrjrrUrrrDrrrr`rzrX)r6Ztimr:r:r;test_annotation_usage[s    z%NamedTupleTests.test_annotation_usagecCstd}||t||t||jd||jdtdd}||jd|tjd|tjd|tjt t t d|tj t dd| t Gdd d t}Wdn1s0YdS) NZJellerZSjoerdrrr)rc@s"eZdZUdZeed<eed<dS)zRNamedTupleTests.test_annotation_usage_with_default..NonDefaultAfterDefaultrrrN)rDrErFrrXrr:r:r:r;NonDefaultAfterDefaultvs  r)rrjrrUrrrDrrrrzrX_field_defaultsrOrPr&)r6ZjelleZcooler_employeerr:r:r;"test_annotation_usage_with_defaultfs     z2NamedTupleTests.test_annotation_usage_with_defaultcCs|tdd|tdjtdd|ttdd|tddtdd|t Gdddt}Wdn1s0Y|t Gd d d t}Wdn1s0YdS) NrrrNrz42 -> 1rc@seZdZUeed<ddZdS)zDNamedTupleTests.test_annotation_usage_with_methods..XMethBadrcSsdS)Nzno chance for thisr:rRr:r:r;rszLNamedTupleTests.test_annotation_usage_with_methods..XMethBad._fieldsN)rDrErFrXrrr:r:r:r;XMethBads rc@seZdZUeed<ddZdS)zENamedTupleTests.test_annotation_usage_with_methods..XMethBad2rcSsdS)Nzno chance for this as wellr:rRr:r:r;_sourceszMNamedTupleTests.test_annotation_usage_with_methods..XMethBad2._sourceN)rDrErFrXrrr:r:r:r; XMethBad2s r) rUrrrrzrrOrr&)r6rrr:r:r;"test_annotation_usage_with_methodszs . z2NamedTupleTests.test_annotation_usage_with_methodscCsNGddd}|t"Gdddt|}Wdn1s@0YdS)Nc@s eZdZdS)z4NamedTupleTests.test_multiple_inheritance..ANrHr:r:r:r;r[sr[c@seZdZUeed<dS)z4NamedTupleTests.test_multiple_inheritance..XrNrr:r:r:r;ros ro)rOrPr&)r6r[ror:r:r;rUs z)NamedTupleTests.test_multiple_inheritancecCstdttd}|dd}||t||jd||jd||jd||j t ttd| t $tddtfgtdWdn1s0Y| t tddd d Wdn1s0YdS) N LocalEmployee)rZageZNickrrrrrrZ) r&rzrXrjrrUrrDrrrrOrP)r6rZnickr:r:r;test_namedtuple_keyword_usages   2 z-NamedTupleTests.test_namedtuple_keyword_usagecCstdttttd}||jd||jd|tdddtfgd}||j t||j d||j d||j dtfgdS)Nr&)r7r6typenamefieldsrNrr) r&r]rrzrrUrDrrr7r6rr)r6r&rr:r:r;%test_namedtuple_special_keyword_namessz5NamedTupleTests.test_namedtuple_special_keyword_namescCsZ|ttWdn1s(0Y|ttWdn1sX0Y|t"tddtfgdWdn1s0Y|t tddtfgWdn1s0Y|ttdttdWdn1s0Y|t(tddtfdtfgdWdn1sL0YdS)Nrr_name)rrrr)r)rOrPr&rlrzrrXrRr:r:r;test_namedtuple_errorss & $ 0 . . z&NamedTupleTests.test_namedtuple_errorsc Cstddtfdtfgatt|jfD]}|j|d|dd}ttj dD]2}t ||}t |}| ||| ||qLt|}| ||| ||t|}| ||| ||Wdq"1s0Yq"dS)Nrrr)r7jane%r)r&rzrXrrrsubTestrrrrrrUrjrr)r6r7rrrjane2r:r:r;test_copy_and_pickles       z$NamedTupleTests.test_copy_and_pickleN)rDrErFr&rrrrrrrUrrrrr:r:r:r;r>s   rc@sdeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ dS)TypedDictTestscCstdttd}||t||tj||tj j |ddd}| t |t| |dd| |dd| |jd| |jt| |jtf| |jttd| |jddSNrrrrrrTr'rzrXr<rr?rr=rr=r$rvr]rUrDrErr __total__r6rrr:r:r;test_basics_functional_syntaxs  z,TypedDictTests.test_basics_functional_syntaxcCstdttd}||t||tj||tj j |ddd}| t |t| |dd| |dd| |jd| |jt| |jtf| |jttd| |jddSrrrr:r:r;test_basics_keywords_syntaxs  z*TypedDictTests.test_basics_keywords_syntaxc Cstdttttttd}||jd||j ttttttd|tddddt fgdt hd}||dt||d d||d d||d d||d dt fg||d dt hdS)NTD)r7r6r _typenamerrrNr5rrr7r6rrrr) r'r]rrzrXrrrUrDrrr^)r6rrr:r:r;$test_typeddict_special_keyword_namessz3TypedDictTests.test_typeddict_special_keyword_namescCs|ttWdn1s(0Y|ttWdn1sX0Y|t"tddtfgdWdn1s0Y|ttdttdWdn1s0Y|t"tdttddWdn1s 0YdS)Nrr)rrrr)r)rOrPr'rlrzrXrRr:r:r;test_typeddict_create_errorss & $ 0 , z+TypedDictTests.test_typeddict_create_errorscCs~tdttd}|tjd|ddd}|tti|Wdn1sT0Y|tt||Wdn1s0Y|ttt |Wdn1s0Y|ttdddWdn1s0Y|t"tddtfd gWdn1s00Y|t$tddtfgtd Wdn1sp0YdS) Nrrr?rrZHirr)rrr) r'rzrXrUrErOrPrQr4rrr:r:r;test_typeddict_errorss  ( ( ( * 2 z$TypedDictTests.test_typeddict_errorscCs|tjd|tjt|tjtttd|tjtf|tj d| tt j t ddd}||dd||ddtddd d}||d d dS) NrrWTrrrZrrhir)rUrrDrErrXrzrrrr=r?r$r)r6Z not_originrxr:r:r;test_py36_class_syntax_usages z+TypedDictTests.test_py36_class_syntax_usagecCstdttdatddd}ttjdD]d}t||}t|}| ||| |dddtt|}t|}| |ddd|q*dS)NEmpDrrrr) r'rzrXrrrrrrrU)r6rrrrZZZZEmpDnewr:r:r;r8#s     zTypedDictTests.test_picklecCsFtdttd}|tj|tjd|f|tj|tj |dS)Nrr) r'rzrXrUr?rrrsrr)r6rr:r:r;r0szTypedDictTests.test_optionalcCstddtidd}||i||ddddi||jd||jt||jdh|ti|tddd di|tjd|tjt|tjd d hdS) Nr,rFrrrr)rrr)r'rXrUr__required_keys__r__optional_keys__rrr:r:r; test_total6szTypedDictTests.test_totalcCsBGdddtdd}|jtddgks*J|jtdgks>JdS)Nc@seZdZUeed<dS)z6TypedDictTests.test_optional_keys..Point2Dor3DrNrr:r:r:r; Point2Dor3DEs rFrrrr)rrrr)r6rr:r:r;test_optional_keysDsz!TypedDictTests.test_optional_keyscCsGdddt}Gddd|dd}Gddd|}|jtd gksHJ|jtgksZJ|jd tikslJ|jtd gksJ|jtd d gksJ|jtttd ksJ|jtd d gksJ|jtd d gksJ|jttttdksJdS)Nc@seZdZUeed<dS)z8TypedDictTests.test_keys_inheritance..BaseAnimalrNrr:r:r:r; BaseAnimalLs rc@seZdZUeed<eed<dS)z4TypedDictTests.test_keys_inheritance..AnimalvoicetailN)rDrErFrzrrr:r:r:r;AnimalOs rFrc@seZdZUeed<dS)z1TypedDictTests.test_keys_inheritance..Cat fur_colorNrr:r:r:r;CatSs rrrr)rrrr)rrrr)r'rrrrrzr)r6rrrr:r:r;test_keys_inheritanceKs* z$TypedDictTests.test_keys_inheritanceN)rDrErFrrrrrrr8rrrrr:r:r:r;rs    rc@s,eZdZddZddZddZddZd S) IOTestscCs.ttddd}|jd}||jtfdS)NrcSs|Sr>readlinerr:r:r;rpszIOTests.test_io..stuffr)r)r rrUrur6rrr:r:r;test_ions zIOTests.test_iocCs,ttddd}|jd}||jddS)NrcSs|Sr>rrr:r:r;rxsz"IOTests.test_textio..stuffrr:)r*rzrrUrurr:r:r; test_textiovs zIOTests.test_textiocCs,ttddd}|jd}||jddS)NrcSs|Sr>rrr:r:r;rsz$IOTests.test_binaryio..stuffrr:)r+r{rrUrurr:r:r; test_binaryio~s zIOTests.test_binaryiocCsnddlm}m}m}m}m}||tj||tj||tj|t |t gd||ddS)Nr)r)r*r+r3rDr(z typing.io) Z typing.ior)r*r+r3rDrvr?rUr^)r6r)r*r+r3rDr:r:r;test_io_submodules zIOTests.test_io_submoduleN)rDrErFrrrrr:r:r:r;rlsrc@s<eZdZddZddZddZddZd d Zd d Zd S)RETestscCstdtj}||jt|t|t||t|d}||jt |t|t ||t tt t t ft t t t fdS)Nz[a-z]+z12345abcde.....) rDcompiler|r<rr,r]rjsearchr-rrzr{)r6patZmatr:r:r;rs   zRETests.test_basicscCsP|tttt|tttt|tttt|tttdSr>)rUr,rzrsr{r-rRr:r:r;test_alias_equalityszRETests.test_alias_equalitycCsttttf}|t|tWdn1s80Y|ttdttWdn1sp0Y|t"tttttWdn1s0YdSrM) r-rrzr{rOrPrQr,r4)r6mr:r:r;rYs & , zRETests.test_errorscCst|ttd|tttd|tttd|ttd|tttd|tttddS)Nztyping.Patternztyping.Pattern[str]ztyping.Pattern[bytes]z typing.Matchztyping.Match[str]ztyping.Match[bytes])rUrVr,rzr{r-rRr:r:r;rWs zRETests.test_reprcCs\ddlm}m}m}m}||tj||tj|t|tddg||ddS)Nr)r-r,r3rDr-r,z typing.re) Z typing.rer-r,r3rDrvr?rUr^)r6r-r,r3rDr:r:r;test_re_submodules zRETests.test_re_submodulecCsR|t"}Gdddtj}Wdn1s20Y|t|jddS)Nc@s eZdZdS)z'RETests.test_cannot_subclass..ANrHr:r:r:r;r[sr[z.type 're.Match' is not an acceptable base type)rOrPr?r-rUrz exception)r6exr[r:r:r;r_s  0 zRETests.test_cannot_subclassN) rDrErFrrrYrWrr_r:r:r:r;rs  rc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZddZ ddZddZddZddZd d!Zd"S)#AnnotatedTestscCs<|tttddfd|ttttddfddS)Nrrztyping.Annotated[int, 4, 5]z(typing.Annotated[typing.List[int], 4, 5])rUrVr.rXrrRr:r:r;rWszAnnotatedTests.test_reprcCsJtttdfdf}||ttddf||jd||jtdS)Nrrr)r.rXrU __metadata__rwr^r:r:r;rszAnnotatedTests.test_flattencCstttdf}tttdf}||ttttdf||tjd||tjtt|t|tWdn1s0Y|t|tt fWdn1s0YdS)N my decoration)r) r.rr rXrUrrwrOrPr)r6LLIr:r:r;test_specializes & zAnnotatedTests.test_specializecCs|tttddfttddfhd|ttddfttddf|ttddfttddf|ttdfttddf|ttddfttddfttddfhttddfttddfhdSNrrrrUrr.rXrsrzr rRr:r:r; test_hash_eqs(  &zAnnotatedTests.test_hash_eqcs^Gfdddtdf}|d}d}|||||j|j||j|jdS)Ncs$eZdZdZddZfddZdS)z*AnnotatedTests.test_instantiate..CrcSs ||_dSr>rrar:r:r;rsz3AnnotatedTests.test_instantiate..C.__init__cst|stS|j|jkSr>)rQNotImplementedrrrr:r;__eq__s z1AnnotatedTests.test_instantiate..C.__eq__N)rDrErFclassvarrrr:rr:r;rsr a decorationr)r.rUrr)r6r[rrr:rr;test_instantiates  zAnnotatedTests.test_instantiatecCsNttjtdf}||gdddd||tgdddddS)Nr)rrrrrr)r.r?rOr rUrX)r6ZMyCountr:r:r;test_instantiate_genericsz'AnnotatedTests.test_instantiate_genericcCs>td}|t|dWdn1s00YdS)N)rXrrr)r.rOrPr^r:r:r;test_cannot_instantiate_forward s z.AnnotatedTests.test_cannot_instantiate_forwardcCsBttdf}|t|dWdn1s40YdS)Nrr)r.r rOrPr^r:r:r; test_cannot_instantiate_type_vars  z/AnnotatedTests.test_cannot_instantiate_type_varcCs<|tttdfjWdn1s.0YdS)N)rr)rOrr.r rrRr:r:r;test_cannot_getattr_typevars z*AnnotatedTests.test_cannot_getattr_typevarcCs@Gddd}t|df}||jdd|_||jddS)Nc@seZdZdZdS)z/AnnotatedTests.test_attr_passthrough..CrN)rDrErFrr:r:r:r;rsrrrr)r.rUrr)r6rr[r:r:r;test_attr_passthroughs  z$AnnotatedTests.test_attr_passthroughcCs|tttddfttddfhd|ttddfttddf|ttddfttddf|ttdfttddf|ttddfttddfttddfhttddfttddfhdSrrrRr:r:r;r!s(  &cCs@|td Gdddt}Wdn1s20YdS)NzCannot subclass .*Annotatedc@s eZdZdS)z.AnnotatedTests.test_cannot_subclass..CNrHr:r:r:r;r-sr)ZassertRaisesRegexrPr.rr:r:r;r_+sz#AnnotatedTests.test_cannot_subclasscCs@|t"tdttdfWdn1s20YdS)Nrpositive)rOrPrQr.rXrRr:r:r;test_cannot_check_instance0s z)AnnotatedTests.test_cannot_check_instancecCs@|t"ttttdfWdn1s20YdS)Nr )rOrPr4rXr.rRr:r:r;test_cannot_check_subclass4s z)AnnotatedTests.test_cannot_check_subclassc Cs6tjtjttftjtttdftjtgtfg}|D]t}t |df}t t j dD]T}|j ||d2t ||}t |}|||WdqV1s0YqVq8Gdddttat ttdf}d|_d |_t t j dD]D}t ||} t | }||jd||jd ||jdqdS) N.rr)protocolr]c@seZdZdZdS)_Annotated_test_GrNrNr:r:r:r;rHsrz A decorationrNr=)r?rrrXrzrrrr{r.rrrrrrrUrr rrrr) r6r7rrZprotZpickledZrestoredrcrrr:r:r;r88s*   .  zAnnotatedTests.test_picklecCsd}d}tt|f}||ttt|f||tt|ftt||fttt|f}||tttt|f|t|ttfWdn1s0Y|||tttt||fttjt t f|f}||t tfttjt tf|f|t|tWdn1s80Ytt|f}|t|dWdn1sx0Y|t}|t|dWdn1s0YdS)Nrzanother decoration) r.r rUrXrrOrPr?rr rrz)r6rZdec2r~rr,ZItrr:r:r; test_substVs( " *"& (  ( zAnnotatedTests.test_substcCs0tttdf}||ttttdfdS)Nr)rr.r rUrXrpr:r:r;test_annotated_in_other_typesssz,AnnotatedTests.test_annotated_in_other_typesN)rDrErFrWrrrrrrrrr r_r r r8rrr:r:r:r;rs"     rc@s eZdZdZddZddZdS)AllTestszTests for __all__.cCsddlm}|d||d||d||d|ttdrR|d||d ||d ||d ||d ||d ||d||d|dS)Nr)r3r6 ValuesViewrrAbstractContextManagerriorDosr Textrr)r?r3rrrrr]r:r:r;test_all{s             zAllTests.test_allcs>ddltjfddtD}||dS)Nrcsnh|]f\}}|vsf|ds|jjvr|jjvr|dvr|ds||kst|ddjkr|qS)_>rDr)r Z_contraZ_corEN)rvrr3rDrupperr1rDrZ actual_allr?r:r; s     z3AllTests.test_all_exported_names..)r?r^r3varsrZassertSetEqual)r6Z computed_allr:rr;test_all_exported_namess    z AllTests.test_all_exported_namesN)rDrErF__doc__rrr:r:r:r;rxsr__main__)rrrrDr Zunittestrrrrrrr?rr r r r r rrrrrrrrrrrrrrrrrrr r!r"r$r%r&r'r)r*r+r,r-r.r/r=rEr-rr0r1rGrIrJrKrLrbrhrrrrrzr{rrrr rrrrrrrr#r$r&r'r)rrwr|rrrZ ASYNCIO_TESTSr ImportErrorrrrrrr[r?rrcrrrrrrrrrrrrXrrr+r0errrrrr#rrrrrrrrrrDr:r:r:r;s     *"Y*H\  w9(1W$   * 86`' #<.1