a ze@sddlTddlZddlZddlZddlZddlmZddlmZm Z m Z m Z m Z m Z mZmZmZmZddlmZddlmZmZmZddlmZddlZddlZGdd d eZGd d d ejZGd d d ejZGdddejZGdddejZGdddejZGdddejZ GdddejZ!GdddejZ"GdddejZ#GdddejZ$GdddejZ%Gd d!d!ejZ&Gd"d#d#ejZ'Gd$d%d%ejZ(e)d&kre*dS)')*N)Mock) ClassVarAnyListUnionTupleDictGenericTypeVarOptionalProtocol)get_type_hints)deque OrderedDict namedtuple)total_orderingc@s eZdZdS) CustomErrorN__name__ __module__ __qualname__rrI/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_dataclasses.pyrrc@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`Z2dadbZ3dcddZ4dedfZ5dgdhZ6didjZ7dkdlZ8dmdnZ9dodpZ:dqdrZ;dsdtZdydzZ?d{d|Z@d}d~ZAddZBddZCddZDddZEddZFddZGddZHddZIddZJddZKddZLddZMddZNddZOddZPddZQddZRddZSddZTddZUddZVddZWddZXddZYddZZddZ[ddZ\ddZ]ddZ^ddZ_dS)TestCasecCs0tGddd}|}|tt|ddS)Nc@s eZdZdS)z"TestCase.test_no_fields..CNrrrrrCsrr dataclass assertEquallenfieldsselfrorrrtest_no_fieldsszTestCase.test_no_fieldscCs0tGddd}|}|tt|ddS)Nc@seZdZdZdS)z6TestCase.test_no_fields_but_member_variable..CrN)rrrirrrrr!srrrr"rrr"test_no_fields_but_member_variable sz+TestCase.test_no_fields_but_member_variablecCs,tGddd}|d}||jddS)Nc@seZdZUeed<dS)z-TestCase.test_one_field_no_default..CxNrrrint__annotations__rrrrr)s r*rrr(r"rrrtest_one_field_no_default(sz"TestCase.test_one_field_no_defaultcCsFd}|t|"tGddd}Wdn1s80YdS)Nz/cannot specify both default and default_factoryc@s"eZdZUededZeed<dS)z.Cdefaultdefault_factoryr(N)rrrfieldr*r(r+rrrrr3s r)assertRaisesRegex ValueErrorr)r#msgrrrr(test_field_default_default_factory_error0sz1TestCase.test_field_default_default_factory_errorcCs8tdddd}d|_t|}dtd}|||dS)Nr/TF)r1initrepridz4Field(name='id',type=None,default=1,default_factory=zX,init=True,repr=False,hash=None,compare=True,metadata=mappingproxy({}),_field_type=None))r3namer9MISSINGr)r#Z int_fieldZ repr_outputZexpected_outputrrrtest_field_repr7szTestCase.test_field_reprcCs.tGddd}|dd}||jddS)Nc@seZdZUeed<dS)z*TestCase.test_named_init_params..Cr(Nr)rrrrrDs r r(r-r"rrrtest_named_init_paramsCs zTestCase.test_named_init_paramscCstGddd}|d}||j|jfd|td"tGddd}Wdn1sb0Y|td6tGddd}tGd dd|}Wdn1s0Y|td6tGd dd}tGd dd|}Wdn1s0YdS) Nc@s"eZdZUeed<dZeed<dS)/TestCase.test_two_fields_one_default..Cr(ryNrrrr*r+rBrrrrrLs r)rDrz1non-default argument 'y' follows default argumentc@s"eZdZUdZeed<eed<dS)rArr(rBNrrrr(r*r+rrrrrXs  c@seZdZUdZeed<dS)/TestCase.test_two_fields_one_default..Brr(NrErrrrBas rGc@seZdZUeed<dS)rArBNr)rrrrres c@seZdZUeed<eed<dS)rFr(rBNr)rrrrrGns c@seZdZUdZeed<dS)rArr(NrErrrrrss )rrr(rBr4 TypeError)r#rr$rGrrrtest_two_fields_one_defaultKs..0z$TestCase.test_two_fields_one_defaultcCstddGddd}|t|ddtddGddd}|t|dtd|td (tdd Gd dd}Wdn1s0Ytdd Gd dd}|t|d td|td (tdd Gddd}Wdn1s 0YdS)NTfrozenc@seZdZUeed<ddZdS)'TestCase.test_overwrite_hash..Cr(cSsdSN-rr#rrr__hash__}s0TestCase.test_overwrite_hash..C.__hash__N)rrrr*r+rPrrrrrzs rdrNc@seZdZUeed<ddZdS)rLr(cSsdSNFrr#otherrrr__eq__s.TestCase.test_overwrite_hash..C.__eq__Nrrrr*r+rVrrrrrs )rR#Cannot overwrite attribute __hash__ unsafe_hashc@seZdZddZdS)rLcSsdSNrrOrrrrPsrQNrrrrPrrrrrsc@seZdZUeed<ddZdS)rLr(cSsdSr\rrOrrrrVsrWNrXrrrrrs  )r^c@s&eZdZUeed<ddZddZdS)rLr(cSsdSr\rrOrrrrVsrWcSsdSr\rrOrrrrPsrQN)rrrr*r+rVrPrrrrrs )rrhashr4rHr#rrrrtest_overwrite_hashws&.zTestCase.test_overwrite_hashcCsptGddd}tGddd|}|}|t|d|}|t|d|dd}|t|d dS) Nc@s&eZdZUdZeed<dZeed<dS)z=TestCase.test_overwrite_fields_in_derived_class..Baseg.@r(rrBN)rrrr(rr+rBr*rrrrBases  rbc@s&eZdZUdZeed<dZeed<dS)z;TestCase.test_overwrite_fields_in_derived_class..C1r^zr(N)rrrrcr*r+r(rrrrC1s  rezJTestCase.test_overwrite_fields_in_derived_class..Base(x=15.0, y=0)zLTestCase.test_overwrite_fields_in_derived_class..C1(x=15, y=0, z=10)r?zKTestCase.test_overwrite_fields_in_derived_class..C1(x=5, y=0, z=10)rrr9)r#rbrer$rrr&test_overwrite_fields_in_derived_classs z/TestCase.test_overwrite_fields_in_derived_classcCstGddd}|d}||jdt|j}tt|j}| d|tGddd}t|j}tt|j}|d|dS)Nc@seZdZUeed<dS))TestCase.test_field_named_self..Cr#Nrrrstrr+rrrrrs rfoor#c@seZdZUeed<dS)riZselfxNrjrrrrrs ) rrr#inspect signature__init__nextiter parametersassertNotEqual)r#rcsigfirstrrrtest_field_named_selfs   zTestCase.test_field_named_selfcCs,tGddd}|d}||jddS)Nc@seZdZUeed<dS)z+TestCase.test_field_named_object..CobjectNrjrrrrrs rrlrrrxr#rrtrrrtest_field_named_objectsz TestCase.test_field_named_objectcCs2tddGddd}|d}||jddS)NTrJc@seZdZUeed<dS)z2TestCase.test_field_named_object_frozen..CrxNrjrrrrrs rrlryrzrrrtest_field_named_object_frozensz'TestCase.test_field_named_object_frozencsnhdtfddtjD}dd|D}td|}|dd|D}|D]}|t|||qRdS)N>FalseTrueNonec3s$|]}|ds|vr|VqdS__N startswith.0bZ exclusionsrr sz9TestCase.test_field_named_like_builtin..cSsg|] }|tfqSrrkrr;rrr rz:TestCase.test_field_named_like_builtin..rcSsg|]}|qSrrrrrrrrsortedbuiltins__dict__keysmake_dataclassrgetattrr#Zbuiltins_namesZ attributesrrtr;rrrtest_field_named_like_builtins  z&TestCase.test_field_named_like_builtincsrhdtfddtjD}dd|D}td|dd}|d d|D}|D]}|t|||qVdS) N>r}r~rc3s$|]}|ds|vr|VqdSrrrrrrrsz@TestCase.test_field_named_like_builtin_frozen..cSsg|] }|tfqSrrrrrrrrzATestCase.test_field_named_like_builtin_frozen..rTrJcSsg|]}|qSrrrrrrrrrrrrr$test_field_named_like_builtin_frozens z-TestCase.test_field_named_like_builtin_frozenc CsTtGddd}tddGddd}||fD]}|j|d|||tdd d d d d d d gD]\}}|j|d \|td|jd|jd|||Wdn1s0YWdqt1s0YqtWdq21s 0Yq2tddGddd}||||||dS)Nc@s eZdZdS)z)TestCase.test_0_field_compare..C0NrrrrrC0 srForderc@s eZdZdS)z)TestCase.test_0_field_compare..C1NrrrrrresreclscSs||kSr\rarrrrrz/TestCase.test_0_field_compare..cSs||kSr\rrrrrrrcSs||kSr\rrrrrrrcSs||kSr\rrrrrrridx$not supported between instances of '' and ''Tc@s eZdZdS)z(TestCase.test_0_field_compare..CNrrrrrrsr) rsubTestr enumerater4rHrassertLessEqualassertGreaterEqualr#rrerrfnrrrrtest_0_field_compare s* nzTestCase.test_0_field_comparec CstGddd}tddGddd}||fD]}|j|d||d|d||d |dtd d d d d d dd gD]\}}|j|d`|td|jd|jd"||d |d Wdn1s0YWdq1s 0YqWdq21s,0Yq2tddGddd}||d |d| |d |d| |d|d| |d|d | |d|d | |d|ddS)Nc@seZdZUeed<dS)z)TestCase.test_1_field_compare..C0r(Nr)rrrrr's rFrc@seZdZUeed<dS)z)TestCase.test_1_field_compare..C1r(Nr)rrrrre+s rerr/rcSs||kSr\rrrrrr3rz/TestCase.test_1_field_compare..cSs||kSr\rrrrrr4rcSs||kSr\rrrrrr5rcSs||kSr\rrrrrr6rrrrrTc@seZdZUeed<dS)z(TestCase.test_1_field_compare..Cr(Nr)rrrrr<s r) rrrrsrr4rHr assertLessr assertGreaterrrrrrtest_1_field_compare%s4tzTestCase.test_1_field_comparec CsTtGddd}tddGddd}||fD]B}|j|d||dd|dd||d d |d d ||d d|dd||d d|d d td d d d dd dd gD]\}}|j|df|td|jd|jd&||dd|ddWdn1s*0YWdq1sJ0YqWdq21sl0Yq2tddGddd}tdd dd dd gD]T\}}|j|d,|||dd|ddWdn1s0Yqtdd dd dd gD]\}}|j|dd|||dd|dd |||dd |d d|||d d|d d Wdn1s0Yqtdd dd dd gD]\}}|j|dd|||dd |dd|||d d|dd |||d d |d dWdn1sB0YqdS) Nc@seZdZUeed<eed<dS)z(TestCase.test_simple_compare..C0r(rBNr)rrrrrHs rFrc@seZdZUeed<eed<dS)z(TestCase.test_simple_compare..C1r(rBNr)rrrrreMs rerrr/cSs||kSr\rrrrrrXrz.TestCase.test_simple_compare..cSs||kSr\rrrrrrYrcSs||kSr\rrrrrrZrcSs||kSr\rrrrrr[rrrrrTc@seZdZUeed<eed<dS)z'TestCase.test_simple_compare..Cr(rBNr)rrrrras rcSs||kSr\rrrrrrfrcSs||kSr\rrrrrrgrcSs||kSr\rrrrrrhrcSs||kSr\rrrrrrlrcSs||kSr\rrrrrrmrcSs||kSr\rrrrrrnrcSs||kSr\rrrrrrtrcSs||kSr\rrrrrrurcSs||kSr\rrrrrrvr) rrrrsrr4rHr assertTruerrrrtest_simple_compareFsXz@@zTestCase.test_simple_comparec Cs2tGddd}tGddd|}tdddfddd fgD]R\}\}}|j|d *|||d |d |WdqB1s0YqBtd dd dddddgD]v\}}|j|d P|td"||d |d Wdn1s0YWdq1s"0YqdS)Nc@seZdZUeed<dS)z+TestCase.test_compare_subclasses..Br&Nr)rrrrrGs rGc@s eZdZdS)z+TestCase.test_compare_subclasses..CNrrrrrrsrcSs||kSr\rrrrrrrz2TestCase.test_compare_subclasses..FcSs||kSr\rrrrrrrTrrcSs||kSr\rrrrrrrcSs||kSr\rrrrrrrcSs||kSr\rrrrrrrcSs||kSr\rrrrrrrz.not supported between instances of 'B' and 'C')rrrrr4rH)r#rGrrrexpectedrrrtest_compare_subclasses|s&  :z TestCase.test_compare_subclassesc CsdD]\}}}|j||dp|dkrt|td*t||dGddd}Wdn1sf0Ynt||dGddd}|dkr|d |j|d |j|d |j|d |j|d |jn|dkr0|d |j|d |j|d |j|d |j|d |jnR|dkr|d |j|d |j|d |j|d |j|d |jnWdq1s0YqdS)N))FFneither)FT exception)TFeq_only)TTboth)eqrrz eq must be true if order is truec@s eZdZdSz!TestCase.test_eq_order..CNrrrrrrsrc@s eZdZdSrrrrrrrsrrV__lt____le____gt____ge__rr)rr4r5r assertNotInrassertIn)r#rrresultrrrr test_eq_orders6 2   zTestCase.test_eq_ordercCsZtGddd}||djd|td|Wdn1sL0YdS)Nc@seZdZUeZeed<dS)z)TestCase.test_field_no_default..Cr(Nrrrr3r(r*r+rrrrrs rrf8__init__\(\) missing 1 required positional argument: 'x')rrr(r4rHr`rrrtest_field_no_defaultszTestCase.test_field_no_defaultcsfttGfddd}||j|d}||jd|`||j||jdS)Ncs eZdZUedZeed<dS)z&TestCase.test_field_default..Cr1r(N)rrrr3r(rxr+rrrrrs rr^)rxrassertIsr(rrzrrrtest_field_defaultszTestCase.test_field_defaultcCstGddd}|t|Wdn1s80Y|d}|t|dtGddd}|dd}|t|ddS)Nc@s eZdZUeddZeed<dS)$TestCase.test_not_in_repr..CFr9r(Nrrrrrrs rr^z&TestCase.test_not_in_repr..C()c@s(eZdZUeddZeed<eed<dS)rFrr(rBNrrrrrrs z*TestCase.test_not_in_repr..C(y=20))r assertRaisesrHrr9rzrrrtest_not_in_reprs $ zTestCase.test_not_in_reprcCsptGddd}|||dd||dd|dd||d|dd||dd|dddS) Nc@s.eZdZUdZeed<edddZeed<dS)z'TestCase.test_not_in_compare..Crr(F)comparer1rBN)rrrr(r*r+r3rBrrrrrs  rrrr/r^rDrrrrsr`rrrtest_not_in_compares zTestCase.test_not_in_comparec sdD]\}|jdrtddGfddd}|dkr^|t|dtd n"|d kr|t|dtd nWdq1s0YqdS) N))TFr3)TTr3)FFabsent)FTr)NFr)NTr3)r_rTrZcs$eZdZUeddZeed<dS)z)TestCase.test_hash_field_rules..Crf)rr_r1r(NrrrZhash_rrrs rr3rf)rfrr)rrrr_)r#rrrrrtest_hash_field_rulesszTestCase.test_hash_field_rulescCsftGddd}|d|jtGddd}|d|dj|t|ddddd dS) Nc@s eZdZUeddZeed<dS).TestCase.test_init_false_no_default..CFr8r(Nrrrrrrs rr(c@s@eZdZUeed<dZeed<eddZeed<dZeed<d S) rr(rrBFrrcr^tN) rrrr*r+rBr3rcrrrrrrs  rcrrfr^)rr(rB)rrrrvarsr`rrrtest_init_false_no_defaultsz#TestCase.test_init_false_no_defaultcCs`tGddd}t|}||t|D]$}|t|t||j|j q*| t |d| |djd| |djt | t|d||dj||dj| |djd| |djt|t|d| |dj||dj| |djd | |djt| t|d ||dj| |djdS) Nc@s<eZdZUeed<edddZeed<eddZeed<dS)z%TestCase.test_class_marker..Cr(FNr8r1rBrrc) rrrr*r+r3rBrkrcrrrrr#s rrDrr(r/rBrrc)rr!assertIsInstancetuplertypeZFieldrr;r+rr r* assertFalsehasattrrr8r9rk assertIsNoner)r#rZ the_fieldsfrrrtest_class_marker"s. zTestCase.test_class_markercCstGddd}tGddd|}|ddt|DgdtGdd d |}|d dt|Dgd tGd d d |}|ddt|DgddS)Nc@s2eZdZUdZeed<dZeed<dZeed<dS)z$TestCase.test_field_order..BB:arB:brB:crtN)rrrrrkr+rrtrrrrrGDs   rGc@seZdZUdZeed<dS)z$TestCase.test_field_order..CC:brN)rrrrrkr+rrrrrJs rcSsg|]}|j|jfqSrr;r1rrrrrrNrz-TestCase.test_field_order..)rr)rr)rtrc@seZdZUdZeed<dS)z$TestCase.test_field_order..DD:crtN)rrrrtrkr+rrrrDSs rcSsg|]}|j|jfqSrrrrrrrWr)rrrrtrc@s&eZdZUdZeed<dZeed<dS)z$TestCase.test_field_order..EE:arE:ddN)rrrrrkr+rrrrrE\s  rcSsg|]}|j|jfqSrrrrrrrar))rrrr)rrrrr!)r#rGrrrrrrtest_field_orderCs"zTestCase.test_field_ordercs\ttGfddd}|t|d|t|d||j||jddS)NcsFeZdZUeed<eddZeed<Zeed<eddZ eed<d S) z$TestCase.test_class_attrs..Cr(FrrBrcrRrrN) rrrr*r+r3rBrcrxrrrrrrks  rr(rBrR)rxrrrrrcrrr`rrrtest_class_attrsgszTestCase.test_class_attrsc stgdgftiddiftttdgffD]V\|jd,|tdd(tGfddd}Wdn1s0Y|tdd(tGfd dd}Wdn1s0YGd d d |td (tGfd dd}Wdn1s*0YtGfddd}tGfddd}Wdq*1sx0Yq*dS)Nr/rtypzmutable default z for field x is not allowedcseZdZUZed<dS)8TestCase.test_disallowed_mutable_defaults..Pointr(N)rrrr(r+r)emptyrrrPoints rz for field y is not allowedcseZdZUZed<dS)rrBN)rrrrBr+r) non_emptyrrrrs c@s eZdZdS)z;TestCase.test_disallowed_mutable_defaults..SubclassNrrrrrSubclassrrz7mutable default .*Subclass'> for field z is not allowedcseZdZUZed<dS)rrcN)rrrrcr+rrrrrrs cs eZdZUZeed<dS)4TestCase.test_disallowed_mutable_defaults..CrcN)rrrrcrr+rrrrrs rcs eZdZUZeed<dS)rr(N)rrrr(rr+rrrrrs )listdictsetrr4r5rr#rrr)rrrrr test_disallowed_mutable_defaultsws2   4 46z)TestCase.test_disallowed_mutable_defaultscsGdddtGfddd}}||}||}||||jjddg|||||jjddg||j|jdS)Nc@seZdZddZdS)z.MutablecSs g|_dSr\lrOrrrroszETestCase.test_deliberately_mutable_defaults..Mutable.__init__NrrrrorrrrMutablesrcseZdZUed<dS)z6TestCase.test_deliberately_mutable_defaults..Cr(Nrrrr+rrrrrs rr/r)rrr(rextendr)r#rlstZo1Zo2rrr"test_deliberately_mutable_defaultss  z+TestCase.test_deliberately_mutable_defaultscCs*tGddd}||djddS)Nc@seZdZUeed<dS)z#TestCase.test_no_options..Cr(Nr)rrrrrs rr,r-r`rrrtest_no_optionsszTestCase.test_no_optionscCsRtGddd}||dddtGddd}||dd|dddS) Nc@seZdZUeed<eed<dS)z&TestCase.test_not_tuple..Pointr(rBNr)rrrrrs rr/rr/rc@seZdZUeed<eed<dS)z"TestCase.test_not_tuple..Cr(rBNr)rrrrrs rrD)rrsrrrrtest_not_tuples zTestCase.test_not_tuplecCstGddd}tGddd}||ddd|ddd||dd dd |td "|d d d\}}}Wdn1s0YtGddd}||ddd|dS)Nc@s&eZdZUeed<eed<eed<dS)z2TestCase.test_not_other_dataclass..Point3Dr(rBrcNr)rrrrPoint3Ds r c@s&eZdZUeed<eed<eed<dS)z/TestCase.test_not_other_dataclass..DateZyearZmonthZdayNr)rrrrDates r irDr/r)r/rrDunpackrrfc@s2eZdZUdZeed<dZeed<dZeed<dS)z4TestCase.test_not_other_dataclass..Point3Dv1rr(rBrcN)rrrr(r*r+rBrcrrrr Point3Dv1s   rr)rrsr4rH)r#r r r(rBrcrrrrtest_not_other_dataclasss0z!TestCase.test_not_other_dataclasscsnGdddfdd}tGfddd}||tdddGfd dd}||dS) Nc@s eZdZdS)z-TestCase.test_function_annotations..FNrrrrrFsrcs|jdt|jdt|jd|jdt|jdtt|j} |j dt |j }t|}|jdt|}|jd |jt|jtjj|jtjjt|}|jd |jt|jtjj|jtjjt|}|jd |j|jtjjt|}|jd |jt|jtjjtt|dS)Nr&jkrrcr#)rr+r*rkfloatcomplexrmrnrorZreturn_annotationrqrrvaluesrpr; annotationr1Z ParameterrkindZPOSITIONAL_OR_KEYWORDr StopIteration)rrnparamsZparam)rr#rrvalidate_classs: z:TestCase.test_function_annotations..validate_classcsPeZdZUeed<eed<Zed<eddZe ed<eddd Z e ed <dS z-TestCase.test_function_annotations..Cr&rrNrry@@Fr1r8rc rrrr*r+rkrr3rrrcrrrrrrr s  rT)rKr[csPeZdZUeed<eed<Zed<eddZe ed<eddd Z e ed <dSrrrr rrr+s  )r)r#rrr)rrr#rtest_function_annotationss+ z"TestCase.test_function_annotationscCstGddd}|td|Wdn1s:0Y|d|jtGddd}|td|Wdn1s0Y|d|jdS)Nc@s eZdZUeedZeed<dS)z(TestCase.test_missing_default..Crr(Nrrrr3r<r(r*r+rrrrr8s r3__init__\(\) missing 1 required positional argumentr(c@seZdZUeed<dS)z(TestCase.test_missing_default..Dr(Nr)rrrrrAs rrr4rHrrr#rrrrrtest_missing_default5s$$zTestCase.test_missing_defaultcCstGddd}|td|Wdn1s:0Y|d|jtGddd}|td|Wdn1s0Y|d|jdS)Nc@s eZdZUeedZeed<dS)z0TestCase.test_missing_default_factory..Cr2r(Nr"rrrrrNs rr#r(c@s"eZdZUeeedZeed<dS)z0TestCase.test_missing_default_factory..Dr0r(Nr"rrrrrWs rr$r%rrrtest_missing_default_factoryJs$$z%TestCase.test_missing_default_factorycCs|dttdS)NzMISSING_TYPE object)rr9r<rOrrrtest_missing_repr`szTestCase.test_missing_reprcCsbtGddd}|t|jdg||dd||djd||djddS)Nc@s6eZdZUeed<edddZeedddZdS)z7TestCase.test_dont_include_other_annotations..Cr&)returncSsdSNrrrOrrrrlgsz;TestCase.test_dont_include_other_annotations..C.foocSsdSNrfrrOrrrbarisz;TestCase.test_dont_include_other_annotations..C.barN)rrrr*r+rlpropertyr-rrrrrds rr&r^rrf)rrrr+rlr-r&r`rrr#test_dont_include_other_annotationscs z,TestCase.test_dont_include_other_annotationscCs,tGddd}|t|Wdn1s80YtGddd}|t|Wdn1sz0Y|dtddGddd}|tGddd}||jd ||d jd td d Gddd}|t|Wdn1s0YdS)Nc@seZdZddZdS)"TestCase.test_post_init..CcSs tdSr\rrOrrr __post_init__us0TestCase.test_post_init..C.__post_init__Nrrrr2rrrrrssrc@s"eZdZUdZeed<ddZdS)r0r^r&cSs|jdkrtdSNr^)r&rrOrrrr2}s r3N)rrrr&r*r+r2rrrrrzs  rfFrc@seZdZddZdS)r0cSs tdSr\r1rOrrrr2sr3Nr4rrrrrsc@s"eZdZUdZeed<ddZdS)r0rr(cSs|jd9_dSNrr?rOrrrr2sr3Nrrrr(r*r+r2rrrrrs  rrrTrJc@s"eZdZUdZeed<ddZdS)r0rr(cSs|jd9_dSr6r?rOrrrr2sr3Nr7rrrrrs  )rrrrr(FrozenInstanceErrorr`rrrtest_post_initqs( $ $ zTestCase.test_post_initcCsGddd}tGddd|}||jdtGddd|}|t|Wdn1sl0YtGddd|}|t|Wdn1s0YdS)Nc@seZdZddZdS)z(TestCase.test_post_init_super..BcSs tdSr\r1rOrrrr2sz6TestCase.test_post_init_super..B.__post_init__Nr4rrrrrGsrGc@seZdZddZdS)(TestCase.test_post_init_super..CcSs d|_dSr,r?rOrrrr2s6TestCase.test_post_init_super..C.__post_init__Nr4rrrrrsrrfcseZdZfddZZS)r:cstdSr\)superr2rO __class__rrr2sr;)rrrr2 __classcell__rrr=rrsc@s eZdZdS)r:Nrrrrrrs)rrr(rrr#rGrrrrtest_post_init_supers $ zTestCase.test_post_init_supercsPdtGfddd}||dd}||j|jfd|dS)NFcs.eZdZUeed<eed<efddZdS)z/TestCase.test_post_init_staticmethod..Cr(rBcsddSNTrrflagrrr2sz=TestCase.test_post_init_staticmethod..C.__post_init__N)rrrr*r+ staticmethodr2rrCrrrs rrDrrDr)rrrr(rBrrzrrCrtest_post_init_staticmethods  z$TestCase.test_post_init_staticmethodcCsLtGddd}||j|dd}||j|jfd||jdS)Nc@s.eZdZUdZeed<eed<eddZdS)z.TestCase.test_post_init_classmethod..CFr(rBcSs d|_dSrBrCrrrrr2sz.C.__post_init__N)rrrrDr*r+ classmethodr2rrrrrs rrDrrF)rrrDrr(rBrrzrrrtest_post_init_classmethods   z#TestCase.test_post_init_classmethodcCstGddd}|d}|t|d|tt|d|t|jd||jd||jd||jd ||j d |jd 7_||jd |d }||j |j fd||jd ||jd||jd ||j d dS)Nc@s^eZdZUeed<dZeed<dZeeed<dZeeed<dZ eeed <d Z eed <d S) z"TestCase.test_class_var..Cr(r^rBrcw rsN) rrrr*r+rBrcrrLrrOrrrrrs  rrfz-TestCase.test_class_var..C(x=5, y=10)rrrJrKrMrNr/rrr^) rrr9r r!r+rcrLrrOr(rBrzrrrtest_class_vars$zTestCase.test_class_varcCs$tGddd}|d|jdS)Nc@seZdZUeeed<dS)z-TestCase.test_class_var_no_default..Cr(N)rrrrr*r+rrrrrs rr(rrrr`rrrtest_class_var_no_defaultsz"TestCase.test_class_var_no_defaultcCsP|td0tGddd}|d|jWdn1sB0YdS)Ncannot have a default factoryc@s$eZdZUeedZeeed<dS)z2TestCase.test_class_var_default_factory..Cr'r(Nrrrr3r*r(rr+rrrrrs rr(r4rHrrrr`rrrtest_class_var_default_factorys z'TestCase.test_class_var_default_factorycCsDtGddd}||jdtGddd}||jddS)Nc@seZdZUdZeeed<dS)/TestCase.test_class_var_with_default..Cr^r(N)rrrr(rr*r+rrrrrs rr^c@s$eZdZUeddZeeed<dS)rYr^rr(N)rrrr3r(rr*r+rrrrrs r-r`rrrtest_class_var_with_default s z$TestCase.test_class_var_with_defaultcCstddGddd}|d}|t|dd|tt|d|t|jd||jd||jd ||jd |jd 7_||jd |d }||j |j fd||jd ||jd ||jd dS)NTrJc@sReZdZUeed<dZeed<dZeeed<dZeeed<dZ eeed <d S) z)TestCase.test_class_var_frozen..Cr(r^rBrJrcrKrLrMrN) rrrr*r+rBrcrrLrrrrrrs  rrfz4TestCase.test_class_var_frozen..C(x=5, y=10)rrJrKrMr/rPrrQ) rrr9r r!r+rcrLrr(rBrzrrrtest_class_var_frozens zTestCase.test_class_var_frozencCs$tGddd}|d|jdS)Nc@seZdZUeeed<dS)z,TestCase.test_init_var_no_default..Cr(N)rrrInitVarr*r+rrrrr6s rr(rSr`rrrtest_init_var_no_default4sz!TestCase.test_init_var_no_defaultcCsP|td0tGddd}|d|jWdn1sB0YdS)NrUc@s$eZdZUeedZeeed<dS)z1TestCase.test_init_var_default_factory..Cr'r(N)rrrr3r*r(r\r+rrrrrAs rr(rWr`rrrtest_init_var_default_factory<s z&TestCase.test_init_var_default_factorycCsDtGddd}||jdtGddd}||jddS)Nc@seZdZUdZeeed<dS).TestCase.test_init_var_with_default..Cr^r(N)rrrr(r\r*r+rrrrrIs rr^c@s$eZdZUeddZeeed<dS)r_r^rr(N)rrrr3r(r\r*r+rrrrrNs r-r`rrrtest_init_var_with_defaultGs z#TestCase.test_init_var_with_defaultcCs.tGddd}|dd}||jddS)Nc@s2eZdZUdZeed<dZeeed<ddZdS)z!TestCase.test_init_var..CNr( init_paramcSs|jdur|d|_dSr6r?)r#rarrrr2Ys z/TestCase.test_init_var..C.__post_init__) rrrr(r*r+rar\r2rrrrrTs  rr^)rarr-rzrrr test_init_varSs zTestCase.test_init_varcCsB|ttjt|tttd|ttttddS)Ndataclasses.InitVar[int]z%dataclasses.InitVar[typing.List[int]])rr\r*rr9rrOrrrtest_init_var_preserve_type`s z$TestCase.test_init_var_preserve_typecCsltGddd}|dd}|t|dditGddd|}|ddd d }|t|d d d dS)Nc@s"eZdZUeed<eeed<dS)z0TestCase.test_init_var_inheritance..Baser( init_baseN)rrrr*r+r\rrrrrbls rbrr^r(c@s*eZdZUeed<eeed<ddZdS)z-TestCase.test_init_var_inheritance..CrB init_derivedcSs|j||_|j||_dSr\r(rB)r#rerfrrrr2{s z;TestCase.test_init_var_inheritance..C.__post_init__Nrrrr*r+r\r2rrrrrvs  r 23erg)rrr)r#rbrrrtrrrtest_init_var_inheritancehs z"TestCase.test_init_var_inheritancecstGddd}|d}|d}||jd||jg|||||j|j|t|ddgddgfgtGfddd}|d}|d}||jd||jg|||||j|j|t|ddgddgftGddd}|t|d||jgtd d Gd dd}|t|gf|t|td tGd dd}|t|gftGddd}|||dgdS)Nc@s(eZdZUeed<eedZeed<dS)(TestCase.test_default_factory..Cr(r'rBN)rrrr*r+r3rrBrrrrrs rrDrfr/cs0eZdZUeed<efdddZeed<dS)ror(csSr\rrrrrrrz1TestCase.test_default_factory..C.r'rBN)rrrr*r+r3rBrrrrrrs c@s"eZdZUeeddZeed<dS)roF)r2r9r(Nrrrr3rr(r+rrrrrs z*TestCase.test_default_factory..C()TrZc@s"eZdZUeeddZeed<dS)roF)r2r_r(Nrprrrrrs rc@s"eZdZUeeddZeed<dS)roFr2r8r(Nrprrrrrs c@s"eZdZUeeddZeed<dS)roF)r2rr(Nrprrrrrs ) rrr(rB assertIsNotastuplerr9r_)r#rZc0c1rrrtest_default_factorysB  zTestCase.test_default_factorycsLttGfddd}|j|jd|j|jddS)Ncs"eZdZUeddZeed<dS)z5TestCase.test_default_factory_with_no_init..CFrqr(N)rrrr3r(rr+rfactoryrrrs rr/rrrr(r call_countr`rrvr!test_default_factory_with_no_initsz*TestCase.test_default_factory_with_no_initcslttGfddd}|j|jd||djd|jd|j|jddS)Ncs eZdZUedZeed<dS)zBTestCase.test_default_factory_not_called_if_value_given..Cr'r(Nrrrvrrrs rr/r^rrxr`rrvr.test_default_factory_not_called_if_value_givensz7TestCase.test_default_factory_not_called_if_value_givencCs~tGddd}tGddd|}||ji||ji||jdtGddd|}||jidS)Nc@s eZdZUeedZeed<dS)z2TestCase.test_default_factory_derived..Foor'r(N)rrrr3rr(r+rrrrFoos r|c@seZdZUdZeed<dS)z2TestCase.test_default_factory_derived..Barr/rBNrrrrBr*r+rrrrBars r~r/c@s eZdZdS)z2TestCase.test_default_factory_derived..BazNrrrrrBazsr)rrr(rB)r#r|r~rrrrtest_default_factory_derivedsz%TestCase.test_default_factory_derivedcCstGddd}Gddd|}tGddd|}|dd}||j|jfd |td |jWdn1s|0YGd d d |}|d d}||j|jfddS)Nc@seZdZUeed<dS)z3TestCase.test_intermediate_non_dataclass..Ar(Nr)rrrrAs rc@seZdZUeed<dS)z3TestCase.test_intermediate_non_dataclass..BrBNr)rrrrrGs rGc@seZdZUeed<dS)z3TestCase.test_intermediate_non_dataclass..CrcNr)rrrrrs rr/rD)r/rDzobject has no attributec@seZdZUeed<dS)z3TestCase.test_intermediate_non_dataclass..DrNr)rrrrrs rrrf)rrf)rrr(rcr4AttributeErrorrB)r#rrGrrtrrrrrtest_intermediate_non_dataclasss $ z(TestCase.test_intermediate_non_dataclasscCsB|td"tGddd}Wdn1s40YdS)NrUc@s$eZdZUeedZeeed<dS)z1TestCase.test_classvar_default_factory..Cr'r(NrVrrrrrs rr4rHrr`rrrtest_classvar_default_factory s z&TestCase.test_classvar_default_factorycsGddd}|td|tt|t||t|tGdddtGfddd}d}||d }|t|t||t|j|t|j|t|jdS) Nc@s eZdZdS)z0TestCase.test_is_dataclass..NotDataClassNrrrrr NotDataClasssrrc@seZdZUeed<dS)z%TestCase.test_is_dataclass..Cr(Nr)rrrrrs rcseZdZUed<eed<dS)z%TestCase.test_is_dataclass..DreNrrrr+r*rrrrrs rr^r)r is_dataclassr*rrr(rr)r#rrrtrrrrtest_is_dataclasss  zTestCase.test_is_dataclassc Cs*Gddd}|t||}Gddd}|}g|_||fD]}|j|d|t||tdt|Wdn1s0Y|tdt|Wdn1s0Y|tdt|ddWdn1s0YWdqD1s0YqDdS) Nc@seZdZddZdS)zATestCase.test_is_dataclass_when_getattr_always_returns..AcSsdSNrr)r#keyrrr __getattr__0szMTestCase.test_is_dataclass_when_getattr_always_returns..A.__getattr__N)rrrrrrrrr/src@s eZdZdS)zATestCase.test_is_dataclass_when_getattr_always_returns..BNrrrrrrG6srG)objz'should be called on dataclass instancesrr?) rrZ__dataclass_fields__rr4rHasdictrsreplace)r#rrrGrrrrr-test_is_dataclass_when_getattr_always_returns-s &&z6TestCase.test_is_dataclass_when_getattr_always_returnscCs0tGddd}|t|t|dddS)Nc@seZdZUeed<eed<dS)z:TestCase.test_helper_fields_with_class_instance..Cr(rBN)rrrr*r+rrrrrrJs rrgrr`rrr&test_helper_fields_with_class_instanceGsz/TestCase.test_helper_fields_with_class_instancecCs|tdtdWdn1s*0YGddd}|tdt|Wdn1sl0Y|tdt|Wdn1s0YdS)Nzdataclass type or instancerc@s eZdZdS)z0TestCase.test_helper_fields_exception..CNrrrrrrWrr)r4rHr!r`rrrtest_helper_fields_exceptionQs&&z%TestCase.test_helper_fields_exceptioncCstGddd}|dd}|t|ddd|t|t||t|t|d|_|t|ddd|tt|tdS)Nc@seZdZUeed<eed<dS)z&TestCase.test_helper_asdict..Cr(rBNr)rrrrr_s rr/rrgr,)rrrrrr(rrrrzrrrtest_helper_asdict]s zTestCase.test_helper_asdictcCs~tGddd}|tdt|Wdn1s<0Y|tdttWdn1sp0YdS)Nc@seZdZUeed<eed<dS)z8TestCase.test_helper_asdict_raises_on_classes..Cr(rBNr)rrrrrns rdataclass instance)rr4rHrr*r`rrr$test_helper_asdict_raises_on_classesls &z-TestCase.test_helper_asdict_raises_on_classescCsxtGddd}g}|d|}t|}||d|||d||d}t|}|dd||jgdS)Nc@s,eZdZUeed<eedZeeed<dS)z2TestCase.test_helper_asdict_copy_values..Cr(r'rBN rrrr*r+r3rrBrrrrrrxs rr/rB)rrrrrappendrB)r#rinitialrtrrrrtest_helper_asdict_copy_valuesws z'TestCase.test_helper_asdict_copy_valuescstGdddtGfddd}|ddd}t|}||ddddd |t|t|d |j_|t|ddd dd dS) Nc@seZdZUeed<eed<dS)z2TestCase.test_helper_asdict_nested..UserIdtokengroupNr)rrrrUserIds rcseZdZUeed<ed<dS)z0TestCase.test_helper_asdict_nested..Userr;r:NrjrrrrUsers rJoe{r/)rrr;r:r)rrrrrr:r)r#rurrrrtest_helper_asdict_nesteds z"TestCase.test_helper_asdict_nestedc s tGdddtGfddd}tGfddd}tGfddd}d d }d d }|d ||g}|d ||f}|d ||d}|t|d d d dd d dgd|t|d d d dd d dfd|t|d d d dd d ddddS)Nc@seZdZUeed<eed<dS)z.Userr;r:Nrrrrkr+r*rrrrrs rcs"eZdZUeed<eed<dS)zATestCase.test_helper_asdict_builtin_containers..GroupListr:usersNrrrr*r+rrrrr GroupLists rcs&eZdZUeed<edfed<dS)zBTestCase.test_helper_asdict_builtin_containers..GroupTupler:.rNrrrr*r+rrrrr GroupTuples rcs&eZdZUeed<eefed<dS)zATestCase.test_helper_asdict_builtin_containers..GroupDictr:rNrrrr*r+r rkrrrr GroupDicts rAlicer/Bobrrrvsecondr)r:rrrr r#rrrrrglgtgdrrr%test_helper_asdict_builtin_containerss,    z.TestCase.test_helper_asdict_builtin_containerscsxtGdddtGfddd}|t|dgdddgii|t|ddiddddiiidS) Nc@seZdZUeed<dS)zDTestCase.test_helper_asdict_builtin_object_containers..ChildrNrrrrxr+rrrrChilds rcseZdZUed<dS)zETestCase.test_helper_asdict_builtin_object_containers..ParentchildNrrrrrParents rr/rrrrr#rrrr,test_helper_asdict_builtin_object_containerss $z5TestCase.test_helper_asdict_builtin_object_containerscCstGddd}|dd}t|td}||tddg||t|tdd|_t|td}||td dg|t|tdS) Nc@seZdZUeed<eed<dS)z.TestCase.test_helper_asdict_factory..Cr(rBNr)rrrrrs rr/rZ dict_factory)r(r/)rBrr,)r(r,)rrrrrrr(rrr#rrtrrrrtest_helper_asdict_factorys   z#TestCase.test_helper_asdict_factoryc stddtGfddd}|dd|ddd d d }t|}||ddddd d d d d t|td }||ddddd d d d d |t|t|t|ddtdS)NTa b ccseZdZUeed<ed<dS)z1TestCase.test_helper_asdict_namedtuple..Cr(rBNrjrrrrrs routerr/innerri rrgrrB)rrrrrrrrrrrtest_helper_asdict_namedtuples0      z&TestCase.test_helper_asdict_namedtuplecCsNtGddd}tdd}||ddi}|t|d|dddiidS) Nc@seZdZUeed<dS)z5TestCase.test_helper_asdict_namedtuple_key..CrN)rrrrr+rrrrrs rrrzan arrr)rrrr)r#rrrtrrr!test_helper_asdict_namedtuple_keys  z*TestCase.test_helper_asdict_namedtuple_keycsGdddtddtGfddd}d}||}t|}||ddd i||d|||dddS) Nc@seZdZddZdS)z9TestCase.test_helper_asdict_namedtuple_derived..TcSs|jSr\rrOrrrmy_asz>TestCase.test_helper_asdict_namedtuple_derived..T.my_aN)rrrrrrrrrsrZTbasercseZdZUed<dS)z9TestCase.test_helper_asdict_namedtuple_derived..CrNrrrrrrs rrrr)rrrrrrr)r#rrrtrrrr%test_helper_asdict_namedtuple_derivedsz.TestCase.test_helper_asdict_namedtuple_derivedcCstGddd}|d}|t|d|t|t||t|t|d|_|t|d|tt|tdS)Nc@s"eZdZUeed<dZeed<dS)z'TestCase.test_helper_astuple..Cr(rrBNrCrrrrrs rr/)r/rr,)r/r,)rrrsrrrBrrrrzrrrtest_helper_astupleszTestCase.test_helper_astuplecCs~tGddd}|tdt|Wdn1s<0Y|tdttWdn1sp0YdS)Nc@seZdZUeed<eed<dS)z9TestCase.test_helper_astuple_raises_on_classes..Cr(rBNr)rrrrrs rr)rr4rHrsr*r`rrr%test_helper_astuple_raises_on_classess &z.TestCase.test_helper_astuple_raises_on_classescCsxtGddd}g}|d|}t|}||d|||d||d}t|}|dd||jgdS)Nc@s,eZdZUeed<eedZeeed<dS)z3TestCase.test_helper_astuple_copy_values..Cr(r'rBNrrrrrr)s rr/)rrsrrrrrB)r#rrrtrrrrtest_helper_astuple_copy_values(s z(TestCase.test_helper_astuple_copy_valuescs|tGdddtGfddd}|ddd}t|}||d|t|t|d |j_|t|d dS) Nc@seZdZUeed<eed<dS)z3TestCase.test_helper_astuple_nested..UserIdrrNr)rrrrr8s rcseZdZUeed<ed<dS)z1TestCase.test_helper_astuple_nested..Userr;r:Nrjrrrrr<s rrrr/)r)rr/r)r)rr)rrsrrrr:r)r#rrrrrrtest_helper_astuple_nested7s z#TestCase.test_helper_astuple_nestedc stGdddtGfddd}tGfddd}tGfddd}d d }d d }|d ||g}|d ||f}|d ||d}|t|d ddgf|t|d|t|d dddfdS)Nc@seZdZUeed<eed<dS)z=TestCase.test_helper_astuple_builtin_containers..Userr;r:NrrrrrrHs rcs"eZdZUeed<eed<dS)zBTestCase.test_helper_astuple_builtin_containers..GroupListr:rNrrrrrrLs rcs&eZdZUeed<edfed<dS)zCTestCase.test_helper_astuple_builtin_containers..GroupTupler:.rNrrrrrrPs rcs&eZdZUeed<eefed<dS)zBTestCase.test_helper_astuple_builtin_containers..GroupDictr:rNrrrrrrTs rrr/rrrrrr/rr)r)rrrrrsrrrr&test_helper_astuple_builtin_containersGs   z/TestCase.test_helper_astuple_builtin_containerscsptGdddtGfddd}|t|dgdgff|t|ddiddiffdS)Nc@seZdZUeed<dS)zETestCase.test_helper_astuple_builtin_object_containers..ChildrNrrrrrrbs rcseZdZUed<dS)zFTestCase.test_helper_astuple_builtin_object_containers..ParentrNrrrrrrfs rr/rrrrrr-test_helper_astuple_builtin_object_containersas  z6TestCase.test_helper_astuple_builtin_object_containerscstGddd}tddfdd}|dd}t||d }||dd||t||d d |_t||d }||d d|t|dS) Nc@seZdZUeed<eed<dS)z/TestCase.test_helper_astuple_factory..Cr(rBNr)rrrrrns rNTzx ycs|Sr\r)rrrrntssz0TestCase.test_helper_astuple_factory..ntr/rZ tuple_factoryr,)rrrsrrrr(rr)r#rrrtrrrrtest_helper_astuple_factoryms     z$TestCase.test_helper_astuple_factoryc stddtGfddd}|dd|ddd d d }t|}||ddd d ft|td }||ddddd d gd gdS)NrrcseZdZUeed<ed<dS)z2TestCase.test_helper_astuple_namedtuple..Cr(rBNrjrrrrrs rrr/rrirrr)r)rirrr)rrrsrr)r#rrtrrrrtest_helper_astuple_namedtuple~s   z'TestCase.test_helper_astuple_namedtuplecCsNdttdi}tdd|}t|}||||t|ddddddS)Nr+rgrrr/r)r*rrrrr#Zcls_dictrZcls1rrrtest_dynamic_class_creations   z$TestCase.test_dynamic_class_creationcCsTttdtddd}tdd|}t|}||||t|dddddS)Nrgrfr)r+rBrrr/)r*r3rrrrrrrr'test_dynamic_class_creation_using_fields  z0TestCase.test_dynamic_class_creation_using_fieldcstGddd}gfdd}||_|dd}|dd|dd|d gfd |d gfd |d |dddS)Nc@sjeZdZUeed<eZeed<eeddZeed<eedZ eed<eddd Z eed <dZ eed <d S) z&TestCase.test_init_in_order..CrrFrqrtr'rrrrrN) rrrr*r+r3rrrtrrrrrrrrs rcs||fdSr\)rr#r;valueZcallsrrsetattrsz,TestCase.test_init_in_order..setattrrr/)rr)rr/rtrrrD)rr)rrr)r __setattr__rr)r#rrrtrrrtest_init_in_orders   zTestCase.test_init_in_ordercCstGddd}|d}|d|j|d|j|d|j|d|j||jd|d |j||jd|d|j||jd|d|j||jg|d|j||j g|d|j|d |j||jddS) Nc@s\eZdZUeed<eeddZeed<eedZeed<edddZ eed <d Z eed <d S) z'TestCase.test_items_in_dicts..CrFrqrr'rtrrrrrN) rrrr*r+r3rrrtrrrrrrrs rrrrrtrrr) rrrrrrrrrrtrzrrrtest_items_in_dictss&zTestCase.test_items_in_dictscCs*tGddd}||djddS)Nc@s"eZdZUeed<eddZdS)z:TestCase.test_alternate_classmethod_constructor..Cr(cSs d}||S)Nrr)rfilenameZ value_in_filerrr from_fileszDTestCase.test_alternate_classmethod_constructor..C.from_fileN)rrrr*r+rHrrrrrrs rrr)rrrr(r`rrr&test_alternate_classmethod_constructors z/TestCase.test_alternate_classmethod_constructorcCstGddd}|t|dj|tt|djd|td"dt|djd<Wdn1st0YdS)Nc@seZdZUeed<dS)z/TestCase.test_field_metadata_default..Cr&Nr)rrrrrs rr does not support item assignmentrDtest)rrr!metadatarr r4rHr`rrrtest_field_metadata_defaultsz$TestCase.test_field_metadata_defaultcsF|t"tGddd}Wdn1s20YitGfddd}|t|dj|tt|djddd<|tt|djd|t|djdd|td"dt|djd <Wdn1s0Yd d d d tGfddd}|tt|djd|t|djd d |t|djdd |t|djdd dd<|tt|djd|t|djdd|t "t|djdWdn1s0Y|td"dt|djd <Wdn1s80YdS)Nc@s eZdZUeddZeed<dS)/TestCase.test_field_metadata_mapping..Crrr&Nrrrr3r&r*r+rrrrrs rcs eZdZUedZeed<dSrrr&Nrrrrrrs rr/rlrrDrr^Z42Zthree)rr-rDcs eZdZUedZeed<dSrrrrrrrs r-rZbaz) rrHrrr!rrr r4KeyErrorr`rrrtest_field_metadata_mappings> .0  2z$TestCase.test_field_metadata_mappingcsGdddtGfddd}|tt|djd|t|djdd|t"t|djd Wdn1s0Y|t|djd d dS) Nc@s$eZdZddZddZddZdS)zDTestCase.test_field_metadata_custom_mapping..SimpleNameSpacec[s|j|dSr\)rupdate)r#kwrrrro'szMTestCase.test_field_metadata_custom_mapping..SimpleNameSpace.__init__cSs|dkr dSt||S)Nxyzzyplugh)r)r#itemrrr __getitem__*szPTestCase.test_field_metadata_custom_mapping..SimpleNameSpace.__getitem__cSs |jSr\)r__len__rOrrrr/szLTestCase.test_field_metadata_custom_mapping..SimpleNameSpace.__len__N)rrrrorrrrrrSimpleNameSpace&srcs&eZdZUedddZeed<dS)z6TestCase.test_field_metadata_custom_mapping..Cr^rrr&Nrrrrrr2s rrr/rr^rrr)rrr r!rrrr`rrr"test_field_metadata_custom_mapping$s  0z+TestCase.test_field_metadata_custom_mappingcsXtdtGfdddt}|d}||jd||jdt|t}dS)Nrcs"eZdZUed<dZeed<dS)z5TestCase.test_generic_dataclasses..LabeledBoxcontent labelN)rrrr+rrkrrrr LabeledBox@s rr,r)r rr rrrrr*)r#rZboxAliasrrrtest_generic_dataclasses=sz!TestCase.test_generic_dataclassescstdtdtGfdddtf}tGddd|tf}|t}|ddd }|t|d Gd d d |tf}|t}|d d}||ddS)NSrcseZdZUed<ed<dS)z-TestCase.test_generic_extending..Baser(rBNrrrrrrrbPs rbc@seZdZUeed<dS)z4TestCase.test_generic_extending..DataDerivedZ new_fieldNrjrrrr DataDerivedUs rrtest1test2)rr r c@seZdZddZdS)z7TestCase.test_generic_extending..NonDataDerivedcSs|jSr\rBrOrrr new_method]szBTestCase.test_generic_extending..NonDataDerived.new_methodN)rrrr rrrrNonDataDerived\sr r^?) r rr r*rkrrsrr )r#rbrrrtr rrrtest_generic_extendingLs   zTestCase.test_generic_extendingcstdtGfdddt}tddfdtdfg|ttfddid }||td d jd||td d d jd ||td d d j d|}||td d j d ||j ||tt fdS) NrcseZdZUed<dS)z-TestCase.test_generic_dynamic..Parentr(Nrrrrrrfs rrrBrcrUr,)bases namespacer/rrD) r rr rr r*rrcrrUr(__mro__rx)r#rrrrrrtest_generic_dynamiccszTestCase.test_generic_dynamicc Cs8tGdddatGdddatGdddatd}d|_tdtddtd|tdtdgd g}|D]}ttjdD]}|j||d t t ||}| |j |j | |j|j| ||d |_ t t ||}| |j |j | |j|jWdq1s&0YqqtdS) Nc@s"eZdZUeed<dZeed<dS)Pr(rrBNrCrrrrrvs rc@s*eZdZUeed<edddZeed<dS)Qr(rFrrBNrrrr*r+r3rBrrrrrzs rc@s,eZdZUeed<eedZeeed<dS)Rr(r'rBNrrrrrr~s rr/r)rrDr)sampleprotor,)rrrrrBrangepickleHIGHEST_PROTOCOLrloadsdumpsrr(rr)r#qZsamplesrrZ new_sampleZanother_new_samplerrrtest_dataclassses_pickleablets(, z%TestCase.test_dataclassses_pickleableN)`rrrr%r'r.r7r=r@rIrarhrwr{r|rrrrrrrrrrrrrrrrrrr r rr!r&r(r)r/r9rArGrIrRrTrXrZr[r]r^r`rbrdrnrurzr{rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrs ,5!6(  !$-F/     9    !     +rc@s$eZdZddZddZddZdS)TestFieldNoAnnotationcCsB|td"tGddd}Wdn1s40YdS)N)'f' is a field but has no type annotationc@seZdZeZdS)z>TestFieldNoAnnotation.test_field_without_annotation..CNrrrr3rrrrrrsrrr`rrrtest_field_without_annotations z3TestFieldNoAnnotation.test_field_without_annotationcCsVtGddd}|td$tGddd|}Wdn1sH0YdS)Nc@seZdZUeed<dS)zUTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_base..BrNr)rrrrrGs rGr"c@seZdZeZdS)zUTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_base..CNr#rrrrrsrrr4rHr@rrr4test_field_without_annotation_but_annotation_in_baseszJTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_basecCsRGddd}|td$tGddd|}Wdn1sD0YdS)Nc@seZdZUeed<dS)zcTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_base_not_dataclass..BrNr)rrrrrGs rGr"c@seZdZeZdS)zcTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_base_not_dataclass..CNr#rrrrrsrrr@rrrBtest_field_without_annotation_but_annotation_in_base_not_dataclasss zXTestFieldNoAnnotation.test_field_without_annotation_but_annotation_in_base_not_dataclassN)rrrr$r&r'rrrrr!s r!c@sleZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS) TestDocStringcCs ||dd|dddS)N )rr)r#rrrrrassertDocStrEqualszTestDocString.assertDocStrEqualcCs$tGddd}||jddS)Nc@seZdZUeed<dS)z?TestDocString.test_existing_docstring_not_overridden..Cr(Nr)rrrrrs rz Lorem ipsum)rr__doc__r`rrr&test_existing_docstring_not_overriddensz4TestDocString.test_existing_docstring_not_overriddencCs$tGddd}||jddS)Nc@s eZdZdS)z1TestDocString.test_docstring_no_fields..CNrrrrrrsrzC()rr+r,r`rrrtest_docstring_no_fieldssz&TestDocString.test_docstring_no_fieldscCs$tGddd}||jddS)Nc@seZdZUeed<dS)z1TestDocString.test_docstring_one_field..Cr(Nr)rrrrrs rzC(x:int)r.r`rrrtest_docstring_one_fieldsz&TestDocString.test_docstring_one_fieldcCs$tGddd}||jddS)Nc@seZdZUeed<eed<dS)z2TestDocString.test_docstring_two_fields..Cr(rBNr)rrrrrs rzC(x:int, y:int)r.r`rrrtest_docstring_two_fieldssz'TestDocString.test_docstring_two_fieldscCs$tGddd}||jddS)Nc@s&eZdZUeed<eed<eed<dS)z4TestDocString.test_docstring_three_fields..Cr(rBrcNrrrr*r+rkrrrrrs rzC(x:int, y:int, z:str)r.r`rrrtest_docstring_three_fieldssz)TestDocString.test_docstring_three_fieldscCs$tGddd}||jddS)Nc@seZdZUdZeed<dS)z>TestDocString.test_docstring_one_field_with_default..CrDr(NrErrrrrs rz C(x:int=3)r.r`rrr%test_docstring_one_field_with_defaultsz3TestDocString.test_docstring_one_field_with_defaultcCs$tGddd}||jddS)Nc@s&eZdZUdZeeedfed<dS)zCTestDocString.test_docstring_one_field_with_default_none..CNr()rrrr(rr*rr+rrrrrs rzC(x:Optional[int]=None)r.r`rrr*test_docstring_one_field_with_default_nonesz8TestDocString.test_docstring_one_field_with_default_nonecCs$tGddd}||jddS)Nc@seZdZUeeed<dS)z2TestDocString.test_docstring_list_field..Cr(N)rrrrr*r+rrrrrs rzC(x:List[int])r.r`rrrtest_docstring_list_fieldsz'TestDocString.test_docstring_list_fieldcCs$tGddd}||jddS)Nc@s$eZdZUeedZeeed<dS)zGTestDocString.test_docstring_list_field_with_default_factory..Cr'r(N) rrrr3rr(rr*r+rrrrrs rzC(x:List[int]=)r.r`rrr.test_docstring_list_field_with_default_factorysz.Cr(N)rrrrr+rrrrrs rzC(x:collections.deque)r.r`rrrtest_docstring_deque_fieldsz(TestDocString.test_docstring_deque_fieldcCs$tGddd}||jddS)Nc@s eZdZUeedZeed<dS)zHTestDocString.test_docstring_deque_field_with_default_factory..Cr'r(N)rrrr3rr(r+rrrrrs rz C(x:collections.deque=)r.r`rrr/test_docstring_deque_field_with_default_factorysz=TestDocString.test_docstring_deque_field_with_default_factoryN)rrrr+r-r/r0r1r3r4r5r6r7r8r9rrrrr(s r(c@s,eZdZddZddZddZddZd S) TestInitcCsGddd}tGddd|}|d}||jd|dt|tddGd dd|}|}||jd||jd dS) Nc@seZdZddZdS)z&TestInit.test_base_has_init..BcSs d|_dS)NrRrcrOrrrrosz/TestInit.test_base_has_init..B.__init__NrrrrrrGsrGc@seZdZUdZeed<dS)&TestInit.test_base_has_init..Crr(NrErrrrrs rr^rcFrc@seZdZUdZeed<dS)r<r^r(NrErrrrr"s rR)rrr(rrrc)r#rGrrtrrrtest_base_has_inits zTestInit.test_base_has_initcCsTtddGddd}||jdtddGddd}||jddS)NFrc@seZdZUdZeed<dS) TestInit.test_no_init..Crr&N)rrrr&r*r+rrrrr+s rrc@s"eZdZUdZeed<ddZdS)r>rr&cSs d|_dSNrDr&rOrrrro2sz)TestInit.test_no_init..C.__init__N)rrrr&r*r+rorrrrr0s  rD)rrr&r`rrr test_no_init)s   zTestInit.test_no_initcCs|tGddd}||djdtddGddd}||djd td dGd dd}||d jd dS)Nc@seZdZUeed<ddZdS))TestInit.test_overwriting_init..Cr(cSsd||_dSr6r?r#r(rrrro=s2TestInit.test_overwriting_init..C.__init__Nrrrr*r+rorrrrr:s rrDrTrc@seZdZUeed<ddZdS)rBr(cSsd||_dSr6r?rCrrrroDsrDNrErrrrrAs rFc@seZdZUeed<ddZdS)rBr(cSsd||_dSr6r?rCrrrroKsrDNrErrrrrHs rfr^r-r`rrrtest_overwriting_init6szTestInit.test_overwriting_initcCs`Gdddt}tGddd|}||djdtGddd|}||djddS) Nc@seZdZUeed<dS)z.TestInit.test_inherit_from_protocol..PrNr)rrrrrSs rc@seZdZUeed<dS)z.TestInit.test_inherit_from_protocol..CrNr)rrrrrVs rrfc@seZdZddZdS)z.TestInit.test_inherit_from_protocol..DcSs|d|_dSr6r)r#rrrrro^sz7TestInit.test_inherit_from_protocol..D.__init__Nrrrrrr\srr^)r rrr)r#rrrrrrtest_inherit_from_protocolOsz#TestInit.test_inherit_from_protocolN)rrrr=rArGrHrrrrr:s r:c@s$eZdZddZddZddZdS)TestReprcCstGddd}tGddd|}|d}|t|dtGddd|}|t|d tGd dd}|t|d d |t|d dS)Nc@seZdZUeed<dS)zTestRepr.test_repr..Br(Nr)rrrrrGfs rGc@seZdZUdZeed<dS)TestRepr.test_repr..Cr^rBNr}rrrrrjs rrz(TestRepr.test_repr..C(x=4, y=10)c@seZdZUdZeed<dS)zTestRepr.test_repr..Drr(NrErrrrrqs rz)TestRepr.test_repr..D(x=20, y=10)c@s0eZdZeGdddZeGdddZdS)rJc@seZdZUeed<dS)zTestRepr.test_repr..C.Dr&Nr)rrrrrxs rc@s eZdZdS)zTestRepr.test_repr..C.ENrrrrrr{srN)rrrrrrrrrrrvsrz$TestRepr.test_repr..C.D(i=0)z!TestRepr.test_repr..C.E())rrr9rr)r#rGrr$rrrr test_represzTestRepr.test_reprcCsbtddGddd}|tdt|dtddGddd}|t|dddS) NFrc@seZdZUeed<dS) TestRepr.test_no_repr..Cr(Nr)rrrrrs rz+.TestRepr.test_no_repr..C object atrDc@seZdZUeed<ddZdS)rLr(cSsdS)NC-classrrOrrr__repr__sz)TestRepr.test_no_repr..C.__repr__Nrrrr*r+rNrrrrrs rM)rrrr9rr`rrr test_no_reprs  zTestRepr.test_no_reprcCstGddd}|t|ddtddGddd}|t|ddtddGd dd}|t|dddS) Nc@seZdZUeed<ddZdS))TestRepr.test_overwriting_repr..Cr(cSsdSNr(rrOrrrrNs2TestRepr.test_overwriting_repr..C.__repr__NrOrrrrrs rrr(Trc@seZdZUeed<ddZdS)rQr(cSsdSrRrrOrrrrNsrSNrOrrrrrs Fc@seZdZUeed<ddZdS)rQr(cSsdSrRrrOrrrrNsrSNrOrrrrrs rgr`rrrtest_overwriting_reprszTestRepr.test_overwriting_reprN)rrrrKrPrTrrrrrIdsrIc@seZdZddZddZdS)TestEqcCsltddGddd}||d|d|d}|||tddGddd}||dddS) NFrc@seZdZUeed<dS)TestEq.test_no_eq..Cr(Nr)rrrrrs rrrDc@seZdZUeed<ddZdS)rWr(cSs|dkSr5rrTrrrrVsz#TestEq.test_no_eq..C.__eq__NrXrrrrrs r^)rrsrrzrrr test_no_eqs zTestEq.test_no_eqcCstGddd}||dd||ddtddGddd}||dd||ddtd dGd dd}||dd ||dddS) Nc@seZdZUeed<ddZdS)%TestEq.test_overwriting_eq..Cr(cSs|dkSr?rrTrrrrVs,TestEq.test_overwriting_eq..C.__eq__NrXrrrrrs rr/rDTrVc@seZdZUeed<ddZdS)rYr(cSs|dkSr+rrTrrrrVsrZNrXrrrrrs rFc@seZdZUeed<ddZdS)rYr(cSs|dkSr,rrTrrrrVsrZNrXrrrrrs rfrr`rrrtest_overwriting_eqszTestEq.test_overwriting_eqN)rrrrXr[rrrrrUsrUc@s$eZdZddZddZddZdS) TestOrderingcCsZttGddd}||dd||dd||dd||dddS)Nc@seZdZUeed<ddZdS)z5TestOrdering.test_functools_total_ordering..Cr(cSs |j|kSr\r?rTrrrrsz.C.__lt__Nrrrr*r+rrrrrrs rrr/)rrrrrrr`rrrtest_functools_total_orderingsz*TestOrdering.test_functools_total_orderingcCstddGddd}|d|j|d|j|d|j|d|jtddGd dd}|d|j|d|j|d|jdS) NFrc@seZdZUeed<dS)%TestOrdering.test_no_order..Cr(Nr)rrrrrs rrrrrc@seZdZUeed<ddZdS)r`r(cSsdSrSrrTrrrrsz,TestOrdering.test_no_order..C.__lt__Nr]rrrrrs rSr`rrr test_no_orderszTestOrdering.test_no_ordercCs|td(tddGddd}Wdn1s:0Y|td(tddGddd}Wdn1s~0Y|td(tddGd dd}Wdn1s0Y|td (tddGd dd}Wdn1s0YdS) NzACannot overwrite attribute __lt__.*using functools.total_orderingTrc@seZdZUeed<ddZdS).TestOrdering.test_overwriting_order..Cr(cSsdSr\rrOrrrr sz5TestOrdering.test_overwriting_order..C.__lt__Nr]rrrrr s rzACannot overwrite attribute __le__.*using functools.total_orderingc@seZdZUeed<ddZdS)rbr(cSsdSr\rrOrrrr sz5TestOrdering.test_overwriting_order..C.__le__N)rrrr*r+rrrrrr s zACannot overwrite attribute __gt__.*using functools.total_orderingc@seZdZUeed<ddZdS)rbr(cSsdSr\rrOrrrr sz5TestOrdering.test_overwriting_order..C.__gt__N)rrrr*r+rrrrrr s zACannot overwrite attribute __ge__.*using functools.total_orderingc@seZdZUeed<ddZdS)rbr(cSsdSr\rrOrrrr# sz5TestOrdering.test_overwriting_order..C.__ge__N)rrrr*r+rrrrrr s rr`rrrtest_overwriting_order s(...z#TestOrdering.test_overwriting_orderN)rrrr_rarcrrrrr\sr\c@s<eZdZddZddZddZddZd d Zd d Zd S)TestHashcCs6tddGddd}|t|ddtddS)NTrZc@seZdZUeed<eed<dS)z$TestHash.test_unsafe_hash..Cr(rBNr2rrrrr( s rr/rl)r/rlrrr_r`rrrtest_unsafe_hash' szTestHash.test_unsafe_hashc sdd}fdd}tgddD]r\}\}}}}}|||||d||||||d|||||||||d|||||||||d|q"dS) NcSs|dur dS|rdSdS)N)rDrr)rrrrnon_bool/ s z*TestHash.test_hash_rules..non_boolc sBj||||d|dkr\|r@t|||dGddd}nt|||dGddd}|dkrd|j|jdn|d kr|sd|jn~|d krȈd|j|jdnV|dkrtd ,t|||dGd dd}Wdn1s0YnWdn1s40YdS) N)caser[rrKr)r[rrKc@seZdZddZdS)1TestHash.test_hash_rules..test..CcSsdSrrrOrrrrP> s:TestHash.test_hash_rules..test..C.__hash__Nr]rrrrr< src@s eZdZdS)riNrrrrrrA srrPr*nonerYc@seZdZddZdS)ricSsdSrrrOrrrrP\ srjNr]rrrrrZ s) rrrrZassertIsNotNonerrr4rH)rhr[rrKZ with_hashrrrOrrr7 s.      2z&TestHash.test_hash_rules..test))FFFr*r*)FFTr*r*)FTFrkr*)FTTrr*)TFFrr)TFTrr)TTFrr)TTTrrr/FT)r) r#rgrrhr[rrKZres_no_defined_hashZres_defined_hashrrOrtest_hash_rules. s 1  zTestHash.test_hash_rulescCstGddd}||d|d||d|dtddGddd}||d|d|t|dt|dtddd Gd dd}||d |d ||d|d|t|dt|ddS) Nc@seZdZUeed<ddZdS) TestHash.test_eq_only..Cr&cSs |j|jkSr\r@rTrrrrV s'TestHash.test_eq_only..C.__eq__NrXrrrrr s rr/rTrZc@seZdZUeed<ddZdS)rmr&cSs |j|jkSr\r@rTrrrrV srnNrXrrrrr s r)r[rc@seZdZUeed<ddZdS)rmr&cSs|jdko|j|jkSr?r@rTrrrrV srnNrXrrrrr s rD)rrrsr_r`rrr test_eq_only| s zTestHash.test_eq_onlycCs`tddGddd}|t|tdtddGddd}|t|tddS)NTrJc@s eZdZdSz%TestHash.test_0_field_hash..CNrrrrrr srrrZc@s eZdZdSrprrrrrr srer`rrrtest_0_field_hash s zTestHash.test_0_field_hashcCstddGddd}|t|dtd|t|dtdtdd Gd dd}|t|dtd|t|dtddS) NTrJc@seZdZUeed<dSz%TestHash.test_1_field_hash..Cr(Nr)rrrrr s rr)rr,r,rZc@seZdZUeed<dSrrr)rrrrr s rer`rrrtest_1_field_hash szTestHash.test_1_field_hashcCsLGddd}ddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dfddtdfdd|dffD]~\}}}}|j||||d L|dur|durtGd d d |}nh|dur:t|d Gd d d |}nB|dur`t|dGdd d |}nt||dGdd d |}|dkr|d}|tdt|Wdn1s0Yn`|dkr|t|ddn@|dkr||jtjn$|dkr&|t|dtdnWdq1s<0YqdS)Nc@seZdZddZdS)z(TestHash.test_hash_no_args..BasecSsdSrMrrOrrrrP sz1TestHash.test_hash_no_args..Base.__hash__Nr]rrrrrb srbZ unhashableFrxbaseTr)rKrrurc@seZdZUeed<dSz%TestHash.test_hash_no_args..Cr&Nr)rrrrr s rrVc@seZdZUeed<dSrvr)rrrrr s rJc@seZdZUeed<dSrvr)rrrrr s )rKrc@seZdZUeed<dSrvr)rrrrr s r^unhashable typerNr,rs) rxrrr4rHr_rrrP)r#rbrKrrurrrtrrrtest_hash_no_args sV                      *   zTestHash.test_hash_no_argsN) rrrrfrlrorqrtrxrrrrrd& s N#  rdc@s\eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS) TestFrozencCsptddGddd}|d}||jd|td|_Wdn1sT0Y||jddS)NTrJc@seZdZUeed<dS)z!TestFrozen.test_frozen..Cr&Nr)rrrrr s rr^rf)rrr&rr8rzrrr test_frozen s $zTestFrozen.test_frozencCstddGddd}tddGddd|}|dd}|td |_Wdn1sb0Y|td |_Wdn1s0Y||jd||jddS) NTrJc@seZdZUeed<dS)z"TestFrozen.test_inherit..Cr&Nr)rrrrr s rc@seZdZUeed<dS)z"TestFrozen.test_inherit..DrNr)rrrrr s rrr^rfr)rrr8r&rrr#rrrrrr test_inherit s  $ $zTestFrozen.test_inheritcCs\tddGddd}|td$tGddd|}Wdn1sN0YdS)NTrJc@s eZdZdS)z>TestFrozen.test_inherit_nonfrozen_from_empty_frozen..CNrrrrrr sr5cannot inherit non-frozen dataclass from a frozen onec@seZdZUeed<dS)z>TestFrozen.test_inherit_nonfrozen_from_empty_frozen..DrNr)rrrrr& s rr%r%rrr(test_inherit_nonfrozen_from_empty_frozen sz3TestFrozen.test_inherit_nonfrozen_from_empty_frozencCsLtGddd}tGddd|}|d}||jd|||dS)Nc@s eZdZdS)z7TestFrozen.test_inherit_nonfrozen_from_empty..CNrrrrrr+ src@seZdZUeed<dS)z7TestFrozen.test_inherit_nonfrozen_from_empty..DrNr)rrrrr/ s rrD)rrrrr{rrr!test_inherit_nonfrozen_from_empty* sz,TestFrozen.test_inherit_nonfrozen_from_emptyc CsdD]}|j|dtddGddd}|rDGddd|}n|}|td $tGd d d |}Wdn1s~0YWdq1s0YqdS) NTFintermediate_classTrJc@seZdZUeed<dS)z8TestFrozen.test_inherit_nonfrozen_from_frozen..Cr&Nr)rrrrr< s rc@s eZdZdS)z8TestFrozen.test_inherit_nonfrozen_from_frozen..INrrrrrIA rrr}c@s eZdZdS)z8TestFrozen.test_inherit_nonfrozen_from_frozen..DNrrrrrrG srrrr4rHr#rrrrrrr"test_inherit_nonfrozen_from_frozen9 sz-TestFrozen.test_inherit_nonfrozen_from_frozenc CsdD]}|j|dtGddd}|r>Gddd|}n|}|td*tdd Gd d d |}Wdn1s~0YWdq1s0YqdS) Nrrc@seZdZUeed<dS)z8TestFrozen.test_inherit_frozen_from_nonfrozen..Cr&Nr)rrrrrN s rc@s eZdZdS)z8TestFrozen.test_inherit_frozen_from_nonfrozen..INrrrrrrS rrz5cannot inherit frozen dataclass from a non-frozen oneTrJc@s eZdZdS)z8TestFrozen.test_inherit_frozen_from_nonfrozen..DNrrrrrrY srrrrrr"test_inherit_frozen_from_nonfrozenK sz-TestFrozen.test_inherit_frozen_from_nonfrozenc CsdD]}|j|dRGddd}|r:Gddd|}n|}tddGd d d |}Wdn1sl0Y|d }|td |_Wdq1s0YqdS) Nrrc@s eZdZdS)z4TestFrozen.test_inherit_from_normal_class..CNrrrrrr` src@s eZdZdS)z4TestFrozen.test_inherit_from_normal_class..INrrrrrrd rrTrJc@seZdZUeed<dS)z4TestFrozen.test_inherit_from_normal_class..Dr&Nr)rrrrrh s rr^rf)rrrr8r&)r#rrrrrrrrtest_inherit_from_normal_class] s0 z)TestFrozen.test_inherit_from_normal_classcCstddGddd}Gddd|}|d}||jd||jdd|_|td |_Wdn1sx0Y|td |_Wdn1s0Y||jd||jd||jddS) NTrJc@s"eZdZUeed<dZeed<dS)z4TestFrozen.test_non_frozen_normal_derived..Dr(r^rBNrCrrrrrs s rc@s eZdZdS)z4TestFrozen.test_non_frozen_normal_derived..SNrrrrrrx srrDr^rf)rrr(rBcachedrr8)r#rrrOrrrtest_non_frozen_normal_derivedp s $ $z)TestFrozen.test_non_frozen_normal_derivedcCs|td(tddGddd}Wdn1s:0Y|td(tddGddd}Wdn1s~0YtddGd dd}||d jd dS) Nz&Cannot overwrite attribute __setattr__TrJc@seZdZUeed<ddZdS)-TestFrozen.test_overwriting_frozen..Cr(cSsdSr\rrOrrrr s9TestFrozen.test_overwriting_frozen..C.__setattr__Nrrrr*r+rrrrrr s rz&Cannot overwrite attribute __delattr__c@seZdZUeed<ddZdS)rr(cSsdSr\rrOrrr __delattr__ sz9TestFrozen.test_overwriting_frozen..C.__delattr__N)rrrr*r+rrrrrr s Fc@seZdZUeed<ddZdS)rr(cSs|d|jd<dS)Nrr()rrrrrr srNrrrrrr s r^r)r4rHrrr(r`rrrtest_overwriting_frozen s..z"TestFrozen.test_overwriting_frozencCs`tddGddd}t|d|tdt|iWdn1sR0YdS)NTrJc@seZdZUeed<dS)z&TestFrozen.test_frozen_hash..Cr(N)rrrrr+rrrrr s rrDrw)rr_r4rHr`rrrtest_frozen_hash s  zTestFrozen.test_frozen_hashN) rrrrzr|r~rrrrrrrrrrrry s  ryc@seZdZddZddZdS) TestSlotscCstGddd}|td|Wdn1s:0Y|d}||jdd|_||jd|tdd|_Wdn1s0YdS)Nc@seZdZUdZeed<dS)z TestSlots.test_simple..Cr?r(Nrrr __slots__rr+rrrrr s rrr^rfz'C' object has no attribute 'y')rr4rHrr(rrBrzrrr test_simple s$zTestSlots.test_simplecCsNtGddd}tGddd|}|dd}||j|jfdd|_dS) Nc@seZdZUdZeed<dS)z0TestSlots.test_derived_added_field..Baser?r(Nrrrrrrb s rbc@seZdZUeed<eed<dS)z3TestSlots.test_derived_added_field..Derivedr(rBNr)rrrrDerived s rr/rr r^)rrr(rBrc)r#rbrrrrrtest_derived_added_field s z"TestSlots.test_derived_added_fieldN)rrrrrrrrrr src@s,eZdZddZddZddZddZd S) TestDescriptorscsnGdddtGfddd}||jjdtGfddd}||jjd||jddS)Nc@seZdZddZddZdS)z(TestDescriptors.test_set_name..DcSs|d|_dSrRr;r#ownerr;rrr __set_name__ sz5TestDescriptors.test_set_name..D.__set_name__cSs|dur dS|SNr/r)r#instancerrrr__get__ sz0TestDescriptors.test_set_name..D.__get__N)rrrrrrrrrr srcseZdZUZeed<dS)(TestDescriptors.test_set_name..CrtN)rrrrtr*r+rrrrr s rcxcs$eZdZUeddZeed<dS)rFrrtNrrrr3rtr*r+rrrrr s r/rrrtr;r`rrr test_set_name s zTestDescriptors.test_set_namecs8GdddtGfddd}||jjddS)Nc@seZdZddZdS)z.TestDescriptors.test_non_descriptor..DcSs|d|_dSrRrrrrrr sz;TestDescriptors.test_non_descriptor..D.__set_name__N)rrrrrrrrr srcs$eZdZUeddZeed<dS)z.TestDescriptors.test_non_descriptor..CFrrtNrrrrrr s rrrr`rrrtest_non_descriptor sz#TestDescriptors.test_non_descriptorcsFGddd}|t_tGfddd}|jjddS)Nc@s eZdZdS)z2TestDescriptors.test_lookup_on_instance..DNrrrrrr srcs"eZdZUeddZeed<dS)z2TestDescriptors.test_lookup_on_instance..CFrr&Nrrrrrr s rrrrrrry)r#rrrrrtest_lookup_on_instance s z'TestDescriptors.test_lookup_on_instancecs@Gdddt_tGfddd}|jjddS)Nc@s eZdZdS)z/TestDescriptors.test_lookup_on_class..DNrrrrrr srcs$eZdZUeddZeed<dS)z/TestDescriptors.test_lookup_on_class..CFrr&Nrrrrrr s rr/rr`rrrtest_lookup_on_class s z$TestDescriptors.test_lookup_on_classN)rrrrrrrrrrrr s rc@s<eZdZddZddZddZddZd d Zd d Zd S)TestStringAnnotationsc sddD]Z|jd:tGfddd}||d|jWdq1sT0YqdS)N) z ClassVar[int]zClassVar [int] ClassVar [int]rz ClassVar ztyping.ClassVar[int]ztyping.ClassVar[str]z typing.ClassVar[str]ztyping .ClassVar[str]ztyping. ClassVar[str]ztyping.ClassVar [str]ztyping.ClassVar [ str]ztyping.ClassVar.[int]ztyping.ClassVar+ZtypestrcseZdZUed<dS)z.TestStringAnnotations.test_classvar..Cr(Nrrrrrr< s rr()rrrrr`rrr test_classvar# s z#TestStringAnnotations.test_classvarc sbdD]X|jd8tGfddd}||djdWdq1sR0YqdS)N) CVz t.ClassVarzt.ClassVar[int]ztyping..ClassVar[int]ZClassvarz Classvar[int]ztyping.ClassVarx[int]ztypong.ClassVar[int]zdataclasses.ClassVar[int]ztypingxClassVar[str]rcseZdZUed<dS)z3TestStringAnnotations.test_isnt_classvar..Cr(NrrrrrrT s rr^rrrr(r`rrrtest_isnt_classvarG s  z(TestStringAnnotations.test_isnt_classvarc sdD]||jd\tGfddd}|td|djWdn1sX0YWdq1sv0YqdS)N) z InitVar[int]zInitVar [int] InitVar [int]r\z InitVar rczdataclasses.InitVar[str]z dataclasses.InitVar[str]zdataclasses .InitVar[str]zdataclasses. InitVar[str]zdataclasses.InitVar [str]zdataclasses.InitVar [ str]zdataclasses.InitVar.[int]zdataclasses.InitVar+rcseZdZUed<dS)z-TestStringAnnotations.test_initvar..Cr(Nrrrrrrq s rzobject has no attribute 'x'r/)rrr4rr(r`rrr test_initvar[ sz"TestStringAnnotations.test_initvarc sbdD]X|jd8tGfddd}||djdWdq1sR0YqdS)N)IVz dc.InitVarzxdataclasses.xInitVarztyping.xInitVar[int]rcseZdZUed<dS)z2TestStringAnnotations.test_isnt_initvar..Cr(Nrrrrrr s rr^rr`rrrtest_isnt_initvarz s z'TestStringAnnotations.test_isnt_initvarc CsXddlm}ddlm}ddlm}ddlm}||||fD]}|j|d|jrb|d}n|}||j d| dd d d d }d D]n}|j|dN| t d|dt ||Wdn1s0YWdq1s0Yq|jr$|d|j||jd n|d|jWdq<1sH0Yq.rr^)r^rfri)rr*r3rr(rBrrzrrrr s zTestMakeDataclass.test_simplecCs6i}tddtfdttddfg|d}||idS)Nrr(rBrfrr)rr*r3r)r#nsrrrrtest_no_mutate_namespace sz*TestMakeDataclass.test_no_mutate_namespacecCsdGddd}Gddd}tddtfg||fd}|d}|||||||||dS) Nc@s eZdZdS)z*TestMakeDataclass.test_base..Base1NrrrrrBase1 src@s eZdZdS)z*TestMakeDataclass.test_base..Base2NrrrrrBase2 srrr(rr)rr*rr#rrrrtrrr test_base s  zTestMakeDataclass.test_basecCstGddd}Gddd}tddtfg||fd}|td|d }Wdn1sb0Y|d d }|||||||||||j|jfd dS) Nc@seZdZUeed<dS)z4TestMakeDataclass.test_base_dataclass..Base1r(Nr)rrrrr s rc@s eZdZdS)z4TestMakeDataclass.test_base_dataclass..Base2Nrrrrrr srrrBrzrequired positionalrr/r ) rrr*r4rHrrr(rBrrrrtest_base_dataclass s&    z%TestMakeDataclass.test_base_dataclasscCs`dd}tddtfdttfgd|id}|dd }|t|dd i|tt|d dS) NcSs|j|9_dSr\r?r#rBrrr post_init sz2TestMakeDataclass.test_init_var..post_initrr(rBr2rrrDrr/)rr*r\rrr r!)r#rrrtrrrrb s  zTestMakeDataclass.test_init_varc Cs~tddtfdttdfdtttddfg}|d}|t|ddi|tt|d||jd||j ddS) Nrr(rBr^rcrrr/) rr*rr3rrr r!rBrcrzrrrrR s z TestMakeDataclass.test_class_varc Cstddtfdttdfdtttddfgdd }|d t||d t||td tdgdd }Wdn1s0YdS)Nrr(rBr^rcrrFrrorNzunexpected keyword argument)Zxxinit) rr*rr3rrrr4rHr`rrrtest_other_params s z#TestMakeDataclass.test_other_paramscCstdgd}|ddd}|t|dddd||jddddtdddtfd g}|ddd}|t|dddd||jdtdddS) Nrr(rBrcr/rrDz typing.Anyr(rBrc)rrrr+r*rzrrr test_no_types s    zTestMakeDataclass.test_no_typesc CsdD]j}|j|dJ|tdtdd|gWdn1sF0YWdq1sd0YqtddfD]j}|j|dJ|tdtdd|gWdn1s0YWdq|1s0Yq|dS) N)r)r/rrDr) bad_fieldzInvalid field: rrcSs|Sr\rr?rrrr4 rzCTestMakeDataclass.test_invalid_type_specification..zhas no len\(\))rr4rHrr)r#rrrrtest_invalid_type_specification* sLz1TestMakeDataclass.test_invalid_type_specificationc CsvdD]l}|j|dL|td td|d|gWdn1sH0YWdq1sf0YqdS)N)rabr3zField name duplicatedrrrr4rHrr#r3rrrtest_duplicate_field_names: sz,TestMakeDataclass.test_duplicate_field_namesc CsdD]}|j|d|tdtdd|gWdn1sF0Y|tdtd|gWdn1s~0Y|tdtd|dgWdn1s0YWdq1s0YqdS)N)forasyncawaitasrzmust not be keywordsrrrrrrrtest_keyword_field_names@ s,*z*TestMakeDataclass.test_keyword_field_namesc CsdD]}|j|d|tdtdd|gWdn1sF0Y|tdtd|gWdn1s~0Y|tdtd|dgWdn1s0YWdq1s0YqdS)N)()x,yr2@3r*zlittle johnny tablesrzmust be valid identifiersrrrrrrrtest_non_identifier_field_namesJ s,*z1TestMakeDataclass.test_non_identifier_field_namescCstdgddS)Nr)_Z_aZa_aZa_)rrOrrrtest_underscore_field_namesT sz-TestMakeDataclass.test_underscore_field_namesc CsVdD]L}|j|d,t|ddg}||j|Wdq1sF0YqdS)N)rrrrr*) classnamerr)rrrr)r#rrrrrtest_funny_class_names_namesY sz.TestMakeDataclass.test_funny_class_names_namesN)rrrrrrrrbrRrrrrrrrrrrrrr s      rc@steZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZdS) TestReplacecCsNtddGddd}|dd}t|dd}||jd||jddS) NTrJc@seZdZUeed<eed<dS)zTestReplace.test..Cr(rBNr)rrrrrc s rr/rrDr?)rrrr(rBr#rrtrtrrrrb s   zTestReplace.testcCs^tddGddd}|dd}t|dd}||j|j|j|jfd ||j|j|j|jfd |td  t|dd d dWdn1s0Y|td ,t|d dt|dd d dWdn1s0Y|t dd|_Wdn1s0Y|t dt|d dd}Wdn1sP0YdS)NTrJc@sFeZdZUeed<eed<edddZeed<edddZeed<d S) z"TestReplace.test_frozen..Cr(rBFr^rrcrRrN)rrrr*r+r3rcrrrrrrn s rr/rrDr?)r/rr^rR)rDrr^rR init=Falserrj)r(rcrr;zcannot assign to field 'x'z3__init__\(\) got an unexpected keyword argument 'a'rf)r(r) rrrr(rBrcrr4r5r8rHrrrrrzm s  . .&zTestReplace.test_frozencCs^tddGddd}|dd}|tdt|dd }Wdn1sP0YdS) NTrJc@seZdZUeed<eed<dS)z.TestReplace.test_invalid_field_name..Cr(rBNr)rrrrr s rr/rz3__init__\(\) got an unexpected keyword argument 'z'rDr;rr4rHrrrrrtest_invalid_field_name s  z#TestReplace.test_invalid_field_namecCstddGddd}|tdt|ddWdn1sF0Y|tdtdddWdn1s~0YdS) NTrJc@seZdZUeed<eed<dS)z*TestReplace.test_invalid_object..Cr(rBNr)rrrrr s rrrDr?rrr`rrrtest_invalid_object s *zTestReplace.test_invalid_objectcCstGddd}|d}d|_t|dd}||j|jfd|tdt|d d d Wdn1sp0Y|tdt|d d Wdn1s0YdS) Nc@s*eZdZUeed<edddZeed<dS)z#TestReplace.test_no_init..Cr(Fr^rrBNrrrrrr s rr/rrfr?)rfr^rrrgr )rrBrrr(r4r5rrrrrA s ,zTestReplace.test_no_initcCstGddd}|d}|d}||j|j||jd|tdt|ddWdn1sn0Yt|d d dS) Nc@s&eZdZUeed<dZeeed<dS)z$TestReplace.test_classvar..Cr(rJrBN)rrrr*r+rBrrrrrr s rr/rrJz3__init__\(\) got an unexpected keyword argument 'y'rr rfr?)rrrBrr4rHrrrrrr s*zTestReplace.test_classvarcCstGddd}|dd}||jd|tdt|ddWdn1sX0Yt|ddd }||jd dS) Nc@s*eZdZUeed<eeed<ddZdS)z0TestReplace.test_initvar_is_specified..Cr(rBcSs|j|9_dSr\r?rrrrr2 sz>TestReplace.test_initvar_is_specified..C.__post_init__Nrhrrrrr s  rr/r^z,InitVar 'y' must be specified with replace()rDr?rfrgrd)rrr(r4r5rrzrrrtest_initvar_is_specified s *z%TestReplace.test_initvar_is_specifiedcCsxtGddd}|dddd}|t||dd|t|dd |ddd d|t|ddd |dddddS) Nc@s>eZdZUeed<dZeeed<dZeeed<ddZdS)z6TestReplace.test_initvar_with_default_value..Cr(NrBr,rccSs0|dur|j|7_|dur,|j|7_dSr\r?)r#rBrcrrrr2 szDTestReplace.test_initvar_with_default_value..C.__post_init__) rrrr*r+rBr\rcr2rrrrr s rr/r^rrr?rr r,)rBrc)rrrrzrrrtest_initvar_with_default_value s  z+TestReplace.test_initvar_with_default_valuecCs4tGddd}|d}||_|t|ddS)Nc@seZdZUded<dS)z*TestReplace.test_recursive_repr..CrrNrrrrrr s rz1TestReplace.test_recursive_repr..C(f=...)rrrr9rzrrrtest_recursive_repr s zTestReplace.test_recursive_reprcCs<tGddd}|dd}||_||_|t|ddS)Nc@seZdZUded<ded<dS)z4TestReplace.test_recursive_repr_two_attrs..CrrgNrrrrrr s rzBTestReplace.test_recursive_repr_two_attrs..C(f=..., g=...))rrrrr9rzrrrtest_recursive_repr_two_attrs s  z)TestReplace.test_recursive_repr_two_attrscCsTtGddd}tGddd}|d}|d}||_||_|t|ddS)Nc@seZdZUded<dS)z6TestReplace.test_recursive_repr_indirection..CrrNrrrrrr s rc@seZdZUded<dS)z6TestReplace.test_recursive_repr_indirection..DrrNrrrrrr s rzwTestReplace.test_recursive_repr_indirection..C(f=TestReplace.test_recursive_repr_indirection..D(f=...))r)r#rrrtrrrrtest_recursive_repr_indirection sz+TestReplace.test_recursive_repr_indirectioncCsttGddd}tGddd}tGddd}|d}|d}|d}||_||_||_|t|ddS)Nc@seZdZUded<dS)z:TestReplace.test_recursive_repr_indirection_two..CrrNrrrrrr s rc@seZdZUded<dS)z:TestReplace.test_recursive_repr_indirection_two..DrrNrrrrrr s rc@seZdZUded<dS)z:TestReplace.test_recursive_repr_indirection_two..ErrNrrrrrr s rzTestReplace.test_recursive_repr_indirection_two..C(f=TestReplace.test_recursive_repr_indirection_two..D(f=TestReplace.test_recursive_repr_indirection_two..E(f=...)))r)r#rrrrtrrrrr#test_recursive_repr_indirection_two sz/TestReplace.test_recursive_repr_indirection_twocCs6tGddd}|dd}||_|t|ddS)Nc@seZdZUded<eed<dS)z5TestReplace.test_recursive_repr_misc_attrs..CrrrNrrrrrr- s rr/zATestReplace.test_recursive_repr_misc_attrs..C(f=..., g=1)rrzrrrtest_recursive_repr_misc_attrs, s  z*TestReplace.test_recursive_repr_misc_attrsN)rrrrrzrrrArrrrrrrrrrrrra s      r__main__)+Z dataclassesrrmrZunittestZ unittest.mockrtypingrrrrrr r r r r r collectionsrrr functoolsr Exceptionrrr!r(r:rIrUr\rdryrrrrrrmainrrrrs` 0   #YVG/L]/*H%f