Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_minidom.cpython-310.pyc
o

�9j��@s�ddlZddlZddlZddlZddlmZddlZddlZddlZ	ddlm
Z
mZmZm
Z
mZmZddlmZddlmZejddd�Zd	Zdd
d�Zdd
�Zdd�ZGdd�dej�Zedkrge��dSdS)�N)�support)�parse�Attr�Node�Document�Element�parseString)�getDOMImplementation)�
ExpatErrorztest.xml�xmltestdata)�subdira<?xml version='1.0' encoding='us-ascii'?>
<!DOCTYPE doc PUBLIC 'http://xml.python.org/public' 'http://xml.python.org/system' [
  <!ELEMENT e EMPTY>
  <!ENTITY ent SYSTEM 'http://xml.python.org/entity'>
]><doc attr='value'> text
<?pi sample?> <!-- comment --> <e/> </doc>cCst��dd|�S)N�doc)r	�createDocument)�doctype�r�(/usr/lib/python3.10/test/test_minidom.py�create_doc_without_doctype�rcCsxt��ddd�}g|j_g|j_tjj�ddd�}|jj�	|�tjj�
dddd�}d|_d|_d|_
|jj�	|�|S)	Nr
zmy-notationz"http://xml.python.org/notations/myz	my-entityz!http://xml.python.org/entities/myz1.0�utf-8�us-ascii)r	�createDocumentType�entities�_seq�	notations�xml�dom�minidom�Notation�append�Entity�version�encoding�actualEncoding)r�notation�entityrrr�create_nonempty_doctype!s ��r%cCs.t�}t|�}||j�d�_||j�d�_|S�Nr)r%rr�item�
ownerDocumentr)rr
rrr�create_doc_with_doctype1s
r)c@s�eZdZ�d$dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Ze�d�dd��Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z d;d<�Z!d=d>�Z"d?d@�Z#dAdB�Z$dCdD�Z%dEdF�Z&dGdH�Z'dIdJ�Z(dKdL�Z)dMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3dadb�Z4dcdd�Z5dedf�Z6dgdh�Z7didj�Z8dkdl�Z9dmdn�Z:dodp�Z;dqdr�Z<dsdt�Z=dudv�Z>dwdx�Z?dydz�Z@d{d|�ZAd}d~�ZBdd��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZd�d��Z[d�d��Z\d�d��Z]d�d��Z^d�d��Z_d�d��Z`d�d��Zad�d��Zbd�d��Zcd�d„Zdd�dĄZed�dƄZfd�dȄZgd�dʄZhd�d̄Zid�d΄Zjd�dЄZkd�d҄Zld�dԄZmd�dքZnd�d؄Zod�dڄZpd�d܄Zqd�dބZrd�d�Zsd�d�Ztd�d�Zud�d�Zvd�d�Zwd�d�Zxd�d�Zyd�d�ZzGd�d�d�Z{d�d�Z|d�d�Z}d�d��Z~d�d��Zd�d��Z�d�d��Z�d�d��Z�d��d�Z��d�d�Z��d�d�Z��d�d�Z��d�d�Z��d	�d
�Z��d�d�Z��d
�d�Z��d�d�Z��d�d�Z��d�d�Z��d�d�Z��d�d�Z��d�d�Z��d�d�Z��d�d�Z��d�d �Z��d!�d"�Z��d#S(%�MinidomTest�TestcCs|�||�dS�N)�
assertTrue)�self�test�testnamerrr�confirm9rzMinidomTest.confirmcCs"|j}|�||kd||f�dS)Nzlooking for %r, found %r)�	wholeTextr1)r.�node�s�trrr�checkWholeText<szMinidomTest.checkWholeTextcCs"t�}|�|j�|�tj�dSr,)r�assertFalse�async_�r.r
rrr�testDocumentAsyncAttr@sz!MinidomTest.testDocumentAsyncAttrcCsPttd��}t|�}|��|�t|t��Wd�dS1s!wYdS)N�rb��open�tstfiler�unlinkr1�
isinstancer�r.�filerrrr�testParseFromBinaryFileEs
"�z#MinidomTest.testParseFromBinaryFilecCsTttddd��}t|�}|��|�t|t��Wd�dS1s#wYdS)N�rz
iso-8859-1)r!r<rArrr�testParseFromTextFileKs
"�z!MinidomTest.testParseFromTextFilecCsJtdddd�}|�|jd�|�|jd�|�|jd�|�|jd�dS)N�qName�namespaceURI�	localName�prefix�r�assertEqual�namerGrIrH�r.�attrrrr�testAttrModeSetsParamsAsAttrsQs
z)MinidomTest.testAttrModeSetsParamsAsAttrscCsLtdddd�}|�|jd�|�|jd�|�|jd�|�|j|j�dS)NrFrGrIrJrMrrr� testAttrModeSetsNonOptionalAttrsXs
z,MinidomTest.testAttrModeSetsNonOptionalAttrscCs0tt�}|�|�d�|j�d�k�|��dS)N�LI)rr>r1�getElementsByTagName�documentElementr?�r.rrrr�testGetElementsByTagName_s

�z$MinidomTest.testGetElementsByTagNamecCs�td�}|j}|jd}|�d�}|�||�|�t|j�dkoS|jjdkoS|jd|uoS|j�d�|uoS|jd|uoS|j�d�|uoS|j	|uoS|j
|uoS|��dkd�|�d�}|�|d�|�t|j�dko�|jjdko�|jd|uo�|j�d�|uo�|jd|uo�|j�d�|uo�|j
|uo�|j|uo�|��d	kd�|�d
�}|�||�|�t|j�dko�|jjdko�|jd|uo�|j�d�|uo�|jd|uo�|j�d�|uo�|j
|uo�|j|uo�|��dkd�|��dS)
N�<doc><foo/></doc>r�element��z<doc><element/><foo/></doc>z0testInsertBefore -- node properly placed in tree�z%<doc><element/><foo/><element/></doc>�bar�z+<doc><element/><foo/><bar/><element/></doc>)rrS�
childNodes�
createElement�insertBeforer1�len�lengthr'�
firstChild�	lastChild�toxml�previousSibling�nextSiblingr?)r.r�root�elem�nelem�nelem2rrr�testInsertBeforees�


�������
�


�������
�


���������zMinidomTest.testInsertBeforecCsrtd�}|�d�}|�d�}|�d�}|�d�}|j�|�|��}|�|�|�|�|�|�||||||fS)N�<doc/>�original�foor[�bat)r�createTextNoderS�appendChild�createDocumentFragment�r.r�orig�c1�c2�c3�fragrrr�_create_fragment_test_nodes�s






z'MinidomTest._create_fragment_test_nodescCs�|��\}}}}}}|j�|d�|�t|jj�||||fkd�|��|��|��\}}}}}}|j�||�|�t|jj�||||fkd�|��|��dS)NzinsertBefore(<fragment>, None)zinsertBefore(<fragment>, orig))ryrSr_r1�tupler]r?rsrrr�testInsertBeforeFragment�s$
��
��z$MinidomTest.testInsertBeforeFragmentcCsVtt�}|j�|�d��|�|jjdjdk�|�|jjdjdk�|�	�dS)N�Hello���z#comment)
rr>rSrq�
createCommentr1r]�nodeName�datar?rTrrr�testAppendChild�s
zMinidomTest.testAppendChild�cpucsrt�}|�ddd���j}�fdd�tdd�D�}|}t��}|D]	}|�|�|}q!t��}|�||d�dS)N�some_tagcsg|]
}��d|����qS)zchild-)r^)�.0�i��newdocrr�
<listcomp>�szDMinidomTest.testAppendChildNoQuadraticComplexity.<locals>.<listcomp>rYi�r\)r	rrS�range�time�	monotonicrq�
assertLess)r.�impl�top_element�childrenrW�start�child�endrr�r�$testAppendChildNoQuadraticComplexity�s
z0MinidomTest.testAppendChildNoQuadraticComplexitycCs6td�}td�}d|_|�|�|�|�d�d�dS)Nr/�idztest-id)rr�value�setAttributeNoderK�getAttribute)r.rhrNrrr�(testSetAttributeNodeWithoutOwnerDocument�s

z4MinidomTest.testSetAttributeNodeWithoutOwnerDocumentcCsT|��\}}}}}}|j�|�|�t|jj�||||fkd�|��|��dS)NzappendChild(<fragment>))ryrSrqr1rzr]r?rsrrr�testAppendChildFragment�s
��z#MinidomTest.testAppendChildFragmentcCs\|��\}}}}}}|j�||�|��|�t|jj�|||fkd�|��|��dS)NzreplaceChild(<fragment>))ryrS�replaceChildr?r1rzr]rsrrr�testReplaceChildFragment�s�z$MinidomTest.testReplaceChildFragmentcCs�t�}|�d�}|�d�}|�tjj|j|�|�|�|�tjj|j||�|�tjj|j	||�|j
}|�tjj|j|�|�tjj|j|�|�|�|�
�dS)NrW�text)rr^rp�assertRaisesrr�HierarchyRequestErrrqr_r��
attributes�setNamedItem�setNamedItemNSr?)r.rrhr��nodemaprrr�testLegalChildren�s(


����
zMinidomTest.testLegalChildrencCs�t�}|�d�}|j}d|d<|�d�}|�|j|ud�|�|j|ud�|�|jdkd�|�|jdkd�|�	�|�	�dS)	NrWr[rnrz-NamedNodeMap.__setitem__() sets ownerDocumentz,NamedNodeMap.__setitem__() sets ownerElementz%NamedNodeMap.__setitem__() sets valuez)NamedNodeMap.__setitem__() sets nodeValue)
rr^r�r'r1r(�ownerElementr��	nodeValuer?)r.rrh�attrs�arrr�testNamedNodeMapSetItem�s&

����z#MinidomTest.testNamedNodeMapSetItemcCsBtt�}|�|�|�|�d��|�|jdj�|��dS)Nrnr})rr>r1rqr~r]r?rTrrr�testNonZeros

zMinidomTest.testNonZerocCs,tt�}|�|j�|��|�|j�dSr,)rr>r-r]r?r7rTrrr�
testUnlinkszMinidomTest.testUnlinkcCsDtt��}|�|j�Wd�n1swY|�|j�dSr,)rr>r-r]r7rTrrr�testContexts
�zMinidomTest.testContextcCs.t�}|�|�d��|�|j�|��dS�N�abc)rrqr^r1rSr?rTrrr�testElementszMinidomTest.testElementcCsjtd�}|j}|�dd�|�|��dkd�|�d�}|�|j|ud�|�|j|jud�|��dS)N�<abc/>�spam�jam2�<abc spam="jam2"/>�testAAAz!setAttribute() sets ownerDocumentz setAttribute() sets ownerElement)	rrS�setAttributer1rd�getAttributeNoder(r�r?)r.r�elr�rrrr�#s
��zMinidomTest.testAAAcCsFtd�}|j}|�dd�|�dd�|�|��dkd�|��dS)Nr�r��jamr�r��testAAB)rrSr�r1rdr?�r.rr�rrrr�/szMinidomTest.testAABcCs�t�}|�|�d��}|�dd�|�|�d�dk�|�|jdjdk�|�dd�|�|�d�dk�|�|jdjdk�|�t|j�dk�|�dd�|�|�d�dk�|�|jdjdk�|�t|j�dk�|�	�dS)Nr��def�ghi�jkl�mnorX�newval)
rrqr^r�r1r�r�r�r`r?�r.rr�rrr�testAddAttr7szMinidomTest.testAddAttrcCsrt�}|�|�d��}|�t|j�dk�|�dd�|�t|j�dk�|jd=|�t|j�dk�|��dS)Nr�rr�r�rY)rrqr^r1r`r�r�r?r�rrr�testDeleteAttrLszMinidomTest.testDeleteAttrcCstt�}|�|�d��}|�dd�|�t|j�dk�|�tj	j
|jd�|�d�|�t|j�dk�|��dS)Nr�r�r�rYrnr)
rrqr^r�r1r`r�r�rr�NotFoundErr�removeAttributer?r�rrr�testRemoveAttrWs
zMinidomTest.testRemoveAttrcCs�t�}|�|�dd��}|�ddd�|�ddd�|�tjj|jdd�|�	t
|j�dk�|�dd�|�	t
|j�d	k�|��dS)
N�http://www.python.org�
python:abc�http://www.w3.org�xmlns:pythonzpython:abcattrrnrX�abcattrrY)
rrq�createElementNS�setAttributeNSr�rrr��removeAttributeNSr1r`r�r?r�rrr�testRemoveAttrNSbs
���zMinidomTest.testRemoveAttrNScCs�t�}|�|�d��}|�dd�|�t|j�dk�|�d�}|�t	j
j|jd�|�
||�|��|�t|j�dkoB|�d�du�t�}|�|�d��}|�d�}|�t	j
j|j|�|��dS)Nrnr�r�rYr)rrqr^r�r1r`r�r�r�rrr��removeAttributeNode�assertIsr?)r.rr�r3�dom2�child2�node2rrr�testRemoveAttributeNodeps&
��
�z#MinidomTest.testRemoveAttributeNodecCs6t�}|�|�d��}|�dd�|�|�d��dS)Nrnr�r�)rrqr^r�r1�hasAttributer�rrr�testHasAttribute�szMinidomTest.testHasAttributecCs�td�}|j}|�dd�|�t|j�dk�|�dd�|�d�|�t|j�dkoG|jdjdkoG|jdjdkoG|�	d�dkoG|�
d�j�d|jd<|�t|j�dkos|jdjdkos|jdjdkos|�	d�dkos|jdj�|�dd�|�t|j�dko�|jdjdko�|jdjdko�|�	d�dko�|jdjdko�|jdjdko�|�	d�dk�d	|jd<|�t|j�dko�|jdjdko�|jdjdko�|�	d�dko�|jdjd	ko�|jdjd	ko�|�	d�d	k�|��dS)
Nr�r�r�rY�bam�ham�spam2rX�bam2)
rrSr�r1r`r��setIdAttributer�r�r�r��isIdr?r�rrr�testChangeAttr�sl
���
�
���
�������
������zMinidomTest.testChangeAttrcC�dSr,r�r.rrr�testGetAttrList��zMinidomTest.testGetAttrListcCr�r,rr�rrr�testGetAttrValues�r�zMinidomTest.testGetAttrValuescCr�r,rr�rrr�testGetAttrLength�r�zMinidomTest.testGetAttrLengthcCs.t�}|�|�dd��}|�|�d�d�dS)Nr�r��missing�)rrqr�rKr�r�rrr�testGetAttribute�s

�zMinidomTest.testGetAttributecCsvt�}|�|�dd��}|�ddd�|�|�dd�d�|�|�dd�d�|�|�d��}|�|�dd	�d�dS)
Nr�r�r�r��python�otherr�r�r�)rrqr�r�rK�getAttributeNSr^)r.rr�r�rrr�testGetAttributeNS�s"
�����zMinidomTest.testGetAttributeNScCr�r,rr�rrr�testGetAttributeNode��z MinidomTest.testGetAttributeNodecCs|d}t|�}|�dd�}|�t|�dko6|djdko6|djdko6|djdko6|djdko6|djdk�|�	�dS)NzZ<foo xmlns:minidom='http://pyxml.sf.net/minidom'>
        <minidom:myelem/>
        </foo>zhttp://pyxml.sf.net/minidom�myelemrYrrzminidom:myelem)
r�getElementsByTagNameNSr1r`rGrHrI�tagNamerr?)r.�dr�elemsrrr�testGetElementsByTagNameNS�s"������z&MinidomTest.testGetElementsByTagNameNScCs"|�||�}|�t|�dk�dSr&)r�r1r`)r.r
�nsuri�lname�nodelistrrr�5get_empty_nodelist_from_elements_by_tagName_ns_helper�szAMinidomTest.get_empty_nodelist_from_elements_by_tagName_ns_helpercCshtd�}|�|dd�|�|dd�|�|dd�td�}|�|dd�|�|dd�|�|d	d
�dS)Nrlz"http://xml.python.org/namespaces/a�	localname�*�splatz3<doc xmlns="http://xml.python.org/splat"><e/></doc>zhttp://xml.python.org/splatz	not-therez#http://somewhere.else.net/not-there�e)rr�r9rrr�+testGetEmptyNodeListFromElementsByTagNameNS�s(������z7MinidomTest.testGetEmptyNodeListFromElementsByTagNameNScC�@t�}|�|�d��}t|�}t|�}|�||k�|��dSr��rrqr^�repr�strr1r?�r.rr��string1�string2rrr�testElementReprAndStr��z!MinidomTest.testElementReprAndStrcCr�r�r�r�rrr�testElementReprAndStrUnicode�rz(MinidomTest.testElementReprAndStrUnicodecCsPt�}|�|�dd��}t|�}t|�}|�||k�|�d|v�|��dS)Nzhttp://www.slashdot.orgz	slash:abc)rrqr�r�r�r1r?r�rrr�testElementReprAndStrUnicodeNSs
�z*MinidomTest.testElementReprAndStrUnicodeNScCsDt�}|�|�d��}|�dd�}|�t|�t|�k�|��dS)Nr�r�)rrqr^r�r1r�r�r?)r.rr�r3rrr�testAttributeReprs
zMinidomTest.testAttributeReprcCr�r,rr�rrr�testTextNodeReprr�zMinidomTest.testTextNodeReprcCs.d}t|�}|��}|��|�||k�dS)Nz <?xml version="1.0" ?><a b="c"/>)rrdr?r1�r.r�r�domstrrrr�testWriteXMLs
zMinidomTest.testWriteXMLcCs:d}t|�}|jdd�}|��|�||�dd�k�dS)Nz"<?xml version="1.0" ?>
<a b="c"/>
z
)�newl�
)r�toprettyxmlr?r1�replacerrrr�testAltNewlines
zMinidomTest.testAltNewlinecCs�d}|�td���|d�|�td���|d�|�td���|d�|�td���|d	�|�td
���|d�dS)N�<?xml version="1.0" ?>
�<B>A</B>z	<B>A</B>
z<C>A<B>A</B></C>z<C>
	A
	<B>A</B>
</C>
z<C><B>A</B>A</C>z<C>
	<B>A</B>
	A
</C>
z<C><B>A</B><B>A</B></C>z<C>
	<B>A</B>
	<B>A</B>
</C>
z<C><B>A</B>A<B>A</B></C>z <C>
	<B>A</B>
	A
	<B>A</B>
</C>
)rKrr
)r.�declrrr� test_toprettyxml_with_text_nodes#s �����z,MinidomTest.test_toprettyxml_with_text_nodescCsVt�}|�d�}|�|�d��|�|�d��|�|�d}|�|��|d�dS)Nrh�TEXTrz<elem>
	TEXT
	TEXT
</elem>
)rr^rqrprKr
)r.rrhrrrr�)test_toprettyxml_with_adjacent_text_nodes1s


�z5MinidomTest.test_toprettyxml_with_adjacent_text_nodescCsVdD]&}t|�}t|���}|�|�d�djd��|�d�djd���qdS)N)rz<A><B>C</B></A>�Br)rr
rKrRr]rd)r.r�rr�rrr�/test_toprettyxml_preserves_content_of_text_node<s��z;MinidomTest.test_toprettyxml_preserves_content_of_text_nodecCs�td�}|jj}|�|jdkoE|jdkoE|jdkoE|jtj	koE|j
duoE|��oEt|j
�dkoE|jduoE|jduoE|jduoE|jtjjk�dS)Nz<e><?mypi 	
 data 	
 ?></e>�mypizdata 	
 r)rrSrbr1�targetr�r�nodeTyper�PROCESSING_INSTRUCTION_NODEr��
hasChildNodesr`r]rcrHrGrr�EMPTY_NAMESPACE)r.r�pirrr�testProcessingInstructionEs.��
������	�
�z%MinidomTest.testProcessingInstructioncCr�r,rr�rrr�testProcessingInstructionReprTr�z)MinidomTest.testProcessingInstructionReprcCr�r,rr�rrr�testTextReprVr�zMinidomTest.testTextReprcCr�r,rr�rrr�
testWriteTextXr�zMinidomTest.testWriteTextcCr�r,rr�rrr�testDocumentElementZr�zMinidomTest.testDocumentElementcCs:td�}|�d�}|�tjj|j|�|��|��dS)Nrl�extra)rr^r�rrr�rqr?�r.r
rhrrr�testTooManyDocumentElements\s

z'MinidomTest.testTooManyDocumentElementscCr�r,rr�rrr�testCreateElementNSdr�zMinidomTest.testCreateElementNScCr�r,rr�rrr�testCreateAttributeNSfr�z!MinidomTest.testCreateAttributeNScCr�r,rr�rrr�	testParsehr�zMinidomTest.testParsecCr�r,rr�rrr�testParseStringjr�zMinidomTest.testParseStringcCr�r,rr�rrr�testCommentlr�zMinidomTest.testCommentcCr�r,rr�rrr�testAttrListItemnr�zMinidomTest.testAttrListItemcCr�r,rr�rrr�testAttrListItemspr�zMinidomTest.testAttrListItemscCr�r,rr�rrr�testAttrListItemNSrr�zMinidomTest.testAttrListItemNScCr�r,rr�rrr�testAttrListKeystr�zMinidomTest.testAttrListKeyscCr�r,rr�rrr�testAttrListKeysNSvr�zMinidomTest.testAttrListKeysNScCsPtd�}|j}|j}|�d�}|�d�}|�|�|��|�tj	j
|jd�dS)Nz<doc a=''/>r�)rrSr�r��removeNamedItemr1�
isSameNoder�rrr��r.r
r�r��a1�a2rrr�testRemoveNamedItemxs

zMinidomTest.testRemoveNamedItemcCsVtd�}|j}|j}|�dd�}|�dd�}|�|�|��|�tj	j
|jdd�dS)Nz.<doc xmlns:a='http://xml.python.org/' a:b=''/>zhttp://xml.python.org/�b)rrSr��getAttributeNodeNS�removeNamedItemNSr1r2r�rrr�r3rrr�testRemoveNamedItemNS�s�z!MinidomTest.testRemoveNamedItemNScCr�r,rr�rrr�testAttrListValues�r�zMinidomTest.testAttrListValuescCr�r,rr�rrr�testAttrListLength�r�zMinidomTest.testAttrListLengthcCr�r,rr�rrr�testAttrList__getitem__�r�z#MinidomTest.testAttrList__getitem__cCr�r,rr�rrr�testAttrList__setitem__�r�z#MinidomTest.testAttrList__setitem__cCr�r,rr�rrr�testSetAttrValueandNodeValue�r�z(MinidomTest.testSetAttrValueandNodeValuecCr�r,rr�rrr�testParseElement�r�zMinidomTest.testParseElementcCr�r,rr�rrr�testParseAttributes�r�zMinidomTest.testParseAttributescCr�r,rr�rrr�testParseElementNamespaces�r�z&MinidomTest.testParseElementNamespacescCr�r,rr�rrr�testParseAttributeNamespaces�r�z(MinidomTest.testParseAttributeNamespacescCr�r,rr�rrr�testParseProcessingInstructions�r�z+MinidomTest.testParseProcessingInstructionscCr�r,rr�rrr�testChildNodes�r�zMinidomTest.testChildNodescCr�r,rr�rrr�testFirstChild�r�zMinidomTest.testFirstChildcCs<td�}|j}|�|���td�}|j}|�|���dS)NrVrl)rrSr-rr7)r.rr
r��doc2rrr�testHasChildNodes�szMinidomTest.testHasChildNodescCs�|j}|j}t|���}t|���}|��|��|�||kd�tt|��D]5}|�|�}	|�|�}
|�|	|
uoQ|	j|
jkoQ|	j	|
j	koQ|	j
|
j
koQ|	j|
jkd�|�|
j|ud�q(dS)Nz(clone of element has same attribute keysz3clone of attribute node has proper attribute valuesz'clone of attribute node correctly owned)
r��list�keys�sortr1r�r`r'r�r�rGrHr�)r.�e1�e2r/�attrs1�attrs2�keys1�keys2r�r4r5rrr�!_testCloneElementCopiesAttributes�s0


�
�
�
���z-MinidomTest._testCloneElementCopiesAttributescCs^td�}|j}|�|�}|�||d|rdpd�d|_|_|�dd�|�dd	�||fS)
Nz<doc attr='value'><foo/></doc>�testCloneElement�Deep�Shallow�MODIFIEDrNz	NEW VALUE�added�VALUE)rrS�	cloneNoderRr�rr�)r.�deeprrg�clonerrr�_setupCloneElement�s
�zMinidomTest._setupCloneElementcC�R|�d�\}}|�t|j�dko |jjdko |jduo |��dkd�|��dS)Nrz<doc attr="value"/>�testCloneElementShallow�r\r1r`r]ra�
parentNoderdr?�r.rr[rrrr^��
��
�z#MinidomTest.testCloneElementShallowcCr])NrYz<doc attr="value"><foo/></doc>�testCloneElementDeepr_rarrrrc�rbz MinidomTest.testCloneElementDeepcCs&td�}|�d�}|�|dud�dS)N��<?xml version='1.0'?>
<!-- comment --><!DOCTYPE doc [
<!NOTATION notation SYSTEM 'http://xml.python.org/'>
]>
<doc attr='value'/>rzFtestCloneDocumentShallow: shallow cloning of documents makes no sense!)rrYr1�r.r
rGrrr�testCloneDocumentShallow�s


�z$MinidomTest.testCloneDocumentShallowcCs�td�}|�d�}|�|�|�p|�|�d�|�t|j�t|j�kd�|�|jjtj	kd�|�|jj
�|�d�|�|j�|j�d�|jduro|�|jjtjkd�|�|jj
�|��|�|j�|j��dSdS)	NrdrYz4testCloneDocumentDeep: document objects not distinctz8testCloneDocumentDeep: wrong number of Document childrenz:testCloneDocumentDeep: documentElement not an ELEMENT_NODEz@testCloneDocumentDeep: documentElement owner is not new documentz;testCloneDocumentDeep: documentElement should not be sharedz7testCloneDocumentDeep: doctype not a DOCUMENT_TYPE_NODE)
rrYr1r2r`r]rSrr�ELEMENT_NODEr(r�DOCUMENT_TYPE_NODErerrr�testCloneDocumentDeep�s0
�����
��z!MinidomTest.testCloneDocumentDeepcCs�t�}|�d�}|�|duoV|j|jkoV|j|jkoV|j|jkoV|j|jkoVt|j�t|j�koV|j�	t|j��duoVt|j
�t|j
�koV|j
�	t|j
��duoVt|j�dk�tt|j��D]G}|j�	|�}|j�	|�}|�|�
|�o�|�
|�o�|j|jko�|j|jko�|j|jko�|j|jko�|j|jko�|j|jko�|j|jk�q_tt|j
��D]/}|j
�	|�}|j
�	|�}|�|�
|�o�|�
|�o�|j|jko�|j|jko�|j|jk�q�dS)NrYr)r%rYr1rrL�publicId�systemIdr`rr'rr]r�r2�notationNamer!r"r )r.rr[r��se�ce�sn�cnrrr�testCloneDocumentTypeDeepOksl

�
�
�
�����	�

�
�
�
�
�
�
�
�	
�
�
�
��z'MinidomTest.testCloneDocumentTypeDeepOkcC�&t�}|j�d�}|�|dud�dS)NrY�testCloneDocumentTypeDeepNotOk�r)rrYr1�r.r
r[rrrrs$�z*MinidomTest.testCloneDocumentTypeDeepNotOkcCs�t�}|�d�}|�|duoJ|j|jkoJ|j|jkoJ|j|jkoJ|j|jkoJt|j�dkoJ|j�	d�duoJt|j
�dkoJ|j
�	d�duoJt|j�dk�dSr&)r%rYr1rrLrjrkr`rr'rr])r.rr[rrr�testCloneDocumentTypeShallowOk)s*

�
�
�
�����	�z*MinidomTest.testCloneDocumentTypeShallowOkcCrr)Nr�!testCloneDocumentTypeShallowNotOkrtrurrrrx7rvz-MinidomTest.testCloneDocumentTypeShallowNotOkcCs*td�}td�}|�tjj|j||�dS)Nrl)rr�rr�NotSupportedErr�
importNode)r.rZ�testName�doc1rGrrr�check_import_document<sz!MinidomTest.check_import_documentcC�|�dd�dS)Nr�testImportDocumentShallow�r}r�rrrrArz%MinidomTest.testImportDocumentShallowcCr~)NrY�testImportDocumentDeepr�r�rrrr�Drz"MinidomTest.testImportDocumentDeepcC�(t�}t�}|�tjj|j|jd�dSr&�r)rr�rrryrzr�r.�srcrrrr�testImportDocumentTypeShallowG�
�z)MinidomTest.testImportDocumentTypeShallowcCr��NrYr�r�rrr�testImportDocumentTypeDeepMr�z&MinidomTest.testImportDocumentTypeDeepcCs�td�}|j�d�}|�|d�|�|�}|�|�|��|�|�|��|�|jdu|d�|�|j�|j�|d�|�|j	|d�dS)Nz<doc attr='value'/>rNz: ownerElement should be Nonez: ownerDocument does not matchz.: cloned attribute must have specified == True)
rrSr��assertNotEqualrYr1r2r�r(�	specified)r.rZr{r
rNr[rrr�check_clone_attributeUs
���z!MinidomTest.check_clone_attributecCr~)Nr�testCloneAttributeShallow�r�r�rrrr�crz%MinidomTest.testCloneAttributeShallowcCr~)NrY�testCloneAttributeDeepr�r�rrrr�frz"MinidomTest.testCloneAttributeDeepcCsJtd�}|j}|�|jtj�|�|�}|�|j|jko!|j	|j	k�dS)Nz<?target data?><doc/>)
rrbrKrrrrYr1rr�)r.rZr{r
rr[rrr�check_clone_piis

�zMinidomTest.check_clone_picCr~)Nr�testClonePIShallow�r�r�rrrr�qrzMinidomTest.testClonePIShallowcCr~)NrY�testClonePIDeepr�r�rrrr�trzMinidomTest.testClonePIDeepc
Cstjj�d���}Gdd�d�}|�}|j}|jd}|�dd|�|r?|jdd�}|�	|j
jjd	�tjj
j}|jjd}	n't�|d
d��|jdd�}Wd�n1sWwYtjj
j}|jd}	|�	|j|�|�	|jd�|�	|jd�|�|j|�|�|j|	�dS)Nu
            <?xml version="1.0" ?>
            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                "http://www.w3.org/TR/html4/strict.dtd"
                [ <!ENTITY smile "☺"> ]
            >
            <doc>Don't let entities make you frown &smile;</doc>
        c@seZdZdd�ZdS)z4MinidomTest.check_clone_node_entity.<locals>.HandlercSs"||_||_||_||_||_dSr,)�	operation�keyr�r��dst�r.r�r�r�r�r�rrr�handle�s

z;MinidomTest.check_clone_node_entity.<locals>.Handler.handleN)�__name__�
__module__�__qualname__r�rrrr�Handler�sr��smiler�r�T)rZu%Don't let entities make you frown ☺r()rrrr�striprr�setUserDatarYrKrSrbr2�UserDataHandler�
NODE_IMPORTEDr�	swap_attr�NODE_CLONEDr�r�r�r�r�r�)
r.�clone_document�documentr��handlerrr$r[r�r�rrr�check_clone_node_entityws2
�	
�
�

z#MinidomTest.check_clone_node_entitycCs|�d�|�d�dS)NFT)r�r�rrr�testCloneNodeEntity�s
zMinidomTest.testCloneNodeEntitycCs�td�}|j}|�|�d��|�|�d��|�t|j�dko%|jjdkd�|��|�t|j�dkoF|jjdkoF|j	|j
uoF|j	jdkd�|��td�}|j}|�|�d	��|��|�t|j�d
kon|jjd
kd�|��dS)Nrl�first�secondrXztestNormalize -- preparationrY�firstsecondztestNormalize -- resultr�rz*testNormalize -- single empty node removed)
rrSrqrpr1r`r]ra�	normalizerbrcr�r?�r.r
rgrrr�
testNormalize�s6
�
�
�
�
�zMinidomTest.testNormalizecCs�td�}|j}|�|�d��|�|�d��|�|�d��|�t|j�dko-|jjdkd�|�	�|�t|j�dkoh|jjdkoh|j
jdkoh|j
|juoh|j
j
|juoh|j
jduoh|jj|j
uoh|jj
dud	�|��dS)
Nrlr�r�r�rZz1testNormalizeCombineAndNextSibling -- preparationrXr�z-testNormalizeCombinedAndNextSibling -- result)rrSrqrpr^r1r`r]rar�rbr�rcrfrer?r�rrr�"testNormalizeCombineAndNextSibling�s6
�
�
�
��
��
�	z.MinidomTest.testNormalizeCombineAndNextSiblingcCs�td�}|j}|�|�d��|�|�d��|�t|j�dko%|jjdkd�|��|�t|j�dkoR|jjdkoR|j	j
dkoR|j	|juoR|j	jduoR|j	j
dud�|��dS)Nrlr�r�rXz1testNormalizeDeleteWithPrevSibling -- preparationrYz,testNormalizeDeleteWithPrevSibling -- result�rrSrqrpr1r`r]rar�rbr�rcrfrer?r�rrr�"testNormalizeDeleteWithPrevSibling��,
�
�
�
�
�
�z.MinidomTest.testNormalizeDeleteWithPrevSiblingcCs�td�}|j}|�|�d��|�|�d��|�t|j�dko%|jjdkd�|��|�t|j�dkoR|jjdkoR|j	j
dkoR|j	|juoR|j	jduoR|j	j
dud�|��dS)Nrlr�r�rXz1testNormalizeDeleteWithNextSibling -- preparationrYz,testNormalizeDeleteWithNextSibling -- resultr�r�rrr�"testNormalizeDeleteWithNextSibling�r�z.MinidomTest.testNormalizeDeleteWithNextSiblingcCs�td�}|j}|�|�d��|�|�d��|�|�d��|�t|j�dko-|jjdkd�|�	�|�t|j�dkob|jjdkob|j
|juob|j
j|juob|j
j
duob|jj
|j
uob|jjdud�|��dS)Nrlr�r�rZz1testNormalizeDeleteWithTwoSiblings -- preparationrXz,testNormalizeDeleteWithTwoSiblings -- result)rrSrqr^rpr1r`r]rar�rbrcrfrer?r�rrr�)testNormalizeDeleteWithTwoNonTextSiblings�s2
�
�
��
��
�z5MinidomTest.testNormalizeDeleteWithTwoNonTextSiblingscCs�td�}|j}|�|�d��|�|�d��|�|�d��|�|�d��|�|�d��|�t|j�dko=|jjdkd�|��|�t|j�dkoj|jjdkoj|j	|j
uoj|j	jdkoj|j	jduoj|j	j
dud	�|��dS)
Nrlr�r��fourth�z,testNormalizeDeleteAndCombine -- preparationrY�secondfourthz'testNormalizeDeleteAndCombine -- result)rrSrqrpr1r`r]rar�rbrcr�rerfr?r�rrr�testNormalizeDeleteAndCombines2
�
�
�
�
�
�z)MinidomTest.testNormalizeDeleteAndCombinecCstd�}|j}|jd�|�d��|jd�|�d��|jdjd�|�d��|jd�|�d��|�|�d��|�t|j�dko�|jjdko�t|jdj�d	ko�|jdjjd	ko�t|jdj�dko�|jdjjdko�t|jdjdj�d
ko�|jdjdjjd
kd�|��|�t|j�d
ko�|jjd
ko�t|jdj�d
ko�|jdjjd
ko�t|jdj�d
ko�|jdjjd
ko�t|jdjdj�dko�|jdjdjjdkd�|�|jdjdj	d
k�o	|jdjdjdj	dk�o	|jdjdj	dkd�|�|jdjdj
du�o�|jdjdj|jdjdu�o�|jdjdjdu�o�|jdjdj
|jdjdu�o�|jdjdj
du�o�|jdjdj|jdjdu�o�|jdjdjdu�o�|jdjdj
|jdjdud�|��dS)Nz)<doc><o><i/>t</o><o><o>t2</o>t3</o></doc>rr��xrY�x2�x3rZr\rXztestNormalize2 -- preparationz$testNormalize2 -- childNodes lengths�tx�t2x2�t3x3z$testNormalize2 -- joined text fieldsz"testNormalize2 -- sibling pointers)
rrSr]rqrpr1r`rar�r�rfrer?r�rrr�testNormalizeRecursion%s�
�������	
�������	����������	�
��
z"MinidomTest.testNormalizeRecursioncCs8td�}|jjd}|�|jtj�|��|��dS)Nz<o>text</o>r)	rrSr]rKrr�	TEXT_NODEr�r?)r.r
r�rrr�testBug0777884ds
zMinidomTest.testBug0777884cCs>td�}|j}d|jd_|��|�|jdjdud�dS)Nz<o><i/>t</o>r�rYr}z)Final child's .nextSibling should be None)rrSr]r�r�r1rf�r.r
r3rrr�testBug1433694ls�zMinidomTest.testBug1433694cCsjtd�}|j}|j\}}}|�|j|uo,|jduo,|j|uo,|j|uo,|jduo,|j|ud�|��dS)Nz<doc><?pi?>text?<elm/></doc>�testSiblings)rrSr]r1rfrer?)r.r
rgrr��elmrrrr�ts����
�zMinidomTest.testSiblingscCsrtd�}|j}|jd}|j\}}|jd}|�|j|uo0|j|uo0|j|uo0|j|uo0|j|ud�|��dS)Nz3<doc><elm1><elm2/><elm2><elm3/></elm2></elm1></doc>r�testParents)rrSr]r1r`r?)r.r
rg�elm1�elm2a�elm2b�elm3rrrr��s"�


���
�zMinidomTest.testParentscCs�td�}|j}|d}|�|d|�d�uo>|�d�duo>|j�d�|jduo>|j�d�|jduo>|j�d�j�d�dud�|��dS)Nz<doc><e/><e/></doc>rrYztest NodeList.item())rr]r1r'r?)r.r
r��docelemrrr�testNodeListItem�s����zMinidomTest.testNodeListItemcCs�td�}|�|��d�|�|�d�d�|�|�d�d�|�|�d�d�|�|�d	�d
�d	��tjdkrG|�ttd�|�ttd
�n|�ttd�|�	�dS)N�<foo>&#x20ac;</foo>�$<?xml version="1.0" ?><foo>€</foo>rs4<?xml version="1.0" encoding="utf-8"?><foo>€</foo>ziso-8859-15s8<?xml version="1.0" encoding="iso-8859-15"?><foo>�</foo>rs;<?xml version="1.0" encoding="us-ascii"?><foo>&#8364;</foo>zutf-16u5<?xml version="1.0" encoding="utf-16"?><foo>€</foo>�rXr\r�s<fran�ais></fran�ais>s.<franais>Comment �a va ? Tr�s bien ?</franais>s0<fran�ais>Comment �a va ? Tr�s bien ?</fran�ais>)
rrKrd�encode�pyexpat�version_infor�r
�UnicodeDecodeErrorr?r9rrr�
testEncodings�s8
�����
���zMinidomTest.testEncodingscCsttd�}|�|��d�|�|jdd�d�|�|jdd�d�|�|jdd�d�|�|�dd�d	�|��dS)
Nr�r�)�
standaloneTu4<?xml version="1.0" standalone="yes"?><foo>€</foo>Fu3<?xml version="1.0" standalone="no"?><foo>€</foo>rsE<?xml version="1.0" encoding="utf-8" standalone="yes"?><foo>€</foo>)rrKrdr?r9rrr�testStandalone�s"
�����zMinidomTest.testStandalonec@seZdZdZdd�ZdS)zMinidomTest.UserDataHandlerrcCs*|�||d|�|�|dd�d|_dSr�)r��calledr�rrrr��s
z"MinidomTest.UserDataHandler.handleN)r�r�r�r�r�rrrrr��sr�cCs$t�}|�d�}|�|�d�du�|�ddd�|�|�d�du�|�ddd�|�ddd�|�|�d�dk�|�|�d�dk�|�ddd�|�|�d�du�|�|�d�dk�|��}|�dd|�|�d�}|�|jo�|�d�duo�|�d�dk�|��|��|��dS)Nr�rn�r[�
rY)	rr^r1�getUserDatar�r�rYr�r?)r.r�nr��crrr�testUserData�s.


��zMinidomTest.testUserDatacCs@|�tjj|j|dd�td�}|�tjj|j|tjjd�dS)N�http://xml.python.org/nsz	xmlns:foorlrn)r�rr�NamespaceErr�
renameNoder�WrongDocumentErrr)r.r
r3rGrrr� checkRenameNodeSharedConstraints�s��z,MinidomTest.checkRenameNodeSharedConstraintscCsLtd�}|j}|j}|jd}|�|tjjd�}|�|jdko[|j	dko[|j
duo[|jtjjko[|jduo[|j
dko[|�d�duo[|�d��|�o[|d�|�o[|j�|�o[|j�|��|�|dd�}|�|jdko�|j	dko�|j
dko�|jdko�|jduo�|j
dko�|�d�duo�|�d�duo�|�d��|�o�|�dd��|�o�|d�|�o�|d�|��|�|dd	�}|�|jd	k�o!|j	d	k�o!|j
d
k�o!|jdk�o!|jdk�o!|j
dk�o!|�d�du�o!|�d�du�o!|�d�du�o!|�dd�du�o!|�d	��|��o!|�dd
��|��o!|d	�|��o!|d�|��|�|tjjd
�}|�|jd
k�o�|j	d
k�o�|j
du�o�|jtjjk�o�|jdu�o�|j
dk�o�|�d�du�o�|�d�du�o�|�d�du�o�|�d	�du�o�|�dd�du�o�|�d
��|��o�|d
�|��|�tjj|j|dd�|�||�|��dS)Nz<doc a='v'/>r�r7�vr�r�)r�r��http://xml.python.org/ns2zp:dr��p)r�r�r��xmlns)rrSr�r�rrrr1rLrrHrGrIr�r�r2r(r�r8r�r�r�r?)r.r
rh�attrmaprNrrr�testRenameAttribute�s�
��������
	�

�
��������	������������	����������������	�
����
��zMinidomTest.testRenameAttributecCs~td�}|j}|�|tjjd�}|�|jdko2|jdko2|j	duo2|j
tjjko2|jduo2|j�
|��|�|dd�}|�|jdko[|jdko[|j	dko[|j
dko[|jduo[|j�
|��|�|dd�}|�|jdko�|jdko�|j	dko�|j
dko�|jdko�|j�
|��|�|tjjd	�}|�|jd	ko�|jd	ko�|j	duo�|j
tjjko�|jduo�|j�
|��|�||�|��dS)
Nrlr�r�r7r�zp:cr�r�r�)rrSr�rrrr1r�rrHrGrIr(r2r�r?r%rrr�testRenameElement<sh����
�����
�����
�����
�zMinidomTest.testRenameElementcCsLtjj���tjjdd�}|�d�}|�tjj|j	|tjjd�|�
�dS)Nr��commentrn)rrrr	rrr~r�ryr�r?r�rrr�testRenameOthergs
�
�zMinidomTest.testRenameOthercCs:td�}|j}|jd}|�|jtj�|�|d�|�|�	d��|�|d�|�
|�d�|�|�|d�|�d�}|�|�|�	d	�}|�|�|�|d�|�|d	�|�
d
�}|�||�|}|�|d�|�|d	�|�dd�}|�||�|}|�|d�|�|d	�|�|�|�|d
�|�|d
�dS)Nz<doc>a</doc>rr�r7�abr��cabr�r�r��y�z�cabd)rrSr]rKrrr�r6rqrpr_�createCDATASectionr~r^r��createProcessingInstruction�removeChild)r.r
rhr��splitter�text2r�rrr�
testWholeTextqs8






zMinidomTest.testWholeTextcCsHtd�}|j}|j}|�|j|ud�|�||�|�|j|ud�dS)Nz<doc><e/></doc>zBefore replaceChild()zAfter replaceChild())rrSrbr1r`r�)r.r
rhr�rrr�testPatch1094164�szMinidomTest.testPatch1094164cCs�dd�}|�\}}}}}|�d�}|�|d�|�|d�|�t|j�dk�|�\}}}}}|�d�}|�|d�|�|d�|�t|j�dk�|�\}}}}}|�d�}|�|d�|�|duoit|j�d	k�dS)
NcSsRtd�}|j}|j}|j}|j}|�|�d�|�|�|�d�|�|||||fS)Nz<doc>a<e/>d</doc>r7r�)rrSrbrcrfr_rpr�)r
rh�text1r�r�rrr�setup�sz/MinidomTest.testReplaceWholeText.<locals>.setupznew contentr�rZr�r�r�rX)�replaceWholeTextr6r1r`r])r.r�r
rhr�r�r�r�rrr�testReplaceWholeText�s"



�z MinidomTest.testReplaceWholeTextcCsvtd�}|j}|j}|�|jduo|jtjjk�d�	�}|D]}|�
|�}|j}|�t|d�o6|jtjjk�qdS)Nal<!DOCTYPE doc [
  <!ENTITY e1 SYSTEM 'http://xml.python.org/e1'>
  <!ENTITY e2 SYSTEM 'http://xml.python.org/e2'>
  <!ATTLIST doc id   ID       #IMPLIED 
                ref  IDREF    #IMPLIED 
                refs IDREFS   #IMPLIED 
                enum (a|b)    #IMPLIED 
                ent  ENTITY   #IMPLIED 
                ents ENTITIES #IMPLIED 
                nm   NMTOKEN  #IMPLIED 
                nms  NMTOKENS #IMPLIED 
                text CDATA    #IMPLIED 
    >
]><doc id='name' notid='name' text='splat!' enum='b'       ref='name' refs='name name' ent='e1' ents='e1 e2'       nm='123' nms='123 abc' />z+id notid text enum ref refs ent ents nm nmsrL)rrS�
schemaTyper1rL�	namespacerrr�splitr��hasattr)r.r
rhr5�namesrLr�rrr�testSchemaType�s ��
��zMinidomTest.testSchemaTypecCs6td�}|j}|�d�}|�d�}|�|�d�duo!|jo!|j�|�d�|�|�|�d��o8|jo8|j�|�d�|�|�|�d��oV|�|�d��oV|joV|j�|�d�}d|_	|�
|�|�|�d�duo�|�|�d��o�|jo�|jo�|j�|�|tj
jd�|�|�|�d��o�|j�dS)Nz<doc a1='v' a2='w'/>r4r5r��w�an)rrSr�r1�getElementByIdr�r�r2�createAttributer�r�r�rrr)r.r
r�r4r5�a3rrr�testSetIdAttribute�sN

��
��
���

�����zMinidomTest.testSetIdAttributecCspd}d}td|d|d�}|j}|�|d�}|�|d�}|�|�d�duo/|jo/|j�|�|d�|�|�|�d��oG|joG|j�|�|d�|�|�|�d��of|�|�d	��of|jof|j�|�|d�}d|_	|�
|�|�|�|�d	���|�|j�|�|j�|�|j�|�|�d�du�|�|tj
jd
�|�|�|�d	��o�|j�dS�Nzhttp://xml.python.org/ns1r�z<doc xmlns:ns1='z
' xmlns:ns2='z' ns1:a1='v' ns2:a2='w'/>r4r5r�rr)rrSr8r1rr��setIdAttributeNSr2�createAttributeNSr�r�r�rrr�r.�NS1�NS2r
r�r4r5rrrr�testSetIdAttributeNS�sZ�����������
�z MinidomTest.testSetIdAttributeNScCsld}d}td|d|d�}|j}|�|d�}|�|d�}|�|�d�duo/|jo/|j�|�|�|�|�|�d��oF|joF|j�|�|�|�|�|�d��od|�|�d	��od|jod|j�|�|d�}d|_	|�
|�|�|�|�d	���|�|j�|�|j�|�|j�|�|�d�du�|�|tj
jd
�|�|�|�d	��o�|j�dSr)rrSr8r1rr��setIdAttributeNoder2r
r�r�r�rrrrrrr�testSetIdAttributeNodesZ������
��
���
�z"MinidomTest.testSetIdAttributeNodecCs||fg}|�r	|��\}}|�|j|j�|�t|j�t|j��|�|j|j�|�|�|��|�|�|��|jtj	kr�t|j
�t|j
�t|j�t|j�|�t|j
�t|j
��|�t|j�t|j��tt|j��D]-}|j�
|�}|j�
|�}|�|j|j�|�|j|j�|�|j|j�|�||f�qstt|j
��D]-}|j
�
|�}	|j
�
|�}
|�|	j|
j�|�|	j|
j�|�|	j|
j�|�|	|
f�q�|jtjkr�|�|j�|��|�|j�|��tt|j��D]}|�|j||j|f�q�|sdSdSr,)�poprKrr`r]rr7r2rrhrrr�r'rLrjrkrrl�
DOCUMENT_NODEr-r()r.r
rG�stack�n1�n2r��no1�no2rLrMrrr�assert_recursive_equalCsF




�z"MinidomTest.assert_recursive_equalcCsDtt�}tdtjd�D]}t�||�}t�|�}|�||�qdS)NrXrY)r�sampler��pickle�HIGHEST_PROTOCOL�dumps�loadsr)r.r
�protor4rGrrr�testPickledDocumenths
�zMinidomTest.testPickledDocumentcCs"tt�}t�|�}|�||�dSr,)rr�copy�deepcopyrrerrr�testDeepcopiedDocumentos
z"MinidomTest.testDeepcopiedDocumentcCs(t�}|�|�d��|�t|j�dS)Nzfoo--bar)rrqr~r��
ValueErrorrdr9rrr�(testSerializeCommentNodeWithDoubleHyphentsz4MinidomTest.testSerializeCommentNodeWithDoubleHyphencCs,td�}t|���}|�|jtjjk�dS)Nz$<element xmlns=''>
<foo/>
</element>)rrdr1rGrrrrerrr�testEmptyXMLNSValuezszMinidomTest.testEmptyXMLNSValuecCsVtjdkr|�td�}n|�td�}|�
td�Wd�dS1s$wYdS)Nr�zsyntax errorzUnsupported syntaxzE<element xmlns:abc="http:abc.com/de f g/hi/j k"><abc:foo /></element>)r�r��assertRaisesRegexr
r#r)r.�contextrrr�!testExceptionOnSpacesInXMLNSValue�s

"�z-MinidomTest.testExceptionOnSpacesInXMLNSValuecCsftt�}|j�d�d}|�tjj|j|�t	|j
�}|�|j
d�t	|j
�}|�||dk�dS)N�TITLErrY)rr>rSrRr�rrr�r�r`r]r-)r.r
�	title_tag�num_children_before�num_children_afterrrr�testDocRemoveChild�s

zMinidomTest.testDocRemoveChildcCstt�}|�dd�}d|_dS)Nr�r��crash)rr>r�r�)r.r
rrrr�"testProcessingInstructionNameError�s
z.MinidomTest.testProcessingInstructionNameErrorcCs2d}t|�}t��}|�|�|�|��|�dS�N�E<?xml version="1.0" ?><curriculum status="public" company="example"/>)r�io�StringIO�writexmlrK�getvalue)r.�xml_strr
�outputrrr�test_minidom_attribute_order�s

z(MinidomTest.test_minidom_attribute_ordercCs d}t|�}|�|��|�dSr0)rrKrd�r.r6r
rrr�"test_toxml_with_attributes_ordered�sz.MinidomTest.test_toxml_with_attributes_orderedcC� d}t|�}|�|��d�dS)Nr1zG<?xml version="1.0" ?>
<curriculum status="public" company="example"/>
�rrKr
r9rrr�(test_toprettyxml_with_attributes_ordered��

�z4MinidomTest.test_toprettyxml_with_attributes_orderedcCr;)N�C<?xml version="1.0" ?><root><node><![CDATA[</data>]]></node></root>zH<?xml version="1.0" ?>
<root>
	<node><![CDATA[</data>]]></node>
</root>
r<r9rrr�test_toprettyxml_with_cdata�r>z'MinidomTest.test_toprettyxml_with_cdatacCsLd}t|�}|�|�d�djd�t|���}|�|�d�djd�dS)Nr?r3rz</data>)rr6rRrbr
)r.r6�dom1r�rrr�test_cdata_parsing�s
zMinidomTest.test_cdata_parsingN)r+)�r�r�r�r1r6r:rCrErOrPrUrkryr{r�r�requires_resourcer�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr
rrrrrr r!r"r#r&r'r(r)r*r+r,r-r.r/r0r6r:r;r<r=r>r?r@rArBrCrDrErFrHrRr\r^rcrfrirqrsrwrxr}rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrr"r$r%r(r-r/r8r:r=r@rBrrrrr*8s$+

		&
		
		"/?M+
$
	!$$%			r*�__main__r,)r rr�r2r/r�unittestr��xml.dom.minidomrrrrrrrr	�xml.parsers.expatr
�findfiler>rrr%r)�TestCaser*r��mainrrrr�<module>sB 
�

Youez - 2016 - github.com/yon3zu
LinuXploit