asda?‰PNG  IHDR ? f ??C1 sRGB ??é gAMA ±? üa pHYs ? ??o¨d GIDATx^íüL”÷e÷Y?a?("Bh?_ò???¢§?q5k?*:t0A-o??¥]VkJ¢M??f?±8\k2íll£1]q?ù???T a bYhs@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZmZddlmZddlmZmZmZmZmZmZdadaedddZzed Wneye d Yn0ed ddZ ed ddZ!d Z"dZ#dZ$dZ%dZ&dZ'ddddZ(ddZ)Gddde j*Z+dpddZ,dd Z-Gd!d"d"Z.Gd#d$d$e j*Z/Gd%d&d&e j*Z0iZ1d'e1d(<d)e1d*<d+e1d,<d-e1d.<d/e1d0<d1e1d2<d3e1d4<d5e1d6<d72e3ede1d8<d9e1d:<iZ4d;e4d<<d=e4d><d?e1d@<dAe1dB<dCe1dD<GdEdFdFe j*Z5GdGdHdHe j*Z6GdIdJdJe.e j*Z7GdKdLdLe.e j*Z8GdMdNdNe9Z:e9j;e:_;GdOdPdPe9ZGdUdVdVe j*Z?GdWdXdXe j*Z@GdYdZdZe j*ZAGd[d\d\e j*ZBGd]d^d^e j*ZCGd_d`d`e j*ZDGdadbdbe j*ZEGdcdddde j*ZFGdedfdfe j*ZGGdgdhdhe j*ZHdidjZIGdkdldle j*ZJdqdmdnZKeLdokreKdS)rN)partial)productislice)support)TESTFNfindfileimport_fresh_module gc_collect swap_attr swap_itemz simple.xml xmltestdataZsubdirutf-8z!filename is not encodable to utf8z simple-ns.xmlzexpat224_utf8_bug.xmlz text
subtext
zz
subtext
zy text
subtext
z Apples Bananas African Coffee Table 80 120 zy %user-entities; ]> &entity; zl ]> &entity; F)quietcsfdd}|S)Ncs fdd}t||S)NcsBtjdi|i|Wdn1s40YdS)Nr)rZcheck_warnings)argskwargs)filtersrtest//usr/local/lib/python3.9/test/test_xml_etree.pynewtestksz1checkwarnings..decorator..newtest) functoolsupdate_wrapper)rrrr)rr decoratorjs z checkwarnings..decoratorr)rrrrrr checkwarningsisrcCs|dtjS)N )replaceoslinesepencode)datarrr convlineseprsr"c@seZdZddZddZdS) ModuleTestcCs(ddlm}ddlm}ddlm}dS)Nr) ElementTreeElementInclude ElementPath) xml.etreer$r&r()selfr$r&r(rrr test_sanityws  zModuleTest.test_sanitycCsd}tj|t|dddS)N)xml.etree.ElementTree _elementtree)Z HTML_EMPTY)Z blacklist)rZ check__all__ET)r*namesrrrtest_all~szModuleTest.test_allN)__name__ __module__ __qualname__r+r0rrrrr#vsr#TunicodecKsX|dkrt}nt}t|}|j|fd|i||rF|S|d|SdS)Nr4encodingr)ioBytesIOStringIOr.r$writegetvalueseek)elem to_stringr5optionsfiletreerrr serializes   rAcCsdd|DS)NcSsg|] }|jqSrtag.0r<rrr z"summarize_list..r)seqrrrsummarize_listsrIc@s(eZdZeddZddZddZdS)ElementTestCasecCstth|_dSN)pyETr.modules)clsrrr setUpClassszElementTestCase.setUpClassc Cszvttj||t||}Wdn1s20Yttj||t|}Wdn1sj0YWn`tjy}zFttdft dfg} t d|| ||| ||f|WYd}~n d}~00|S)NZcETrLz%Failed to round-trip %r from %r to %r) r sysrMpickledumpsloads PicklingErrordictr.rLrZ TestFailedget) r*objnamedumperloaderprotoZtempresultpeZhumanrrrpickleRoundTrips *,  zElementTestCase.pickleRoundTripcCs||tjtjf||tjtjf|tt|tt|t||D]\}}|||qNt dddd}|||||dS)NrCtailtextattrib) assertIsInstancer.ElementrL assertEquallenlistzipassertEqualElementsoperator attrgetter)r*ZalicebobxyZ propertiesrrrrhsz#ElementTestCase.assertEqualElementsN)r1r2r3 classmethodrOr^rhrrrrrJs rJc@sleZdZddZddZddZddZd 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.dYS)ZElementTreeTestcCs|t||dSrK)rdrA)r*r<expectedrrrserialize_checkszElementTreeTest.serialize_checkcsfddfddfddtd}|t|}|tjdd d }t|}t|d tjdd d }fd d |j|j|j|j |j |j |j |j |j|j|j|j|j|j|jfdd}|| d|| d|| d|| dtjtjtjtjdS)NcsJt||D]}jt|dd|dq |d}|d}|dddS)Nz%expected one-character string, got %rmsg r)rerd)stringcharZ new_stringr*rr check_strings z4ElementTreeTest.test_interface..check_stringcsRt||}|}|D] }||}qd|d<j|ddd|dddS)Nvaluekeyzexpected value string, got %rrs)rekeysitemsrd)mappingr}r~r|itemryrr check_mappings   z5ElementTreeTest.test_interface..check_mappingcsjt|ddt|}dD]0}jt||d|dj||d|dq |j|j|jdurz|j|j dur|j |D] }|qdS)Nznot an elementrs)rCrar`r_z no %s memberzno %s visible by dir) assertTruer.Z iselementdirhasattrassertInrCrar`r_)elementZdirelemattrr<) check_elementrrzr*rrrs"       z5ElementTreeTest.test_interface..check_elementrCtägr{r|z^$csjt|dd|ddS)N__call__z%s not callablers)rrmethodryrr check_methods z4ElementTreeTest.test_interface..check_methodcs|jdSrK)__next__)it)rrr check_itersz2ElementTreeTest.test_interface..check_iter*)r.rcr$getroot assertRegexreprappendextendinsertremovefinditerfindfindallfindtextclearrVsetr}r~iteritertextrdXML fromstringPIProcessingInstruction)r*rr@rr)rrrrzr*rtest_interfacesD                      zElementTreeTest.test_interfacecCstd}||jdd|_||jdd|_||jd||jd|_||jdd|_||jd||jd|_||jdd|_||jd||jidd d |_||jdd d d d d |_||jd d d dS)NrCTagZTAGTextZTEXTZTailZTAILbd)acBD)AC)r.rcrdrC assertIsNoner`r_ra)r*rrrrtest_set_attributes*     z"ElementTreeTest.test_set_attributecCstd}||dtd}||||d||||d|d|||d||||g||d|||t|g||d||tjddd }||d td }||||d |d|||d ||||d ||||d | t }||Wdn1s`0Y| t |j d||d |||g|dd<||dd| |dd|d|dg| |ddd|d|dg|dd=||d dS)Ntag2zrzrCr{rzsubtagz!z+zlist.remove(x): x not in listrrz )r.rrqrcrrrrr assertRaises ValueErrorrdstr exception)r*r<erZ subelementcmrrrtest_simpleops*sR                         *  " zElementTreeTest.test_simpleopscCs:|tdd|tdd|tdddS)Nzhelloz)helloz)rqr.rryrrr test_cdataVs   zElementTreeTest.test_cdatacCs|ttd}tj|d}||djd||djdtjt d}||djd||djddS)Nr)r?rC section/tagrzelement/../empty-element empty-element) r6r7 SAMPLE_XMLr r.r$rdrrCSIMPLE_XMLFILE)r*Z stringfiler@rrrtest_file_init`s  zElementTreeTest.test_file_initcCsddlm}tt}tdD]}t|dt|qt |j }tdD]}t|dt|qN| t |j |tdD]}t|dt|q| t |j |tdD]}t|dt|q| t |j ddS)Nrr' z./iXi)r)r(r.rrranger$rrre_cacherdZ assertGreaterZ assertLess)r*r(r<iZ cache_len_10rrrtest_path_cacheks  & &&&zElementTreeTest.test_path_cachecCsZddl}td}||}||}d|d_||d||d||ddS)Nrzhellobarfoozhellozhello)copyr.rdeepcopyrrCrq)r*re1e2e3rrr test_copyzs      zElementTreeTest.test_copycCs&td}|d||ddd|dd||ddtjddd}||dd||jddiddi}td|}|||dd||jddiddi}tjdi|}|||dd||jdditjdddidd}||dd||jdditd}d|_|d d |d d |t|d |t | d d g|t | ddg||jd d d|jd <d |jd<|t|dtd}|dd|dd|dd|dd|t|ddS)NrCr|defaultr{rotherrZaatestatestvaltestbtest2s-aa)rr)rrZtest1Ztestcs;aar r rz rz s[)rC) r.rcrVrdrrarr`tostringsortedr}r~)r*r<rarrr test_attribs\                 zElementTreeTest.test_attribcCstd}ddi}|d|}|j|j|dd||||d|||d||||d|||g||d |g|dd<||dt |g|dd<||ddS) NrCr|r{rzattrib aliasingrsz!zM) r.rcZ makeelement assertIsNotrarrqrrtuple)r*r<rasubelemrrrtest_makeelements$        z ElementTreeTest.test_makeelementcCstt}t}|j|dd||dtt}t}|j|dd||dt t}| }Wdn1s0Yt }| |j d||||dt}tj |d}||||ddS)Nr4r5zi text texttail z text texttail z^Expat target)r.parserr6r8r9rdr:SIMPLE_NS_XMLFILEopenread XMLParserrversionfeedrqclose TreeBuilder)r*r@streamfr!parserrrrrtest_parsefiles4     &     zElementTreeTest.test_parsefilecCstd}|tj|dddtd}|tj|dddgd}t|}|t|d|dt|d|t|ddtd\}}|t |d td \}}|t |d ||d j d dS) Ntextr4r)z ztexttextrGasciisE textrz(textrrbody) r.rrdrrZfromstringlistjoin tostringlistZXMLIDrerC)r*rZsequence_Zidsrrrtest_parseliterals0    z!ElementTreeTest.test_parseliteralc Cs8tj}|t}t|\}}|||jfd|dd|Dgd||jjd|t}|dd|Dgdd}|t|}|d d|Dgd}|t|d }|d d|Dgd }|t|}|d d|Dgdd}|t|}|dd|Dgdd}|t d|}dd|D}||ddgd}t tdR}| t }|||Wdn1s0Y| |jWdn1s0Y|t|jdt|Z| t }|t|Wdn1s0Y|t|jd~Wdn1s40Ytd} d}|| |}|dd|Dddgt d} || } t| \}}|||jfd | tj}t| Wdn1s0Y|t|jd!|tjtt td"}|d#Wdn1s"0Y|t} t| \}}|||jfd t|\| tj}t| Wdn1s0Y|t|jd!~~ Wdn1s0Yt||t} ~ Wdn1s0Y| t|d$Wdn1s*0YdS)%NendrcSsg|]\}}||jfqSrrBrEactionr<rrrrFrGz2ElementTreeTest.test_iterparse..)rrrrrootrcSsg|]\}}||jfqSrrBrrrrrF%rG)r{namespace}elementrr{namespace}empty-elementr{namespace}rootrcSsg|]\}}||jfqSrrBrrrrrF.rGeventscSsg|]\}}||jfqSrrBrrrrrF2rGstartrcSsg|]\}}||jfqSrrBrrrrrF6rGr rr rrrr)r rrr)r rstart-nsend-nscSs*g|]"\}}|dvr||jfn||fqS)r rBrrrrrFCs) r)ru namespacer rr rrrrr rrrrNrrzcSsg|] \}}|qSrrrrrrrFTrGrrr rZbogusrbzunknown event 'bogus's text )rcSsg|]\}}||fqSrrrrrrrFjrG)r)ruuhttp://éffbot.org/ns)r)ucléhttp://effbot.org/nszjunk)rdocumentz.junk after document element: line 1, column 12wbsjunkZ nonexistent)r. iterparsernextrdrCrrr6r8rrr assertFalseclosedrrrZcheck_no_resource_warningr7 ParseError addCleanupunlinkrr9FileNotFoundError) r*rcontextrr<r resrrsourcerrrrtest_iterparses         *,  *"   (  *  ( $ " zElementTreeTest.test_iterparsecCstd}d|_||ddt|d_||dd|_||d|dtd ||d td d |d<||d dS)NrCr`ztextsubtextrz'textsubtextztextsubtextrcommentz*textsubtextr|r{z)textsubtext) r.rcr`rq SubElementrCrCommentrr*r<rrrtest_writefiles    zElementTreeTest.test_writefilecCstt}|}Wdn1s&0YGdddt}|}tj|d}||||gdtt}|}Wdn1s0YGdddt}|}tj|d}||||gddS)Nc@s$eZdZddZddZddZdS)4ElementTreeTest.test_custom_builder..BuildercSs|d|fdSNr rr*rCrarrrr s:ElementTreeTest.test_custom_builder..Builder.startcSs|d|fdSNrr2r*rCrrrrs8ElementTreeTest.test_custom_builder..Builder.endcSsdSrKrr*r`rrrr!s9ElementTreeTest.test_custom_builder..Builder.dataN)r1r2r3r rr!rrrrBuildersr:rr c@sDeZdZddZddZddZddZd d Zd d Zd dZ dS)r0cSs|d|fdSr1r2r3rrrr sr4cSs|d|fdSr5r2r6rrrrsr7cSsdSrKrr8rrrr!sr9cSs|d||fdS)Npir2)r*rr!rrrr;sz7ElementTreeTest.test_custom_builder..Builder.picSs|d|fdS)Nr+r2)r*r!rrrr+sz.Builder.commentcSs|d||fdS)Nrr2)r*prefixurirrrstart_nssz=ElementTreeTest.test_custom_builder..Builder.start_nscSs|d|fdSNrr2r*r<rrrend_nssz;ElementTreeTest.test_custom_builder..Builder.end_nsN) r1r2r3r rr!r;r+r>rArrrrr:s) )r;r;r!)r+ comment )rrurrrrrrrrrrru) rrrrfr.rrrdr)r*rr!r:builderrrrrtest_custom_builders &   &  z#ElementTreeTest.test_custom_buildercCsFGdddt}|}tj|d}|td||gddS)Nc@seZdZddZdS)z@ElementTreeTest.test_custom_builder_only_end_ns..BuildercSs|d|fdSr?r2r@rrrrAszGElementTreeTest.test_custom_builder_only_end_ns..Builder.end_nsN)r1r2r3rArrrrr:sr:ra text texttail ))rr)rprC)rfr.rrtextwrapdedentrd)r*r:rDrrrrtest_custom_builder_only_end_nss   z/ElementTreeTest.test_custom_builder_only_end_nscCs8tjdd}||jtjt}||jtjdS)Nr)r.rrbrr)r*rparser2rrr%test_initialize_parser_without_targets z5ElementTreeTest.test_initialize_parser_without_targetcCs|ttd}t|}Wdn1s*0Y|dd|Dgdgggg|dd|Dgdggggtt}|t t |d|t t |dd||ddt ||d }|d}|dd=|t t |d|||d |||d||g|d d<|||d |||d| ||d | |t |gdS) NrcSsg|] }t|qSrrIrDrrrrFsz1ElementTreeTest.test_children..)rrrcSsg|] }t|qSrrLrDrrrrFsrrrr) rrr.rrdrrrrrerfassertNotEqualr)r*rr@r<child1child2rrr test_childrensH (     zElementTreeTest.test_childrencCs<td}|t|dtd}|t|ddS)Nrr)r.rrdrrr.rrrtest_writestrings  z ElementTreeTest.test_writestringcCstd}t||t|dtd}t||t|dtd}t||t|dtd}t||t|dtd}t||t|d td }t||t|d dS) Nz srs" text z! text z"texttails% texttailz=

par

text


s^

par

text


8

pre
post

text

sJ

pre
post

text

r.rindentrdrr.rrr test_indent%s0            zElementTreeTest.test_indentcCsXtd}tj|dd|t|dtd}tj|dd|t|ddS)NrS )spacesD

pre
post

text

rus>

pre
post

text

rTr.rrrtest_indent_spaceQs  z!ElementTreeTest.test_indent_spacecCstd}t||dd|Dhd|dd|Dhd|tdd|Dtdd|DdS) Nz@

par

text


cSsh|] }|jqSrr_rEelrrr nrGz.>  N cSsh|] }|jqSrr`r[rrrr]rrG>Zparr`Nr`z r^cSsh|] }|jqSrrZr[rrrr]vrGcSsh|]}t|jqSr)idr_r[rrrr]wrG)r.rrUrdrrer.rrrtest_indent_space_cachingjs  z)ElementTreeTest.test_indent_space_cachingcCstd}|ttj|ddWdn1s80Y|t|dtj|dd|t|dtd}tj|ddd |t|d dS) NrS)levels9

pre
post

text

rs^

pre
post

text

rrrv)rerXsI

pre
post

text

)r.rrrrUrdrr.rrrtest_indent_levelzs$  , z!ElementTreeTest.test_indent_levelcCs<td}|tj|ddd|tj|dddddS)N0r4rArr5default_namespace1r.rrdrr.rrrtest_tostring_default_namespaces  z/ElementTreeTest.test_tostring_default_namespacecCs&td}|tj|dddddS)Nrgr4foobarrizPrlr.rrr3test_tostring_default_namespace_different_namespaces  zCElementTreeTest.test_tostring_default_namespace_different_namespacecCsNtd}d}|t| tj|dddWdn1s@0YdS)Nrz>^cannot use non-qualified names with default_namespace option$r4rnri)r.rassertRaisesRegexrr)r*r<Z EXPECTED_MSGrrr5test_tostring_default_namespace_original_no_namespaces zEElementTreeTest.test_tostring_default_namespace_original_no_namespacecCs$td}|tj|ddddS)Nrr4rrrlr.rrr test_tostring_no_xml_declarations   z0ElementTreeTest.test_tostring_no_xml_declarationcCs&td}|tj|dddddS)Nrutf8Tr5xml_declarations: rlr.rrrtest_tostring_xml_declarations  z-ElementTreeTest.test_tostring_xml_declarationcCs&td}|tj|dddddS)Nrr4Trt; rlr.rrr.test_tostring_xml_declaration_unicode_encodings  z>ElementTreeTest.test_tostring_xml_declaration_unicode_encodingc Csttd}gd}|D]X\}}}|d|d|(|tj|||d|Wdq1sd0YqdS)Nø))øNN)øUTF-8N)rzUS-ASCIIN)E ISO-8859-1N)ryr4N)rzNF)r{r|F)rzr}F)srF)ryr4F)sH øNT)sA ør|T)sH ør}T)r~rT)uA ør4Tz encoding=z xml_declaration=rt)r.rsubTestrdr)r*r<Z TESTCASESZexpected_retvalr5rurrr#test_tostring_xml_declaration_casess   z3ElementTreeTest.test_tostring_xml_declaration_casesc CsHtd}|dtj|ddd|dtj|dddddS) Nrgrur4rrhrrirk)r.rrdrrr.rrr#test_tostringlist_default_namespaces z3ElementTreeTest.test_tostringlist_default_namespacecCstd}|dtj|ddd|dtj|ddd tj|ddd }|d|d ||d d |gd|dddS)Nrrur4rrrGT)rus> rtrwrz%^<\?xml version='1.0' encoding='.+'?>)zzzrr)r.rrdrrr)r*r<Z stringlistrrr!test_tostringlist_xml_declarations  z1ElementTreeTest.test_tostringlist_xml_declarationc sdfdd }|dd|dd|dd|d d |d d |d dddfdd}gd}|D] }tt||dqjgd}|D]}ttj||qgd}|D]}tjtj||qttjddttjdddS)Nrucs>d||f}t||j|t|j|dS)Nz0%s)rdr.rr r`)r5rxmlryrrchecks z,ElementTreeTest.test_encoding..checkrrus-ascii iso-8859-1½z iso-8859-15u€cp437u√ mac-romanu˚cSsd|S)Nz*rrrrrrsz*ElementTreeTest.test_encoding..xmlcs||SrK)r r)rrrbxml sz+ElementTreeTest.test_encoding..bxml)Crrz utf-8-sigutf-16utf-16beutf-16lez iso8859-1z iso8859-2z iso8859-3z iso8859-4z iso8859-5z iso8859-6z iso8859-7z iso8859-8z iso8859-9z iso8859-10z iso8859-13z iso8859-14z iso8859-15z iso8859-16rZcp720Zcp737cp775cp850cp852cp855Zcp856cp857cp858cp860cp861cp862cp863cp865cp866cp869Zcp874Zcp1006cp1125cp1250cp1251cp1252cp1253cp1254cp1255cp1256cp1257cp1258z mac-cyrillicz mac-greekz mac-icelandz mac-latin2rz mac-turkishz iso2022-jpz iso2022-jp-1z iso2022-jp-2ziso2022-jp-2004z iso2022-jp-3ziso2022-jp-extzkoi8-rzkoi8-tzkoi8-ukz1048hzptcp154s)big5 big5hkscscp932cp949cp950zeuc-jpz euc-jis-2004z euc-jisx0213zeuc-krgb2312gbkgb18030z iso2022-krjohabz shift-jiszshift-jis-2004zshift-jisx0213zutf-7) cp037cp424cp500cp864Zcp875cp1026cp1140utf_32 utf_32_be utf_32_leZ undefinedZxxx)ru) rdr.rrrrr"r LookupError)r*rrZsupported_encodingsr5Z&unsupported_ascii_compatible_encodingsZ(unsupported_ascii_incompatible_encodingsrr*rr test_encodings(        zElementTreeTest.test_encodingcCsttd}d|_|t|d|t|ddd|t|ddd|t|ddd|t|ddd dS) Nz-r_z/ rrhtmlz* r`z1 < 2 )r.rr_rdrAr*rrrr test_methodsLs  zElementTreeTest.test_methodscCs2td}|t|d|t|ddddS)Nz(textrrr.rrdrArrrrtest_issue18347[s  zElementTreeTest.test_issue18347cCs8td}|t|ddd||d|tj}tdWdn1sV0Y|t|jd|tj}tt Wdn1s0Y|t|jdt }d |j d <| t | }||d |tj}ttWdn1s0Y|t|jd dS) Nz*testrrs*testu%testz&entity;z#undefined entity: line 1, column 10z,undefined entity &entity;: line 5, column 10r`entityztextz,undefined entity &entity;: line 4, column 10)r.rrdrArqrr"rr ENTITY_XMLrrrrEXTERNAL_ENTITY_XML)r*rrrrrrr test_entitybs2  ( (    * zElementTreeTest.test_entitycCsrtd}||dtd}||dtd}||dtd}||dtt}||d dS) NzzzCzCz7z7zGzEz text subtext )r.rrq SAMPLE_XML_NSr.rrrtest_namespaces$      zElementTreeTest.test_namespacecCstd}||dttd}||dttdd}||dttdd}t|tdd}t|tdd}||d|d|jd <||d |d|jtd <||d |d |jd <||d |td |jd <||d |td}td|jd<||||||d|t tddd|t tddtdd}tdd}|||tdd}| ||| |d||ddS)Nz{uri}tagzr=rCZtag1rz;r{z{uri}keyz+z {uri}valuez0z/z {uri2}valuez {uri1}keyz{nsz{ns}tagz other-tagzns:tag) r.rcrqQNamer,rrarrdrrN)r*r<rZq1Zq2rrr test_qnamesb               zElementTreeTest.test_qnamecCstd}dS)Nztext)r.rr.rrrtest_doctype_publicsz#ElementTreeTest.test_doctype_publiccsddlmd?fdd }|ddg|dddg|d d d g|d d dg|d gd|dgd|dgd|dgd|dgd|dddg|dgd|ddg|dgd|ddg|d gd!|d"gd#|d$gd%|d&d d'g|d(d(g|d)gd*|d+gd,|d-d-g|d.d.g|d/d/g|d0d0g|d1gd2|d3gd4d5d6i|d7d8gd9d6i|d:d d8gd5d6i|d;d d7gd9d6i|ddS)@Nrr'cs"dd||D|dS)NcSsg|]\}}|p|qSrr)rEoprCrrrrFszGElementTreeTest.test_xpath_tokenizer..check..)rdZxpath_tokenizer)rFrp namespacesr(r*rrrs   z3ElementTreeTest.test_xpath_tokenizer..checkrztext()r`()z@name@rXz@*zpara[1])para[1]z para[last()])rrZlastrrz*/para)r/rz/doc/chapter[5]/section[2]) rdocrchapterr5rrsectionr2rz chapter//para)r//rz//pararrz //olist/item)rZolistrr.z.//para)rrr..z../@lang)rrrlangzchapter[title])rrtitlerz#employee[@secretary and @assistant]) ZemployeerrZ secretaryruandrurZ assistantrz @{ns}attrz{ns}attr{http://spam}eggz ./spam.egg)rrzspam.eggz.//{http://spam}egg)rrrz{ns}*{}*{*}tag{*}*z .//{*}tag)rrrz ./xsd:type)rr&{http://www.w3.org/2001/XMLSchema}typeZxsdz http://www.w3.org/2001/XMLSchematyperruz @xsd:typez@typez@{*}typez{*}type)rur)N)r)r()r*rrrrtest_xpath_tokenizersd              z$ElementTreeTest.test_xpath_tokenizercCsn|ttddd|ttddd|ttddd|ttdddddS) NrZ instructionsz s?>u ãzlatin-1s= ?>)rdr.rrrryrrrtest_processinginstruction+sz*ElementTreeTest.test_processinginstructioncCspdD]f}||fD]T}d|}ttd|dd}|||ttd||fdd}|||qqdS)N) ZAREAZBASEZBASEFONTZBRZCOLFRAMEZHRZIMGZINPUTZISINDEXZLINKZMETAZPARAMz<%s>z<%s />rrz <%s>)lowerrAr.rrd)r*rr<rpZ serializedrrr#test_html_empty_elems_serialization;s z3ElementTreeTest.test_html_empty_elems_serializationcCsVtjdddd}t}t|Wdn1s80Y||ddS)N cirriculumpublicexamplestatusZcompanyz1 )r.rcrcaptured_stdoutdumprdr:)r*rstdoutrrrtest_dump_attribute_orderHs  ( z)ElementTreeTest.test_dump_attribute_ordercCs8tjdddd}|t|d|t|ddddS) Nrrrrz0rrz;)r.rcrdrAr*rrrrtest_tree_write_attribute_orderPs z/ElementTreeTest.test_tree_write_attribute_orderN)/r1r2r3rqrrrrrrrrrrrr)r/rErIrKrQrRrVrYrcrfrmrorqrrrvrxrrrrrrrrrrrrrrrrrrrrosXV,   6-x= %,  , ;%!A: roc@seZdZd ddZd!ddZd"ddZd#dd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZdS)$XMLPullParserTestNcCsD|dur||n,tdt||D]}|||||q$dSNr)rrre)r*rr! chunk_sizerrrr_feed[s zXMLPullParserTest._feedcCs$|ddt||D|dS)NcSs g|]\}}||j|jffqSr)rCr`)rEeventr<rrrrFdsz3XMLPullParserTest.assert_events..)rdr read_eventsr*rrp max_eventsrrr assert_eventsbs  zXMLPullParserTest.assert_eventscCs|tt|||dSrK)rdrfrrrrrrassert_event_tupleshsz%XMLPullParserTest.assert_event_tuplescCs(t||}|dd|D|dS)NcSsg|]\}}||jfqSrrBrrrrrForGz7XMLPullParserTest.assert_event_tags..)rrrd)r*rrprr rrrassert_event_tagsmsz#XMLPullParserTest.assert_event_tagsc CsdD]}|j|dt}||g||d|||g||d|||g||d|||dg||d|||d|||dd g||d |||d g||Wdq1s0YqdS) N)Nrr)r z+ text rtexttail  r r)rr. XMLPullParserrrrr)r*rrrrrtest_simple_xmlrs,   z!XMLPullParserTest.test_simple_xmlcCst}|}||dt|\}}|||jfd||dt|\}}|||jfd|tt|Wdn1s0YdS)Nz- text rr r) r.r rrrrdrCr StopIteration)r*rrrr<rrrtest_feed_while_iteratings     z+XMLPullParserTest.test_feed_while_iteratingcCst}||g||d||g||d||g||d||g||d||dg||d||d||ddg||d ||d g||dS) Nr "text r)ruabcr)rFZxyzrrr {abc}tagrr r  {abc}childrr rrr.r rrrrrrrrtest_ns_events_starts.    z&XMLPullParserTest.test_ns_events_startcCstjdd}||d|j|ddgdd|j|dgd d||d ||d d g||d ||j|dgd d||ddgdS)N)rr rrr rrrrrrrrrrrrrrr rrrrtest_ns_events_start_ends:    z*XMLPullParserTest.test_ns_events_start_endcCstjdd}||d||gtjdd}||d||gtjdd}||d||dg||d||d g||d ||d g||d ||gd ||d||||dgtjdd}||d||g||d||dg||d||d g||d ||g||d ||ddg||d||dS)Nrr z r  z rrrrrz8texttail )r  {foo}elementr {foo}empty-element)rr')rr%zr)r rr$r&)r.r rrrrrrrrr test_eventssL                   zXMLPullParserTest.test_eventscCstjdd}||d||dtjdffg||d||dtjdffg||d||d g||d ||dtjd ffg||d ||d g||d||dtjdffgtjdd}||d||dtjdffgdS)N)r r+rr r#r+z text here z z more text here ztext)r root-tagz z inner commentz )rr)z z outer comment )r+)r.r rrr-rrrrrtest_events_comments          z%XMLPullParserTest.test_events_commentcCsdtjdd}||d||dtjdffgtjdd}||d||dtjdffgdS) N)r r;rr z r;pitarget)r;z zpitarget some text )r.r rrrrrrrtest_events_pi,s     z XMLPullParserTest.test_events_picCslddh}tj|d}||d||ddgGddd}tj|d}||d||ddgdS) Nrr r zbar)r r)rrc@s$eZdZddZddZddZdS)z9XMLPullParserTest.test_events_sequence..DummyItercSstgd|_dS)N)r rr)rr ryrrr__init__<szBXMLPullParserTest.test_events_sequence..DummyIter.__init__cSs|SrKrryrrr__iter__>szBXMLPullParserTest.test_events_sequence..DummyIter.__iter__cSs t|jSrK)rr ryrrrr@szBXMLPullParserTest.test_events_sequence..DummyIter.__next__N)r1r2r3r-r.rrrrr DummyIter;sr/)r.r rr)r*Zeventsetrr/rrrtest_events_sequence4s   z&XMLPullParserTest.test_events_sequencecCs:|ttjddWdn1s,0YdS)Nrr )rrr.r ryrrrtest_unknown_eventGs z$XMLPullParserTest.test_unknown_event)N)N)N)N)r1r2r3rrrrr r rrr!r"r(r*r,r0r1rrrrrYs     .rz

120 Mz is adequate for an average home user.

C1.xmlz

The opinions represented herein represent those of the individual and should not be interpreted as official policy endorsed by this organization.

zdisclaimer.xmlz

This document has been accessed times.

C2.xmlZ324387z count.txtz

This document has been accessed times.

C2b.xmlz

The following is the source of the "data.xml" resource:

C3.xmlzQ zdata.xmlaW C5.xmlz

Example.

default.xmla 

The following is the source code of Recursive1.xml:

include_c1_repeated.xmlz

120 Mz is adequate for an average home user.

B1.xmlzn
B2.xmlz

The following is the source code of Recursive2.xml:

Recursive1.xmlz

The following is the source code of Recursive3.xml:

zRecursive2.xmlz

The following is the source code of Recursive1.xml:

zRecursive3.xmlc@sHeZdZdddZdddZddZd d Zd d Zd dZddZ dS) XIncludeTestrNcCs>z t|}Wnty&tdYn0|dkr:t|}|S)Nresource not foundr)XINCLUDEKeyErrorOSErrorr.r)r*hrefrr5r!rrrxinclude_loaders   zXIncludeTest.xinclude_loadercCsdSrKr)r*rArr5rrr none_loaderszXIncludeTest.none_loadercCsJ|dkrBt|d}t|WdS1s60YndSdS)Nrr)rr.rr)r*rArrrrr _my_loaders .zXIncludeTest._my_loadercCs8ddlm}|d}|||j|t|ddS)Nrr%r7z

Example.

text texttail
)r)r&rBincluderDrdrA)r*r&rrrrtest_xinclude_defaults    z"XIncludeTest.test_xinclude_defaultcCsddlm}|d}|||j|t|d|d}|||j|t|d|d}|||j|t|d|d }|||j|t|d |d }|t}|||jWdn1s0Y|t|j d |t|d dS)Nrr%r2a

120 Mz is adequate for an average home user.

The opinions represented herein represent those of the individual and should not be interpreted as official policy endorsed by this organization.

r3zO

This document has been accessed 324387 times.

r4zX

This document has been accessed 324387 times.

r5z

The following is the source of the "data.xml" resource:

<?xml version='1.0'?> <data> <item><![CDATA[Brooks & Shields]]></item> </data>
r6r=aI) r)r&rBrErdrArr@rrr*r&rrrrr test_xincludes8           , zXIncludeTest.test_xincludecCs>ddlm}|d}|||j|dt|ddS)Nrr%r8rz.//p)r)r&rBrErdrer)r*r&rrrrtest_xinclude_repeated5s  z#XIncludeTest.test_xinclude_repeatedcCsddlm}ttd}||j }|j||jdWdn1sL0Y| t |j dttd}||j }|j||jdWdn1s0Y| t |j dtt d}||j }|j||jdWdn1s0Y| t |j d tt d }||j }|j||jdWdn1sd0Y| t |j d | d }||j}|||j Wdn1s0Y| t |j d | d }||j"}|j||j ddWdn1s0Y| t |j d | d }||j"}|j||j ddWdn1st0Y| t |j d| d }||j"}|j||j ddWdn1s0Y| t |j d| d }||j"}|j||j ddWdn1s,0Y| t |j d| d }||j"}|j||j ddWdn1s0Y| t |j d dS)Nrr%r2)rZz%cannot load 'disclaimer.xml' as 'xml'r3z!cannot load 'count.txt' as 'text'r9z1unknown parse type in xi:include tag ('BAD_TYPE')r:zYxi:fallback tag must be child of xi:include ('{http://www.w3.org/2001/XInclude}fallback')r;z#recursive include of Recursive2.xml)Z max_depthzAmaximum xinclude depth reached when including file Recursive2.xmlrrzAmaximum xinclude depth reached when including file Recursive3.xmlrzAmaximum xinclude depth reached when including file Recursive1.xmlrM)r)r&r.rr>rZFatalIncludeErrorrErCrdrr XINCLUDE_BADrBZLimitedRecursiveIncludeErrorrGrrrtest_xinclude_failures<sz . . 0 0  .  2  2  2  2  2 z#XIncludeTest.test_xinclude_failures)rN)N) r1r2r3rBrCrDrFrHrIrKrrrrr<s  @r<c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ e edddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Z d6d7Z!d8d9Z"d:S);BugsTestcsfdd}td}||td}d|_||td}d|_||td}|dd||td}|dd||dS)NcsHt}t|Wdn1s(0Yt|jddS)Nzcannot serialize 123 (type int))r TypeErrorrArdrr)r<rryrrrs  & z-BugsTest.test_bug_xmltoolkit21..check{r<Z123)r.rcr`r_r)r*rr<rryrtest_bug_xmltoolkit21s        zBugsTest.test_bug_xmltoolkit21cCs<tt}t|}||dd||dddS)NrCr`rr*)r.rrr$rdr)r*r<r@rrrtest_bug_xmltoolkit25s  zBugsTest.test_bug_xmltoolkit25cCs<td}|t|dg|t|ddgdS)N"
z.//theadz.//tbodyZtbody)r.rrdrIrr*r@rrrtest_bug_xmltoolkit28s zBugsTest.test_bug_xmltoolkit28cCsPtd}t*}t|||dWdn1sB0YdS)NrQz$
)r.rrrrrdr:)r*r@rrrrtest_bug_xmltoolkitX1s   zBugsTest.test_bug_xmltoolkitX1cCstd}|t|ddtd}||jddi|t|ddtd}|t|dd td }|t|ddtd }|dd|t|dddS) Ns2rssDuättruväluess:textstextrrC)r.rrdrrarcrrRrrrtest_bug_xmltoolkit39s$      zBugsTest.test_bug_xmltoolkit39cCs2td}|t|ddd|t|ddS)Nz=]>&ldots;rrsurrrrrtest_bug_xmltoolkit54s  zBugsTest.test_bug_xmltoolkit54cCsL|tj}tdWdn1s,0Y|t|jddS)Ns?&ldots;&ndots;&rdots;z+undefined entity &ldots;: line 1, column 36)rr.r"rrdrr)r*rrrrtest_bug_xmltoolkit55s ( zBugsTest.test_bug_xmltoolkit55cCs$Gddd}|ttj|dS)Nc@seZdZddZdS)z5BugsTest.test_bug_xmltoolkit60..ExceptionFilecSstdSrK)r@r*rlrrrrsz:BugsTest.test_bug_xmltoolkit60..ExceptionFile.readN)r1r2r3rrrrr ExceptionFilesrY)rr@r.r)r*rYrrrtest_bug_xmltoolkit60szBugsTest.test_bug_xmltoolkit60cCsHddd}t}|j||d|}||djddS)Nu’u‘)ZrsquoZlsquoaF A new cultivar of Begonia plant named ‘BCT9801BEG’. z .//paragraphu7A new cultivar of Begonia plant named ‘BCT9801BEG’.) r.rrupdaterrrdrr`)r*ZENTITIESrtrrrtest_bug_xmltoolkit62s   zBugsTest.test_bug_xmltoolkit62zSkips under coverage.cCsBdd}|td}tdD] }|q |td|dS)NcSs,t}|di|d|ddS)NrCr`)r.rr r!r)r@rrr xmltoolkit63s  z4BugsTest.test_bug_xmltoolkit63..xmltoolkit63i)rP getrefcountrrd)r*r^countrrrrtest_bug_xmltoolkit63s   zBugsTest.test_bug_xmltoolkit63c Cs`tjddd}|t|d|tt|dd|ttt|ddS)NZSomeTagzdef _f(): return 3 ras0r`)r.rcrdrrrVrrrrtest_bug_200708_newlines z BugsTest.test_bug_200708_newlinecCs`t}|d||jdGddd}tj|d}|d||jddS)Nzsome textrc@seZdZddZdS)z2BugsTest.test_bug_200708_close..EchoTargetcSs tdS)Nrr.rcryrrrr"sz8BugsTest.test_bug_200708_close..EchoTarget.closeNr1r2r3rrrrr EchoTarget!srer)r.rrrdrrC)r*rrerrrtest_bug_200708_closes  zBugsTest.test_bug_200708_closecCstd}t|d}|t|dddtd}t|d}t|d}|t|dddtd}t|d}t|d}|t}t|ddWdn1s0Y|t|jddS) Nz {default}elemr)rjz%z{not-default}elemzIr<zrz(http://namespace.invalid/does/not/exist/sBz'{http://purl.org/dc/elements/1.1/}titles8)r.rcrdrregister_namespacerrrr"test_bug_200709_register_namespace?s       z+BugsTest.test_bug_200709_register_namespacecCs`td}|td||djtjtd}|td||djtjdS)Nrrr)r.rcrr-rdrCr)r*rrrrtest_bug_200709_element_commentNs   z(BugsTest.test_bug_200709_element_commentcCsptd}t|d}t|d}td}|d||t|gd|d||t|gddS) Nrrrrr)rrrrd)rrrr)r.rcr,rrdrIr*rrrrrrrtest_bug_200709_element_insertZs      z'BugsTest.test_bug_200709_element_insertcCsJtd}t|d}td}|||t|tjtjgdS)NrrzTEST-b)r.rcr,r-rrdrIr)r*rrZ comment_brrrtest_bug_200709_iter_commentds     z%BugsTest.test_bug_200709_iter_commentcCsDt}|d}|di}|d}|}|t|ddS)Nr!rCr)r.rr!r rrrdrA)r*rkrrrrtest_bug_1534630ns    zBugsTest.test_bug_1534630cCs@td}|t|ddtd}|t|dddS)Ns7tãgrs< tãgs;tgrlrrrrtest_issue6233vs  zBugsTest.test_issue6233cCsRtd}|t|dgtt}|dd|dd<|t|gddS)NrrCrCrCr)r.rrdrIr)r*r<Znewelemrrrtest_issue6565s   zBugsTest.test_issue6565cCstddtdddS)NZ test10777z http://myuri/)r.riryrrrtest_issue10777s zBugsTest.test_issue10777cs`Gfddd}td|_}t|}||||jt|jddS)NcseZdZfddZdS)z%BugsTest.test_lost_text..Textcs d_dS)NchangedTraryrrr__bool__sz.BugsTest.test_lost_text..Text.__bool__Nr1r2r3rvrrurrrsrrCrt)r.rcr`rrrbrrdr*rrr\rrurtest_lost_texts  zBugsTest.test_lost_textcs|Gfddd}tdtd|d_}t|}||||djt|djddS)NcseZdZfddZdS)z%BugsTest.test_lost_tail..Textcsdd_dSNrtrTrZryrurrrvs z.BugsTest.test_lost_tail..Text.__bool__NrwrrurrrsrrrCrrt) r.rcrr_rrrbrrdrxrrurtest_lost_tails   zBugsTest.test_lost_tailcsGfddd}tdt|tddz t}Wntyr|dYn0||j||djt | djddS)NcseZdZfddZdS)z$BugsTest.test_lost_elem..Tagcstdd<tdSrz)r.rcr)r*rrrrr__eq__sz+BugsTest.test_lost_elem..Tag.__eq__Nr1r2r3r}rr|rrrsrrrCzgenerators are not reentrantrrt) r.rcrrrrskipTestrbrCrrd)r*rr\rr|rtest_lost_elems    zBugsTest.test_lost_elemcCs.d|}t|}||d|ddS)Ns rr)r.rrdrVdecode)r*r`rrrrrcheck_expat224_utf8_bugs z BugsTest.check_expat224_utf8_bugcCs d}||d}||dS)Nsààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààsxàààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààà)rr8rrrtest_expat224_utf8_bugs zBugsTest.test_expat224_utf8_bugcCsttd}|}Wdn1s(0Yt|}|d}|d}|dd}|dd}| |d|dS)Nrrrrrv) rUTF8_BUG_XMLFILErr.rrVrstriprrd)r*fprawrZxmlattrr`rrrtest_expat224_utf8_bug_files &    z$BugsTest.test_expat224_utf8_bug_filecCs.|ttjd|ttjdddS)NrC)rrMr.rr ryrrrtest_39495_treebuilder_startsz%BugsTest.test_39495_treebuilder_startN)#r1r2r3rOrPrSrTrUrVrWrZr]unittestZskipIfrPgettracerarbrfrhrjrkrmrnrorprrrsryr{rrrrrrrrrrLs:           rLc@s\eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)BasicElementTestcCsd}ddi}t||}||tj|dt||dt||dt||dt|||j|||j||j | |j |||j |d|d <| |j || |j |dS) NrzixwyprCrar`r_bazr) r.rcrbrrrdrCrr`r_rrarN)r*rCra element_foorrr test___init__s    zBasicElementTest.test___init__cCsdttjvrtdtdddi}|tdddi|t|}Wdn1sf0Y| ||| |j |j | |j |j | |j |j | t|t|t||D]\}}|||q| |j|jdS) NrzElement.copy() not presentrrrrrqix)rr.rcrSkipTestrZ assertWarnsDeprecationWarningrrrdrCr`r_re itertools zip_longestassertIsrar*rZ element_foo2rOrPrrrr s  & zBasicElementTest.test_copycCstdddi}|tdddit|}|||||j|j||j|j||j|j|t |t |t ||D]\}}| ||q||j |j dSNrrrrrr)r.rcrrrrdrCr`r_rerrrrarrrr test___copy__$ s  zBasicElementTest.test___copy__cCstdddi}|tdddit|}|||||j|j||j|j||j |j |t |t |t ||D]\}}|||q||j |j ||j |j d|j d<||j |j ||j |j dSr)r.rcrrrrrdrCr`r_rerrrarNrrrrtest___deepcopy__< s   z"BasicElementTest.test___deepcopy__cCs<td}|t|jd|t|jtddg|t|jddtdg|dd<|td|d<Wdn1s0Y|t&tddg|dd<Wdn1s0Yt|drddgdd d d }|t|j|t|d r8Gd ddtj}|dg|dd<|tt j |dS)Njoerrrr __setstate__rCrr_r`)rC _childrenrar_r` __deepcopy__c@seZdZddZdS)z9BasicElementTest.test_augmentation_type_errors..EcSsdSrKr)r*memorrrrq szFBasicElementTest.test_augmentation_type_errors..E.__deepcopy__N)r1r2r3rrrrrEp sr) r.rcrrMrrrrrrr)r*rstaterrrrtest_augmentation_type_errorsZ s*  & 4  z.BasicElementTest.test_augmentation_type_errorscCsGddd}|}tjd|d|_t|}~t||td}|}||_t|}tj|d|d}~~~t||td}td}td}||||||t|}~~~t||dS) Nc@s eZdZdS)z.BasicElementTest.test_cyclic_gc..DummyNr1r2r3rrrrDummyw srr)rrrrr) r.rcZdummyrefweakrefrefr rr,r)r*rrwrefrrrrrrrtest_cyclic_gcv s2            zBasicElementTest.test_cyclic_gccs\dfdd}td}t||}||jd~t|d||ddS)NFcsddSNTr)wflagrrwref_cb sz.BasicElementTest.test_weakref..wref_cbrT)r.rcrrrdrCr )r*rrrrrr test_weakref s    zBasicElementTest.test_weakrefcCsBtjddddd}||jdddd||jd ddddS) NrrrrrM)rlrmzrl)rr)r.rcrdrV)r*rrrrtest_get_keyword_args sz&BasicElementTest.test_get_keyword_argsc CstdtjdD]}t|jddD]\}}|jddd}d|_d|_||d  |d | |d | d d  d d| |d|||}| |jd| |jdd| t|d|||q"qdS)Nrrrrepeatr*)rztext goes herezopposite of headchildZ grandchildz .//grandchildrrz other valuer,r)rrQHIGHEST_PROTOCOLrrMrcr`r_r,rrrr^rdrCrarerh)r*r[rYrZrrrrr test_pickle szBasicElementTest.test_picklec CstdtjdD]z}t|jddD]f\}}d}||}t|drV||dd| |d|||}||j d||d j d q"qdS) Nrrrrz\ 4 __getstate__rCgroupr,rZdogs) rrQrrrMrrrdrr^rC)r*r[rYrZZXMLTEXTrrrrrtest_pickle_issue18997 s  z'BasicElementTest.test_pickle_issue18997N) r1r2r3rrrrrrrrrrrrrrrs# rc@s\eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)BadElementTestcs|Gfddd}|gtd}z|WntyDYn0Gddd|tj}|dgtd}|dS)NcseZdZefddZdS)z2BadElementTest.test_extend_mutable_list..Xcstdgdd<tjS)NrrcryLrr __class__ sz.X.__class__Nr1r2r3propertyrrrrrX srrc@s eZdZdS)z2BadElementTest.test_extend_mutable_list..YNrrrrrY srrlr.rcrrMr*rrrrrrtest_extend_mutable_list s    z'BadElementTest.test_extend_mutable_listcsGfddd}|tdgtd}z|WntyLYn0Gddd|tj}|dtdgtd}|dS)NcseZdZefddZdS)z3BadElementTest.test_extend_mutable_list2..Xcsdd=tjSrKrcryrrrr s z=BadElementTest.test_extend_mutable_list2..X.__class__Nrrrrrr srrrc@s eZdZdS)z3BadElementTest.test_extend_mutable_list2..YNrrrrrr srrrrrrrtest_extend_mutable_list2 s   z(BadElementTest.test_extend_mutable_list2cszGfdddtj}td|dg|tjtdtdtdg|tj|ddS)NcseZdZfddZdS)z3BadElementTest.test_remove_with_mutating..Xcsdd=dS)NFrr*orurrr} s z:BadElementTest.test_remove_with_mutating..X.__eq__Nr~rrurrr srrrr)r.rcrrrrr*rrrurtest_remove_with_mutating s  z(BadElementTest.test_remove_with_mutatingc Csltd}t|d|B|tt|Wdn1s@0YWdn1s^0YdS)NrrC)r.rcr r RuntimeErrorrrrrrtest_recursive_repr s  z"BadElementTest.test_recursive_reprcsnGfdddt}t}|di|d||d|d|d||jddS)NcseZdZfddZdS)z/BadElementTest.test_element_get_text..Xcs"z jWntyYn0dSrK)r` NameErrorryr<rr__del__ s  z7BadElementTest.test_element_get_text..X.__del__Nr1r2r3rrrrrr srrCABCDEFGHIJKL ABCDEFGHIJKL) rr.rr r!rrrdr`r*rrrrrtest_element_get_text s    z$BadElementTest.test_element_get_textcsGfdddt}t}|di|di|d|d||d|d|d||djd dS) NcseZdZfddZdS)z/BadElementTest.test_element_get_tail..Xcs&zdjWnty Yn0dSr)r_rryrrrr s z7BadElementTest.test_element_get_tail..X.__del__Nrrrrrr srrrCrrrrr) rr.rr rr!rrdr_rrrrtest_element_get_tail s      z$BadElementTest.test_element_get_tailcs^Gfddd}tdtdd|tddd|dS)NcseZdZfddZdS)z%BadElementTest.test_subscr..Xcsdd=dSNrrrryrurr __index__3 s z/BadElementTest.test_subscr..X.__index__Nr1r2r3rrrurrr2 srr<rrr)r.rcrrrrur test_subscr0 s  zBadElementTest.test_subscrcsPGfddd}tdtdD]}dtdq$gdd|<dS)NcseZdZfddZdS)z)BadElementTest.test_ass_subscr..Xcsgdd<dSrrryrurrrA s z3BadElementTest.test_ass_subscr..X.__index__Nrrrurrr@ srr<rrr)r.rcrr)r*rrrrurtest_ass_subscr> s   zBadElementTest.test_ass_subscrcCsHdd}tj|d}|di|d|t|jdi~tdS)NcSsgSrKrrlrmrrrelement_factoryM sz>BadElementTest.test_treebuilder_start..element_factoryrrCrr)r.rr r!rAttributeErrorr r*rrrrrtest_treebuilder_startK s   z%BadElementTest.test_treebuilder_startcCsFdd}tj|d}|di|d|t|jd~tdS)NcSsgSrKrrrrrrY sz.element_factoryrrCr)r.rr r!rrrr rrrrtest_treebuilder_endW s   z#BadElementTest.test_treebuilder_endN) r1r2r3rrrrrrrrrrrrrrr s   rc@seZdZddZddZdS)MutatingElementPathcGstj|g|R}||_|SrK)r__new__r<)rNr<rr*rrrre szMutatingElementPath.__new__cCs|jdd=dSrrrrrrr}i s zMutatingElementPath.__eq__N)r1r2r3rr}rrrrrd src@seZdZddZdS)BadElementPathcCs dddS)Nrrrrrrrrr}o szBadElementPath.__eq__Nr~rrrrrn srcsXeZdZfddZfddZddZddZd d Zd d Zd dZ ddZ Z S)BadElementPathTestcs(tddlm}|j|_i|_dSNrr')supersetUpr)r(r path_cacher*r(rrrrt s  zBadElementPathTest.setUpcs"ddlm}|j|_tdSr)r)r(rrrtearDownrrrrrz s zBadElementPathTest.tearDowncCs0td}|tdg|t|ddSNrrrl)r.rcrrrrrrrtest_find_with_mutating s z*BadElementPathTest.test_find_with_mutatingcCsFtd}|tdgz|tdWnty@Yn0dSr)r.rcrrrZeroDivisionErrorrrrrtest_find_with_error s   z'BadElementPathTest.test_find_with_errorcCs0td}|tdg|t|ddSr)r.rcrrrrrrrtest_findtext_with_mutating s z.BadElementPathTest.test_findtext_with_mutatingcCsFtd}|tdgz|tdWnty@Yn0dSr)r.rcrrrrrrrrtest_findtext_with_error s   z+BadElementPathTest.test_findtext_with_errorcCs0td}|tdg|t|ddSr)r.rcrrrrrrrtest_findall_with_mutating s z-BadElementPathTest.test_findall_with_mutatingcCsFtd}|tdgz|tdWnty@Yn0dSr)r.rcrrrrrrrrtest_findall_with_error s   z*BadElementPathTest.test_findall_with_error) r1r2r3rrrrrrrr __classcell__rrrrrs s  rc@s4eZdZddZddZddZddZd d Zd S) ElementTreeTypeTestcCsX|tjt|tjt|tjt|tjt|tjt|tjtdSrK) rbr.r"rrr$rcrrryrrr test_istype s zElementTreeTypeTest.test_istypecCsZGdddtj}|d}||tj|||||jdd|_||jddS)Nc@s eZdZdS)zDElementTreeTypeTest.test_Element_subclass_trivial..MyElementNrrrrr MyElement srrr)r.rcrbrdrCr`r*rmyerrrtest_Element_subclass_trivial s z1ElementTreeTypeTest.test_Element_subclass_trivialcsVGfdddtjddddddd }||jd |t|gd dS) Ncs"eZdZiffdd ZZS)zHElementTreeTypeTest.test_Element_subclass_constructor..MyElementcs"t|j|d|fi|dS)N__)rr-)r*rCraextra)rrrrr- szQElementTreeTypeTest.test_Element_subclass_constructor..MyElement.__init__)r1r2r3r-rrrrrr srrrrr)rrrM)rrZfoo__))rrr)rr)rrM)rr)r.rcrdrCrr~)r*rrrr!test_Element_subclass_constructor s z5ElementTreeTypeTest.test_Element_subclass_constructorcCs.Gdddtj}|d}||ddS)Nc@seZdZddZdS)zGElementTreeTypeTest.test_Element_subclass_new_method..MyElementcSs|jSrKrBryrrr newmethod szQElementTreeTypeTest.test_Element_subclass_new_method..MyElement.newmethodN)r1r2r3rrrrrr srr)r.rcrdrrrrr test_Element_subclass_new_method sz4ElementTreeTypeTest.test_Element_subclass_new_methodcCsGdddtj}td}d|_|d}d|_||||dd||djdt| d}|t |d|||djddS) Nc@s eZdZdS)zAElementTreeTypeTest.test_Element_subclass_find..MyElementNrrrrrr srrr`rr*rrr) r.rcr`rrdrrrCrfrre)r*rrsubfoundrrrtest_Element_subclass_find s  z.ElementTreeTypeTest.test_Element_subclass_findN)r1r2r3rrrrr rrrrr s   rc@sLeZdZddZddZddZddZd d Zd d Zd dZ ddZ dS)ElementFindTestcCstt}||djd||djd||djdtt|d<||djd||dd||dd||dd ||dd d ||d ||d d d |td d d dS)NrCr./tagrzsection/nexttagnexttagr`r*rurtogzempty) r.rrrdrrCSAMPLE_SECTIONrrrrrrtest_find_simple s z ElementFindTest.test_find_simplecCsd}t|}||djdd||djdd||djdd||d jdd ||d jdd|td |jd |td |jd|td |jd|td |jddS)Nz z./tag[1]classrz./tag[2]rz ./tag[last()]rz./tag[last()-1]rz./tag[last()-2]ZXPathz./tag[0]z ./tag[-1]z./tag[last()-0]z./tag[last()+1])r.rrdrrarp SyntaxError)r*Z LINEAR_XMLrrrrtest_find_xpath s zElementFindTest.test_find_xpathcCs tt}tt|d<|t|ddg|t|dddg|t|dg|t|dg|t|dgd|t|d dgd |t|d dg|t|d dgd|t|d gd|t|dgd|t|dgd|t|dgd|t|dgd|t|ddg|t|ddg|t|ddgd|t|ddgd|t|ddgd|t|ddg|t|ddgd|t|ddg|t|ddg|t|dg|t|d g|t|d!dgd||d"|d|t|d#dg|t|d$dg|t|d%dg|t|d&dg|t|d'dg|t|d(dg|t|d)dg|t|d*dg|t|d+dg|t|d,dg|t|d-g|t|d.g|d|d/<|t|d&ddg|t|d,ddgdS)0NrrrrCrztog/foorrqz.//tagrrz section//tagz section/*)rCr  nextsectionz section//*)rCr rrCz section/.//*z*/*z*//*z*/tagz*/./tagr z././tagz.//tag[@class]rMz.//tag[@class="a"]z.//tag[@class="b"]z .//tag[@id]z.//section[tag]rz.//section[element]z../tagzsection/../tagz section//z.//section[tag='subtext']z.//section[tag ='subtext']z.//section[tag= 'subtext']z.//section[tag = 'subtext']z.//section[ tag = 'subtext' ]z.//tag[.='subtext']z.//tag[. ='subtext']z.//tag[.= "subtext"]z.//tag[ . = "subtext" ]z.//tag[. = 'subtext']z.//tag[. = 'subtext ']z.//tag[.= ' subtext']rr)r.rrrrdrIrrrrr test_findall s  zElementFindTest.test_findallcCs\tt}|t|dg|t|ddgd|t|ddgddS)NrCz{http://effbot.org/ns}tagrz.//{http://effbot.org/ns}tagrM)r.rrrdrIrrrrrtest_test_find_with_nsZ s   z&ElementFindTest.test_test_find_with_nscCstd}ddi}|t|jd|dd|t|jd|ddddi}|t|jd|dd |t|jd|ddddd }|t|jd|dd|t|jd|dd dS) N xxrz.//xx:b)rr.//brrr)rru)r.rrdrer)r*rnsmaprrrtest_findall_different_nsmapsd s  z-ElementFindTest.test_findall_different_nsmapscCstd}|td|t|dgd|t|ddg|t|ddg|t|d d g|t|d d dg|t|d d g|t|d t|d |t|dgd|t|d|dgt|d|t|dgd|t|dddg|t|dddg|t|dd g|t|dgd|t|dd d g|t|dt|ddS)Nrrz{*}b){X}br{Y}bz{*}crz{X}*rz{Y}*rrrz{}br)rrrrrdrz.//{*}b)rrrrrz.//{*}cz.//{X}*z.//{Y}*z.//{}*)rrrrz.//{}br)r.rrr-rdrIrrrrrtest_findall_wildcardu sd    z%ElementFindTest.test_findall_wildcardcCsDtt}|td|dWdn1s60YdS)Nzcannot use absolute pathz/tag)r.rrrprrrrrr test_bad_find s zElementFindTest.test_bad_findcCstt}|t|djd|t|dd|tt| ddgdd}| t | t| d}Wdn1s0Y|t|dgddS)NrCr`rzThis search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to '.+'z//tagrM) r.rrrdr$rrCrrIrassertWarnsRegex FutureWarning)r*rrtrrrrtest_find_through_ElementTree s .z-ElementFindTest.test_find_through_ElementTreeN) r1r2r3rrrrrrr r#rrrrr  sM ,r c@s>eZdZdddZddZddZdd Zd d Zd d ZdS)ElementIterTestNcCst||SrK)rIr)r*r<rCrrr_ilist szElementIterTest._ilistcCs4td}|||gd|||dddg|t|jd|d| d|d|d d|t| d t |d d }|tt |d d t |d d }tj t d}|ttj ||dd d td}|t|jtd}|d| ddS)Nz7this is a paragraph...)rrrrrrruzthis is a paragraph...zthis is a paragraph.z this is a F)r=rrr)rz*a&b&c&za&b&c&)r.rrdr%rrrrCrrrArrrr$rr)r*rZ sourcefilerr@rrr test_basic s(     zElementIterTest.test_basiccCstd}|||dgt|d}|||ddgt|d}|||gdt|d}|||gd|d|d<|d=|||ddgdS) Nrrr)rrrr)rrrrrrr)r.rcrdr%r,rlrrr test_corners s     zElementIterTest.test_cornerscCstd}|||ddgd|||ddgd|t|jdddgdgd}|t|||||||||d|dS) NaJ bedroom1 bedroom2 nothing here bedroom8 roomrMhouserrB)rr)r(r(Zshedr)r(r)r.rrdr%rIr)r*rZall_tagsrrrtest_iter_by_tag s z ElementIterTest.test_iter_by_tagcCsJtd}|}|tt|Wdn1s<0YdS)Nr)r.rcrrrMr)r*rrrrrr s  zElementIterTest.test_copyc Csftd}|}ttjdD]@}|ttjft ||Wdq 1sV0Yq dS)Nrrr) r.rcrrrQrrrMrTrR)r*rrr[rrrr s  zElementIterTest.test_pickle)N) r1r2r3r%r&r'r*rrrrrrr$ s  r$c@seZdZdZdZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ ddZddZddZddZddZdd Zd!S)"TreeBuilderTestztext
subtext
tailzsometextcCs||jd||jd||jd||jit|}|t|d|d}||jd||jd||jd||jidS)Nrr`rrrZdivr*r_)rdrCr`r_rarfre)r*rchildrenrrrr_check_sample1_element sz&TreeBuilderTest._check_sample1_elementcCsGddd}Gddd|}tj|d}||j||dtj|d}||j||dtjtd}||j||dS)Nc@seZdZddZdS)z.BaseDummyBuildercSsdS)Nrrryrrrr, szBTreeBuilderTest.test_dummy_builder..BaseDummyBuilder.closeNrdrrrrBaseDummyBuilder+ sr.c@seZdZddZZZdS)z8TreeBuilderTest.test_dummy_builder..DummyBuildercWsdSrKr)rrrr0 rGzATreeBuilderTest.test_dummy_builder..DummyBuilder.N)r1r2r3r!r rrrrr DummyBuilder/ sr0rr)r.rrsample1rdrobjectr)r*r.r0rrrrtest_dummy_builder* s   z"TreeBuilderTest.test_dummy_buildercCst}||djtj||djdtjtjd}||djtj||djdtjtd}||dtddS)NZctext)comment_factory)r.rrdr+rCr-r`rer*rrrrtest_treebuilder_comment> s z(TreeBuilderTest.test_treebuilder_commentcCst}||ddjtj||ddjdtjtjd}||djtj||djd||ddjtj||ddjdtjddd}||dtddf||ddtddfdS)Nr) pi_factoryr+z text zpitarget text cSs t||fSrK)re)rr`rrrr/U rGz5TreeBuilderTest.test_treebuilder_pi..)r.rrdr;rCrr`rer5rrrtest_treebuilder_piJ sz#TreeBuilderTest.test_treebuilder_picCsGdddtj}d}t|}||jdtj|d}|||}||jdd}t|}||jdd}tj|d}|||}||jddS)Nc@s eZdZdS)z;TreeBuilderTest.test_late_tail..TreeBuilderSubclassNrrrrrTreeBuilderSubclass[ sr9ztexttailZtexttailrztexttail)r.rrrdr`rrr)r*r9rrrrrrtest_late_tailY s     zTreeBuilderTest.test_late_tailcCszGdddtj}d}tjtjddd}|||}||djd||djd ||jd tj|ddd}|||}||djd||djd ||jd d }tjtjdd d}|||}||djd ||djd||jdtj|dd d}|||}||djd ||djd||jddS)Nc@s eZdZdS)zKTreeBuilderTest.test_late_tail_mix_pi_comments..TreeBuilderSubclassNrrrrrr9t sr9z/text tailT)Zinsert_commentsrrrBz tailztext z+text tail)Z insert_piszpi datar_ztext )r.rrrrrdr`r_)r*r9rrrrrrtest_late_tail_mix_pi_commentsq s6    z.TreeBuilderTest.test_late_tail_mix_pi_commentscCs6tjtjddd}||j|}||dSNrr)r.rrrr1rr-r*rrrrr$test_treebuilder_elementfactory_none s z4TreeBuilderTest.test_treebuilder_elementfactory_nonecCsXGdddtj}|}||ddtj|d}||j|}||dS)Nc@seZdZddZdS)z4TreeBuilderTest.test_subclass..MyTreeBuildercSs|dSNrrrXrrrrn sz;TreeBuilderTest.test_subclass..MyTreeBuilder.foobarNr1r2r3rnrrrr MyTreeBuilder srArrr) r.rrdrnrrr1rr-r*rAtbrrrrr test_subclass s  zTreeBuilderTest.test_subclasscCslGdddtj}|tjtjd}||ddtj|d}||j|d| }| |dS)Nc@seZdZddZdS)z?TreeBuilderTest.test_subclass_comment_pi..MyTreeBuildercSs|dSr?rrXrrrrn szFTreeBuilderTest.test_subclass_comment_pi..MyTreeBuilder.foobarNr@rrrrrA srA)r4r7rrrz) r.rr-rrdrnrrr1rr-rBrrrtest_subclass_comment_pi s   z(TreeBuilderTest.test_subclass_comment_picsNgfdd}tj|d}tj|d}||j||dgdS)Ncs|t||SrK)rr.rc)rCraZlstrr myfactory s z7TreeBuilderTest.test_element_factory..myfactoryrrZtoplevel)r.rrrsample2rrd)r*rGrCrrrFrtest_element_factory s    z$TreeBuilderTest.test_element_factorycCsFtj|d}tj|d}||j|}|||||dSr<)r.rrrr1rrbr-)r*rNrCrrrrr_check_element_factory_class s     z,TreeBuilderTest._check_element_factory_classcCs Gdddtj}||dS)Nc@s eZdZdS)z@TreeBuilderTest.test_element_factory_subclass..MyElementNrrrrrr sr)r.rcrJ)r*rrrrtest_element_factory_subclass sz-TreeBuilderTest.test_element_factory_subclasscCs4tj}||jdGddd|t}||dS)Nr,c@s eZdZdS)zLTreeBuilderTest.test_element_factory_pure_python_subclass..MyElementNrrrrrr sr)r.Z _Element_Pyrdr2rrJ)r*baserrrr)test_element_factory_pure_python_subclass sz9TreeBuilderTest.test_element_factory_pure_python_subclasscCs<Gddd}tj|d}||j||ddS)Nc@s eZdZdZddZddZdS)z3TreeBuilderTest.test_doctype..DoctypeParserNcSs|||f|_dSrK_doctyper*rXZpubidsystemrrrdoctype sz;TreeBuilderTest.test_doctype..DoctypeParser.doctypecSs|jSrKrNryrrrr sz9TreeBuilderTest.test_doctype..DoctypeParser.close)r1r2r3rOrRrrrrr DoctypeParser srSrrz&-//W3C//DTD XHTML 1.0 Transitional//ENz7http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)r.rrr1rdr)r*rSrrrr test_doctype s    zTreeBuilderTest.test_doctypec CsGddd}tj|ddD]@}|t| tj||dWdq 1sV0Yq tj|tdddD]2}tj||tdd}||j||qxdS)Nc@s"eZdZdefddZddZdS)zBTreeBuilderTest.test_builder_lookup_errors..RaisingBuilderNcSs||_||_dSrKraise_inwhat)r*rWrXrrrr- szKTreeBuilderTest.test_builder_lookup_errors..RaisingBuilder.__init__cSs"||jkr||jdd}|S)NcWsdSrKr)rrrrhandle sz^TreeBuilderTest.test_builder_lookup_errors..RaisingBuilder.__getattr__..handlerV)r*rXrYrrr __getattr__ s  zNTreeBuilderTest.test_builder_lookup_errors..RaisingBuilder.__getattr__)r1r2r3rr-rZrrrrRaisingBuilder sr[r)r r!rr+r;)rX) r.rrprrrr1rr)r*r[rrrrrtest_builder_lookup_errors s 0 z*TreeBuilderTest.test_builder_lookup_errorsN)r1r2r3r1rHr-r3r6r8r:r;r>rDrErIrJrKrMrUr\rrrrr+ s"  $  r+c@sPeZdZdZdZdZddZddZdd Zd d Z d d Z ddZ ddZ dS) XMLParserTests22stextuX $£€𐅻cCs6||jd||djd||djddS)Nr?rlineZ22)rdrCr`rrrr_check_sample_element sz#XMLParserTest._check_sample_elementcCs0tjdtd}||j||dS)Nr)r5r)r.rrrr1r_r)r*rJrrrtest_constructor_args s  z#XMLParserTest.test_constructor_argscCs6Gdddtj}|}||j||dS)Nc@s eZdZdS)z-XMLParserTest.test_subclass..MyParserNrrrrrMyParser! sra)r.rrr1r_r)r*rarrrrrD s zXMLParserTest.test_subclasscCsTt8tdtt}||j|Wdn1sF0YdS)Nerror) warningscatch_warnings simplefilterrr.rrrHrrrrrtest_doctype_warning' s    z"XMLParserTest.test_doctype_warningcsdGfdddtj}|}|td||jWdn1sN0Y||dt pt dt t dtGfddd}||d}||j||| dWdn1s0YdS) NcseZdZfddZdS)z@XMLParserTest.test_subclass_doctype..MyParserWithDoctypecs ||fdSrKr)r*rrrNrrrR1 szHXMLParserTest.test_subclass_doctype..MyParserWithDoctype.doctypeNr1r2r3rRrrNrrMyParserWithDoctype0 srhrRrbcseZdZfddZdS)z:XMLParserTest.test_subclass_doctype..DoctypeParsercs|||fdSrKrrP _doctype2rrrR@ szBXMLParserTest.test_subclass_doctype..DoctypeParser.doctypeNrgrrirrrS? srSrrT) r.rr!RuntimeWarningrrHrrrcrdrerrd)r*rhrrSr)rOrjrtest_subclass_doctype. s&*       z#XMLParserTest.test_subclass_doctypecCsptTtdttdtGdddtj}|}||j| Wdn1sb0YdS)z:Ensure that ordinary usage is not deprecated (Issue 19176)rbc@s eZdZdS)zDXMLParserTest.test_inherited_doctype..MyParserWithoutDoctypeNrrrrrMyParserWithoutDoctypeQ srmN) rcrdrerrkr.rrrHr)r*rmrrrrtest_inherited_doctypeL s    z$XMLParserTest.test_inherited_doctypecCsVtjtd}||j|}||jd||jdd||j ddS)NrZmoneyr{u $£€𐅻) r.rrrsample3rrdrCrar`r=rrrtest_parse_stringW s  zXMLParserTest.test_parse_stringN) r1r2r3r1rHror_r`rDrfrlrnrprrrrr] s r]c@seZdZddZdS)NamespaceParseTestcCs`ddd}tt}|t|d|d|t|d|d|t|d|ddS) NZhellor)hrz {hello}tablerrz .//{hello}tdrz .//{foo}name)r.rSAMPLE_XML_NS_ELEMSrdrer)r*rrrrrtest_find_with_namespacea s   z+NamespaceParseTest.test_find_with_namespaceN)r1r2r3rtrrrrrq` srqc@sleZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS)ElementSlicingTestcCsdd|DS)NcSsg|] }|jqSrrB)rErrrrrFl rGz1ElementSlicingTest._elem_tags..r)r*Zelemlistrrr _elem_tagsk szElementSlicingTest._elem_tagscCs|t|SrK)rvrfr.rrr _subelem_tagsn sz ElementSlicingTest._subelem_tagscCs,td}t|D]}t|d|q|S)zxCreate an Element with a tag 'a', with the given amount of children named 'a0', 'a1' ... and so on. rza%s)r.rcrr,)r*Z numchildrenrrrrr_make_elem_with_childrenq s  z+ElementSlicingTest._make_elem_with_childrencsZ|d|djd|djd|tfdd|tfdddS) Nrrra1a8csdS)N rrrurrr/ rGz?ElementSlicingTest.test_getslice_single_index..csdS)Nirrrurrr/ rG)rxrdrCr IndexErrorryrrurtest_getslice_single_index{ s  z-ElementSlicingTest.test_getslice_single_indexcCs|d}|||ddgd|||ddgd|||ddgd|||ddddg|||ddddg|||dd d d gdS) NrrM)a3a4a5rrrrdra0ry)rxrdrvrrrrtest_getslice_range s z&ElementSlicingTest.test_getslice_rangec Cs|d}|||dddddg|||dddgd|||dddddg|||dddd dg|||ddtjd g|||ddtjd >d gdS) Nrrrr{a9rM)rrZa6rrryr@rxrdrvrPmaxsizerrrrtest_getslice_steps s      z&ElementSlicingTest.test_getslice_stepsc Cs|d}|||dddgd|||dddddg|||ddtj dg|||ddtj ddg|||ddtj d >dgdS) Nrrd)ra2ryrrzrryrMrrrrrrrrtest_getslice_negative_steps s    "&z/ElementSlicingTest.test_getslice_negative_stepscCs|d}|dd=|||ddg|d}|dd=|||g|d}|ddd=|||g|d}|ddd=|||ddg|d}|d dd=|||ddg|d}|ddd=|||d gdS) Nrrrrrrdrzrrrry)rxrdrwrrrr test_delslice s$            z ElementSlicingTest.test_delslicecCs|d}td|d<|||gdtd|d<|||gd|ttd|d <Wdn1s0Y|ttd|d <Wdn1s0Y|||gddS) Nrrrrrrrrrrz)rrrrrr)rxr.rcrdrwrr}rrrrtest_setslice_single_index s  , ,z-ElementSlicingTest.test_setslice_single_indexcCs|d}ddtdD|dd<|||gd|d}tdg|dd<|||gd |d}d dtdD|dd<|||gd dS) NrcSsg|]}td|qSzb%srcrErrrrrF rGz:ElementSlicingTest.test_setslice_range..rrrrM)rb0b1rr)rrrcSsg|]}td|qSrrcrrrrrF rG)rrrb2r)rxrrdrwr.rcrrrrtest_setslice_range s   z&ElementSlicingTest.test_setslice_rangecCs|d}ddtdD|ddd<|||gd|d}|t&tdg|ddd<Wdn1s|0Y|t,d dtd D|ddd<Wdn1s0Y|tg|ddd<Wdn1s0Y|||gd |d }tdg|ddtj <|||gd tdg|ddtj d><|||gddS)NrcSsg|]}td|qSrrcrrrrrF rGz:ElementSlicingTest.test_setslice_steps..rrrr)rrrrrrrcSsg|]}td|qSrrcrrrrrF rGrM)rryrrrrrrrrrrrr rxrrdrwrrr.rcrPrrrrrtest_setslice_steps s    4 : , z&ElementSlicingTest.test_setslice_stepscCs|d}ddtdD|ddd<|||gd|d}|t&tdg|ddd<Wdn1s|0Y|t,d dtd D|ddd<Wdn1s0Y|tg|ddd<Wdn1s0Y|||gd |d}tdg|d dtj <|||gd tdg|d dtj d <|||gdtdg|d dtj d><|||gddS)NrcSsg|]}td|qSrrcrrrrrF rGzCElementSlicingTest.test_setslice_negative_steps..rrrd)rrrrrcSsg|]}td|qSrrcrrrrrF rGrM)rryrrrrrrrrr)rrrrrrrrrtest_setslice_negative_steps s$   4 : , z/ElementSlicingTest.test_setslice_negative_stepsN)r1r2r3rvrwrxr~rrrrrrrrrrrrruj s      ruc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZGdddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)S)*IOTestc Cstd}d|_|t|ddD]Z}||<|t||dd|t||ddWdq$1st0Yq$dD]r}||T|t||dd|||}|t||dd||Wdq1s0Yqtd}d |_|t|d |t|d dd |t|d dd dD]$}|t||dd||qDtd}d |jd<|t|d|t|d dd|t|d dddD]$}|t||dd||qtd}d|_|t|d|t|d dd|t|d dddD]$}|t||dd||q,td}d|jd<|t|d|t|d dd|t|d dddD]$}|t||dd||qdS)NrCrzabc)rrrsabc)rrutf-32z2 abcz<&"'>z<&"'>rs<&"'>rz> <&"'>r|z"s"zF uåöö<>uåöö<>såöö<>s%åöö<>u= åöö<>uss()rrrrru@ ) r.rcr`rdrArupperr ra)r*r<encrrrrrs  $ $      zIOTest.test_encodingcCsf|tjtttd}|tttd }| | dWdn1sX0YdS)Nørø) r#rr$rr.r$rr9rrdrr*r@rrrrtest_write_to_filenameFs   zIOTest.test_write_to_filenamecCs|tjtttd}|jtddttd }| | dWdn1s\0Y|jtddttd$}| | t dWdn1s0YdS)Nrrrrør: ) r#rr$rr.r$rr9rrdrr"rrrr$test_write_to_filename_with_encodingMs .  z+IOTest.test_write_to_filename_with_encodingcCs|tjtttd}|j}Wdn1s40Yttttd}|j tddttd }| | dWdn1s0YdS)Nrrr4rrr) r#rr$rrr5r.r$rr9rdr)r*rr5r@rrr!test_write_to_filename_as_unicodeZs $  z(IOTest.test_write_to_filename_as_unicodecCs|tjtttd}ttddd*}|j|dd| |j Wdn1s\0Yttd }| | dWdn1s0Yttddd d *}|j|dd| |j Wdn1s0Yttd }| | d Wdn1s0Yttdd d*}|j|dd| |j Wdn1sf0Yttd }| | d Wdn1s0YdS)Nrrrrr4rrrxmlcharrefreplace)r5errorsrrs r#rr$rr.r$rrr9r r!rdrrrrrtest_write_to_text_filees"* .* 0, zIOTest.test_write_to_text_filecCs|tjtttd}ttd&}||| |j Wdn1sT0Yttd }| | dWdn1s0YdS)Nrrrrrrrrrtest_write_to_binary_filezs  * z IOTest.test_write_to_binary_filecCs |tjtttd}ttd*}|j|dd| |j Wdn1sX0Yttd }| | dWdn1s0Yttd*}|j|dd| |j Wdn1s0Yttd }| | dWdn1s0YdS) Nrrrrrrrrrrrrr'test_write_to_binary_file_with_encodings * . *  z.IOTest.test_write_to_binary_file_with_encodingcCs0|tjtttd}ttd*}|j|dd| |j Wdn1sX0Yttd&}| | d dWdn1s0Yttddd*}|j|dd| |j Wdn1s0Yttd&}| | d dWdn1s"0YdS) Nrrrrru7 ør) buffering)r#rr$rr.r$rrr9r r!rdrr rrrr"test_write_to_binary_file_with_boms( *  "*  z)IOTest.test_write_to_binary_file_with_bomcCs2t}td}||||jddSNz"site)r.r$r6r8rrdrrCr*r@rrrrtest_read_from_stringios  zIOTest.test_read_from_stringiocCs:ttd}t}|j|dd||ddSNrr4r)r.r$rr6r8r9rdr:rrrrtest_write_to_stringioszIOTest.test_write_to_stringiocCs2t}td}||||jddSNs"r)r.r$r6r7rrdrrCr*r@rrrrtest_read_from_bytesios  zIOTest.test_read_from_bytesiocCs6ttd}t}||||ddSNrr)r.r$rr6r7r9rdr:rrrrtest_write_to_bytesios zIOTest.test_write_to_bytesioc@s eZdZdS)z IOTest.dummyNrrrrrdummysrcCsBtd}|}|j|_t}||||j ddSr) r6r8rrr.r$rrdrrC)r*rreaderr@rrrtest_read_from_user_text_readers   z&IOTest.test_read_from_user_text_readercCsJttd}t}|}|j|_|j|dd||ddSr) r.r$rr6r8rr9rdr:)r*r@rwriterrrrtest_write_to_user_text_writers z%IOTest.test_write_to_user_text_writercCsJtd}|}|j|_t}||||j dt}dSr) r6r7rrr.r$rrdrrC)r*rrr@rrr!test_read_from_user_binary_readers  z(IOTest.test_read_from_user_binary_readercCsFttd}t}|}|j|_||||ddSr) r.r$rr6r7rr9rdr:r*r@rrrrr test_write_to_user_binary_writers  z'IOTest.test_write_to_user_binary_writercCsbttd}t}|}|j|_dd|_|j|_|j|dd| | d ddS)NzcSsdSrrrrrrr/rGzBIOTest.test_write_to_user_binary_writer_with_bom..rrz0 ) r.r$rr6r7rr9seekabletellrdr:r rrrr)test_write_to_user_binary_writer_with_boms  z0IOTest.test_write_to_user_binary_writer_with_bomc CsRtd}|t|ddt|d|t|ddt|ddS)Nzfoor4rurrG)r.rrdrrrrrrrtest_tostringlist_invariants   z"IOTest.test_tostringlist_invariantcCsRtd}|t|dd|tj|dddd|tj|dddddS)Nzabcr4zabcT)Zshort_empty_elementsFzabc)r.rrdrrrrrtest_short_empty_elementss  z IOTest.test_short_empty_elementsN)r1r2r3rrrrrrrrrrrrrrrrrrrrrrrrrs(E      rc@s,eZdZddZddZddZddZd S) ParseErrorTestcCs|ttdSrK)rbr.r"rryrrrrDszParseErrorTest.test_subclassc Cs>zt|Wn*tjy8}z|WYd}~Sd}~00dSrK)r.rr")r*rgrrrr _get_error szParseErrorTest._get_errorcCs@||djd||djd||djddS)Nr)rrrz&foo;)rrrzfoobar<)rrr)rdrZpositionryrrrtest_error_positionsz"ParseErrorTest.test_error_positioncCs8ddlmmm}||dj|j|jdS)Nrr) Zxml.parsers.expat.errorsparsersZexpatrrdrcodeZcodesZXML_ERROR_SYNTAX)r*ZERRORSrrrtest_error_codes zParseErrorTest.test_error_codeN)r1r2r3rDrrrrrrrrsrc@seZdZddZdS)KeywordArgsTestc Cstd}||dd|jddd||ddd|jdddd||dd|jddd|t|ddt|jddd|tdj itdt dddtjdt ddddtjdt dd dd tjddddtjdt ddddddg}|D]*}||j d||j t dddq tj |d d d did}||j d d| tdtddWdn1s0Y| tdtjdddWdn1s0YdS)Nz foor)pathr)rrr#r)rArb)ra)rA)rbrrnZkey1Zvalue1zmust be dict, not strzI'm not a dict)r.rrdrrrrfrrcrarUrCr,rprM)r*rlelementsrrrrrtest_issue14818s:   ,zKeywordArgsTest.test_issue14818N)r1r2r3rrrrrrsrc@seZdZddZddZdS)NoAcceleratorTestcCststddS)Nzonly for the Python version)rLrrryrrrr@szNoAcceleratorTest.setUpcCs(|tjjtj|tjjtjdSrK)rbrLrcr-types FunctionTyperryrrrtest_correct_import_pyETEsz*NoAcceleratorTest.test_correct_import_pyETN)r1r2r3rrrrrrr?srcKstj|fi|SrK)rL canonicalize)rr>rrrc14n_roundtripOsrc@s(eZdZdZddZddZddZdS)C14NTestNcCs|tdd|tdd|tdd|tdd|td d |td d |td d|tdd|tdd|tdd|tdd|tddd}|t||d}|t||d}|t||dS)Nzz zzz z,z+z7zz z*Hello, world!zHello, world!z2z2zG"0" && value<"10" ?"valid":"error"]]>zIvalue>"0" && value<"10" ?"valid":"error"zSvalidz{validz7z/z6z=z7z1z5zJzN)rdrrrrrtest_simple_roundtripYsP           zC14NTest.test_simple_roundtripcCstd}|t|ddd|t|ddgdd|t|ddgd d |t|ddgdgd d |t|dd dgd d|t|d dgdd|t|dddgd d|t|ddgdddS)Nz abtext btext dtext T) strip_textzabtextbtextdtextz{http://example.com/x}attr)r exclude_attrszcabtextbtextdtextz{http://example.com/x}d)r exclude_tagszbabtextbtext)rrrz4abtextbtextrrzCdtext)rza dtext zIzu )rGrHrdrrrrrtest_c14n_exclusionsF    zC14NTest.test_c14n_exclusionc stddd}ttjj|ddtt|DddD}fddDfd d|D}|d td d| Dd/d d }| D]f\}}|D]V\}}||ddk} ||ddk} ||ddk} d|vrdd|dd dD} dd|dd dD} nd} } dddt| D}| |d|d|dkrz| sz| d||d kr| s| d|d|vr|ddd!dur| d"||d#}|d$krXtd%d&V}t|d&*}t|d'|}Wdn1s.0YWdn1sN0Ytj|| | | | | d(}t|d#d)d*d+:}|}|d,kr|d-d.}|d-d.}Wdn1s0Y|||Wdq1s0YqqdS)0Nzc14n-20r r cSs"g|]}|dr|ddqS).xmlNr)endswithrEfilenamerrrrFs z+C14NTest.test_xml_c14n2..cSsg|]}|dr|qS)in) startswithrrrrrFs cs8i|]0}|dr|ddt|dDqS)Zc14ncSs,i|]$}|jdd|jpd|fqS)}rdru)rCsplitr`r)rEoptionrrr sz6C14NTest.test_xml_c14n2...r)rr.rrr) full_pathrrrs  z+C14NTest.test_xml_c14n2..cs"i|]fddDqS)csJg|]B}|ddr|dddvr||dddfqS)Zout_rrrrd)rrsplitr)configs input_filerrrFsz6C14NTest.test_xml_c14n2...r)rE)rfiles)rrrscSsg|]}|D]}|q qSrr)rE output_files output_filerrrrFscSs|||dfdS)NrrrV)configZ option_namerrrr get_optionsz+C14NTest.test_xml_c14n2..get_optionZIgnoreCommentstrueZ TrimTextNodesZ PrefixRewriteZ sequentialZ QNameAwarecSs(g|] }d|dd|dqS{ZNSrNamerr[rrrrFsrrz/{http://www.w3.org/2010/xml-c14n2}QualifiedAttrcSs(g|] }d|dd|dqSrrr[rrrrFsz){http://www.w3.org/2010/xml-c14n2}Element,css8|]0\}\}}|d|p*ddd|DVqdS)=rcss|]}|jddVqdS)rrdN)rCr)rErrrr rGz4C14NTest.test_xml_c14n2...N)r)rErXr{r,rrrrs z*C14NTest.test_xml_c14n2..()Z inNsRedeclz2Redeclared namespace handling is not supported in ZinNsSuperfluousz.{http://www.w3.org/2010/xml-c14n2}XPathElementz2QName rewriting in XPath text is not supported in rZinC14N5z world.txtrs&ent2;)Z from_fileZ with_commentsrrewrite_prefixesZqname_aware_tagsZqname_aware_attrsrrsrZinC14N3z attr="default"ru)N)rrrrrrlistdirrdrevaluesr~rrrrrr6r7rrr.r)r*ZdatadirZ input_filesZtestsrrrrrZ keep_commentsrrZqattrsZqtagsZ config_descrrZ entity_filer`rpr)rrrrtest_xml_c14n2s              Z  ,zC14NTest.test_xml_c14n2)r1r2r3ZmaxDiffrrrrrrrrSs(PrcCs:tddgda|durt}|attttttt t t t t tttttttg}tturZ|tgddlm}tjj}|}|j}||_ttdrttjtj }nd}zLt!j"|Wddlm}|#|$|||_|durtj|daanBddlm}|#|$|||_|dur,tj|daa0dS)Nr,r-)Zblockedrr'_set_factories)%rrLr.r#rurrrrorrr<rr r$r+r]rrLrrrrr)r(riZ_namespace_maprrrrr-rrZ run_unittestrr[)moduleZ test_classesr(rZ nsmap_copyrZ old_factoriesrrr test_main8sj           r__main__)Tr4)N)Mrrrr6rrirrQrPrGrrrcrrrrrrZ test.supportrrrr r r rLr.rr UnicodeEncodeErrorrrrrrrrsrrrr"ZTestCaser#rArIrJrorr>formatescaperJr<rLrrrr__hash__rrrr r$r+r]rqrurrrrrrrr1rrrrs             .w    7fd48W`xT $f E