a 5êdg; ã@söddlZddlZddlmZddlmZddlZddlZeddgdZedddgd d Z e  ed ¡Gd d „d ej ƒƒZ e  ed ¡Gdd„dej ƒƒZ e  ed ¡ejGdd„dej ƒƒƒZe  ed ¡ejGdd„dej ƒƒƒZdd„ZedkròeƒdS)éN)Úsupport)Úimport_fresh_modulezxml.etree.ElementTreeÚ _elementtree)Úfreshzxml.etree.cElementTreez xml.etreeT)rZ deprecatedzrequires _elementtreec@speZdZejejdddddd„ƒZdd„Zd d „Zd d „Z d d„Z ej dd„ƒZ dd„Z dd„Zdd„ZdS)Ú MiscTestsédéF)ÚsizeZmemuseÚdry_runcCs4d|}t ¡}z| t|j|¡Wd}nd}0dS)Nóx)ÚcETÚ XMLParserÚ assertRaisesÚ OverflowErrorÚfeed)Úselfr ÚdataÚparser©rú1/usr/local/lib/python3.9/test/test_xml_etree_c.pyÚtest_length_overflows zMiscTests.test_length_overflowcCsØt d¡}d|_| t¡|`Wdƒn1s40Y| |jd¡| t¡|`Wdƒn1sp0Y| |j¡d|_| t¡|`Wdƒn1s°0Y| |jd¡| t¡|`Wdƒn1sì0Y| |j¡d|_| t¡|`Wdƒn1s.0Y| |jd¡| t¡|` Wdƒn1sl0Y| |j i¡dddœ|_ | t¡|` Wdƒn1s¶0Y| |j dddœ¡dS)NÚtagZTAGZTEXTZTAILÚBÚD)ÚAÚC) r ÚElementrrÚAttributeErrorÚ assertEqualÚtextÚ assertIsNoneÚtailÚattrib)rÚelementrrrÚtest_del_attributes4  " "  " "  $ $  $zMiscTests.test_del_attributecCs8t d¡}}tdƒD]}t |d¡}q~~t ¡dS)NÚrooti@ Úx)r rÚrangeÚ SubElementrÚ gc_collect)rÚer%ÚirrrÚ test_trashcan<s  zMiscTests.test_trashcancCsdd„}|ƒt ¡dS)Nc Ss>t ¡}zt‚Wn(ty8}z|}WYd}~n d}~00dS©N)r r Ú ValueError)rÚexcÚerrrrrÚparser_ref_cycleJs z9MiscTests.test_parser_ref_cycle..parser_ref_cycle)rr))rr1rrrÚtest_parser_ref_cycleEs zMiscTests.test_parser_ref_cyclecs¤t d¡‰G‡fdd„dƒ}|ƒˆ_ˆ ¡|ƒˆ_ˆ ¡|ƒˆ_|ƒˆ_ˆ ¡|ƒˆ_|ƒˆ_ˆ ¡|ƒˆ_ˆ ddi¡ˆ ¡|ƒˆ_ˆ ddi¡dS)NÚelemcseZdZ‡fdd„ZdS)z#MiscTests.test_bpo_31728..Xcsˆjˆjˆ ¡dSr-)rr!Úclear©r©r3rrÚ__del___sz+MiscTests.test_bpo_31728..X.__del__N)Ú__name__Ú __module__Ú __qualname__r7rr6rrÚX^sr;ré*)r rrr4r!Ú __setstate__)rr;rr6rÚtest_bpo_31728Ys" zMiscTests.test_bpo_31728cCsxtj tj¡}| t|j¡| t|jd¡Gdd„dƒ}| t|j|ƒ¡| t|jd¡|  |j ¡|  |j ¡dS)NÚfooc@seZdZdd„ZdS)z5MiscTests.test_uninitialized_parser..MockFilecWsdS)NÚr)ÚargsrrrÚreadsz:MiscTests.test_uninitialized_parser..MockFile.readN)r8r9r:rBrrrrÚMockFile€srC) r r Ú__new__rr.ÚcloserZ _parse_wholeZ _seteventsr ZentityÚtarget)rrrCrrrÚtest_uninitialized_parserys z#MiscTests.test_uninitialized_parserc Cs¦tj tj¡}tdƒD]&}| dddit d¡gdddœ¡q| |jd¡| |jd¡| |jd¡| t |j   ¡ƒd g¡| t |ƒd ¡| |d jd¡dS) Nrr?Úbarr<Úchildztext goes herezopposite of head)rr"Ú _childrenrr!)rHr<rr) r rrDr'r=rrrr!Úlistr"ÚitemsÚlen)rr3r+rrrÚtest_setstate_leaksˆs   ý zMiscTests.test_setstate_leakscCs*d}t t |¡¡}t|ƒ~t ¡dS©Nz )r Z iterparseÚioÚStringIOÚnextrr)©rZXMLrrrrÚtest_iterparse_leaks˜s zMiscTests.test_iterparse_leakscCs$d}t ¡}| |¡~t ¡dSrO)r Z XMLPullParserrrr)rSrrrÚtest_xmlpullparser_leaks¢s  z"MiscTests.test_xmlpullparser_leaksN)r8r9r:rZ bigmemtestZ_2Grr$r,r2r>Ú cpython_onlyrGrNrTrUrrrrrs      rc@seZdZdd„ZdS)ÚTestAliasWorkingcCst d¡}| |jd¡dS)Nr?)Ú cET_aliasrrr©rr*rrrÚtest_alias_working°s z#TestAliasWorking.test_alias_workingN)r8r9r:rZrrrrrW­srWc@s$eZdZdd„Zdd„Zdd„ZdS)ÚTestAcceleratorImportedcCs| tjjd¡dS©Nr)rr r(r9r5rrrÚtest_correct_import_cET¹sz/TestAcceleratorImported.test_correct_import_cETcCs| tjjd¡dSr\)rrXr(r9r5rrrÚtest_correct_import_cET_alias½sz5TestAcceleratorImported.test_correct_import_cET_aliascCs| tjjtj¡dSr-)ZassertNotIsInstancer rÚ__init__ÚtypesÚ FunctionTyper5rrrÚtest_parser_comes_from_CÀsz0TestAcceleratorImported.test_parser_comes_from_CN)r8r9r:r]r^rbrrrrr[µsr[c@s2eZdZdd„ZejZdd„Zdd„Zdd„Zd S) Ú SizeofTestcCst d¡|_t d¡|_dS)NZ5PZPnnP4P)rZ calcobjsizeÚ elementsizeÚstructÚcalcsizeÚextrar5rrrÚsetUpÊs zSizeofTest.setUpcCst d¡}| ||j¡dS)NÚa)r rÚ check_sizeofrdrYrrrÚ test_elementÑs zSizeofTest.test_elementcCs&tjddd}| ||j|j¡dS)Nrizabout:)Zhref)r rrjrdrgrYrrrÚtest_element_with_attribÕsz#SizeofTest.test_element_with_attribcCsFt d¡}tdƒD]}t |d¡q| ||j|jt d¡¡dS)NriéÚspanZ8P) r rr'r(rjrdrgrerf)rr*r+rrrÚtest_element_with_childrenÙs   ÿz%SizeofTest.test_element_with_childrenN) r8r9r:rhrrjrkrlrorrrrrcÇs rccCs,ddlm}t tttt¡|jt ddS)Nr©Útest_xml_etree)Úmodule) ÚtestrqrZ run_unittestrrWr[rcÚ test_mainr rprrrrtás ürtÚ__main__)rPrersrZ test.supportrr`Zunittestr rXZ skipUnlessZTestCaserrWrVr[rcrtr8rrrrÚs4  ÿþ