a zei@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZmZddlmZddlmZmZmZmZmZmZdadaedddZzed Wneye d Yn0ed ddZ!ed ddZ"d Z#dZ$dZ%dZ&dZ'dZ(ddddZ)Gddde j*Z+dnddZ,ddZ-Gdd d Z.Gd!d"d"e j*Z/Gd#d$d$e j*Z0iZ1d%e1d&<d'e1d(<d)e1d*<d+e1d,<d-e1d.<d/e1d0<d1e1d2<d3e1d4<d52e3ede1d6<d7e1d8<iZ4d9e4d:<d;e4d<<d=e1d><d?e1d@<dAe1dB<GdCdDdDe j*Z5GdEdFdFe j*Z6GdGdHdHe.e j*Z7GdIdJdJe.e j*Z8GdKdLdLe9Z:e9j;e:_;GdMdNdNe9ZGdSdTdTe j*Z?GdUdVdVe j*Z@GdWdXdXe j*ZAGdYdZdZe j*ZBGd[d\d\e j*ZCGd]d^d^e j*ZDGd_d`d`e j*ZEGdadbdbe j*ZFGdcdddde j*ZGGdedfdfe j*ZHdgdhZIGdidjdje j*ZJdodkdlZKeLdmkreKdS)pN)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)filtersrtestG/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_xml_etree.pynewtestlsz1checkwarnings..decorator..newtest) functoolsupdate_wrapper)rrrr)rr decoratorks z checkwarnings..decoratorr)rrrrrr checkwarningsjsrc@seZdZddZddZdS) ModuleTestcCs(ddlm}ddlm}ddlm}dS)Nr) ElementTreeElementInclude ElementPath) xml.etreerrr!)selfrrr!rrr test_sanityus  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$r)rrrrrtsrTunicodecKsX|dkrt}nt}t|}|j|fd|i||rF|S|d|SdS)Nr-encodingr)ioBytesIOStringIOr'rwritegetvalueseek)elem to_stringr.optionsfiletreerrr serializes   r:cCsdd|DS)NcSsg|] }|jqSrtag.0r5rrr z"summarize_list..r)seqrrrsummarize_listsrBc@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)NZcETrEz%Failed to round-trip %r from %r to %r) r sysrFpickledumpsloads PicklingErrordictr'rErZ TestFailedget) r#objnamedumperloaderprotoZtempresultpeZhumanrrrpickleRoundTrips *,  zElementTestCase.pickleRoundTripcCs||tjtjf||tjtjf|tt|tt|t||D]\}}|||qNt dddd}|||||dS)Nr<tailtextattrib) assertIsInstancer'ElementrE assertEquallenlistzipassertEqualElementsoperator attrgetter)r#ZalicebobxyZ propertiesrrrrasz#ElementTestCase.assertEqualElementsN)r*r+r, classmethodrHrWrarrrrrCs rCc@sdeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPZ*dQdRZ+dSdTZ,dUdVZ-dWS)XElementTreeTestcCs|t||dSrD)r]r:)r#r5expectedrrrserialize_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)r^r])stringcharZ new_stringr#rr check_strings z4ElementTreeTest.test_interface..check_stringcsRt||}|}|D] }||}qd|d<j|ddd|dddS)Nvaluekeyzexpected value string, got %rrl)r^keysitemsr])mappingrvrwruitemrrrr 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 elementrl)r<rZrYrXz no %s memberzno %s visible by dir) assertTruer'Z iselementdirhasattrassertInr<rZrYrX)elementZdirelemattrr5) check_elementrzrsr#rrrs"       z5ElementTreeTest.test_interface..check_elementr<tägrtruz^$csjt|dd|ddS)N__call__z%s not callablerl)r{r}methodrrrr check_methods z4ElementTreeTest.test_interface..check_methodcs|jdSrD)__next__)it)rrr check_itersz2ElementTreeTest.test_interface..check_iter*)r'r\rgetroot assertRegexreprappendextendinsertremovefinditerfindfindallfindtextclearrOsetrvrwiteritertextr]XML fromstringPIProcessingInstruction)r#rr9rr)rrzrrsr#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)Nr<TagZTAGTextZTEXTZTailZTAILbd)acBD)AC)r'r\r]r< assertIsNonerYrXrZ)r#rrrrtest_set_attribute s*     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)Ntag2zrzr<rtrzsubtagz!z+zlist.remove(x): x not in listrkz )r'rrjr\rrrrr assertRaises ValueErrorr]str exception)r#r5erZ subelementcmrrrtest_simpleops(sR                         *  " zElementTreeTest.test_simpleopscCs:|tdd|tdd|tdddS)Nzhelloz)helloz)rjr'rrrrrr test_cdataTs   zElementTreeTest.test_cdatacCs|ttd}tj|d}||djd||djdtjt d}||djd||djddS)Nr)r8r< section/tagrzelement/../empty-element empty-element) r/r0 SAMPLE_XMLencoder'rr]rr<SIMPLE_XMLFILE)r#Z stringfiler9rrrtest_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'rrrangerrrr^_cacher]Z assertGreaterZ assertLess)r#r!r5iZ cache_len_10rrrtest_path_cacheis  & &&&zElementTreeTest.test_path_cachecCsZddl}td}||}||}d|d_||d||d||ddS)Nrzhellobarfoozhellozhello)copyr'rdeepcopyrr<rj)r#re1e2e3rrr test_copyxs      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)Nr<rudefaultrtrotherrZaatestatestvaltestbtest2s-aa)rr)rrZtest1Ztestcs;aar r rz rz s[)r<) r'r\rOr]rrZrrYtostringsortedrvrw)r#r5rZrrr test_attribs\                 zElementTreeTest.test_attribcCstd}ddi}|d|}|j|j|dd||||d|||d||||d|||g||d |g|dd<||dt |g|dd<||ddS) Nr<rurtrzattrib aliasingrlz!zM) r'r\Z makeelement assertIsNotrZrrjrrtuple)r#r5rZsubelemrrrtest_makeelements$        z ElementTreeTest.test_makeelementcCstt}t}|j|dd||dtt}t}|j|dd||dt t}| }Wdn1s0Yt }| |j d||||dt}tj |d}||||ddS)Nr-r.zi text texttail z text texttail z^Expat target)r'parserr/r1r2r]r3SIMPLE_NS_XMLFILEopenread XMLParserrversionfeedrjclose TreeBuilder)r#r9streamfdataparserrrrrtest_parsefiles4     &     zElementTreeTest.test_parsefilecCstd}|tj|dddtd}|tj|dddgd}t|}|t|d|dt|d|t|ddtd\}}|t |d td \}}|t |d ||d j d dS) Ntextr-r)z ztexttextr@asciisE textrz(textrkbody) r'rr]rrZfromstringlistjoin tostringlistZXMLIDr^r<)r#rZsequence_Zidsrrrtest_parseliterals0    z!ElementTreeTest.test_parseliteralc Cstj}|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!~~ Wdn1s0YdS)$NendrcSsg|]\}}||jfqSrr;r>actionr5rrrr?r@z2ElementTreeTest.test_iterparse..)rrrrrootrcSsg|]\}}||jfqSrr;rrrrr?#r@)r{namespace}elementrr{namespace}empty-elementr{namespace}rootrcSsg|]\}}||jfqSrr;rrrrr?,r@eventscSsg|]\}}||jfqSrr;rrrrr?0r@startrcSsg|]\}}||jfqSrr;rrrrr?4r@rrrrrr r)rrrr)rrstart-nsend-nscSs*g|]"\}}|dvr||jfn||fqS)rr;rrrrr?As) r )rn namespacerrrrrrrrrrrr Nr r zcSsg|] \}}|qSrrrrrrr?Rr@r r rrZbogusrbzunknown event 'bogus's text )r cSsg|]\}}||fqSrrrrrrr?hr@)r )rnuhttp://éffbot.org/ns)r )ucléhttp://effbot.org/nszjunk)rdocumentz.junk after document element: line 1, column 12wbsjunk)r' iterparsernextr]r<rrr/r1rrr assertFalseclosedrrrZcheck_no_resource_warningr0 ParseError addCleanupunlinkrr2) r#rcontextrr5rresrrsourcerrrrtest_iterparses         *,  *"   (  *  ( zElementTreeTest.test_iterparsecCstd}d|_||ddt|d_||dd|_||d|dtd ||d td d |d<||d dS)Nr<rYztextsubtextrz'textsubtextztextsubtextrcommentz*textsubtextrurtz)textsubtext) r'r\rYrj SubElementr<rCommentrr#r5rrrtest_writefiles    zElementTreeTest.test_writefilecCstt}|}Wdn1s&0YGdddt}|}tj|d}||||gdtt}|}Wdn1s0YGdddt}|}tj|d}||||gddS)Nc@s$eZdZddZddZddZdS)4ElementTreeTest.test_custom_builder..BuildercSs|d|fdSNrrr#r<rZrrrrs:ElementTreeTest.test_custom_builder..Builder.startcSs|d|fdSNrr,r#r<rrrrs8ElementTreeTest.test_custom_builder..Builder.endcSsdSrDrr#rYrrrrs9ElementTreeTest.test_custom_builder..Builder.dataN)r*r+r,rrrrrrrBuildersr4rrc@sDeZdZddZddZddZddZd d Zd d Zd dZ dS)r*cSs|d|fdSr+r,r-rrrrsr.cSs|d|fdSr/r,r0rrrrsr1cSsdSrDrr2rrrrsr3cSs|d||fdS)Npir,)r#rrrrrr5sz7ElementTreeTest.test_custom_builder..Builder.picSs|d|fdS)Nr%r,)r#rrrrr%sz.Builder.commentcSs|d||fdS)Nr r,)r#prefixurirrrstart_nssz=ElementTreeTest.test_custom_builder..Builder.start_nscSs|d|fdSNr r,r#r6rrrend_nssz;ElementTreeTest.test_custom_builder..Builder.end_nsN) r*r+r,rrrr5r%r8r;rrrrr4s) )r5r5r)r% comment )r rnrrrrrrrrrr rn) rrrr_r'rrr]r)r#rrr4builderrrrrtest_custom_builders &   &  z#ElementTreeTest.test_custom_buildercCsFGdddt}|}tj|d}|td||gddS)Nc@seZdZddZdS)z@ElementTreeTest.test_custom_builder_only_end_ns..BuildercSs|d|fdSr9r,r:rrrr;szGElementTreeTest.test_custom_builder_only_end_ns..Builder.end_nsN)r*r+r,r;rrrrr4sr4ra text texttail ))r r)r pr=)r_r'rrtextwrapdedentr])r#r4r>rrrrtest_custom_builder_only_end_nss   z/ElementTreeTest.test_custom_builder_only_end_nscCs|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|qSrrBr=rrrr?sz1ElementTreeTest.test_children..)rrrcSsg|] }t|qSrrDr=rrrr?srrkr) rrr'rr]rrrrr^r_assertNotEqualr)r#rr9r5child1child2rrr test_childrensH (     zElementTreeTest.test_childrencCs<td}|t|dtd}|t|ddS)Nrr)r'rr]rrr(rrrtest_writestring s  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'rindentr]rr(rrr test_indents0            zElementTreeTest.test_indentcCsXtd}tj|dd|t|dtd}tj|dd|t|ddS)NrK )spacesD

pre
post

text

rns>

pre
post

text

rLr(rrrtest_indent_space>s  z!ElementTreeTest.test_indent_spacecCstd}t||dd|Dhd|dd|Dhd|tdd|Dtdd|DdS) Nz@

par

text


cSsh|] }|jqSrrXr>elrrr [r@z.>N   cSsh|] }|jqSrrYrSrrrrU_r@>rYNrXZparz rVcSsh|] }|jqSrrRrSrrrrUcr@cSsh|]}t|jqSr)idrXrSrrrrUdr@)r'rrMr]rr^r(rrrtest_indent_space_cachingWs  z)ElementTreeTest.test_indent_space_cachingcCstd}|ttj|ddWdn1s80Y|t|dtj|dd|t|dtd}tj|ddd |t|d dS) NrK)levels9

pre
post

text

rs^

pre
post

text

rkro)r]rPsI

pre
post

text

)r'rrrrMr]rr(rrrtest_indent_levelgs$  , z!ElementTreeTest.test_indent_levelcCs<td}|tj|ddd|tj|dddddS)N0r-rArr.default_namespace1r'rr]rr(rrrtest_tostring_default_namespaces  z/ElementTreeTest.test_tostring_default_namespacecCs&td}|tj|dddddS)Nr_r-foobarrazPrdr(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$r-rfra)r'rassertRaisesRegexrr)r#r5Z EXPECTED_MSGrrr5test_tostring_default_namespace_original_no_namespaces zEElementTreeTest.test_tostring_default_namespace_original_no_namespacecCs$td}|tj|ddddS)Nrr-rrrdr(rrr test_tostring_no_xml_declarations   z0ElementTreeTest.test_tostring_no_xml_declarationcCs&td}|tj|dddddS)Nrutf8Tr.xml_declarations: rdr(rrrtest_tostring_xml_declarations  z-ElementTreeTest.test_tostring_xml_declarationcCs6td}t}|d|dtj|ddddS)Nr r-Trl)r'rlocalegetpreferredencodingr]r)r#r5preferredencodingrrr.test_tostring_xml_declaration_unicode_encodings   z>ElementTreeTest.test_tostring_xml_declaration_unicode_encodingcCstd}t}dddddddd d d d d ddd|dddfg}|D]X\}}}|d|d|(|tj|||d|WdqF1s0YqFdS)Nø)øNN)øUTF-8N)rvUS-ASCIIN)E ISO-8859-1N)rur-N)rvNF)rwrxF)rvryF)sr{F)rur-F)sH øNT)sA ørxT)sH øryT)rzr{Trou'?> ør-Tz encoding=z xml_declaration=rl)r'rrqrrsubTestr]r)r#r5rsZ TESTCASESZexpected_retvalr.rmrrr#test_tostring_xml_declaration_casess@    z3ElementTreeTest.test_tostring_xml_declaration_casesc CsHtd}|dtj|ddd|dtj|dddddS) Nr_rnr-rr`rrarc)r'rr]rrr(rrr#test_tostringlist_default_namespaces z3ElementTreeTest.test_tostringlist_default_namespacecCstd}|dtj|ddd|dtj|ddd t}tj|ddd }|d|d |d ||d d|gd|dddS)Nrrnr-rrr@T)rms> rlrorprz%^<\?xml version='1.0' encoding='.+'?>)zzzrk)r'rr]rrrqrrr)r#r5rsZ 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)Nrncs>d||f}t||j|t|j|dS)Nz0%s)r]r'rrrY)r.rxmlrrrrchecks z,ElementTreeTest.test_encoding..checkrrus-ascii iso-8859-1½z iso-8859-15u€cp437u√ mac-romanu˚cSsd|S)Nz*rrrrrrsz*ElementTreeTest.test_encoding..xmlcs||SrD)rr)rrrbxmlsz+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)rn) r]r'rrrrrr LookupError)r#rrZsupported_encodingsr.Z&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-rWz/ rrhtmlz* rYz1 < 2 )r'rrXr]r:r#rrrr test_methods<s  zElementTreeTest.test_methodscCs2td}|t|d|t|ddddS)Nz(textrrr'rr]r:rrrrtest_issue18347Ks  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 10rYentityztextz,undefined entity &entity;: line 4, column 10)r'rr]r:rjrrrr ENTITY_XMLrrrrEXTERNAL_ENTITY_XML)r#rrrrrrr test_entityRs2  ( (    * zElementTreeTest.test_entitycCsrtd}||dtd}||dtd}||dtd}||dtt}||d dS) NzzzCzCz7z7zGzEz text subtext )r'rrj SAMPLE_XML_NSr(rrrtest_namespacews$      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}tagzr7r<Ztag1rz;rtz{uri}keyz+z {uri}valuez0z/z {uri2}valuez {uri1}keyz{nsz{ns}tagz other-tagzns:tag) r'r\rjQNamer&rrZrr]rrF)r#r5rZq1Zq2rrr 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)r>opr<rrrr?szGElementTreeTest.test_xpath_tokenizer..check..)r]Zxpath_tokenizer)r@ri namespacesr!r#rrrs   z3ElementTreeTest.test_xpath_tokenizer..checkrztext()rY()z@name@rQz@*zpara[1])para[1]z para[last()])rrZlastrrz*/para)r/rz/doc/chapter[5]/section[2]) rdocrchapterr5rrsectionr2rz chapter//para)r//rz//pararrz //olist/item)rZolistrry.z.//para)rrr..z../@lang)rrrlangzchapter[title])rrtitlerz#employee[@secretary and @assistant]) ZemployeerrZ secretaryrnandrnrZ 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/XMLSchematyperrnz @xsd:typez@typez@{*}typez{*}type)rnr)N)r"r!)r#rrrrtest_xpath_tokenizersd              z$ElementTreeTest.test_xpath_tokenizercCsn|ttddd|ttddd|ttddd|ttdddddS) NrZ instructionsz s?>u ãzlatin-1s= ?>)r]r'rrrrrrrrtest_processinginstructionsz*ElementTreeTest.test_processinginstructioncCspdD]f}||fD]T}d|}ttd|dd}|||ttd||fdd}|||qqdS)N) ZAREAZBASEZBASEFONTZBRZCOLFRAMEZHRZIMGZINPUTZISINDEXZLINKZMETAZPARAMz<%s>z<%s />rrz <%s>)lowerr:r'rr])r#rr5riZ serializedrrr#test_html_empty_elems_serialization+s z3ElementTreeTest.test_html_empty_elems_serializationcCsVtjdddd}t}t|Wdn1s80Y||ddS)N cirriculumpublicexamplestatusZcompanyz1 )r'r\rcaptured_stdoutdumpr]r3)r#rstdoutrrrtest_dump_attribute_order8s  ( z)ElementTreeTest.test_dump_attribute_ordercCs8tjdddd}|t|d|t|ddddS) Nrrrrz0rrz;)r'r\r]r:r#rrrrtest_tree_write_attribute_order@s z/ElementTreeTest.test_tree_write_attribute_orderN).r*r+r,rjrrrrrrrrrrrr#r)r?rCrIrJrNrQr[r^rergrirjrnrtr}r~rrrrrrrrrrrrrrrrrrhsVV,   6-p=%,  - ;%!A: rhc@seZdZd ddZd!ddZd"ddZd#dd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZdS)$XMLPullParserTestNcCsD|dur||n,tdt||D]}|||||q$dSNr)rrr^)r#rr chunk_sizerrrr_feedKs zXMLPullParserTest._feedcCs$|ddt||D|dS)NcSs g|]\}}||j|jffqSr)r<rY)r>eventr5rrrr?Tsz3XMLPullParserTest.assert_events..)r]r read_eventsr#rri max_eventsrrr assert_eventsRs  zXMLPullParserTest.assert_eventscCs|tt|||dSrD)r]r_rrrrrrassert_event_tuplesXsz%XMLPullParserTest.assert_event_tuplescCs(t||}|dd|D|dS)NcSsg|]\}}||jfqSrr;rrrrr?_r@z7XMLPullParserTest.assert_event_tags..)rrr])r#rrirrrrrassert_event_tags]sz#XMLPullParserTest.assert_event_tagsc CsdD]}|j|dt}||g||d|||g||d|||g||d|||dg||d|||d|||dd g||d |||d g||Wdq1s0YqdS) N)Nrk)r z+ text rtexttail  r r)r|r' XMLPullParserrrrr)r#rrrrrtest_simple_xmlbs,   z!XMLPullParserTest.test_simple_xmlcCst}|}||dt|\}}|||jfd||dt|\}}|||jfd|tt|Wdn1s0YdS)Nz- text rrr) r'rrrrr]r<r StopIteration)r#rrrr5rrrtest_feed_while_iteratingys     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 )rnabcr )r@Zxyzrrr{abc}tagrk r {abc}childrr rrr'rrrrrr rrrtest_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)r rrr rrrrrrrrkrrrrrrrr rrrtest_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)Nrrz r z r r r rrz8texttail )r {foo}elementr{foo}empty-element)rr#)rr!zr)rrr r")r'rrrrrrr rrr test_eventssL                   zXMLPullParserTest.test_eventscCstjdd}||d||dtjdffg||d||dtjdffg||d||d g||d ||dtjd ffg||d ||d g||d||dtjdffgtjdd}||d||dtjdffgdS)N)rr%rrrr%z text here z z more text here ztext)rroot-tagz z inner commentz )rr%z z outer comment )r%)r'rrrr'rr rrrtest_events_comment s          z%XMLPullParserTest.test_events_commentcCsdtjdd}||d||dtjdffgtjdd}||d||dtjdffgdS) N)rr5rrz r5pitarget)r5z zpitarget some text )r'rrrrr rrrtest_events_pis     z XMLPullParserTest.test_events_picCslddh}tj|d}||d||ddgGddd}tj|d}||d||ddgdS) Nrrrzbar)rr)rrc@s$eZdZddZddZddZdS)z9XMLPullParserTest.test_events_sequence..DummyItercSstgd|_dS)N)rrr )rrrrrrr__init__,szBXMLPullParserTest.test_events_sequence..DummyIter.__init__cSs|SrDrrrrrr__iter__.szBXMLPullParserTest.test_events_sequence..DummyIter.__iter__cSs t|jSrD)rrrrrrrr0szBXMLPullParserTest.test_events_sequence..DummyIter.__next__N)r*r+r,r)r*rrrrr DummyIter+sr+)r'rrr)r#Zeventsetrr+rrrtest_events_sequence$s   z&XMLPullParserTest.test_events_sequencecCs:|ttjddWdn1s,0YdS)Nrr)rrr'rrrrrrtest_unknown_event7s z$XMLPullParserTest.test_unknown_event)N)N)N)N)r*r+r,rrrrrr r rrrr$r&r(r,r-rrrrrIs     .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#hrefrr.rrrrxinclude_loaders   zXIncludeTest.xinclude_loadercCsdSrDr)r#r=rr.rrr none_loaderszXIncludeTest.none_loadercCsJ|dkrBt|d}t|WdS1s60YndSdS)Nrr)rr'rr)r#r=rrrrr _my_loaders .zXIncludeTest._my_loadercCs8ddlm}|d}|||j|t|ddS)Nrrr3z

Example.

text texttail
)r"rr>includer@r]r:)r#rrrrrtest_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)Nrrr.a

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.

r/zO

This document has been accessed 324387 times.

r0zX

This document has been accessed 324387 times.

r1z

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

<?xml version='1.0'?> <data> <item><![CDATA[Brooks & Shields]]></item> </data>
r2r9aI) r"rr>rAr]r:rr<rrr#rrrrrr test_xincludes8           , zXIncludeTest.test_xincludecCs>ddlm}|d}|||j|dt|ddS)Nrrr4rz.//p)r"rr>rAr]r^r)r#rrrrrtest_xinclude_repeated%s  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)Nrrr.)rSz%cannot load 'disclaimer.xml' as 'xml'r/z!cannot load 'count.txt' as 'text'r5z1unknown parse type in xi:include tag ('BAD_TYPE')r6zYxi:fallback tag must be child of xi:include ('{http://www.w3.org/2001/XInclude}fallback')r7z#recursive include of Recursive2.xml)Z max_depthzAmaximum xinclude depth reached when including file Recursive2.xmlrkzAmaximum xinclude depth reached when including file Recursive3.xmlrzAmaximum xinclude depth reached when including file Recursive1.xmlrE)r"rr'rr:rZFatalIncludeErrorrAr?r]rr XINCLUDE_BADr>ZLimitedRecursiveIncludeErrorrCrrrtest_xinclude_failures,sz . . 0 0  .  2  2  2  2  2 z#XIncludeTest.test_xinclude_failures)rN)N) r*r+r,r>r?r@rBrDrErGrrrrr8s  @r8c@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:d;Z#d.check{r5Z123)r'r\rYrXr)r#rr5rrrrtest_bug_xmltoolkit21xs        zBugsTest.test_bug_xmltoolkit21cCs<tt}t|}||dd||dddS)Nr<rYrr$)r'rrrr]r)r#r5r9rrrtest_bug_xmltoolkit25s  zBugsTest.test_bug_xmltoolkit25cCs<td}|t|dg|t|ddgdS)N"
z.//theadz.//tbodyZtbody)r'rr]rBrr#r9rrrtest_bug_xmltoolkit28s zBugsTest.test_bug_xmltoolkit28cCsPtd}t*}t|||dWdn1sB0YdS)NrMz$
)r'rrrrr]r3)r#r9rrrrtest_bug_xmltoolkitX1s   zBugsTest.test_bug_xmltoolkitX1cCstd}|t|ddtd}||jddi|t|ddtd}|t|dd td }|t|ddtd }|dd|t|dddS) Ns2rssDuättruväluess:textstextrr<)r'rr]rrZr\rrNrrrtest_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'rrr]rr)r#rrrrtest_bug_xmltoolkit55s ( zBugsTest.test_bug_xmltoolkit55cCs$Gddd}|ttj|dS)Nc@seZdZddZdS)z5BugsTest.test_bug_xmltoolkit60..ExceptionFilecSstdSrD)r<r#rerrrrsz:BugsTest.test_bug_xmltoolkit60..ExceptionFile.readN)r*r+r,rrrrr ExceptionFilesrU)rr<r'r)r#rUrrrtest_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'rrupdaterrr]rrY)r#ZENTITIESrtrrrtest_bug_xmltoolkit62s   zBugsTest.test_bug_xmltoolkit62zSkips under coverage.cCsBdd}|td}tdD] }|q |td|dS)NcSs,t}|di|d|ddS)Nr<rY)r'rrrr)r9rrr xmltoolkit63s  z4BugsTest.test_bug_xmltoolkit63..xmltoolkit63i)rI getrefcountrr])r#rZcountrrrrtest_bug_xmltoolkit63s   zBugsTest.test_bug_xmltoolkit63c Cs`tjddd}|t|d|tt|dd|ttt|ddS)NZSomeTagzdef _f(): return 3 rYs0rY)r'r\r]rrrOrrrrtest_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'r\rrrrrrsz8BugsTest.test_bug_200708_close..EchoTarget.closeNr*r+r,rrrrr EchoTargetsrar)r'rrr]rr<)r#rrarrrtest_bug_200708_close s  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)rbz%z{not-default}elemzIr5zrz(http://namespace.invalid/does/not/exist/sBz'{http://purl.org/dc/elements/1.1/}titles8)r'r\r]rregister_namespacerrrr"test_bug_200709_register_namespace/s       z+BugsTest.test_bug_200709_register_namespacecCs`td}|td||djtjtd}|td||djtjdS)Nrrr)r'r\rr'r]r<r)r#rrrrtest_bug_200709_element_comment>s   z(BugsTest.test_bug_200709_element_commentcCsptd}t|d}t|d}td}|d||t|gd|d||t|gddS) Nrrrrr)rrrr\)rrrr)r'r\r&rr]rBr#rrrrrrrtest_bug_200709_element_insertJs      z'BugsTest.test_bug_200709_element_insertcCsJtd}t|d}td}|||t|tjtjgdS)NrrzTEST-b)r'r\r&r'rr]rBr)r#rrZ comment_brrrtest_bug_200709_iter_commentTs     z%BugsTest.test_bug_200709_iter_commentcCsDt}|d}|di}|d}|}|t|ddS)Nrr<r)r'rrrrrr]r:)r#rdrrrrtest_bug_1534630^s    zBugsTest.test_bug_1534630cCs@td}|t|ddtd}|t|dddS)Ns7tãgrs< tãgs;tgrdrrrrtest_issue6233fs  zBugsTest.test_issue6233cCs8td}||jdt|}|t|ddS)Nz+z{${stuff}}localnames&)r'rr]r<rr)r#rrXrrrtest_issue3151rs  zBugsTest.test_issue3151cCsRtd}|t|dgtt}|dd|dd<|t|gddS)Nrr<r<r<r)r'rr]rBr)r#r5Znewelemrrrtest_issue6565xs   zBugsTest.test_issue6565cCstddtdddS)NZ test10777z http://myuri/)r'rerrrrrtest_issue10777s zBugsTest.test_issue10777cs`Gfddd}td|_}t|}||||jt|jddS)NcseZdZfddZdS)z%BugsTest.test_lost_text..Textcs d_dS)NchangedTrYrrrrr__bool__sz.BugsTest.test_lost_text..Text.__bool__Nr*r+r,rsrrrrrrsrr<rq)r'r\rYrrr[rr]r#rrrXrrrrtest_lost_texts  zBugsTest.test_lost_textcs|Gfddd}tdtd|d_}t|}||||djt|djddS)NcseZdZfddZdS)z%BugsTest.test_lost_tail..Textcsdd_dSNrqrTrRrrrrrrrss z.BugsTest.test_lost_tail..Text.__bool__Nrtrrrrrrsrrr<rrq) r'r\rrXrrr[rr]rurrrrtest_lost_tails   zBugsTest.test_lost_tailcsGfddd}tdt|tddz t}Wntyr|dYn0||j||djt | djddS)NcseZdZfddZdS)z$BugsTest.test_lost_elem..Tagcstdd<tdSrw)r'r\r)r#rrrrr__eq__sz+BugsTest.test_lost_elem..Tag.__eq__Nr*r+r,rzrryrrrsrrr<zgenerators are not reentrantrrq) r'r\rrrrskipTestr[r<rr])r#rrXrryrtest_lost_elems    zBugsTest.test_lost_elemcCs.d|}t|}||d|ddS)Ns rr)r'rr]rOdecode)r#rYrrrrrcheck_expat224_utf8_bugs z BugsTest.check_expat224_utf8_bugcCs d}||d}||dS)Nsààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààsxàààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààà)rr2rrrtest_expat224_utf8_bugs zBugsTest.test_expat224_utf8_bugcCsttd}|}Wdn1s(0Yt|}|d}|d}|dd}|dd}| |d|dS)Nrrrrro) rUTF8_BUG_XMLFILErr'rrOr~stripreplacer])r#fprawrZxmlattrrYrrrtest_expat224_utf8_bug_files &    z$BugsTest.test_expat224_utf8_bug_filecCs.|ttjd|ttjdddS)Nr<)rrIr'rrrrrrrtest_39495_treebuilder_startsz%BugsTest.test_39495_treebuilder_startN)$r*r+r,rKrLrOrPrQrRrSrVrYunittestZskipIfrIgettracer]r^rbrdrfrgrirjrkrlrmrorprvrxr}rrrrrrrrrHvs<           rHc@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) Nrzixwypr<rZrYrXbazr) r'r\r[r~r|r]r<rrYrXrrZrF)r#r<rZ 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)r|r'r\rSkipTestrZ assertWarnsDeprecationWarningrrr]r<rYrXr^ itertools zip_longestassertIsrZr#rZ element_foo2rGrHrrrrs  & zBasicElementTest.test_copycCstdddi}|tdddit|}|||||j|j||j|j||j|j|t |t |t ||D]\}}| ||q||j |j dSNrrrrrr)r'r\rrrr]r<rYrXr^rrrrZrrrr 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'r\rrrrr]r<rYrXr^rrrZrFrrrrtest___deepcopy__2 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__r<rrXrY)r< _childrenrZrXrY __deepcopy__c@seZdZddZdS)z9BasicElementTest.test_augmentation_type_errors..EcSsdSrDr)r#memorrrrg szFBasicElementTest.test_augmentation_type_errors..E.__deepcopy__N)r*r+r,rrrrrEf sr) r'r\rrIrrrr}rrr)r#rstaterrrrtest_augmentation_type_errorsP 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..DummyNr*r+r,rrrrDummym srr)rrrrr) r'r\Zdummyrefweakrefrefr rr&r)r#rrwrefrrrrrrrtest_cyclic_gcl s2            zBasicElementTest.test_cyclic_gccs\dfdd}td}t||}||jd~t|d||ddS)NFcsddSNTr)wflagrrwref_cb sz.BasicElementTest.test_weakref..wref_cbrT)r'r\rrr]r<r )r#rrrrrr test_weakref s    zBasicElementTest.test_weakrefcCsBtjddddd}||jdddd||jd ddddS) NrrkrrE)rerfzre)rr)r'r\r]rO)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)Nrrkrepeatr*)rztext goes herezopposite of headchildZ grandchildz .//grandchildrrz other valuer%r)rrJHIGHEST_PROTOCOLrrFr\rYrXr&rrrrWr]r<rZr^ra)r#rTrRrSrrrrr test_pickle szBasicElementTest.test_picklec CstdtjdD]z}t|jddD]f\}}d}||}t|drV||dd| |d|||}||j d||d j d q"qdS) Nrrkrz\ 4 __getstate__r<groupr%rZdogs) rrJrrrFrr}r]rrWr<)r#rTrRrSZXMLTEXTrrrrrtest_pickle_issue18997 s  z'BasicElementTest.test_pickle_issue18997N) r*r+r,rrrrrrrrrrrrrrrs# 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)Nrr_rrLrr __class__ sz.X.__class__Nr*r+r,propertyrrrrrX srrc@s eZdZdS)z2BadElementTest.test_extend_mutable_list..YNrrrrrY srrer'r\rrIr#rrrrrrtest_extend_mutable_list s    z'BadElementTest.test_extend_mutable_listcsGfddd}|tdgtd}z|WntyLYn0Gddd|tj}|dtdgtd}|dS)NcseZdZefddZdS)z3BadElementTest.test_extend_mutable_list2..Xcsdd=tjSrDr_rrrrrr 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#orrrrrz s z:BadElementTest.test_remove_with_mutating..X.__eq__Nr{rrrrrr srrrr)r'r\rrrrr#rrrrrtest_remove_with_mutating s  z(BadElementTest.test_remove_with_mutatingc Csltd}t|d|B|tt|Wdn1s@0YWdn1s^0YdS)Nrr<)r'r\r 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 jWntyYn0dSrD)rY NameErrorrrr5rr__del__ s  z7BadElementTest.test_element_get_text..X.__del__Nr*r+r,rrrrrr srr<ABCDEFGHIJKL ABCDEFGHIJKL) rr'rrrrrr]rYr#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)rXrrrrrrr s z7BadElementTest.test_element_get_tail..X.__del__Nrrrrrr srrr<rrrrr) rr'rrrrrr]rXrrrrtest_element_get_tail s      z$BadElementTest.test_element_get_tailcs^Gfddd}tdtdd|tddd|dS)NcseZdZfddZdS)z%BadElementTest.test_subscr..Xcsdd=dSNrkrrrrrrr __index__) s z/BadElementTest.test_subscr..X.__index__Nr*r+r,rrrrrrr( srr5rrr)r'r\rrrrrr test_subscr& s  zBadElementTest.test_subscrcsPGfddd}tdtdD]}dtdq$gdd|<dS)NcseZdZfddZdS)z)BadElementTest.test_ass_subscr..Xcsgdd<dSrrrrrrrrr7 s z3BadElementTest.test_ass_subscr..X.__index__Nrrrrrrr6 srr5rrr)r'r\rr)r#rrrrrrtest_ass_subscr4 s   zBadElementTest.test_ass_subscrcCsHdd}tj|d}|di|d|t|jdi~tdS)NcSsgSrDrrerfrrrelement_factoryC sz>BadElementTest.test_treebuilder_start..element_factoryrr<rr)r'rrrrAttributeErrorr r#rrrrrtest_treebuilder_startA s   z%BadElementTest.test_treebuilder_startcCsFdd}tj|d}|di|d|t|jd~tdS)NcSsgSrDrrrrrrO sz.element_factoryrr<r)r'rrrrrrr rrrrtest_treebuilder_endM s   z#BadElementTest.test_treebuilder_endN) r*r+r,rrrrrrrrrrrrrrr s   rc@seZdZddZddZdS)MutatingElementPathcGstj|g|R}||_|SrD)r__new__r5)rGr5rr#rrrr[ szMutatingElementPath.__new__cCs|jdd=dSrrrrrrrz_ s zMutatingElementPath.__eq__N)r*r+r,rrzrrrrrZ src@seZdZddZdS)BadElementPathcCs dddS)Nrkrrrrrrrze szBadElementPath.__eq__Nr{rrrrrd srcsXeZdZfddZfddZddZddZd d Zd d Zd dZ ddZ Z S)BadElementPathTestcs(tddlm}|j|_i|_dSNrr )supersetUpr"r!r path_cacher#r!rrrrj s  zBadElementPathTest.setUpcs"ddlm}|j|_tdSr)r"r!rrrtearDownrrrrrp s zBadElementPathTest.tearDowncCs0td}|tdg|t|ddSNrrre)r'r\rrrrrrrtest_find_with_mutatingu s z*BadElementPathTest.test_find_with_mutatingcCsFtd}|tdgz|tdWnty@Yn0dSr)r'r\rrrZeroDivisionErrorrrrrtest_find_with_errorz s   z'BadElementPathTest.test_find_with_errorcCs0td}|tdg|t|ddSr)r'r\rrrrrrrtest_findtext_with_mutating s z.BadElementPathTest.test_findtext_with_mutatingcCsFtd}|tdgz|tdWnty@Yn0dSr)r'r\rrrrrrrrtest_findtext_with_error s   z+BadElementPathTest.test_findtext_with_errorcCs0td}|tdg|t|ddSr)r'r\rrrrrrrtest_findall_with_mutating s z-BadElementPathTest.test_findall_with_mutatingcCsFtd}|tdgz|tdWnty@Yn0dSr)r'r\rrrrrrrrtest_findall_with_error s   z*BadElementPathTest.test_findall_with_error) r*r+r,rrrrrrrr __classcell__rrrrri s  rc@s4eZdZddZddZddZddZd d Zd S) ElementTreeTypeTestcCsX|tjt|tjt|tjt|tjt|tjt|tjtdSrD) r[r'rrrrr\rrrrrrr test_istype s zElementTreeTypeTest.test_istypecCsZGdddtj}|d}||tj|||||jdd|_||jddS)Nc@s eZdZdS)zDElementTreeTypeTest.test_Element_subclass_trivial..MyElementNrrrrr MyElement srrr)r'r\r[r]r<rYr#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#r<rZextra)rrrrr) szQElementTreeTypeTest.test_Element_subclass_constructor..MyElement.__init__)r*r+r,r)rrrrrr srrrkr)rrrE)rrZfoo__))rrk)rr)rrE)rr)r'r\r]r<rrw)r#rrrr!test_Element_subclass_constructor s z5ElementTreeTypeTest.test_Element_subclass_constructorcCs.Gdddtj}|d}||ddS)Nc@seZdZddZdS)zGElementTreeTypeTest.test_Element_subclass_new_method..MyElementcSs|jSrDr;rrrrr newmethod szQElementTreeTypeTest.test_Element_subclass_new_method..MyElement.newmethodN)r*r+r,rrrrrr srr)r'r\r]rrrrr 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 srrrYrr$rkr) r'r\rYrr]rrr<r_rr^)r#rrsubfoundrrrtest_Element_subclass_find s  z.ElementTreeTypeTest.test_Element_subclass_findN)r*r+r,rrrrrrrrrr 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)Nr<r./tagrzsection/nexttagnexttagrYr$rnrtogzempty) r'rrr]rr<SAMPLE_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'rr]rrZrh 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)0Nrrrr<r ztog/foorrnz.//tagrrz section//tagz section/*)r<r  nextsectionz section//*)r<r rr<z section/.//*z*/*z*//*z*/tagz*/./tagr z././tagz.//tag[@class]rEz.//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']rk)r'rrrr]rBrrrrr test_findall s  zElementFindTest.test_findallcCs\tt}|t|dg|t|ddgd|t|ddgddS)Nr<z{http://effbot.org/ns}tagrz.//{http://effbot.org/ns}tagrE)r'rrr]rBrrrrrtest_test_find_with_nsP 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.//brrk)rrn)r'rr]r^r)r#rnsmaprrrtest_findall_different_nsmapsZ 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)rrrrr\rz.//{*}b)rrrrrz.//{*}cz.//{X}*z.//{Y}*z.//{}*)rrrrz.//{}br)r'rrr'r]rBrrrrrtest_findall_wildcardk sd    z%ElementFindTest.test_findall_wildcardcCsDtt}|td|dWdn1s60YdS)Nzcannot use absolute pathz/tag)r'rrrhrrrrrr test_bad_find s zElementFindTest.test_bad_findcCstt}|t|djd|t|dd|tt| ddgdd}| t | t| d}Wdn1s0Y|t|dgddS)Nr<rYrzThis 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//tagrE) r'rrr]rrr<rrBrassertWarnsRegex FutureWarning)r#rrmrrrrtest_find_through_ElementTree s .z-ElementFindTest.test_find_through_ElementTreeN) r*r+r,rrrrrrrr!rrrrr  sM ,r c@s>eZdZdddZddZddZdd Zd d Zd d ZdS)ElementIterTestNcCst||SrD)rBr)r#r5r<rrr_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...)rrrrrrrnzthis is a paragraph...zthis is a paragraph.z this is a F)r6rrr)rz*a&b&c&za&b&c&)r'rr]r#rrrr<rrr:rrrrrr)r#rZ sourcefilerr9rrr test_basic s(     zElementIterTest.test_basiccCstd}|||dgt|d}|||ddgt|d}|||gdt|d}|||gd|d|d<|d=|||ddgdS) Nrrr)rrrr)rrrrrkr)r'r\r]r#r&rhrrr test_corners s     zElementIterTest.test_cornerscCstd}|||ddgd|||ddgd|t|jdddgdgd}|t|||||||||d|dS) NaJ bedroom1 bedroom2 nothing here bedroom8 roomrEhouserr;)rr'r&r&Zshedr'r&r)r'rr]r#rBr)r#rZall_tagsrrrtest_iter_by_tag s z ElementIterTest.test_iter_by_tagcCsJtd}|}|tt|Wdn1s<0YdS)Nr)r'r\rrrIr)r#rrrrrr s  zElementIterTest.test_copyc Csftd}|}ttjdD]@}|ttjft ||Wdq 1sV0Yq dS)Nrrk) r'r\rrrJrrrIrMrK)r#rrrTrrrr s  zElementIterTest.test_pickle)N) r*r+r,r#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)NrrYrkrZdivr$rX)r]r<rYrXrZr_r^)r#rchildrenrrrr_check_sample1_element sz&TreeBuilderTest._check_sample1_elementcCsGddd}Gddd|}tj|d}||j||dtj|d}||j||dtjtd}||j||dS)Nc@seZdZddZdS)z.BaseDummyBuildercSsdS)Nrrrrrrrr" szBTreeBuilderTest.test_dummy_builder..BaseDummyBuilder.closeNr`rrrrBaseDummyBuilder! sr,c@seZdZddZZZdS)z8TreeBuilderTest.test_dummy_builder..DummyBuildercWsdSrDr)rrrr& r@zATreeBuilderTest.test_dummy_builder..DummyBuilder.N)r*r+r,rrrrrrr DummyBuilder% sr.rr)r'rrsample1r]robjectr)r#r,r.rrrrtest_dummy_builder s   z"TreeBuilderTest.test_dummy_buildercCst}||djtj||djdtjtjd}||djtj||djdtjtd}||dtddS)NZctext)comment_factory)r'rr]r%r<r'rYr^r#rrrrtest_treebuilder_comment4 s z(TreeBuilderTest.test_treebuilder_commentcCst}||ddjtj||ddjdtjtjd}||djtj||djd||ddjtj||ddjdtjddd}||dtddf||ddtddfdS)Nr) pi_factoryr'z text zpitarget text cSs t||fSrD)r^)rrYrrrr-K r@z5TreeBuilderTest.test_treebuilder_pi..)r'rr]r5r<rrYr^r3rrrtest_treebuilder_pi@ sz#TreeBuilderTest.test_treebuilder_picCsGdddtj}d}t|}||jdtj|d}|||}||jdd}t|}||jdd}tj|d}|||}||jddS)Nc@s eZdZdS)z;TreeBuilderTest.test_late_tail..TreeBuilderSubclassNrrrrrTreeBuilderSubclassQ sr7ztexttailZtexttailrztexttail)r'rrr]rYrrr)r#r7rrrrrrtest_late_tailO 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..TreeBuilderSubclassNrrrrrr7j sr7z/text tailT)Zinsert_commentsrrr<z tailztext z+text tail)Z insert_piszpi datarXztext )r'rrrrr]rYrX)r#r7rrrrrrtest_late_tail_mix_pi_commentsg s6    z.TreeBuilderTest.test_late_tail_mix_pi_commentscCs6tjtjddd}||j|}||dSNrr)r'rrrr/rr+r#rrrrr$test_treebuilder_elementfactory_none s z4TreeBuilderTest.test_treebuilder_elementfactory_nonecCsXGdddtj}|}||ddtj|d}||j|}||dS)Nc@seZdZddZdS)z4TreeBuilderTest.test_subclass..MyTreeBuildercSs|dSNrrrTrrrrf sz;TreeBuilderTest.test_subclass..MyTreeBuilder.foobarNr*r+r,rfrrrr MyTreeBuilder sr?rrr) r'rr]rfrrr/rr+r#r?tbrrrrr test_subclass s  zTreeBuilderTest.test_subclasscCslGdddtj}|tjtjd}||ddtj|d}||j|d| }| |dS)Nc@seZdZddZdS)z?TreeBuilderTest.test_subclass_comment_pi..MyTreeBuildercSs|dSr=rrTrrrrf szFTreeBuilderTest.test_subclass_comment_pi..MyTreeBuilder.foobarNr>rrrrr? sr?)r2r5rrrz) r'rr'rr]rfrrr/rr+r@rrrtest_subclass_comment_pi s   z(TreeBuilderTest.test_subclass_comment_picsNgfdd}tj|d}tj|d}||j||dgdS)Ncs|t||SrD)rr'r\)r<rZZlstrr myfactory s z7TreeBuilderTest.test_element_factory..myfactoryrrZtoplevel)r'rrrsample2rr])r#rErArrrDrtest_element_factory s    z$TreeBuilderTest.test_element_factorycCsFtj|d}tj|d}||j|}|||||dSr:)r'rrrr/rr[r+)r#rGrArrrrr_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'r\rH)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_Pyr]r+rrH)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|_dSrD_doctyper#rQZpubidsystemrrrdoctype sz;TreeBuilderTest.test_doctype..DoctypeParser.doctypecSs|jSrDrLrrrrrr sz9TreeBuilderTest.test_doctype..DoctypeParser.close)r*r+r,rMrPrrrrr DoctypeParser srQrrz&-//W3C//DTD XHTML 1.0 Transitional//ENz7http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)r'rrr/r]r)r#rQrrrr 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||_||_dSrDraise_inwhat)r#rUrVrrrr) szKTreeBuilderTest.test_builder_lookup_errors..RaisingBuilder.__init__cSs"||jkr||jdd}|S)NcWsdSrDr)rrrrhandle sz^TreeBuilderTest.test_builder_lookup_errors..RaisingBuilder.__getattr__..handlerT)r#rQrWrrr __getattr__ s  zNTreeBuilderTest.test_builder_lookup_errors..RaisingBuilder.__getattr__)r*r+r,rr)rXrrrrRaisingBuilder srYr)rrrr%r5)rV) r'rrhrrrr/rr)r#rYrrrrrtest_builder_lookup_errors s 0 z*TreeBuilderTest.test_builder_lookup_errorsN)r*r+r,r/rFr+r1r4r6r8r9r<rBrCrGrHrIrKrSrZrrrrr) s"  $  r)c@sPeZdZdZdZdZddZddZdd Zd d Z d d Z ddZ ddZ dS) XMLParserTests22stextuX $£€𐅻cCs6||jd||djd||djddS)Nr8rlineZ22)r]r<rYrrrr_check_sample_element sz#XMLParserTest._check_sample_elementcCs0tjdtd}||j||dS)Nr)r.r)r'rrrr/r]r)r#Zparser2rrrtest_constructor_args s  z#XMLParserTest.test_constructor_argscCs6Gdddtj}|}||j||dS)Nc@s eZdZdS)z-XMLParserTest.test_subclass..MyParserNrrrrrMyParser sr_)r'rrr/r]r)r#r_rrrrrB s zXMLParserTest.test_subclasscCsTt8tdtt}||j|Wdn1sF0YdS)Nerror) warningscatch_warnings simplefilterrr'rrrFrr rrrtest_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 ||fdSrDr)r#rrrLrrrP' szHXMLParserTest.test_subclass_doctype..MyParserWithDoctype.doctypeNr*r+r,rPrrLrrMyParserWithDoctype& srfrPr`cseZdZfddZdS)z:XMLParserTest.test_subclass_doctype..DoctypeParsercs|||fdSrDrrN _doctype2rrrP6 szBXMLParserTest.test_subclass_doctype..DoctypeParser.doctypeNrerrgrrrQ5 srQrrR) r'rrRuntimeWarningrrFrrrarbrcrr])r#rfrrQr)rMrhrtest_subclass_doctype$ s&*       z#XMLParserTest.test_subclass_doctypecCsptTtdttdtGdddtj}|}||j| Wdn1sb0YdS)z:Ensure that ordinary usage is not deprecated (Issue 19176)r`c@s eZdZdS)zDXMLParserTest.test_inherited_doctype..MyParserWithoutDoctypeNrrrrrMyParserWithoutDoctypeG srkN) rarbrcrrir'rrrFr)r#rkrrrrtest_inherited_doctypeB s    z$XMLParserTest.test_inherited_doctypecCsVtjtd}||j|}||jd||jdd||j ddS)NrZmoneyrtu $£€𐅻) r'rrrsample3rr]r<rZrYr;rrrtest_parse_stringM s  zXMLParserTest.test_parse_stringN) r*r+r,r/rFrmr]r^rBrdrjrlrnrrrrr[ s r[c@seZdZddZdS)NamespaceParseTestcCs`ddd}tt}|t|d|d|t|d|d|t|d|ddS) NZhellor)hrz {hello}tablerkz .//{hello}tdrz .//{foo}name)r'rSAMPLE_XML_NS_ELEMSr]r^r)r#rrrrrtest_find_with_namespaceW s   z+NamespaceParseTest.test_find_with_namespaceN)r*r+r,rrrrrrroV sroc@sleZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS)ElementSlicingTestcCsdd|DS)NcSsg|] }|jqSrr;)r>rrrrr?b r@z1ElementSlicingTest._elem_tags..r)r#Zelemlistrrr _elem_tagsa szElementSlicingTest._elem_tagscCs|t|SrD)rtr_r(rrr _subelem_tagsd 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'r\rr&)r#Z numchildrenrrrrr_make_elem_with_childreng s  z+ElementSlicingTest._make_elem_with_childrencsZ|d|djd|djd|tfdd|tfdddS) Nrrka1a8csdS)N rrrrrrr-w r@z?ElementSlicingTest.test_getslice_single_index..csdS)Nirrrrrrr-x r@)rvr]r<r IndexErrorrrrrrrtest_getslice_single_indexq s  z-ElementSlicingTest.test_getslice_single_indexcCs|d}|||ddgd|||ddgd|||ddgd|||ddddg|||ddddg|||dd d d gdS) NrrE)a3a4a5rr}r~r\ra0rw)rvr]rtrrrrtest_getslice_rangez s z&ElementSlicingTest.test_getslice_rangec Cs|d}|||dddddg|||dddgd|||dddddg|||dddd dg|||ddtjd g|||ddtjd >d gdS) Nrrkrya9rE)rr}Za6rrrwr}@rvr]rtrImaxsizerrrrtest_getslice_steps s      z&ElementSlicingTest.test_getslice_stepsc Cs|d}|||dddgd|||dddddg|||ddtj dg|||ddtj ddg|||ddtj d >dgdS) Nrr\)r}a2rwrrxr}rwrErkrrrrrrtest_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) Nrrrrr}r\rxrrkrw)rvr]rurrrr test_delslice s$            z ElementSlicingTest.test_delslicecCs|d}td|d<|||gdtd|d<|||gd|ttd|d <Wdn1s0Y|ttd|d <Wdn1s0Y|||gddS) Nrrrkrrrr}rrx)rrrr}rr)rvr'r\r]rurr{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%sr_r>rrrrr? r@z:ElementSlicingTest.test_setslice_range..rrkrE)rb0b1r}r)rrr}cSsg|]}td|qSrr_rrrrr? r@)rrrb2r})rvrr]rur'r\rrrrtest_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|qSrr_rrrrr? r@z:ElementSlicingTest.test_setslice_steps..rrkr)rrrrr~rrcSsg|]}td|qSrr_rrrrr? r@rE)rrwrr}r~rrrrrrrrr} rvrr]rurrr'r\rIrrrrrtest_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|qSrr_rrrrr? r@zCElementSlicingTest.test_setslice_negative_steps..rrr\)rrrr}rcSsg|]}td|qSrr_rrrrr? r@rE)rrwrr}rkrrrrr)rrrr}rrrrrtest_setslice_negative_steps s$   4 : , z/ElementSlicingTest.test_setslice_negative_stepsN)r*r+r,rtrurvr|rrrrrrrrrrrrrs` s      rsc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ GdddZ ddZ ddZddZddZddZdd 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)Nr<rzabc)rrrsabc)rrutf-32z2 abcz<&"'>z<&"'>rs<&"'>rz> <&"'>ruz"s"zF uåöö<>uåöö<>såöö<>s%åöö<>u= åöö<>uss()rrrrru@ ) r'r\rYr]r:r|upperrrZ)r#r5encrrrrr s  $ $      zIOTest.test_encodingcCsf|tjtttd}|tttd }| | dWdn1sX0YdS)Nr) rrrrr'rrr2rr]rr#r9rrrrtest_write_to_filename<s   zIOTest.test_write_to_filenamecCs|tjtttd}ttddd*}|j|dd| |j Wdn1s\0Yttd }| | dWdn1s0YdS)Nrrrrr-rr rrrrr'rrrr2rrr]rrrrrtest_write_to_text_fileCs* zIOTest.test_write_to_text_filecCs|tjtttd}ttd&}||| |j Wdn1sT0Yttd }| | dWdn1s0YdS)Nrrrrrrrrrtest_write_to_binary_fileLs  * z IOTest.test_write_to_binary_filecCs0|tjtttd}ttd*}|j|dd| |j Wdn1sX0Yttd&}| | d dWdn1s0Yttddd*}|j|dd| |j Wdn1s0Yttd&}| | d dWdn1s"0YdS) Nrrrrr0 r) buffering)rrrrr'rrrr2rrr]rrrrrr"test_write_to_binary_file_with_bomUs( *  "*  z)IOTest.test_write_to_binary_file_with_bomcCs2t}td}||||jddSNz"site)r'rr/r1rr]rr<r#r9rrrrtest_read_from_stringiois  zIOTest.test_read_from_stringiocCs:ttd}t}|j|dd||ddSNrr-r)r'rrr/r1r2r]r3rrrrtest_write_to_stringiooszIOTest.test_write_to_stringiocCs2t}td}||||jddSNs"r)r'rr/r0rr]rr<r#r9rrrrtest_read_from_bytesious  zIOTest.test_read_from_bytesiocCs6ttd}t}||||ddSNrr)r'rrr/r0r2r]r3rrrrtest_write_to_bytesio{s zIOTest.test_write_to_bytesioc@s eZdZdS)z IOTest.dummyNrrrrrdummysrcCsBtd}|}|j|_t}||||j ddSr) r/r1rrr'rrr]rr<)r#rreaderr9rrrtest_read_from_user_text_readers   z&IOTest.test_read_from_user_text_readercCsJttd}t}|}|j|_|j|dd||ddSr) r'rrr/r1rr2r]r3)r#r9rwriterrrrtest_write_to_user_text_writers z%IOTest.test_write_to_user_text_writercCsJtd}|}|j|_t}||||j dt}dSr) r/r0rrr'rrr]rr<)r#rrr9rrr!test_read_from_user_binary_readers  z(IOTest.test_read_from_user_binary_readercCsFttd}t}|}|j|_||||ddSr) r'rrr/r0rr2r]r3r#r9rrrrr test_write_to_user_binary_writers  z'IOTest.test_write_to_user_binary_writercCsbttd}t}|}|j|_dd|_|j|_|j|dd| | d ddS)NrcSsdSrrrrrrr-r@zBIOTest.test_write_to_user_binary_writer_with_bom..rrr) r'rrr/r0rr2seekabletellr]r3rrrrr)test_write_to_user_binary_writer_with_boms  z0IOTest.test_write_to_user_binary_writer_with_bomc CsRtd}|t|ddt|d|t|ddt|ddS)Nzfoor-rnrr@)r'rr]rrrrrrrtest_tostringlist_invariants   z"IOTest.test_tostringlist_invariantcCsRtd}|t|dd|tj|dddd|tj|dddddS)Nzabcr-zabcT)Zshort_empty_elementsFzabc)r'rr]rrrrrtest_short_empty_elementss  z IOTest.test_short_empty_elementsN)r*r+r,rrrrrrrrrrrrrrrrrrrrrr s"E     rc@s,eZdZddZddZddZddZd S) ParseErrorTestcCs|ttdSrD)r[r'rrrrrrrrBszParseErrorTest.test_subclassc Cs>zt|Wn*tjy8}z|WYd}~Sd}~00dSrD)r'rr)r#rcrrrr _get_errorszParseErrorTest._get_errorcCs@||djd||djd||djddS)Nr)rkrz&foo;)rkrzfoobar<)rkr)r]rZpositionrrrrrtest_error_positionsz"ParseErrorTest.test_error_positioncCs8ddlmmm}||dj|j|jdS)Nrr) Zxml.parsers.expat.errorsparsersZexpaterrorsr]rcodeZcodesZXML_ERROR_SYNTAX)r#ZERRORSrrrtest_error_codes zParseErrorTest.test_error_codeN)r*r+r,rBrrrrrrrrsrc@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)r=rZ)rZ)r=)rZrrfZkey1Zvalue1zmust be dict, not strzI'm not a dict)r'rr]rrrr_rr\rZrNr<r&rhrI)r#reelementsrrrrrtest_issue14818s:   ,zKeywordArgsTest.test_issue14818N)r*r+r,rrrrrrsrc@seZdZddZddZdS)NoAcceleratorTestcCststddS)Nzonly for the Python version)rErrrrrrrrszNoAcceleratorTest.setUpcCs(|tjjtj|tjjtjdSrD)r[rEr\r)types FunctionTyperrrrrrtest_correct_import_pyETsz*NoAcceleratorTest.test_correct_import_pyETN)r*r+r,rrrrrrrsrcKstj|fi|SrD)rE canonicalize)rr7rrrc14n_roundtripsrc@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)r]rrrrrtest_simple_roundtripsP           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 )rArBr]rrrrrtest_c14n_exclusionBsF    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)endswithr>filenamerrrr?s z+C14NTest.test_xml_c14n2..cSsg|]}|dr|qS)in) startswithrrrrr?s cs8i|]0}|dr|ddt|dDqS)Zc14ncSs,i|]$}|jdd|jpd|fqS)}r\rn)r<splitrYr)r>optionrrr sz6C14NTest.test_xml_c14n2...r)rr'rrr) full_pathrrrs  z+C14NTest.test_xml_c14n2..cs"i|]fddDqS)csJg|]B}|ddr|dddvr||dddfqS)Zout_rrkr\)rrsplitr)configs input_filerrr?sz6C14NTest.test_xml_c14n2...r)r>)rfiles)rrrscSsg|]}|D]}|q qSrr)r> output_files output_filerrrr?scSs|||dfdS)NrrrO)configZ option_namerrrr get_optionsz+C14NTest.test_xml_c14n2..get_optionZIgnoreCommentstrueZ TrimTextNodesZ PrefixRewriteZ sequentialZ QNameAwarecSs(g|] }d|dd|dqS{ZNSrNamerrSrrrr?srkz/{http://www.w3.org/2010/xml-c14n2}QualifiedAttrcSs(g|] }d|dd|dqSrrrSrrrr?sz){http://www.w3.org/2010/xml-c14n2}Element,css8|]0\}\}}|d|p*ddd|DVqdS)=rcss|]}|jddVqdS)rr\N)r<r)r>rrrr r@z4C14NTest.test_xml_c14n2...N)r)r>rQrtr*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_attrsrrkrZinC14N3z attr="default"rn)N)rrosrrrlistdirr]r^valuesrwrr|r|rrr/r0rrr'r)r#ZdatadirZ input_filesZtestsrrrrrZ keep_commentsrrZqattrsZqtagsZ config_descrrZ entity_filerYrir)rrrrtest_xml_c14n2s              Z  ,zC14NTest.test_xml_c14n2)r*r+r,ZmaxDiffrrrrrrrrs(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)%rrEr'rrsrrrrhrrr8rr r"r)r[rrHrrrrr"r!reZ_namespace_maprrr}rr'rrZ run_unittestrrW)moduleZ test_classesr!rZ nsmap_copyrZ old_factoriesrrr test_mainsj           r__main__)Tr-)N)Mrrrr/rrqrbrrJrIrArrrarrrrrrZ test.supportrrrr r r rEr'rrUnicodeEncodeErrorrrrrrrrqrrrZTestCaserr:rBrCrhrr:formatescaperFr8rHrrrr__hash__rrrr r"r)r[rorsrrrrrrrr*rrrrs              w    7ld48W`xT R$f E