{G_Tc@sddlZddlmZddlmZmZmZddlZddlZddl Zddl Zddl m Z m Z m Z mZddl mZedddZed Zd Zd Zd ejfd YZdZedkrendS(iN(tStringIO(tverboset run_unittesttfindfile(tparsetNodetDocumentt parseString(tgetDOMImplementationstest.xmltsubdirt xmltestdatacCstjdd|S(Ntdoc(RtcreateDocumenttNone(tdoctype((s-/usr/local/lib/python2.7/test/test_minidom.pytcreate_doc_without_doctypescCstjddd}g|j_g|j_tjjj ddd}|jjj |tjjj dddd}d|_ d|_ d|_|jjj ||S( NR s my-notations"http://xml.python.org/notations/mys my-entitys!http://xml.python.org/entities/mys1.0sutf-8sus-ascii(RtcreateDocumentTypeR tentitiest_seqt notationstxmltdomtminidomtNotationtappendtEntitytversiontencodingtactualEncoding(Rtnotationtentity((s-/usr/local/lib/python2.7/test/test_minidom.pytcreate_nonempty_doctypes       cCsCt}t|}||jjd_||jjd_|S(Ni(RRRtitemt ownerDocumentR(RR ((s-/usr/local/lib/python2.7/test/test_minidom.pytcreate_doc_with_doctype)s   t MinidomTestcBs?eZddZdZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ d Z!d!Z"d"Z#d#Z$d$Z%d%Z&d&Z'd'Z(d(Z)d)Z*d*Z+d+Z,d,Z-d-Z.d.Z/d/Z0d0Z1d1Z2d2Z3d3Z4d4Z5d5Z6d6Z7d7Z8d8Z9d9Z:d:Z;d;Z<d<Z=d=Z>d>Z?d?Z@d@ZAdAZBdBZCdCZDdDZEdEZFdFZGdGZHdHZIdIZJdJZKdKd\dLYZLdMZMdNZNdOZOdPZPdQZQdRZRdSZSdTZTdUZUdVZVdWZWdXZXdYZYdZZZd[Z[RS(]tTestcCs|j||dS(N(t assertTrue(tselfttestttestname((s-/usr/local/lib/python2.7/test/test_minidom.pytconfirm1scCs9|j}|j||kdt|t|fdS(Nslooking for %s, found %s(t wholeTextR)trepr(R&tnodetstt((s-/usr/local/lib/python2.7/test/test_minidom.pytcheckWholeText4s cCsBttttj}|j|jt|tdS(N( RRtopenttstfiletreadtunlinkR)t isinstanceR(R&R((s-/usr/local/lib/python2.7/test/test_minidom.pyttestParseFromFile8s cCsBtt}|j|jd|jjdk|jdS(NtLI(RR1R)tgetElementsByTagNametdocumentElementR3(R&R((s-/usr/local/lib/python2.7/test/test_minidom.pyttestGetElementsByTagName=s cCstd}|j}|jd}|jd}|j|||jt|jdko|jjdko|jd|ko|jjd|ko|jd|ko|jjd|ko|j |ko|j |ko|j dkd|jd}|j|d|jt|jdko|jjdko|jd|ko|jjd|ko|jd|ko|jjd|ko|j |ko|j |ko|j d kd|jd }|j|||jt|jd ko|jjd ko|jd|ko|jjd|ko|jd|ko|jjd|ko|j|ko|j |ko|j d kd|jdS( Nsitelementiiss0testInsertBefore -- node properly placed in treeis%tbaris+(RR8t childNodest createElementt insertBeforeR)tlentlengthR t firstChildt lastChildttoxmlR tpreviousSiblingt nextSiblingR3(R&Rtroottelemtnelemtnelem2((s-/usr/local/lib/python2.7/test/test_minidom.pyttestInsertBeforeCsR    cCstd}|jd}|jd}|jd}|jd}|jj||j}|j||j||j|||||||fS(NstoriginaltfooR;tbat(RtcreateTextNodeR8t appendChildtcreateDocumentFragment(R&Rtorigtc1tc2tc3tfrag((s-/usr/local/lib/python2.7/test/test_minidom.pyt_create_fragment_test_nodesns     cCs|j\}}}}}}|jj|d|jt|jj||||fkd|j|j|j\}}}}}}|jj|||jt|jj||||fkd|j|jdS(NsinsertBefore(, None)sinsertBefore(, orig)(RVR8R>R R)ttupleR<R3(R&RRQRRRSRTRU((s-/usr/local/lib/python2.7/test/test_minidom.pyttestInsertBeforeFragment{s   cCsstt}|jj|jd|j|jjdjdk|j|jjdjdk|j dS(NuHellois#commenttHello( RR1R8ROt createCommentR)R<tnodeNametdataR3(R&R((s-/usr/local/lib/python2.7/test/test_minidom.pyttestAppendChilds    cCst|j\}}}}}}|jj||jt|jj||||fkd|j|jdS(NsappendChild()(RVR8ROR)RWR<R3(R&RRQRRRSRTRU((s-/usr/local/lib/python2.7/test/test_minidom.pyttestAppendChildFragments cCs~|j\}}}}}}|jj|||j|jt|jj|||fkd|j|jdS(NsreplaceChild()(RVR8t replaceChildR3R)RWR<(R&RRQRRRSRTRU((s-/usr/local/lib/python2.7/test/test_minidom.pyttestReplaceChildFragments $ cCst}|jd}|jd}|jtjj|j||j||jtjj|j|||jtjj|j |||j }|jtjj|j ||jtjj|j ||j||j dS(NR:ttext(RR=RNt assertRaisesRRtHierarchyRequestErrROR>R_t attributest setNamedItemtsetNamedItemNSR3(R&RRGRatnodemap((s-/usr/local/lib/python2.7/test/test_minidom.pyttestLegalChildrens     cCst}|jd}|j}d|d<|jd}|j|j|kd|j|j|kd|j|jdkd|j|jdkd|j |j dS( NR:R;RLis-NamedNodeMap.__setitem__() sets ownerDocuments,NamedNodeMap.__setitem__() sets ownerElements%NamedNodeMap.__setitem__() sets values)NamedNodeMap.__setitem__() sets nodeValue( RR=RdR R)R!t ownerElementtvaluet nodeValueR3(R&RRGtattrsta((s-/usr/local/lib/python2.7/test/test_minidom.pyttestNamedNodeMapSetItems    cCsUtt}|j||j|jd|j|jdj |jdS(NRLi(RR1R)RORZR<R3(R&R((s-/usr/local/lib/python2.7/test/test_minidom.pyt testNonZeros   cCstt}|jdS(N(RR1R3(R&R((s-/usr/local/lib/python2.7/test/test_minidom.pyt testUnlinks cCs=t}|j|jd|j|j|jdS(Ntabc(RROR=R)R8R3(R&R((s-/usr/local/lib/python2.7/test/test_minidom.pyt testElements cCstd}|j}|jdd|j|jdkd|jd}|j|j|kd|j|j|jkd|jdS(Nstspamtjam2sttestAAAs!setAttribute() sets ownerDocuments setAttribute() sets ownerElement( RR8t setAttributeR)RCtgetAttributeNodeR!RiR3(R&RtelRm((s-/usr/local/lib/python2.7/test/test_minidom.pyRus  cCs_td}|j}|jdd|jdd|j|jdkd|jdS(NsRstjamRtsttestAAB(RR8RvR)RCR3(R&RRx((s-/usr/local/lib/python2.7/test/test_minidom.pyRzs   cCsBt}|j|jd}|jdd|j|jddk|j|jdjdk|jdd|j|jddk|j|jdjdk|jt|jdk|jdd|j|jddk|j|jdjdk|jt|jdk|j dS(NRqtdeftghitjkltmnoitnewval( RROR=RvR)t getAttributeRdRjR?R3(R&Rtchild((s-/usr/local/lib/python2.7/test/test_minidom.pyt testAddAttrs cCst}|j|jd}|jt|jdk|jdd|jt|jdk|jd=|jt|jdk|jdS(NRqiR{R|i(RROR=R)R?RdRvR3(R&RR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestDeleteAttrs  cCst}|j|jd}|jdd|jt|jdk|jd|jt|jdk|jdS(NRqR{R|ii( RROR=RvR)R?RdtremoveAttributeR3(R&RR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestRemoveAttrs  cCst}|j|jdd}|jddd|jddd|jt|jdk|jdd|jt|jd k|jdS( Nshttp://www.python.orgs python:abcshttp://www.w3.orgs xmlns:pythonspython:abcattrRLitabcattri( RROtcreateElementNStsetAttributeNSR)R?RdtremoveAttributeNSR3(R&RR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestRemoveAttrNSs  cCst}|j|jd}|jdd|jt|jdk|jd}|j||jt|jdko|jddk|j dS(NRLRsRyii( RROR=RvR)R?RdRwtremoveAttributeNodeR R3(R&RRR,((s-/usr/local/lib/python2.7/test/test_minidom.pyttestRemoveAttributeNode&s  cCstd}|j}|jdd|jt|jdk|jdd|jd|jt|jdko|jdjdko|jdjdko|j ddko|j dj d|jd<|jt|jdkoC|jdjdkoC|jdjdkoC|j ddkoC|jdj |jdd|jt|jdko|jdjdko|jdjdko|j ddko|jdjdko|jdjdko|j ddkd |jd<|jt|jdko|jdjdko|jdjdko|j ddko|jdjd ko|jdjd ko|j dd k|j dS( NsRsRyitbamthamtspam2itbam2( RR8RvR)R?RdtsetIdAttributeRjRkRRwtisIdR3(R&RRx((s-/usr/local/lib/python2.7/test/test_minidom.pyttestChangeAttr1sD     cCsd}t|}|jdd}|jt|dko|djdko|djdko|djdko|djdko|djdk|j dS(NsZ shttp://pyxml.sf.net/minidomtmyelemiiRsminidom:myelem( RtgetElementsByTagNameNSR)R?t namespaceURIt localNametprefixttagNameR[R3(R&tdRtelems((s-/usr/local/lib/python2.7/test/test_minidom.pyttestGetElementsByTagNameNSWs   cCs/|j||}|jt|dkdS(Ni(RR)R?(R&R tnsuritlnametnodelist((s-/usr/local/lib/python2.7/test/test_minidom.pyt5get_empty_nodelist_from_elements_by_tagName_ns_helperfscCstd}|j|dd|j|dd|j|ddtd}|j|dd|j|dd|j|d d dS( Nss"http://xml.python.org/namespaces/at localnamet*tsplats3shttp://xml.python.org/splats not-theres#http://somewhere.else.net/not-therete(RR(R&R ((s-/usr/local/lib/python2.7/test/test_minidom.pyt+testGetEmptyNodeListFromElementsByTagNameNSks       cCsZt}|j|jd}t|}t|}|j||k|jdS(NRq(RROR=R+tstrR)R3(R&RRxtstring1tstring2((s-/usr/local/lib/python2.7/test/test_minidom.pyttestElementReprAndStr|s    cCsZt}|j|jd}t|}t|}|j||k|jdS(Nuabc(RROR=R+RR)R3(R&RRxRR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestElementReprAndStrUnicodes    cCspt}|j|jdd}t|}t|}|j||k|jd|k|jdS(Nuhttp://www.slashdot.orgu slash:abcs slash:abc(RRORR+RR)R3(R&RRxRR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestElementReprAndStrUnicodeNSs   cCs`t}|j|jd}|jdd}|jt|t|k|jdS(NuabcRqR{(RROR=RvR)RR+R3(R&RRxR,((s-/usr/local/lib/python2.7/test/test_minidom.pyttestAttributeReprs  cCs?d}t|}|j}|j|j||kdS(Ns (RRCR3R)(R&RRtdomstr((s-/usr/local/lib/python2.7/test/test_minidom.pyt testWriteXMLs    cCsQd}t|}|jdd}|j|j||jddkdS(Ns" tnewls s (Rt toprettyxmlR3R)treplace(R&RRR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestAltNewlines   cCsd}|jtdj|d|jtdj|d|jtdj|d|jtdj|d |jtd j|d dS( Ns sAs A sAAs A A sAAs A A sAAs A A sAAAs A A A (t assertEqualRR(R&tdecl((s-/usr/local/lib/python2.7/test/test_minidom.pyt test_toprettyxml_with_text_nodess    cCsut}|jd}|j|jd|j|jd|j|d}|j|j|ddS(NuelemuTEXTs s TEXT TEXT (RR=RORNRR(R&RRGR((s-/usr/local/lib/python2.7/test/test_minidom.pyt)test_toprettyxml_with_adjacent_text_nodess  cCswxpdD]h}t|}t|j}|j|jddjdj|jddjdjqWdS(NsAsCtBi(sAsC(RRRR7R<RC(R&RRtdom2((s-/usr/local/lib/python2.7/test/test_minidom.pyt/test_toprettyxml_preserves_content_of_text_nodes   cCstd}|jj}|j|jdko|jdko|jdko|jtj ko|j dko|j ot |jdko|jdko|jdko|jdko|jtjjkdS(Nstmypisdata i(RR8RAR)ttargetR\R[tnodeTypeRtPROCESSING_INSTRUCTION_NODERdR t hasChildNodesR?R<RBRRRRtEMPTY_NAMESPACE(R&Rtpi((s-/usr/local/lib/python2.7/test/test_minidom.pyttestProcessingInstructions   cCsOtd}|jd}|jtjj|j||j|jdS(Nstextra(RR=RbRRRcROR3(R&R RG((s-/usr/local/lib/python2.7/test/test_minidom.pyttestTooManyDocumentElementss   cCsrtd}|j}|j}|jd}|jd}|j|j||jtj j |jddS(Ns Rm( RR8RdRwtremoveNamedItemR)t isSameNodeRbRRt NotFoundErr(R&R RRlta1ta2((s-/usr/local/lib/python2.7/test/test_minidom.pyttestRemoveNamedItems   cCs{td}|j}|j}|jdd}|jdd}|j|j||jtj j |jdddS(Ns.shttp://xml.python.org/tb( RR8RdtgetAttributeNodeNStremoveNamedItemNSR)RRbRRR(R&R RRlRR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestRemoveNamedItemNSs   c Cs |j}|j}|j}|j}|j|j|j||kdxtt|D]}|j|} |j|} |j| | k o| j| jko| j| jko| j | j ko| j | j kd|j| j |kdqgWdS(Ns(clone of element has same attribute keyss3clone of attribute node has proper attribute valuess'clone of attribute node correctly owned( RdtkeystsortR)trangeR?R RjRkRRRi( R&te1te2R'tattrs1tattrs2tkeys1tkeys2tiRR((s-/usr/local/lib/python2.7/test/test_minidom.pyt!_testCloneElementCopiesAttributess$      cCstd}|j}|j|}|j||d|r?dpBdd|_|_|jdd|jdd ||fS( NsttestCloneElementtDeeptShallowtMODIFIEDtattrs NEW VALUEtaddedtVALUE(RR8t cloneNodeRRR[Rv(R&tdeepRRFtclone((s-/usr/local/lib/python2.7/test/test_minidom.pyt_setupCloneElement s  cCsu|jd\}}|jt|jdko`|jjdko`|jdko`|jdkd|jdS(NisttestCloneElementShallow( RR)R?R<R@t parentNodeR RCR3(R&RR((s-/usr/local/lib/python2.7/test/test_minidom.pyRscCsu|jd\}}|jt|jdko`|jjdko`|jdko`|jdkd|jdS(NisttestCloneElementDeep( RR)R?R<R@RR RCR3(R&RR((s-/usr/local/lib/python2.7/test/test_minidom.pyR scCs5td}|jd}|j|dkddS(Ns ]> isFtestCloneDocumentShallow: shallow cloning of documents makes no sense!(RRR)R (R&R tdoc2((s-/usr/local/lib/python2.7/test/test_minidom.pyttestCloneDocumentShallow)s cCs8td}|jd}|j|j|p<|j| d|jt|jt|jkd|j|jjtj kd|j|jj j|d|j|jj|j d|j dk r4|j|j jtj kd|j|j j j||j|j j|j  ndS( Ns ]> is4testCloneDocumentDeep: document objects not distincts8testCloneDocumentDeep: wrong number of Document childrens:testCloneDocumentDeep: documentElement not an ELEMENT_NODEs@testCloneDocumentDeep: documentElement owner is not new documents;testCloneDocumentDeep: documentElement should not be shareds7testCloneDocumentDeep: doctype not a DOCUMENT_TYPE_NODE(RRR)RR?R<R8RRt ELEMENT_NODER!RR tDOCUMENT_TYPE_NODE(R&R R((s-/usr/local/lib/python2.7/test/test_minidom.pyttestCloneDocumentDeep5s" "!cCst}|jd}|j|dk o|j|jko|j|jko|j|jko|j|jkot|j t|j ko|j j t|j dkot|j t|j ko|j j t|j dkot|j dkxt t|j D]}|j j |}|j j |}|j|j| o|j| o|j|jko|j|jko|j|jko|j|jko|j|jko|j|jko|j|jkqWxt t|j D]}|j j |}|j j |}|j|j| o|j| o|j|jko|j|jko|j|jkqWdS(Nii(RRR)R R[tnametpublicIdtsystemIdR?RR RR<RRt notationNameRRR(R&RRRtsetcetsntcn((s-/usr/local/lib/python2.7/test/test_minidom.pyttestCloneDocumentTypeDeepOkNs@ !!cCs5t}|jjd}|j|dkddS(NittestCloneDocumentTypeDeepNotOk(R"RRR)R (R&R R((s-/usr/local/lib/python2.7/test/test_minidom.pyRps cCst}|jd}|j|dk o|j|jko|j|jko|j|jko|j|jkot|j dko|j j ddkot|j dko|j j ddkot|j dkdS(Ni( RRR)R R[RRRR?RR RR<(R&RR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestCloneDocumentTypeShallowOkus cCs5t}|jjd}|j|dkddS(Nit!testCloneDocumentTypeShallowNotOk(R"RRR)R (R&R R((s-/usr/local/lib/python2.7/test/test_minidom.pyRs cCs;td}td}|jtjj|j||dS(Ns(RRbRRtNotSupportedErrt importNode(R&RttestNametdoc1R((s-/usr/local/lib/python2.7/test/test_minidom.pytcheck_import_documents  cCs|jdddS(NittestImportDocumentShallow(R(R&((s-/usr/local/lib/python2.7/test/test_minidom.pyRscCs|jdddS(NittestImportDocumentDeep(R(R&((s-/usr/local/lib/python2.7/test/test_minidom.pyRscCs8t}t}|jtjj|j|jddS(Ni(R"RRbRRRRR(R&tsrcR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestImportDocumentTypeShallows  cCs8t}t}|jtjj|j|jddS(Ni(R"RRbRRRRR(R&RR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestImportDocumentTypeDeeps  cCstd}|jjd}|j|d|j|}|j|j| |j|j| |j|jdk|d|j|j j|j |d|j|j |ddS(NsRs: ownerElement should be Nones: ownerDocument does not matchs.: cloned attribute must have specified == True( RR8RwtassertNotEqualR RR)RRiR!t specified(R&RRR RR((s-/usr/local/lib/python2.7/test/test_minidom.pytcheck_clone_attributes    cCs|jdddS(NittestCloneAttributeShallow(R(R&((s-/usr/local/lib/python2.7/test/test_minidom.pyRscCs|jdddS(NittestCloneAttributeDeep(R(R&((s-/usr/local/lib/python2.7/test/test_minidom.pyRscCsitd}|j}|j|jtj|j|}|j|j|jkoa|j |j kdS(Ns( RRARRRRRR)RR\(R&RRR RR((s-/usr/local/lib/python2.7/test/test_minidom.pytcheck_clone_pis   cCs|jdddS(NittestClonePIShallow(R(R&((s-/usr/local/lib/python2.7/test/test_minidom.pyRscCs|jdddS(NittestClonePIDeep(R(R&((s-/usr/local/lib/python2.7/test/test_minidom.pyR scCsOtd}|j}|j|jd|j|jd|jt|jdkok|jjdkd|j|jt|jdko|jjdko|j |j ko|j j dkd|j td}|j}|j|jd |j|jt|jd ko:|jjd kd |j dS( NstfirsttsecondistestNormalize -- preparationit firstsecondstestNormalize -- resulttis*testNormalize -- single empty node removed( RR8RORNR)R?R<R@t normalizeRARBR\R3(R&R RF((s-/usr/local/lib/python2.7/test/test_minidom.pyt testNormalizes,       cCsCtd}|j}|j|jd|j|jd|j|jd|jt|jdko|jjdkd|j |jt|jdko.|jjdko.|j j dko.|j |j k o.|j j |j ko.|j jdko.|j j|j ko.|j j dkd |jdS( NsR R Ris1testNormalizeCombineAndNextSibling -- preparationiR s-testNormalizeCombinedAndNextSibling -- result(RR8RORNR=R)R?R<R@RRAR\RBRERDR R3(R&R RF((s-/usr/local/lib/python2.7/test/test_minidom.pyt"testNormalizeCombineAndNextSiblings&   cCstd}|j}|j|jd|j|jd|jt|jdkok|jjdkd|j|jt|jdko|jjdko|j j dko|j |j ko|j j dko|j jdkd|jdS(NsR R is1testNormalizeDeleteWithPrevSibling -- preparationis,testNormalizeDeleteWithPrevSibling -- result(RR8RORNR)R?R<R@RRAR\RBRER RDR3(R&R RF((s-/usr/local/lib/python2.7/test/test_minidom.pyt"testNormalizeDeleteWithPrevSiblings    cCstd}|j}|j|jd|j|jd|jt|jdkok|jjdkd|j|jt|jdko|jjdko|j j dko|j |j ko|j j dko|j jdkd|jdS(NsR R is1testNormalizeDeleteWithNextSibling -- preparationis,testNormalizeDeleteWithNextSibling -- result(RR8RORNR)R?R<R@RRAR\RBRER RDR3(R&R RF((s-/usr/local/lib/python2.7/test/test_minidom.pyt"testNormalizeDeleteWithNextSiblings    cCs1td}|j}|j|jd|j|jd|j|jd|jt|jdko|jjdkd|j |jt|jdko|jjdko|j |j k o|j j |j ko|j j dko|j j |j ko|j j dkd|jdS(NsRR is1testNormalizeDeleteWithTwoSiblings -- preparationis,testNormalizeDeleteWithTwoSiblings -- result(RR8ROR=RNR)R?R<R@RRARBRERDR R3(R&R RF((s-/usr/local/lib/python2.7/test/test_minidom.pyt)testNormalizeDeleteWithTwoNonTextSiblingss$   cCsEtd}|j}|j|jd|j|jd|j|jd|j|jd|j|jd|jt|jdko|jjdkd|j|jt|jdko0|jjdko0|j |j ko0|j j dko0|j j dko0|j jdkd |jdS( NsR R tfourthis,testNormalizeDeleteAndCombine -- preparationit secondfourths'testNormalizeDeleteAndCombine -- result(RR8RORNR)R?R<R@RRARBR\RDR RER3(R&R RF((s-/usr/local/lib/python2.7/test/test_minidom.pyttestNormalizeDeleteAndCombine)s&   cCs td}|j}|jdj|jd|jdj|jd|jdjdj|jd|jdj|jd|j|jd|jt|jdko}|jjdko}t|jdjd ko}|jdjjd ko}t|jdjdko}|jdjjdko}t|jdjdjd ko}|jdjdjjd kd |j|jt|jd koe|jjd koet|jdjd koe|jdjjd koet|jdjd koe|jdjjd koet|jdjdjdkoe|jdjdjjdkd |j|jdjdj d ko|jdjdjdj dko|jdjdj dkd|j|jdjdj dko|jdjdj |jdjdko|jdjdj dko|jdjdj |jdjdko|jdjdj dko|jdjdj |jdjdko|jdjdj dko|jdjdj |jdjdkd|j dS(Ns)tt2t3iR txitx2tx3iiistestNormalize2 -- preparations$testNormalize2 -- childNodes lengthsttxtt2x2tt3x3s$testNormalize2 -- joined text fieldss"testNormalize2 -- sibling pointers(RR8R<RORNR)R?R@RR\RER RDR3(R&R RF((s-/usr/local/lib/python2.7/test/test_minidom.pyttestNormalizeRecursion>sX  $# ##$#cCsJtd}|jjd}|j|jtj|j|jdS(Ns texti( RR8R<RRRt TEXT_NODERR3(R&R Ra((s-/usr/local/lib/python2.7/test/test_minidom.pyttestBug0777884}s   cCsStd}|j}d|jd_|j|j|jdjdkddS(Ns tR iis)Final child's .nextSibling should be None(RR8R<RkRR)RER (R&R R,((s-/usr/local/lib/python2.7/test/test_minidom.pyttestBug1433694s    cCstd}|j}|j\}}}|j|j|ko|jdko|j|ko|j|ko|jdko|j|kd|jdS(Nstext?t testSiblings(RR8R<R)RERDR R3(R&R RFRRatelm((s-/usr/local/lib/python2.7/test/test_minidom.pyR!s  cCstd}|j}|jd}|j\}}|jd}|j|j|ko|j|ko|j|ko|j|ko|j|kd|jdS(Ns3it testParents(RR8R<R)RR3(R&R RFtelm1telm2atelm2btelm3((s-/usr/local/lib/python2.7/test/test_minidom.pyR#s    cCstd}|j}|d}|j|d|jdko|jddko|jjd|jdko|jjd|jdko|jjdjjddkd|jdS(Nsiistest NodeList.item()(RR<R)R R R3(R&R tchildrentdocelem((s-/usr/local/lib/python2.7/test/test_minidom.pyttestNodeListItems   !c Csddlm}|j}|j|jdi|jd|jdi|jd|jd|jd|jd|j|j}|j }|j \}}}|j d}|j |j dko=|j|ko=|j |ko=|j|ko=|j |ko=|jdko=|j dko=|jdkd|j |j|ko|j|ko|j|ko|j|ko|j|kd|jdS( Ni(tpulldomR RatsubelmistestSAX2DOM - siblingsstestSAX2DOM - parents(txml.domR+tSAX2DOMt startDocumentt startElementt characterst endElementt endDocumenttdocumentR8R<R)RDR RERR3( R&R+tsax2domR RFttext1R$ttext2ttext3((s-/usr/local/lib/python2.7/test/test_minidom.pyt testSAX2DOMs:           cCsstd}|j|jdkoK|jddkoK|jddkd|jttd|jdS( Nsu$sutf-8s4s iso-8859-15s8s"testEncodings - encoding EURO SIGNs0Comment a va ? Trs bien ?(RR)RCRbtUnicodeDecodeErrorR3(R&R ((s-/usr/local/lib/python2.7/test/test_minidom.pyt testEncodingss     tUserDataHandlercBseZdZdZRS(icCs7|j||d||j|ddd|_dS(Ni(t setUserDataR tcalled(R&t operationtkeyR\Rtdst((s-/usr/local/lib/python2.7/test/test_minidom.pythandles(t__name__t __module__R>RB(((s-/usr/local/lib/python2.7/test/test_minidom.pyR<scCst}|jd}|j|jddk|jddd|j|jddk|jddd|jddd|j|jddk|j|jddk|jddd|j|jddk|j|jddk|j}|jdd||jd}|j|jop|jddkop|jddk|j |j |j dS(NRRLi R;i i( RR=R)t getUserDataR R=R<RR>R3(R&Rtnthandlertc((s-/usr/local/lib/python2.7/test/test_minidom.pyt testUserDatas*    cCsZ|jtjj|j|ddtd}|jtjj|j|tjjddS(Nshttp://xml.python.org/nss xmlns:foosRL(RbRRt NamespaceErrt renameNodeRtWrongDocumentErrR(R&R R,R((s-/usr/local/lib/python2.7/test/test_minidom.pyt checkRenameNodeSharedConstraintss   cCstd}|j}|j}|jd}|j|tjjd}|j|jdko |j dko |j dko |j tjjko |j dko |jdko |jddko |jdj|o |dj|o |jj|o |jj||j|dd}|j|jdko|j dko|j dko|j dko|j dko|jdko|jddko|jddko|jdj|o|jddj|o|dj|o|d j||j|dd}|j|jdko,|j dko,|j d ko,|j dko,|j d ko,|jdko,|jddko,|jddko,|jddko,|jdddko,|jdj|o,|jdd j|o,|dj|o,|dj||j|tjjd }|j|jd koE|j d koE|j dkoE|j tjjkoE|j dkoE|jdkoE|jddkoE|jddkoE|jddkoE|jddkoE|jdddkoE|jd j|oE|d j||jtjj|j|dd |j|||jdS(Ns RmRtvshttp://xml.python.org/nsRHshttp://xml.python.org/ns2sp:dRtpRtxmlns(shttp://xml.python.org/nsRH(shttp://xml.python.org/ns2R(RR8RdRKRRRR)RR[RR RRRjRwRR!RiRRbRJRMR3(R&R RGtattrmapR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestRenameAttributes     cCs/td}|j}|j|tjjd}|j|jdko|jdko|j dko|j tjjko|j dko|j j||j|dd}|j|jdko|jdko|j dko|j dko|j dko|j j||j|dd}|j|jdko|jdko|j dko|j dko|j dko|j j||j|tjjd }|j|jd ko |jd ko |j dko |j tjjko |j dko |j j||j|||jdS( NsRmshttp://xml.python.org/nsRshttp://xml.python.org/ns2sp:cRHROR(RR8RKRRRR)RR[RR RRR!RRMR3(R&R RG((s-/usr/local/lib/python2.7/test/test_minidom.pyttestRenameElement]s@  cCsltjjjjtjjdd}|jd}|jtjj |j |tjjd|j dS(NRtcommentRL( RRRRR RR RZRbRRKR3(R&R R,((s-/usr/local/lib/python2.7/test/test_minidom.pyttestRenameOthers cCstd}|j}|jd}|j|jtj|j|d|j|j d|j|d|j |j d||j|d|j d}|j||j d }|j||j|d|j|d |j d }|j|||}|j|d|j|d |jd d }|j|||}|j|d|j|d |j||j|d |j|d dS(Ns aiRmRtabRHtcabRTRRtytztcabd(RR8R<RRRRR/RORNR>tcreateCDATASectionRZR=R_tcreateProcessingInstructiont removeChild(R&R RGRatsplitterR7R((s-/usr/local/lib/python2.7/test/test_minidom.pyt testWholeTexts8      cCsdtd}|j}|j}|j|j|kd|j|||j|j|kddS(NssBefore replaceChild()sAfter replaceChild()(RR8RAR)RR_(R&R RGR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestPatch1094164s    cCs2d}|\}}}}}|jd}|j|d|j|d|jt|jdk|\}}}}}|jd}|j|d|j|d|jt|jdk|\}}}}}|jd}|j|d|j|dko*t|jdkdS( NcSsutd}|j}|j}|j}|j}|j|jd||j|jd||||||fS(NsadRRH(RR8RARBRER>RNR[(R RGR6R7R^((s-/usr/local/lib/python2.7/test/test_minidom.pytsetups     s new contentRiRWiR i(treplaceWholeTextR/R)R?R<R (R&RaR RGR6R^R7Ra((s-/usr/local/lib/python2.7/test/test_minidom.pyttestReplaceWholeTexts  cCstd}|j}|j}|j|jdkoE|jtjj kdj }xQ|D]I}|j |}|j}|jt |do|jtjj kq\WdS(Nsl ]>s+id notid text enum ref refs ent ents nm nmsR( RR8t schemaTypeR)RR t namespaceRRRtsplitRwthasattr(R&R RGR.tnamesRRm((s-/usr/local/lib/python2.7/test/test_minidom.pyttestSchemaTypes      cCstd}|j}|jd}|jd}|j|jddko_|j o_|j |jd|j|j|jdo|jo|j |jd|j|j|jdo|j|jdo|jo|j|j d}d|_ |j ||j|jddkoj|j|jdoj|j oj|joj|j |j |t jjd|j|j|jdo|jdS(NsRRRNtwtan(RR8RwR)tgetElementByIdR RRRtcreateAttributeRjtsetAttributeNodeRKRRR(R&R RRRta3((s-/usr/local/lib/python2.7/test/test_minidom.pyttestSetIdAttributes6               cCsd}d}td|d|d}|j}|j|d}|j|d}|j|jddko|j o|j |j|d|j|j|jdo|jo|j |j|d|j|j|jdo|j|jd o|jo|j|j |d}d|_ |j ||j|j|jd |j|j |j|j|j|j |j|jddk|j |t jjd |j|j|jd o|jdS( Nshttp://xml.python.org/ns1shttp://xml.python.org/ns2sRRRNRjRk(RR8RR)RlR RtsetIdAttributeNSRtcreateAttributeNSRjRnRKRRR(R&tNS1tNS2R RRRRo((s-/usr/local/lib/python2.7/test/test_minidom.pyttestSetIdAttributeNSs<         cCsd}d}td|d|d}|j}|j|d}|j|d}|j|jddko|j o|j |j||j|j|jdo|jo|j |j||j|j|jdo|j|jd o|jo|j|j |d}d|_ |j ||j|j|jd |j|j |j|j|j|j |j|jddk|j |t jjd |j|j|jd o|jdS( Nshttp://xml.python.org/ns1shttp://xml.python.org/ns2sRRRNRjRk(RR8RR)RlR RtsetIdAttributeNodeRRrRjRnRKRRR(R&RsRtR RRRRo((s-/usr/local/lib/python2.7/test/test_minidom.pyttestSetIdAttributeNode@s<           c Cstd}tj|}tj|}||fg}x|r|j\}}|j|j|jkot|jt|jko|j |j ko|j | o|j | |jt j krqt|j t|j t|jt|j|jt|j t|j koBt|jt|jkxtt|jD]z}|jj|}|jj|} |j|j| jko|j| jko|j| jk|j|| fq\Wxtt|j D]z}|j j|} |j j|} |j| j| jkoS| j| jkoS| j| jk|j| | fqWn|jt jkr|j|jj |o|jj |nx>tt|jD]'}|j|j||j|fqWq<WdS(Ns ]> text (RtpickletdumpstloadstpopR)RR?R<R[RRRRRRR RRRRRt DOCUMENT_NODER!( R&R R-Rtstacktn1tn2Rtno1tno2RR((s-/usr/local/lib/python2.7/test/test_minidom.pyttestPickledDocumentdsJ      $cCs6t}|j|jd|jt|jdS(Nsfoo--bar(RRORZRbt ValueErrorRC(R&R ((s-/usr/local/lib/python2.7/test/test_minidom.pyt(testSerializeCommentNodeWithDoubleHyphens cCs>td}t|j}|j|jtjjkdS(Ns$ (RRCR)RRRR(R&R R((s-/usr/local/lib/python2.7/test/test_minidom.pyttestEmptyXMLNSValues ((\RCRDR)R/R5R9RJRVRXR]R^R`RhRnRoRpRrRuRzRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR RRRRRRRRR R!R#R*R9R;R<RIRMRRRSRUR_R`RcRiRpRuRwRRR(((s-/usr/local/lib/python2.7/test/test_minidom.pyR#0s     +          &              "                     ?     #    M + $  !  $ $ . cCsttdS(N(RR#(((s-/usr/local/lib/python2.7/test/test_minidom.pyt test_mainst__main__(RxRttest.test_supportRRRtunittestR-Rtxml.dom.minidomtxml.parsers.expatRRRRRR1R RRR"tTestCaseR#RRC(((s-/usr/local/lib/python2.7/test/test_minidom.pyts*     "   s