HEX
Server: Apache
System: Linux bd12.noc223.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: handcraf (1693)
PHP: 8.1.28
Disabled: NONE
Upload Files
File: //proc/self/root/opt/alt/python312/lib64/python3.12/test/__pycache__/test_xml_etree.cpython-312.pyc
�

~h�eSy����ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZmZddlmZddlmZddlmZddlmZmZmZmZddlmZdd	lmZdadaed
d��Z 	e jCd
�edd��Z$edd��Z%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dd�d�Z-d�Z.Gd�dej^�Z0dpd�Z1d �Z2Gd!�d"�Z3Gd#�d$ej^�Z4Gd%�d&ej^�Z5iZ6d'e6d(<d)e6d*<d+e6d,<d-e6d.<d/e6d0<d1e6d2<d3e6d4<d5e6d6<d7joejpe d��e6d8<d9e6d:<iZ9d;e9d<<d=e9d><d?e6d@<dAe6dB<dCe6dD<GdE�dFej^�Z:GdG�dHej^�Z;GdI�dJe3ej^�Z<GdK�dLe3ej^�Z=GdM�dNe>�Z?e>j�e?_@GdO�dPe>�ZAe>j�eA_@GdQ�dRe3ej^�ZBGdS�dTej^�ZCGdU�dVej^�ZDGdW�dXej^�ZEGdY�dZej^�ZFGd[�d\ej^�ZGGd]�d^ej^�ZHGd_�d`ej^�ZIGda�dbej^�ZJGdc�ddej^�ZKGde�dfej^�ZLGdg�dhej^�ZMGdi�djej^�ZNdk�ZOGdl�dmej^�ZPdqdn�ZQeRdok(rej��yy#e"$rejFd��wxYw)r�N)�partial)�product�islice)�support)�	os_helper)�warnings_helper)�findfile�
gc_collect�	swap_attr�	swap_item)�import_fresh_module)�TESTFNz
simple.xml�xmltestdata��subdir�utf-8z!filename is not encodable to utf8z
simple-ns.xmlzexpat224_utf8_bug.xmlz�<body>
  <tag class='a'>text</tag>
  <tag class='b' />
  <section>
    <tag class='b' id='inner'>subtext</tag>
  </section>
</body>
zz<section>
  <tag class='b' id='inner'>subtext</tag>
  <nexttag />
  <nextsection>
    <tag />
  </nextsection>
</section>
zy
<body xmlns="http://effbot.org/ns">
  <tag>text</tag>
  <tag />
  <section>
    <tag>subtext</tag>
  </section>
</body>
z�
<root>
<h:table xmlns:h="hello">
  <h:tr>
    <h:td>Apples</h:td>
    <h:td>Bananas</h:td>
  </h:tr>
</h:table>

<f:table xmlns:f="foo">
  <f:name>African Coffee Table</f:name>
  <f:width>80</f:width>
  <f:length>120</f:length>
</f:table>
</root>
zy<!DOCTYPE points [
<!ENTITY % user-entities SYSTEM 'user-entities.xml'>
%user-entities;
]>
<document>&entity;</document>
zl<!DOCTYPE points [
<!ENTITY entity SYSTEM "file:///non-existing-file.xml">
]>
<document>&entity;</document>
z�<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Foo [
<!ELEMENT foo (bar*)>
<!ELEMENT bar (#PCDATA)*>
<!ATTLIST bar xml:lang CDATA "eng">
<!ENTITY qux "quux">
]>
<foo>
<bar>&qux;</bar>
</foo>
F)�quietc������fd�}|S)Nc�D������fd�}tj|��|S)Nc�j��tj�d�i�5�|i|��ddd�y#1swYyxYw)Nr)r�check_warnings)�args�kwargs�filtersr�tests  ����:/opt/alt/python312/lib64/python3.12/test/test_xml_etree.py�newtestz1checkwarnings.<locals>.decorator.<locals>.newtest}s8��� �/�/��F��F�
&��d�%�f�%�
&�
&�
&�s�	)�2)�	functools�update_wrapper)rrrrs` ��r�	decoratorz checkwarnings.<locals>.decorator|s���	&�	� � ��$�/����)rrr s`` r�
checkwarningsr#{s�����r!c�^�|jdtjj��S)N�
)�replace�os�linesep�encode)�datas r�convlinesepr+�s ���<�<��r�z�z�0�0�2�3�3r!c��eZdZd�Zd�Zy)�
ModuleTestc�(�ddlm}ddlm}ddlm}y)Nr)�ElementTree��ElementInclude��ElementPath)�	xml.etreer/r1r3)�selfr/r1r3s    r�test_sanityzModuleTest.test_sanity�s
��	*�,�)r!c�B�d}tj|t|d��y)N)�xml.etree.ElementTree�_elementtree)�
HTML_EMPTY)�not_exported)r�check__all__�ET)r5�namess  r�test_allzModuleTest.test_all�s��9�����T�2�u�?�Kr!N)�__name__�
__module__�__qualname__r6r?r"r!rr-r-�s
��*�Lr!r-Tc��|dk7rtj�}ntj�}tj	|�}|j
|fd|i|��|r|j
�S|jd�|S)N�unicode�encodingr)�io�BytesIO�StringIOr=r/�write�getvalue�seek)�elem�	to_stringrE�options�file�trees      r�	serializerQ�se���9���z�z�|���{�{�}��
�>�>�$��D��D�J�J�t�2�h�2�'�2���}�}����	�	�!���r!c�@�|D�cgc]}|j��c}Scc}w�N��tag)�seqrLs  r�summarize_listrW�s��!$�%��D�H�H�%�%��%��c�(�eZdZed��Zd�Zd�Zy)�ElementTestCasec�&�tth|_yrS)�pyETr=�modules��clss r�
setUpClasszElementTestCase.setUpClass�s
���R�j��r!c��	ttj||�5tj||�}ddd�ttj||�5tj
�}ddd�|S#1swY�DxYw#1swYSxYw#tj$r]}ttdftdfg�}	tjd|�d|	j||��d|	j||����|�d}~wwxYw)N�cETr\zFailed to round-trip z from z to )
r�sysr]�pickle�dumps�loads�
PicklingError�dictr=r\r�
TestFailed�get)
r5�obj�name�dumper�loader�proto�temp�result�pe�humans
          r�pickleRoundTripzElementTestCase.pickleRoundTrip�s���	L��3�;�;��f�5�
0��|�|�C��/��
0��3�;�;��f�5�
,����d�+��
,��
�
0�
0��
,��
���#�#�	L��2�u�+��f�~�6�7�E��$�$�(+�(-�	�	�&�&�(A�(-�	�	�&�&�(A�&C�D�JL�
L��	L�sL�B�A7�#B�B�-B�7B�<B�B
�B�
B�D�#AC;�;Dc���|j|tjtjf�|j|tjtjf�|j	tt
|��tt
|���t||�D]\}}|j||��tjdddd�}|j	||�||��y)NrU�tail�text�attrib)�assertIsInstancer=�Elementr\�assertEqual�len�list�zip�assertEqualElements�operator�
attrgetter)r5�alice�bob�x�y�
propertiess      rrz#ElementTestCase.assertEqualElements�s������e�b�j�j�$�,�,�%?�@����c�B�J�J����#=�>�����T�%�[�)�3�t�C�y�>�:���s�O�	+�D�A�q��$�$�Q��*�	+��(�(�����I�
�����E�*�J�s�O�<r!N)r@rArB�classmethodr`rtrr"r!rrZrZ�s���!��!�
�=r!rZc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�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-�Z/y.)/�ElementTreeTestc�:�|jt|�|�yrS)r{rQ)r5rL�expecteds   r�serialize_checkzElementTreeTest.serialize_check�s������4��(�3r!c�������fd��tjd�}�|�tj|�}�|j��tjdd��}tj|�}�j	t|�d�tjdd��}�fd���|j��|j��|j��|j��|j��|j��|j��|j��|j��|j��|j ��|j"��|j$��|j&��|j(��fd�}||jd��||jd	��||jd��||jd	���j+tj,tj.��j+tj0tj2�y)
Nc�2���jtj|�d��t|�}dD]9}�jt	||�d|z���j||d|z���;�j
|jt��j
|jt�|j� �j
|jt�|j� �j
|jt�|D]
}�|��y)Nznot an element��msg)rUrxrwrvzno %s memberzno %s visible by dir)
�
assertTruer=�	iselement�dir�hasattr�assertInryrU�strrxrhrwrv)�element�direlem�attrrL�
check_elementr5s    ��rr�z5ElementTreeTest.test_interface.<locals>.check_element�s�����O�O�B�L�L��1�7G�O�H��'�l�G�7�
;�������� 6�*�T�1� �3��
�
�d�G�2�T�9��;�
;�
�!�!�'�+�+�s�3��!�!�'�.�.�$�7��|�|�'��%�%�g�l�l�C�8��|�|�'��%�%�g�l�l�C�8��
$���d�#�
$r!rU�täg�value��keyz^<Element 't\xe4g' at 0x.*>$c�F���jt|d�d|z��y)N�__call__z%s not callabler�)r�r�)�methodr5s �r�check_methodz4ElementTreeTest.test_interface.<locals>.check_method�s%����O�O�G�F�J�7�)�F�2�
�
4r!c�*���|j�yrS)�__next__)�itr�s �r�
check_iterz2ElementTreeTest.test_interface.<locals>.check_iters�������%r!�*)r=rzr/�getroot�assertRegex�repr�append�extend�insert�remove�find�iterfind�findall�findtext�clearrj�set�keys�items�iter�itertextr{�XML�
fromstring�PI�ProcessingInstruction)r5r�rPr�r�r�s`   @@r�test_interfacezElementTreeTest.test_interface�s����	$�$�*�*�U�#���g���~�~�g�&���d�l�l�n�%��*�*�X�7�*�3���~�~�g�&������g��(G�H��*�*�U��*�0��	4�	�W�^�^�$��W�^�^�$��W�^�^�$��W�^�^�$��W�\�\�"��W�%�%�&��W�_�_�%��W�%�%�&��W�]�]�#��W�[�[�!��W�[�[�!��W�\�\�"��W�]�]�#��W�\�\�"��W�%�%�&�	&�	�7�#�#�E�*�+��7�#�#�C�(�)��4�=�=��'�(��4�=�=��%�&�	
���������/�������� 8� 8�9r!c�R�tjd�}|j|jd�d|_|j|jd�d|_|j|jd�|j	|j
�d|_|j|j
d�d|_|j|j
d�|j	|j�d|_|j|jd�d|_|j|jd�|j|ji�dd	d
�|_|j|jdd	d
��ddd
�|_|j|jddd
��y)NrU�Tag�TAG�Text�TEXT�Tail�TAIL�b�d)�a�c�B�D)�A�C)r=rzr{rU�assertIsNonerwrvrx)r5r�s  r�test_set_attributez"ElementTreeTest.test_set_attributesH���*�*�U�#��������e�,����������e�,����������e�,����'�,�,�'����������v�.����������v�.����'�,�,�'����������v�.����������v�.��������,�"��-���������s��)=�>�"��-���������s��)=�>r!c��tjd�}|j|d�tjd�}|j	|�|j|d�|j|�|j|d�|j
d|�|j|d�|j|�|j|g�|j|d�|j|�|jt|g��|j|d�|j|�tjdd�	�}|j|d
�tjd�}|j	|�|j|d�|j
d|�|j|d
�|j|�|j|d�|j|�|j|d
�|jt�5}|j|�ddd�|jtj�d�|j|d
�|||g|dd|j|dd�|j|dd|d|dg�|j|ddd�|d|dg�|dd�=|j|d
�y#1swY��xYw)N�<body><tag/></body>�<body><tag /></body>�tag2z<body><tag /><tag2 /></body>rz<body><tag2 /><tag /></body>rUr�r�z<tag key="value" />�subtagz!<tag key="value"><subtag /></tag>z+<tag key="value"><subtag /><subtag /></tag>zlist.remove(x): x not in list�z
<subtag />�	�)r=r�r�rzr�r�r�r�r��assertRaises�
ValueErrorr{r��	exception)r5rL�er��
subelement�cms      r�test_simpleopszElementTreeTest.test_simpleops)s���v�v�+�,�����T�#9�:��J�J�v������A�����T�#A�B����A�����T�#9�:����A�q�����T�#A�B����A�����Q�C�����T�#A�B����A�����D�!��I�����T�#A�B����A���*�*�U��*�0�����W�&;�<��Z�Z��)�
����z�"����W�&I�J����q�*�%����W�=�	?����z�"����W�&I�J����z�"����W�&;�<�
�
�
�z�
*�	'�b��N�N�:�&�	'�����R�\�\�*�,K�L����W�&;�<�"�J�
�;���!�����W�Q�Z��6������1����
�G�A�J�'?�@������!�A������W�Q�Z�(@�A��A�a�C�L����W�=�	?�	'�	'�s�K�Kc���|jtjd�d�|jtjd�d�|jtjd�d�y)Nz<tag>hello</tag>z)<tag>&#104;&#101;&#108;&#108;&#111;</tag>z<tag><![CDATA[hello]]></tag>)r�r=r��r5s r�
test_cdatazElementTreeTest.test_cdataUs[��	
���R�V�V�$6�7�"�	$����R�V�V�$O�P�"�	$����R�V�V�$B�C�"�	$r!c��tjtjd��}tj|��}|j
|jd�jd�|j
|jd�jd�tjt��}|j
|jd�jd�|j
|jd�jd�y)Nr)rOrU�section/tagr�zelement/../empty-element�
empty-element)
rFrG�
SAMPLE_XMLr)r=r/r{r�rU�SIMPLE_XMLFILE)r5�
stringfilerPs   r�test_file_initzElementTreeTest.test_file_init_s����Z�Z�
� 1� 1�'� :�;�
��~�~�:�~�.��������5�)�-�-�u�5�������=�1�5�5�u�=��~�~�>�~�2��������9�-�1�1�9�=�������#=�>�B�B��	!r!c�~�ddlm}tjt�}|j
j
�td�D]2}tj|�jdt|�z��4t|j
�}td�D]2}tj|�jdt|�z��4|jt|j
�|�td�D]2}tj|�jdt|�z��4|jt|j
�|�td�D]2}tj|�jdt|�z��4|jt|j
�d�y)Nrr2�
z./�iXi�)r4r3r=r�r��_cacher��ranger/r�r�r|r{�
assertGreater�
assertLess)r5r3rL�i�cache_len_10s     r�test_path_cachezElementTreeTest.test_path_cachejs:��	*��v�v�j�!����� � �"��r��B�A�B�N�N�4�0�5�5�d�3�q�6�k�B�B��;�-�-�.���r��B�A�B�N�N�4�0�5�5�d�3�q�6�k�B�B�����[�/�/�0�,�?��r��B�A�B�N�N�4�0�5�5�d�3�q�6�k�B�B����3�{�1�1�2�L�A��s��C�A�R�^�^�D�1�6�6�t�C��F�{�C�C�����K�.�.�/��5r!c��ddl}tjd�}|j|�}|j|�}d|j	d�_|j
|d�|j
|d�|j
|d�y)Nrz<tag>hello<foo/></tag>�bar�fooz<tag>hello<bar /></tag>z<tag>hello<foo /></tag>)�copyr=r��deepcopyr�rUr�)r5r��e1�e2�e3s     r�	test_copyzElementTreeTest.test_copyzsx��	�
�V�V�,�
-��
�T�Y�Y�r�]��
�T�]�]�2�
��"����������R�!:�;����R�!:�;����R�!:�;r!c�8�tjd�}|jd�|j|jdd�d�|j	dd�|j|jd�d�tjdd��}|j|jd�d�|j|j
ddi�ddi}tjd|�}|j
�|j|jd�d�|j|j
ddi�ddi}tjdi|��}|j
�|j|jd�d�|j|j
ddi�tjdddid��}|j|jd�d�|j|j
ddi�tjd�}d|_|j	d	d
�|j	dd�|jtj|�d
�|jt|j��d	dg�|jt|j��ddg�|j|j
dd�d|j
d<d|j
d<|jtj|�d�tjd�}|j	dd�|j	dd�|j	dd�|j	dd�|jtj|�d�y)NrUr��defaultr�r��otherr�aa�testa�testval�testb�test2s-<test testa="testval" testb="test2">aa</test>)r�r)rr�test1�testcs;<test testa="testval" testb="test1" testc="test2">aa</test>r��
r��
r�z	

 r�z



		  s[<test a="&#13;" b="&#13;&#10;" c="&#09;&#10;&#13; " d="&#10;&#10;&#13;&#13;&#09;&#09;  " />rT)r=rzrjr{r�rxr�rw�tostring�sortedr�r�)r5rLrxs   r�test_attribzElementTreeTest.test_attrib�s����z�z�%� �������������%��3�Y�?������ �������%��'�2��z�z�%�W�z�-��������%��'�2�������u�g�&6�7���!���z�z�%��(������������%��'�2�������u�g�&6�7���!���z�z�*�6�*������������%��'�2�������u�g�&6�7��z�z�%�%��!1�w�z�?��������%��'�2�������u�g�&6�7��z�z�&�!����	�����)�$�����'�"�������T�*�@�	B������	�	��,�w��.@�A������
�
��-�%�'9�:�	<�������W�-�w�7�&����G��&����G��������T�*�N�	P��z�z�&�!������d������f������i� �����&�'�������T�*�n�	pr!c�"�tjd�}ddi}|jd|�}|j|j|d��|j|�|j
|d�|j�|j
|d�|j|�|j
|d�|j||g�|j
|d	�|g|dd|j
|d�t|g�|dd|j
|d�y)
NrUr�r�r�zattrib aliasingr�z!<tag><subtag key="value" /></tag>�<tag />zM<tag><subtag key="value" /><subtag key="value" /><subtag key="value" /></tag>)
r=rz�makeelement�assertIsNotrxr�r�r�r��tuple)r5rLrx�subelems    r�test_makeelementz ElementTreeTest.test_makeelement�s����z�z�%� ����!���"�"�8�V�4���������5F��G����G�����T�#F�G��
�
�����T�9�-����G�����T�#F�G����W�g�&�'����T�[�	]��)��Q�����T�#F�G���	�"��Q�����T�#F�Gr!c�d�tjt�}tj�}|j|d��|j
|j�d�tjt�}tj�}|j|d��|j
|j�d�tt�5}|j�}ddd�tj�}|j|jd�|j�|j|j!�d�tj#�}tj|��}|j|�|j|j!�d�y#1swY��xYw)NrD�rEzi<root>
   <element key="value">text</element>
   <element>text</element>tail
   <empty-element />
</root>z�<ns0:root xmlns:ns0="namespace">
   <ns0:element key="value">text</ns0:element>
   <ns0:element>text</ns0:element>tail
   <ns0:empty-element />
</ns0:root>z^Expat ��target)r=�parser�rFrHrIr{rJ�SIMPLE_NS_XMLFILE�open�read�	XMLParserr��version�feedr��close�TreeBuilder)r5rP�stream�fr*�parserrs       r�test_parsefilezElementTreeTest.test_parsefile�sJ���x�x��'��������
�
�6�I�
�.�������*��	��x�x�)�*��������
�
�6�I�
�.�������*��	��.�
!�	�Q��6�6�8�D�	�������������4����D�����V�\�\�^��	����!�����V��,�����D�����V�\�\�^��	�!	�	�s�F&�&F/c�.�tjd�}|jtj|d��d�tj	d�}|jtj|d��d�gd�}tj|�}|jtj|�d�|jdj
tj|��d�|jtj|d�d�tjd�\}}|jt|�d	�tjd
�\}}|jt|�d�|j|djd�y)
N�<html><body>text</body></html>rDr)z<html><body>ztext</boz
dy></html>�<html><body>text</body></html>r!�asciisE<?xml version='1.0' encoding='ascii'?>
<html><body>text</body></html>rz(<html><body id='body'>text</body></html>r��body)r=r�r{rr��fromstringlist�join�tostringlist�XMLIDr|rU)r5r��sequence�_�idss     r�test_parseliteralz!ElementTreeTest.test_parseliteral�s>���&�&�9�:��������W�y��A�0�	2��-�-� @�A��������W�y��A�0�	2�=���#�#�H�-��������W�-�1�	3�������"�/�/�'�":�;�1�	3�������W�g�6�2�	3����:�;���3�����S��1�%����D�E���3�����S��1�%�����V����&�1r!c��tj}|t�}|j|j�t|�\}}|j|j�|j
||jfd�|j
|D��cgc]\}}||jf��c}}gd��|j
|jjd�|t�}|j
|D��cgc]\}}||jf��c}}gd��d}|t|�}|j
|D��cgc]\}}||jf��c}}g�d}|t|��}|j
|D��cgc]\}}||jf��c}}g�d}|t|�}|j
|D��cgc]\}}||jf��c}}gd��d	}|t|�}|j
|D��cgc]\}}|dvr||jfn||f��c}}gd
��d}|tjd�|�}|D��cgc]\}}|��	}}}|j
|d
dg�d}ttd�5}|jt�5}|||�ddd�|j|j�ddd�|j
t!j"�d�t%j&|�5|jt�5}|t|�ddd�|j
t!|j"�d�~ddd�tj(d�}	d}||	|�}|j
|D��cgc]	\}}||f��c}}ddg�tjd�}	||	�}
t|
�\}}|j
||jfd�|jtj*�5}t|
�ddd�|j
t!j"�d�|j-t.j0t2�tt2d�5}|j5d�ddd�|t2�}
t|
�\}}|j
||jfd�t%j&|�5|jtj*�5}t|
�ddd�|j
t!|j"�d�~~
ddd�t%j&|�5|t2�}
~
ddd�|jt6�5|d�ddd�ycc}}wcc}}wcc}}wcc}}wcc}}wcc}}wcc}}w#1swY��%xYw#1swY��xYw#1swY���xYw#1swY���xYwcc}}w#1swY���xYw#1swY��}xYw#1swY��	xYw#1swY��xYw#1swY��xYw#1swYyxYw)N��endr�)r0�r1r��r1�rootr4)�r1�{namespace}elementr5�r1�{namespace}empty-element�r1�{namespace}rootr"��events��startr1��r>r4�r>r�r0rAr0)r>r�r2r3)r>r1�start-ns�end-ns)
�rB)��	namespace�r>r:�r>r6r5rHr5�r>r8r7r9�rCN�rBrCz<root xmlns=''/>rBrC�r>r1�bogus�rbzunknown event 'bogus's�<?xml version='1.0' encoding='iso-8859-1'?>
<body xmlns='http://&#233;ffbot.org/ns'
      xmlns:cl�='http://effbot.org/ns'>text</body>
)rB)rB)rEuhttp://éffbot.org/ns)rB)uclé�http://effbot.org/nsz<document />junk)r1�documentz.junk after document element: line 1, column 12�wbs<document />junk�nonexistent)r=�	iterparser�r�r4�nextr{rUrrFrHrr�r��assertFalse�closedr�r�r�check_no_resource_warningrG�
ParseError�
addCleanupr�unlinkrrI�FileNotFoundError)r5rS�context�actionrLr<�resrr��sourcer�s           r�test_iterparsezElementTreeTest.test_iterparses����L�L�	��N�+�����'�,�,�'��G�}�������'�,�,�'����&�$�(�(�+�-?�@�����I����6�4�8�8�,�I�L�	�
	
������)�)�6�2��-�.������I����6�4�8�8�,�I�L�	����N�F�3������I����6�4�8�8�,�I�2�N����N�6�:������I����6�4�8�8�,�I�2�N�!���N�F�3������I����6�4�8�8�,�I�	L�		�8���-�v�6�����.5�7�*�f�d�17�:J�0J�6�4�8�8�,�39�4�.�A�7�9�
	�(���B�K�K�(;�<�f�E��*1�2�,�&�$�v�2��2�����z�8�4�5�*��
�.�$�
'�	'�1��"�"�:�.�
%�"��!�V�$�
%����Q�X�X�&�	'�	
����R�\�\�*�,C�D�
�
6�
6�t�
<�	��"�"�:�.�
2�"��.�&�1�
2����S����.�0G�H��		����
G�H�����F�F�+�����W�E�\�V�T�6�4�.�E�=�@�H�	�
���/�0��
�v�
���B�x�������&�$�(�(�+�-@�A�
�
�
�r�}�}�
-�	����H�	�����R�\�\�*�@�	B�	
���	�(�(�&�1�
�&�$�
�	)�1�
�G�G�'�(�	)�
�v�
���B�x�������&�$�(�(�+�-@�A�
�
6�
6�t�
<�	��"�"�2�=�=�1�
�R��R��
����S����.�D�
F��B�	��
6�
6�t�
<�	��6�"�B��	��
�
�0�
1�	%��m�$�	%�	%��[J��J��J��J��J��7��"3�

%�
%��	'�	'��
2�
2��	�	��F�	�	��	)�	)��
�
��	�	��	�	��	%�	%�s��V
�4V
�6V!
�7V'
�7V-
�9 V3
�V9�<W�
V?�#W�W&�W�%.W&�W3
�W9�9X�  X �X�/X �X,�	X8�?W		�W�W�W#	�W&�&W0�9X�X�X	�X � X)�,X5�8Yc��tjd�}d|_|j|d�dtj	|d�_|j|d�d|_|j|d�|j
dtjd	��|j|d
�tjdd�|d<|j|d
�y)NrUrwz<tag>text</tag>�subtextr�z'<tag>text<subtag>subtext</subtag></tag>ztext<subtag>subtext</subtag>r�commentz*text<!--comment--><subtag>subtext</subtag>r�r�z)text<?key value?><subtag>subtext</subtag>)	r=rzrwr��
SubElementrUr��Commentr��r5rLs  r�test_writefilezElementTreeTest.test_writefile�s����z�z�%� ����	����T�#4�5�-6��
�
�d�H�%�*����T�#L�M�������T�#A�B����A�r�z�z�)�,�-����T�<�	>��%�%��w�'��Q�����T�#N�Or!c��tt�5}|j�}ddd�Gd�dt�}|�}tj|��}|j
�|j|gd��tt�5}|j�}ddd�Gd�dt�}|�}tj|��}|j
|�|j|gd��y#1swY��xYw#1swY�gxYw)Nc��eZdZd�Zd�Zd�Zy)�4ElementTreeTest.test_custom_builder.<locals>.Builderc�*�|jd|f�y�Nr>�r��r5rUrxs   rr>z:ElementTreeTest.test_custom_builder.<locals>.Builder.start�������W�c�N�+r!c�*�|jd|f�y�Nr1rm�r5rUs  rr1z8ElementTreeTest.test_custom_builder.<locals>.Builder.end�������U�C�L�)r!c��yrSr"�r5rws  rr*z9ElementTreeTest.test_custom_builder.<locals>.Builder.data����r!N)r@rArBr>r1r*r"r!r�Builderrj�s��
,�
*�
r!rwrr?c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	rjc�*�|jd|f�yrlrmrns   rr>z:ElementTreeTest.test_custom_builder.<locals>.Builder.start�ror!c�*�|jd|f�yrqrmrrs  rr1z8ElementTreeTest.test_custom_builder.<locals>.Builder.end�rsr!c��yrSr"rus  rr*z9ElementTreeTest.test_custom_builder.<locals>.Builder.data�rvr!c�,�|jd||f�y)N�pirm)r5rr*s   rr}z7ElementTreeTest.test_custom_builder.<locals>.Builder.pi�s�����T�6�4�0�1r!c�*�|jd|f�y)Nrcrm)r5r*s  rrcz<ElementTreeTest.test_custom_builder.<locals>.Builder.comment�s�����Y��-�.r!c�,�|jd||f�y)NrBrm)r5�prefix�uris   r�start_nsz=ElementTreeTest.test_custom_builder.<locals>.Builder.start_ns�s�����Z���5�6r!c�*�|jd|f�y�NrCrm�r5r�s  r�end_nsz;ElementTreeTest.test_custom_builder.<locals>.Builder.end_ns�������X�v�.�/r!N)
r@rArBr>r1r*r}rcr�r�r"r!rrwz4ElementTreeTest.test_custom_builder.<locals>.Builder�s%��
,�
*�
�
2�
/�
7�
0r!))r}r}r*)rc�	 comment )rBrErFrGrHr5rHr5rIr7r9�rCrE)	rr�rr}r=rrr{r)r5rr*rw�builderr s      r�test_custom_builderz#ElementTreeTest.test_custom_builder�s����.�
!�	�Q��6�6�8�D�	�	�d�	��)�����W��-�����D������	#�		��#�
$�	���6�6�8�D�	�	0�d�	0��)�����W��-�����D������
#�
	�W	�	��.	�	�s�C4�	D�4C=�D	c���Gd�dt�}|�}tj|��}|jt	j
d��|j
|gd��y)Nc��eZdZd�Zy)�@ElementTreeTest.test_custom_builder_only_end_ns.<locals>.Builderc�*�|jd|f�yr�rmr�s  rr�zGElementTreeTest.test_custom_builder_only_end_ns.<locals>.Builder.end_ns�r�r!N)r@rArBr�r"r!rrwr��s��
0r!rwra            <?pi data?>
            <!-- comment -->
            <root xmlns='namespace' xmlns:p='pns' xmlns:a='ans'>
               <a:element key='value'>text</a:element>
               <p:element>text</p:element>tail
               <empty-element/>
            </root>
            ))rCr�)rC�pr�)r}r=rr�textwrap�dedentr{)r5rwr�r s    r�test_custom_builder_only_end_nsz/ElementTreeTest.test_custom_builder_only_end_ns�sZ��	0�d�	0��)�����W��-�����H�O�O�%��	�	
����#�	r!c��tjd��}|j|jtj�tj�}|j|jtj�y)Nr)r=rryrr)r5r �parser2s   r�%test_initialize_parser_without_targetz5ElementTreeTest.test_initialize_parser_without_target�sO�����T��*�����f�m�m�R�^�^�<��,�,�.�����g�n�n�b�n�n�=r!c�>�ttd�5}tj|�}ddd�|j	j�j
�D�cgc]
}t|���c}gd�gggg�|j	|j
�D�cgc]
}t|���c}gd�gggg�tjt�}|j	tt|��d�|j	tt|d��d�|j	|ddt|��|d}|d}|dd�=|j	tt|��d�|j	||d�|j	||d�||g|dd|j	||d�|j	||d�|j||d�|j�|j	t|�g�y#1swY���xYwcc}wcc}w)NrN)r�r�r��r�r�r)rr�r=rr{r�r�rWr�r�r|r}�assertNotEqualr�)r5rrPrL�child1�child2s      r�
test_childrenzElementTreeTest.test_children�s����.�$�
'�	�1��8�8�A�;�D�	����&*�l�l�n�&9�&9�&;�=�"�)��.�=�7����	?�	�	
���&*�i�i�k�3�"�)��.�3�7����	5�	��v�v�j�!������T�$�Z��!�,�����T�$�q�'�]�+�Q�/�����a��$�t�*�-��a����a�����1��I�����T�$�Z��!�,������a��)������a��)��V�$��Q�q�	������a��)������a��)����F�D��G�,��
�
������d��R�(�A	�	��=��3s�H�H�H�Hc���tjd�}|jtj|�d�tj	d�}|jtj|�d�y)Nr#r$)r=r�r{rr�rfs  r�test_writestringz ElementTreeTest.test_writestring!sT���v�v�6�7��������T�*�,M�N��}�}�=�>��������T�*�,M�Nr!c��tjd�}tj|�|jtj	|�d�tjd�}tj|�|jtj	|�d�tjd�}tj|�|jtj	|�d�tjd�}tj|�|jtj	|�d�tjd�}tj|�|jtj	|�d	�tjd
�}tj|�|jtj	|�d�y)Nz
<root></root>s<root />r#s"<html>
  <body>text</body>
</html>z!<html> <body>text</body>  </html>z"<html><body>text</body>tail</html>s%<html>
  <body>text</body>tail</html>z=<html><body><p>par</p>
<p>text</p>	<p><br/></p></body></html>s^<html>
  <body>
    <p>par</p>
    <p>text</p>
    <p>
      <br />
    </p>
  </body>
</html>�8<html><body><p>pre<br/>post</p><p>text</p></body></html>sJ<html>
  <body>
    <p>pre<br />post</p>
    <p>text</p>
  </body>
</html>�r=r��indentr{rrfs  r�test_indentzElementTreeTest.test_indent'sD���v�v�o�&��
�	�	�$��������T�*�K�8��v�v�6�7��
�	�	�$��������T�*�,S�T��v�v�9�:��
�	�	�$��������T�*�,S�T��v�v�:�;��
�	�	�$��������T�*�,U�V��v�v�W�X��
�	�	�$������K�K���
�	
��v�v�P�Q��
�	�	�$������K�K���
�	
r!c�H�tjd�}tj|d��|jtj	|�d�tjd�}tj|d��|jtj	|�d�y)Nr��	)�spacesD<html>
	<body>
		<p>pre<br />post</p>
		<p>text</p>
	</body>
</html>rEs><html>
<body>
<p>pre<br />post</p>
<p>text</p>
</body>
</html>r�rfs  r�test_indent_spacez!ElementTreeTest.test_indent_spaceSs����v�v�P�Q��
�	�	�$�d�	�#�����K�K���
�	
��v�v�P�Q��
�	�	�$�b�	�!�����K�K���
�	
r!c�Z�tjd�}tj|�|j|j	�D�chc]}|j
��c}hd��|j|j	�D�chc]}|j��c}hd��|jt|j	�D�chc]}|j
��c}�t|j	�D�chc]}t|j
���c}��ycc}wcc}wcc}wcc}w)Nz@<html><body><p>par</p><p>text</p><p><br/></p><p /></body></html>>N�
�
  �
    >N�
      �parrwr�r�)	r=r�r�r{r�rvrwr|�id)r5rL�els   r�test_indent_space_cachingz)ElementTreeTest.test_indent_space_cachingls����v�v�X�Y��
�	�	�$�����#�y�y�{�+��R�W�W�+�*�	
�	
���#�y�y�{�+��R�W�W�+�?�	
�	
����4�9�9�;�/�R����/�0��t�y�y�{�3���B�G�G��3�4�	
��
,��
,��0��3s�D�D�D#�1D(c��tjd�}|jt�5tj	|d��ddd�|jtj
|�d�tj	|d��|jtj
|�d�tjd�}tj	|dd�	�|jtj
|�d
�y#1swY��xYw)Nr����)�levels9<html><body><p>pre<br />post</p><p>text</p></body></html>r�s^<html>
      <body>
        <p>pre<br />post</p>
        <p>text</p>
      </body>
    </html>r�� )r�r�sI<html>
  <body>
   <p>pre<br />post</p>
   <p>text</p>
  </body>
 </html>)r=r�r�r�r�r{rrfs  r�test_indent_levelz!ElementTreeTest.test_indent_level|s����v�v�P�Q��
�
�
�z�
*�	&��I�I�d�"�I�%�	&�����K�K���H�	
�
	�	�	�$�a�	� �����K�K���
�	
��v�v�P�Q��
�	�	�$�a�s�	�+�����K�K���
�	
�)	&�	&�s�C?�?Dc���tjd�}|jtj|d��d�|jtj|dd��d�y)N�0<body xmlns="http://effbot.org/ns"><tag/></body>rDr�A<ns0:body xmlns:ns0="http://effbot.org/ns"><ns0:tag /></ns0:body>rO�rE�default_namespace�1<body xmlns="http://effbot.org/ns"><tag /></body>�r=r�r{rrfs  r�test_tostring_default_namespacez/ElementTreeTest.test_tostring_default_namespace�sX���v�v�H�I������K�K��y�K�1�O�	
�	
����K�K��y�DZ�K�[�?�	
r!c�~�tjd�}|jtj|dd��d�y)Nr�rD�foobarr�zP<ns1:body xmlns="foobar" xmlns:ns1="http://effbot.org/ns"><ns1:tag /></ns1:body>r�rfs  r�3test_tostring_default_namespace_different_namespacezCElementTreeTest.test_tostring_default_namespace_different_namespace�s4���v�v�H�I������K�K��y�H�K�M�^�	
r!c��tjd�}d}|jt|�5tj	|dd��ddd�y#1swYyxYw)Nr�z>^cannot use non-qualified names with default_namespace option$rDr�r�)r=r��assertRaisesRegexr�r)r5rL�EXPECTED_MSGs   r�5test_tostring_default_namespace_original_no_namespacezEElementTreeTest.test_tostring_default_namespace_original_no_namespace�sQ���v�v�+�,��W��
�
#�
#�J��
=�	N��K�K��y�H�K�M�	N�	N�	N�s�A�Ac�|�tjd�}|jtj|d��d�y)Nr�rDrr�r�rfs  r� test_tostring_no_xml_declarationz0ElementTreeTest.test_tostring_no_xml_declaration�s2���v�v�+�,������K�K��y�K�1�"�	
r!c�~�tjd�}|jtj|dd��d�y)Nr��utf8T�rE�xml_declarations:<?xml version='1.0' encoding='utf8'?>
<body><tag /></body>r�rfs  r�test_tostring_xml_declarationz-ElementTreeTest.test_tostring_xml_declaration�s4���v�v�+�,������K�K��v�t�K�D�J�	
r!c�~�tjd�}|jtj|dd��d�y)Nr�rDTr��;<?xml version='1.0' encoding='utf-8'?>
<body><tag /></body>r�rfs  r�.test_tostring_xml_declaration_unicode_encodingz>ElementTreeTest.test_tostring_xml_declaration_unicode_encoding�s4���v�v�+�,������K�K��y�$�K�G�J�	
r!c	���tjd�}gd�}|D]N\}}}|jd|�d|���5|jtj	|||��|�ddd��Py#1swY�[xYw)N�<body><tag>ø</tag></body>))�<body><tag>&#248;</tag></body>NN)�<body><tag>ø</tag></body>�UTF-8N)r��US-ASCIIN)�E<?xml version='1.0' encoding='ISO-8859-1'?>
<body><tag>�</tag></body>�
ISO-8859-1N)r�rDN)r�NF)r�r�F)r�r�F)s<body><tag>�</tag></body>r�F)r�rDF)sH<?xml version='1.0' encoding='us-ascii'?>
<body><tag>&#248;</tag></body>NT)sA<?xml version='1.0' encoding='UTF-8'?>
<body><tag>ø</tag></body>r�T)sH<?xml version='1.0' encoding='US-ASCII'?>
<body><tag>&#248;</tag></body>r�T)r�r�T)uA<?xml version='1.0' encoding='utf-8'?>
<body><tag>ø</tag></body>rDTz	encoding=z xml_declaration=r�)r=r��subTestr{r)r5rL�	TESTCASES�expected_retvalrEr�s      r�#test_tostring_xml_declaration_casesz3ElementTreeTest.test_tostring_xml_declaration_cases�s����v�v�2�3��
�	�<;D�
	�6�O�X�����	�(��41�1@�0A�C�D�	
�� � ��K�K��!)�(7� ��
$�
�	
�	
�
	�	
�	
�s�)A.�.A7	c	��tjd�}|jdjtj	|d���d�|jdjtj	|dd���d�y)	Nr�rErDrr�rOr�r�)r=r�r{r(r)rfs  r�#test_tostringlist_default_namespacez3ElementTreeTest.test_tostringlist_default_namespace�sj���v�v�H�I������G�G�B�O�O�D�9�O�=�>�O�	
�	
����G�G�B�O�O�D�9�Pf�O�g�h�?�	
r!c���tjd�}|jdjtj	|d���d�|jdjtj	|d���d	�tj	|dd�
�}|jdj|�d�|j|dd
�|jgd�|dd�y)Nr�rErDrr�r!T)r�s><?xml version='1.0' encoding='us-ascii'?>
<body><tag /></body>r�r�rz%^<\?xml version='1.0' encoding='.+'?>)z<body�>z<tagz />z</body>r�)r=r�r{r(r)r�)r5rL�
stringlists   r�!test_tostringlist_xml_declarationz1ElementTreeTest.test_tostringlist_xml_declarations����v�v�+�,������G�G�B�O�O�D�9�O�=�>�"�	
�	
����H�H�R�_�_�T�4�_�@�A�N�	
�
�_�_�T�I�t�_�T�
�����G�G�J��J�	
�	
����A��(P�Q����A�:�a�b�>�Rr!c
����d�fd�	}|dd�|dd�|dd�|dd�|d	d
�|dd�d
���fd�}gd�}|D]@}�jtjtj||���d��Bgd�}|D]-}�j	t
tj||���/gd�}|D]7}�j	tjtj||���9�j	t
tj�d�jd���j	ttj�d�jd��y)Nc����d|�d|�d�}�jtj|j|��j|��jtj|�j|�y)Nz<?xml version='1.0' encoding='z'?><xml>z</xml>)r{r=r�r)rw)rEr&�xmlr5s   �r�checkz,ElementTreeTest.test_encoding.<locals>.checksU����d�$�C����R�V�V�C�J�J�x�$8�9�>�>��E����R�V�V�C�[�-�-�t�4r!r%r��us-ascii�
iso-8859-1�½ziso-8859-15u€�cp437u√�	mac-romanu˚c��d|zS)Nz*<?xml version='1.0' encoding='%s'?><xml />r"rs rr�z*ElementTreeTest.test_encoding.<locals>.xml s
��?�(�J�Jr!c�2���|�j|�SrS)r))rEr�s �r�bxmlz+ElementTreeTest.test_encoding.<locals>.bxml"s����x�=�'�'��1�1r!)Cr%rz	utf-8-sig�utf-16�utf-16be�utf-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-16r��cp720�cp737�cp775�cp850�cp852�cp855�cp856�cp857�cp858�cp860�cp861�cp862�cp863�cp865�cp866�cp869�cp874�cp1006�cp1125�cp1250�cp1251�cp1252�cp1253�cp1254�cp1255�cp1256�cp1257�cp1258zmac-cyrillicz	mac-greekzmac-icelandz
mac-latin2r�zmac-turkishz
iso2022-jpziso2022-jp-1ziso2022-jp-2ziso2022-jp-2004ziso2022-jp-3ziso2022-jp-extzkoi8-rzkoi8-tzkoi8-u�kz1048�hz�ptcp154s<xml />)�big5�	big5hkscs�cp932�cp949�cp950zeuc-jpzeuc-jis-2004zeuc-jisx0213zeuc-kr�gb2312�gbk�gb18030z
iso2022-kr�johabz	shift-jiszshift-jis-2004zshift-jisx0213zutf-7)
�cp037�cp424�cp500�cp864�cp875�cp1026�cp1140�utf_32�	utf_32_be�	utf_32_le�	undefined�xxx)rE)	r{r=rr�r�r�rXr)�LookupError)r5r�r��supported_encodingsrE�&unsupported_ascii_compatible_encodings�(unsupported_ascii_incompatible_encodingsr�s`      @r�
test_encodingzElementTreeTest.test_encodingsN���	5�
	�g�s��
�j�#��
�l�F�#�
�m�X�&�
�g�x� �
�k�8�$�	K�	2�
��",�	N�H����R�[�[�����X��)?�@�*�M�	N�2
�.�?�	B�H����j�"�&�&�$�x�.�A�	B�4
�0�A�	E�H����b�m�m�R�V�V�T�(�^�D�	E�	
���*�b�f�f�c�+�.>�.E�.E�g�.N�O����+�r�v�v�s�5�z�/@�/@��/I�Jr!c�Z�tjd�}d|_|jt	|�d�|jt	|d��d�|jt	|d��d�|jt	|d��d�|jt	|d��d	�y)
Nz-<html><link/><script>1 &lt; 2</script></html>r�z/<html><link /><script>1 &lt; 2</script></html>
�r�r��htmlz*<html><link><script>1 < 2</script></html>
rwz1 < 2
)r=r�rvr{rQ�r5r�s  r�test_methodszElementTreeTest.test_methodsNs���
�F�F�B�C���������1��B�	D�����1�T�2�B�	D�����1�U�3�B�	D�����1�V�4�=�	?�����1�V�4�i�@r!c��tjd�}|jt|�d�|jt|d��d�y)Nz(<html><CamelCase>text</CamelCase></html>r+r*�r=r�r{rQr,s  r�test_issue18347zElementTreeTest.test_issue18347]sB���F�F�=�>������1��:�	<�����1�V�4�:�	<r!c���tjd�}|jt|d��d�|j	|d�|jtj�5}tjd�ddd�|jtj�d�|jtj�5}tjt�ddd�|jt|j�d�tj�}d	|jd
<|jt�|j�}|j	|d�|jtj�5}tjt�ddd�|jt|j�d�y#1swY��VxYw#1swY��xYw#1swY�HxYw)
Nz*<document title='&#x8230;'>test</document>r�rs*<document title="&#33328;">test</document>u%<document title="舰">test</document>z<document>&entity;</document>z#undefined entity: line 1, column 10z,undefined entity &entity;: line 5, column 10rw�entityz<document>text</document>z,undefined entity &entity;: line 4, column 10)r=r�r{rQr�r�rXr�r��
ENTITY_XMLrr2rr�EXTERNAL_ENTITY_XML)r5r�r�r r4s     r�test_entityzElementTreeTest.test_entityds~��

�F�F�?�@������1�z�:�=�	?����Q� J�K��
�
�r�}�}�
-�	4���F�F�2�3�	4�����R�\�\�*�5�	7��
�
�r�}�}�
-�	���F�F�:��	�����R�\�\�*�>�	@�
�����"(��
�
�h�����J���|�|�~�����T�#>�?��
�
�r�}�}�
-�	(���F�F�&�'�	(�����R�\�\�*�>�	@�-	4�	4��
	�	��	(�	(�s$�$G�G�G'�G�G$�'G0c��tjd�}|j|d�tjd�}|j|d�tjd�}|j|d�tjd�}|j|d�tjt�}|j|d	�y)
Nz<tag xml:lang='en' />z<tag xml:lang="en" />zC<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' />zC<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" />z7<html:html xmlns:html='http://www.w3.org/1999/xhtml' />z7<html:html xmlns:html="http://www.w3.org/1999/xhtml" />zG<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope' />zE<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope" />z�<ns0:body xmlns:ns0="http://effbot.org/ns">
  <ns0:tag>text</ns0:tag>
  <ns0:tag />
  <ns0:section>
    <ns0:tag>subtext</ns0:tag>
  </ns0:section>
</ns0:body>)r=r�r��
SAMPLE_XML_NSrfs  r�test_namespacezElementTreeTest.test_namespace�s���
�v�v�-�.�����T�#:�;��v�v�[�\�����T�Q�	S��v�v�O�P�����T�E�	G��v�v�_�`�����T�S�	U��v�v�m�$�����T�
�	r!c���tjd�}|j|d�tjtjd��}|j|d�tjtjdd��}|j|d�tjtjdd��}tj	|tjdd��}tj	|tjdd��}|j|d�|j�d|jd	<|j|d
�|j�d|jtjd	�<|j|d
�|j�d|jd	<|j|d�|j�tjd�|jd	<|j|d
�|j�tjd�}tjd�|jd<|j|�|j|�|j|d�|jttjdd��d�|jttjd��d�tjdd�}tjdd�}|j||�tjdd�}|j||�|j|d�|j|d�y)Nz{uri}tagz<ns0:tag xmlns:ns0="uri" />r�rU�tag1r�z;<ns0:tag xmlns:ns0="uri"><ns0:tag1 /><ns0:tag2 /></ns0:tag>r�z{uri}keyz+<ns0:tag xmlns:ns0="uri" ns0:key="value" />z
{uri}valuez0<ns0:tag xmlns:ns0="uri" ns0:key="{uri}value" />z/<ns0:tag xmlns:ns0="uri" ns0:key="ns0:value" />z{uri2}valuez	{uri1}keyz{<ns0:tag xmlns:ns0="uri" xmlns:ns1="uri1" xmlns:ns2="uri2"><tag ns1:key="ns2:value" /><tag ns1:key="ns2:value" /></ns0:tag>�nsz{ns}tagz	other-tagzns:tag)r=rzr��QNamerdr�rxr�r{r�r�)r5rLr�q1�q2s     r�
test_qnamezElementTreeTest.test_qname�s���
�z�z�*�%�����T�#@�A��z�z�"�(�(�:�.�/�����T�#@�A��z�z�"�(�(�5�%�0�1�����T�#@�A��z�z�"�(�(�5�%�0�1���-�-��b�h�h�u�f�&=�>���-�-��b�h�h�u�f�&=�>�����T�I�	K�
	
�
�
��")����J�����T�9�	;�	
�
�
��,3����B�H�H�Z�(�)����T�9�	;�	
�
�
��".����J�����T�>�	@�	
�
�
��"$�(�(�<�"8����J�����T�=�	?�	
�
�
���*�*�U�#��&(�h�h�}�&=����{�#����G�����G�����T�
�	�	
����R�X�X�d�E�2�3�Y�?�����R�X�X�i�0�1�9�=�
�X�X�d�E�
"��
�X�X�d�E�
"������R� �
�X�X�d�K�
(�����B��#����B��)�����Y�'r!c�.�tjd�}y)Nz�<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>text</html>)r=r�rfs  r�test_doctype_publicz#ElementTreeTest.test_doctype_public�s���v�v�$�%�r!c����ddlm�d>��fd�	}|ddg�|dddg�|dd	d
g�|dd	dg�|dgd
��|dgd��|dgd��|dgd��|dgd��|dddg�|dgd��|ddg�|dgd��|ddg�|dgd ��|d!gd"��|d#gd$��|d%d	d&g�|d'd'g�|d(gd)��|d*gd+��|d,d,g�|d-d-g�|d.d.g�|d/d/g�|d0gd1��|d2gd3�d4d5i�|d6d7gd8d5i�|d9d	d7gd4d5i�|d:d	d6gd8d5i�|d;d	d<gd8d5i�|d%d	d&gd5d5d=��y)?Nrr2c����j�j||�D��cgc]\}}|xs|��
c}}|�ycc}}wrS)r{�xpath_tokenizer)r�r��
namespaces�oprUr3r5s     ��rr�z3ElementTreeTest.test_xpath_tokenizer.<locals>.check�sI������-8�-H�-H��J�-W�Y�")�"�c�!�i�C�i�Y�%�
'��Ys�<
r�ztext()rw�()z@name�@rlz@*zpara[1])�para�[�1�]zpara[last()])rIrJ�lastrGrLz*/para)r��/rIz/doc/chapter[5]/section[2])rN�docrN�chapterrJ�5rLrN�sectionrJ�2rLz
chapter//para)rP�//rIz//pararTrIz//olist/item)rT�olistrN�item�.z.//para)rWrTrI�..z../@lang)rXrNrH�langzchapter[title])rPrJ�titlerLz#employee[@secretary and @assistant])
�employeerJrH�	secretaryrE�andrErH�	assistantrLz	@{ns}attrz{ns}attr�{http://spam}eggz
./spam.egg)rWrNzspam.eggz.//{http://spam}egg)rWrTr_z{ns}*�{}*�{*}tag�{*}*z	.//{*}tag)rWrTraz
./xsd:type)rWrN�&{http://www.w3.org/2001/XMLSchema}type�xsdz http://www.w3.org/2001/XMLSchema�typercrEz	@xsd:typez@typez@{*}typez{*}type)rEr;rS)r4r3)r5r�r3s` @r�test_xpath_tokenizerz$ElementTreeTest.test_xpath_tokenizer�s����)�	'�	�c�C�5��
�h����'�
�g��V�}�%�
�d�S�#�J��
�i�0�1�
�n�>�?�
�h�*�+�
�*�.�	/�	�o�8�9�
�h��v��'�
�n�:�;�
�c�C�5��
�i�,�-�
�d�T�F��
�j�2�3�
�� >�?�
�3�6K�	L�	�k�C��,�-�
� �#5�"6�7�
�l�2�3�
�#�%D�E�	�g��y�!�
�e�e�W��
�h��
�#�
�f�v�h��
�k�0�1�	�l�P��8�9�	;�
�f�?�@��5�6�	8�
�k�C�!I�J��8�9�	;�
�g��V�}��5�6�	8�
�j�3�	�*��5�6�	8�
�k�C��,�5�7�9�	:r!c���|jtjtjdd��d�|jtjtj	dd��d�|jtjtj	dd��d�|jtjtj	dd�d�d�y)	Nr�instructions<?test instruction?>z
<testing&>s<?test <testing&>?>u<testing&>ãzlatin-1s=<?xml version='1.0' encoding='latin-1'?>
<?test <testing&>�?>)r{r=rr�r�r�s r�test_processinginstructionz*ElementTreeTest.test_processinginstruction-s���	
������R�%=�%=�f�m�%T�U�'�	)�������R�U�U�6�=�%A�B�'�	)�
	
������R�U�U�6�<�%@�A�&�	(�������R�U�U�6�3C�%D�i�P�+�	,r!c�&�dD]�}||j�fD]u}d|z}ttjd|z�d��}|j	||�ttjd|�d|�d��d��}|j	||��w��y)	N)�AREA�BASE�BASEFONT�BR�COL�EMBED�FRAME�HR�IMG�INPUT�ISINDEX�LINK�META�PARAM�SOURCE�TRACK�WBRz<%s>z<%s />r+r*�<z></r�)�lowerrQr=r�r{)r5r�rLr��
serializeds     r�#test_html_empty_elems_serializationz3ElementTreeTest.test_html_empty_elems_serialization=s���2�		7�G�!�'�-�-�/�2�
7��!�D�=��&�r�v�v�h��o�'>�v�N�
�� � ��X�6�&�r�v�v�T�$�.G�'H�.4�6�
�� � ��X�6�

7�		7r!c���tjddd��}tj�5}tj	|�ddd�|jj
�d�y#1swY�*xYw)N�
cirriculum�public�example��status�companyz1<cirriculum status="public" company="example" />
)r=rzr�captured_stdout�dumpr{rJ)r5r��stdouts   r�test_dump_attribute_orderz)ElementTreeTest.test_dump_attribute_orderKs_���J�J�|�H�i�J�H��
�
$�
$�
&�	�&��G�G�A�J�	�������*�M�	O�	�	�s�A,�,A5c��tjddd��}|jt|�d�|jt|d��d�y)	Nr�r�r�r�z0<cirriculum status="public" company="example" />r+r*z;<cirriculum status="public" company="example"></cirriculum>)r=rzr{rQ�r5r4s  r�test_tree_write_attribute_orderz/ElementTreeTest.test_tree_write_attribute_orderSsI���z�z�,�x��z�K������4��K�	M�����4��7�M�	Or!c�x�tjt�}|j|djddi�y)Nrz*{http://www.w3.org/XML/1998/namespace}lang�eng)r=r��ATTLIST_XMLr{rxr�s  r�test_attlist_defaultz$ElementTreeTest.test_attlist_default[s1���}�}�[�)������a����F��N�	Pr!N)0r@rArBr�r�r�r�r�r�r�r�r	rr!r.r`rgr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r(r-r0r5r8r?rArfrirr�r�r�r"r!rr�r��s��4�A:�F?�6*?�X$�	!�6� 
<�4p�lH�,+�Z2�,x%�tP�";�z�,>�#)�JO�*
�X
�2
� 
�@	
�
�N�
�
�
�*�X	
�S�&9K�v
A�<�#@�J�B?(�B%�8:�t,� 7�O�O�Pr!r�c�n�eZdZdd�Zdd�Zdd�Zdd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zy)�XMLPullParserTestNc��|�|j|�ytdt|�|�D]}|j||||z��y�Nr)rr�r|)r5r r*�
chunk_sizer�s     r�_feedzXMLPullParserTest._feeddsG�����K�K����1�c�$�i��4�
2�����D��1�Z�<�0�1�
2r!c	��|jt|j�|�D��cgc]\}}||j|jff��!c}}|�ycc}}wrS)r{r�read_eventsrUrw)r5r r��
max_events�eventrLs      r�
assert_eventszXMLPullParserTest.assert_eventsksW����� &�v�'9�'9�';�Z� H�
J�����d�h�h��	�	�*�
+�
J��	��
Js�$A
c�j�|jtt|j�|��|�yrS)r{r}rr�)r5r r�r�s    r�assert_event_tuplesz%XMLPullParserTest.assert_event_tuplesqs+��������*�*�,�j�9�:��	r!c��t|j�|�}|j|D��cgc]\}}||jf��c}}|�ycc}}wrS)rr�r{rU)r5r r�r�r<r]rLs       r�assert_event_tagsz#XMLPullParserTest.assert_event_tagsvsE����*�*�,�j�9������H����6�4�8�8�,�H�!�	#��Hs�A
c��dD�]3}|j|��5tj�}|j|g�|j	|d|�|j|g�|j	|d|�|j|g�|j	|d|�|j|dg�|j	|d|�|j	|d|�|j|dd	g�|j	|d
|�|j|dg�|j|j
��ddd���6y#1swY��BxYw)N)Nr��)r��<!-- comment -->
z+<root>
  <element key='value'>text</element�>
r0�<element>text</element>tail
�<empty-element/>
r2�</root>
r3)r�r=�
XMLPullParserr�r�r�r)r5r�r s   r�test_simple_xmlz!XMLPullParserTest.test_simple_xml{s8��&�	2�J������4�
2��)�)�+���&�&�v�r�2��
�
�6�#7��D��&�&�v�r�2��
�
�6�I�%�'��&�&�v�r�2��
�
�6�5�*�5��&�&�v�0B�/C�D��
�
�6�#B�J�O��
�
�6�#7��D��&�&�v�&�,�0���
�
�6�;�
�;��&�&�v��/@�A��!�!�&�,�,�.�1�'
2�
2�	2�
2�
2�s�DD;�;E	c��tj�}|j�}|j|d�t	|�\}}|j||jfd�|j|d�t	|�\}}|j||jfd�|jt�5t	|�ddd�y#1swYyxYw)Nz-<root>
  <element key='value'>text</element>
r0r�r3)	r=r�r�r�rTr{rUr��
StopIteration)r5r r�r]rLs     r�test_feed_while_iteratingz+XMLPullParserTest.test_feed_while_iterating�s����!�!�#��
�
�
�
!���
�
�6�L�M��B�x�������&�$�(�(�+�-?�@��
�
�6�;�'��B�x�������&�$�(�(�+�_�=�
�
�
�}�
-�	���H�	�	�	�s�6C�Cc�j�tj�}|j|g�|j|d�|j|g�|j|d�|j|g�|j|d�|j|g�|j|d�|j|dg�|j|d�|j|d�|j|ddg�|j|d	�|j|d
g�|j	|j��y)Nr��<root xmlns='namespace'>
�"<element key='value'>text</elementr�r5r�r�r7r�r9)r=r�r�r�r�r�r5r s  r�test_simple_xml_with_nsz)XMLPullParserTest.test_simple_xml_with_ns�s���!�!�#�����v�r�*��
�
�6�/�0����v�r�*��
�
�6�7�8����v�r�*��
�
�6�?�@����v�r�*��
�
�6�5�!����v�(E�'F�G��
�
�6�:�;��
�
�6�/�0����v�)�/�(�	�	
�
�
�6�;�'����v�(B�'C�D����&�,�,�.�)r!c��tjd��}|j|d�|j|d�|jt	|j��dg�|j|d�|j|d�|j|d�|j|d	�|j|d
�|jt	|j��dg�|j
|j��y)NrKr;r�r�rDr�r�r�r�r�rJ)r=r�r�r{r}r�r�rr�s  r�test_ns_eventsz XMLPullParserTest.test_ns_events�s����!�!�)?�!�@���
�
�6�/�0��
�
�6�7�8������#�#�%�&�
,�-�	/�	
�
�
�6�?�@��
�
�6�5�!��
�
�6�:�;��
�
�6�/�0��
�
�6�;�'�����f�0�0�2�3�6F�5G�H����&�,�,�.�)r!c�`�tjd��}|j|d�|j|ddgd��|j	|dgd	��|j|d
�|j	|ddg�|j|d
�|j�|j	|dg�y)N)rBr>r1r;� <tag xmlns='abc' xmlns:p='xyz'>
�rB)rE�abc�rB)r��xyzr��r��r>�{abc}tagr��
<child />
�r>�
{abc}child�r1r��</tag>
�r1r��r=r�r�r�r�rr�s  r�test_ns_events_startz&XMLPullParserTest.test_ns_events_start�s����!�!�)E�!�F���
�
�6�>�?�� � ��%�&�*
��	!�	�	
���v�!�(
��	�	�	
�
�
�6�=�)����v�#�!�(
�	�
	
�
�
�6�:�&��������v��(
�	r!c��tjd��}|j|d�|j|ddgd��|j	|dgd	��|j|d
�|j	|ddg�|j|d
�|j�|j	|dgd	��|j|ddg�y)N)rBr>r1rCr;r�r�r�r�r�r�r�r�r�r�r�r�rJr�r�s  r�test_ns_events_start_endz*XMLPullParserTest.test_ns_events_start_end�s����!�!�)O�!�P���
�
�6�>�?�� � ��%�&�*
��	!�	�	
���v�!�(
��	�	�	
�
�
�6�=�)����v�#�!�(
�	�
	
�
�
�6�:�&��������v��(
��	�	�	
� � ����*
�	r!c���tjd��}|j|d�|j|g�tjd��}|j|d�|j	|g�tjd��}|j|d�|j|dg�|j|d�|j|d	g�|j|d
�|j|dg�|j|d�|j|gd
��|j|d�|j|j
��|j|dg�tjd��}|j|d�|j|g�|j|d�|j|dg�|j|d�|j|d	g�|j|d
�|j|g�|j|d�|j|ddg�|j|d�|j|j
��y)Nr"r;z<root/>
r=�<!-- text here -->
z<root>
r@r�rAr�r0z8<element xmlns='foo'>text<empty-element/></element>tail
)�r>�{foo}element�r>�{foo}empty-element)r1r�)r1r�z</root>r3)r>r�r�r�)r=r�r�r�r�r�rr�s  r�test_eventszXMLPullParserTest.test_events�s%���!�!��!�,���
�
�6�;�'����v�r�*��!�!�)9�!�:���
�
�6�1�2����6�2�&��!�!�)9�!�:���
�
�6�:�&����v�(9�':�;��
�
�6�?�@����v�(<�'=�>��
�
�6�5�!����v�(:�';�<��
�
�6�N�	P����v�(�	�	
�
�
�6�9�%����&�,�,�.�)����v��'8�9��!�!��!�4���
�
�6�/�0����v�r�*��
�
�6�:�&����v�(9�':�;��
�
�6�?�@����v�(<�'=�>��
�
�6�5�!����v�r�*��
�
�6�N�	P����v�%�+�(�	�	
�
�
�6�9�%����&�,�,�.�)r!c��tjd��}|j|d�|j|dtjdffg�|j|d�|j|dtjdffg�|j|d�|j|d	g�|j|d
�|j|dtjdffg�|j|d�|j|d
g�|j|d�|j|dtjdffg�tjd��}|j|d�|j|dtjdffg�y)N)r>rcr1r;r�rcz text here z<!-- more text here -->
z more text here z<root-tag>text)r>�root-tagz<!-- inner comment-->
z inner commentz</root-tag>
)r1r�z<!-- outer comment -->
z outer comment )rc)r=r�r�r�rer�r�s  r�test_events_commentz%XMLPullParserTest.test_events_comment"sa���!�!�)D�!�E���
�
�6�1�2����6�Y����]�0K�$L�#M�N��
�
�6�6�7����6�Y����=O�0P�$Q�#R�S��
�
�6�+�,����v�(=�'>�?��
�
�6�4�5����6�Y����=M�0N�$O�#P�Q��
�
�6�?�+����v�(;�'<�=��
�
�6�5�6����6�Y����=N�0O�$P�#Q�R��!�!��!�6���
�
�6�1�2����6�Y����]�0K�$L�#M�Nr!c�8�tjd��}|j|d�|j|dtjdffg�tjd��}|j|d�|j|dtjdffg�y)	N)r>r}r1r;z
<?pitarget?>
r}�pitarget)r}z<?pitarget some text ?>
zpitarget some text )r=r�r�r�r�r�s  r�test_events_piz XMLPullParserTest.test_events_pi5s����!�!�)?�!�@���
�
�6�+�,����6�T�B�E�E�:�+>�$?�#@�A��!�!��!�1���
�
�6�6�7����6�T�B�E�E�3H�+I�$J�#K�Lr!c��ddh}tj|��}|j|d�|j|ddg�Gd�d�}tj|���}|j|d�|j|ddg�y)	Nr1r>r;z<foo>bar</foo>)r>r�)r1r�c��eZdZd�Zd�Zd�Zy)�9XMLPullParserTest.test_events_sequence.<locals>.DummyIterc�(�tgd��|_y)N)r>r1rB)r�r<r�s r�__init__zBXMLPullParserTest.test_events_sequence.<locals>.DummyIter.__init__Es��"�#?�@��r!c��|SrSr"r�s r�__iter__zBXMLPullParserTest.test_events_sequence.<locals>.DummyIter.__iter__Gs���r!c�,�t|j�SrS)rTr<r�s rr�zBXMLPullParserTest.test_events_sequence.<locals>.DummyIter.__next__Is���D�K�K�(�(r!N)r@rArBr�r�r�r"r!r�	DummyIterr�Ds��
A�
�
)r!r�)r=r�r�r�)r5�eventsetr r�s    r�test_events_sequencez&XMLPullParserTest.test_events_sequence=s����7�#���!�!��!�2���
�
�6�+�,����v�(8�.�'I�J�	)�	)��!�!���!�5���
�
�6�+�,����v�(8�.�'I�Jr!c��|jt�5tjd��ddd�y#1swYyxYw)NrLr;)r�r�r=r�r�s r�test_unknown_eventz$XMLPullParserTest.test_unknown_eventPs7��
�
�
�z�
*�	?����$=��>�	?�	?�	?�s�6�?rS)r@rArBr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"r!rr�r�bsQ��2���
#�
2�.
�*�*
*��.�6,*�\O�&M�K�&?r!r�z�<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>120 Mz is adequate for an average home user.</p>
  <xi:include href="disclaimer.xml"/>
</document>
�C1.xmlz�<?xml version='1.0'?>
<disclaimer>
  <p>The opinions represented herein represent those of the individual
  and should not be interpreted as official policy endorsed by this
  organization.</p>
</disclaimer>
zdisclaimer.xmlz�<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>This document has been accessed
  <xi:include href="count.txt" parse="text"/> times.</p>
</document>
�C2.xml�324387z	count.txtz�<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>This document has been <em>accessed</em>
  <xi:include href="count.txt" parse="text"/> times.</p>
</document>
�C2b.xmlz�<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>The following is the source of the "data.xml" resource:</p>
  <example><xi:include href="data.xml" parse="text"/></example>
</document>
�C3.xmlzQ<?xml version='1.0'?>
<data>
  <item><![CDATA[Brooks & Shields]]></item>
</data>
zdata.xmlaW<?xml version='1.0'?>
<div xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="example.txt" parse="text">
    <xi:fallback>
      <xi:include href="fallback-example.txt" parse="text">
        <xi:fallback><a href="mailto:bob@example.org">Report error</a></xi:fallback>
      </xi:include>
    </xi:fallback>
  </xi:include>
</div>
�C5.xmlz�<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>Example.</p>
  <xi:include href="{}"/>
</document>
�default.xmla
<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>The following is the source code of Recursive1.xml:</p>
  <xi:include href="C1.xml"/>
  <xi:include href="C1.xml"/>
  <xi:include href="C1.xml"/>
  <xi:include href="C1.xml"/>
</document>
�include_c1_repeated.xmlz�<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>120 Mz is adequate for an average home user.</p>
  <xi:include href="disclaimer.xml" parse="BAD_TYPE"/>
</document>
�B1.xmlzn<?xml version='1.0'?>
<div xmlns:xi="http://www.w3.org/2001/XInclude">
    <xi:fallback></xi:fallback>
</div>
�B2.xmlz�<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>The following is the source code of Recursive2.xml:</p>
  <xi:include href="Recursive2.xml"/>
</document>
�Recursive1.xmlz�<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>The following is the source code of Recursive3.xml:</p>
  <xi:include href="Recursive3.xml"/>
</document>
zRecursive2.xmlz�<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>The following is the source code of Recursive1.xml:</p>
  <xi:include href="Recursive1.xml"/>
</document>
zRecursive3.xmlc�:�eZdZd	d�Zd
d�Zd�Zd�Zd�Zd�Zd�Z	y)�XIncludeTestNc�~�	t|}|dk(rtj	|�}|S#t$rtd��wxYw)N�resource not foundr�)�XINCLUDE�KeyError�OSErrorr=r�)r5�hrefrrEr*s     r�xinclude_loaderzXIncludeTest.xinclude_loader�sH��	0��D�>�D��E�>��6�6�$�<�D����	�	0��.�/�/�	0�s�	'�<c��yrSr")r5r�r rEs    r�none_loaderzXIncludeTest.none_loader�s��r!c��|dk(r9t|d�5}tj|�j�cddd�Sy#1swYyxYw)Nr�rN)rr=rr�)r5r�rrs    r�
_my_loaderzXIncludeTest._my_loader�sJ���E�>��d�D�!�
-�Q��x�x��{�*�*�,�
-�
-��
-�
-�s�#A�A	c��ddlm}|jd�}|j||j�|jt
|�d�y)Nrr0r�z�<document>
  <p>Example.</p>
  <root>
   <element key="value">text</element>
   <element>text</element>tail
   <empty-element />
</root>
</document>)r4r1r��includer�r{rQ)r5r1rOs   r�test_xinclude_defaultz"XIncludeTest.test_xinclude_default�sB��,��"�"�=�1�����s�D�O�O�4�����3��
�	r!c�~�ddlm}|jd�}|j||j�|j	t|�d�|jd�}|j||j�|j	t|�d�|jd�}|j||j�|j	t|�d�|jd	�}|j||j�|j	t|�d
�|jd�}|j
t�5}|j||j�ddd�|j	tj�d�|j	t|�d
�y#1swY�JxYw)Nrr0r�a<document>
  <p>120 Mz is adequate for an average home user.</p>
  <disclaimer>
  <p>The opinions represented herein represent those of the individual
  and should not be interpreted as official policy endorsed by this
  organization.</p>
</disclaimer>
</document>r�zO<document>
  <p>This document has been accessed
  324387 times.</p>
</document>r�zX<document>
  <p>This document has been <em>accessed</em>
  324387 times.</p>
</document>r�z�<document>
  <p>The following is the source of the "data.xml" resource:</p>
  <example>&lt;?xml version='1.0'?&gt;
&lt;data&gt;
  &lt;item&gt;&lt;![CDATA[Brooks &amp; Shields]]&gt;&lt;/item&gt;
&lt;/data&gt;
</example>
</document>r�r�aI<div xmlns:ns0="http://www.w3.org/2001/XInclude">
  <ns0:include href="example.txt" parse="text">
    <ns0:fallback>
      <ns0:include href="fallback-example.txt" parse="text">
        <ns0:fallback><a href="mailto:bob@example.org">Report error</a></ns0:fallback>
      </ns0:include>
    </ns0:fallback>
  </ns0:include>
</div>)
r4r1r�r�r{rQr�r�r�r��r5r1rPr�s    r�
test_xincludezXIncludeTest.test_xinclude�s���,��'�'��1�����x��)=�)=�>�����8�,�
�	��'�'��1�����x��)=�)=�>�����8�,�
�	��'�'�	�2�����x��)=�)=�>�����8�,�
�	��'�'��1�����x��)=�)=�>�����8�,�
�	��'�'��1��
�
�
�w�
'�	C�2��"�"�8�T�-A�-A�B�	C�����R�\�\�*�,@�A�����8�,�
�		�	C�	C�s�
F3�3F<c��ddlm}|jd�}|j||j�|j	dt|j
d���y)Nrr0r�r�z.//p)r4r1r�r�r{r|r�)r5r1rPs   r�test_xinclude_repeatedz#XIncludeTest.test_xinclude_repeated>sL��,��'�'�(A�B�����x��)=�)=�>������H�$4�$4�V�$<� =�>r!c�
�ddlm}tjtd�}|j|j�5}|j||j��ddd�|jtj�d�tjtd�}|j|j�5}|j||j��ddd�|jt|j�d�tjtd�}|j|j�5}|j||j��ddd�|jt|j�d	�tjtd
�}|j|j�5}|j||j��ddd�|jt|j�d�|jd�}|j|j�5}|j||j�ddd�|jt|j�d
�|jd�}|j|j�5}|j||jd��ddd�|jt|j�d
�|jd�}|j|j�5}|j||jd��ddd�|jt|j�d�|jd�}|j|j�5}|j||jd��ddd�|jt|j�d�|jd�}|j|j�5}|j||jd��ddd�|jt|j�d�|jd�}|j|j�5}|j||jd��ddd�|jt|j�d
�y#1swY���xYw#1swY��xYw#1swY���xYw#1swY��%xYw#1swY���xYw#1swY��QxYw#1swY���xYw#1swY��{xYw#1swY��xYw#1swY��xYw)Nrr0r�)rnz%cannot load 'disclaimer.xml' as 'xml'r�z!cannot load 'count.txt' as 'text'r�z1unknown parse type in xi:include tag ('BAD_TYPE')r�zYxi:fallback tag must be child of xi:include ('{http://www.w3.org/2001/XInclude}fallback')r�z#recursive include of Recursive2.xml)�	max_depthzAmaximum xinclude depth reached when including file Recursive2.xmlr�zAmaximum xinclude depth reached when including file Recursive3.xmlr�zAmaximum xinclude depth reached when including file Recursive1.xmlr�)r4r1r=r�r�r��FatalIncludeErrorr�r�r{r�r��XINCLUDE_BADr��LimitedRecursiveIncludeErrorr�s    r�test_xinclude_failuresz#XIncludeTest.test_xinclude_failuresEs���,��6�6�(�8�,�-��
�
�
�~�?�?�
@�	F�B��"�"�8�D�4D�4D�"�E�	F�����R�\�\�*�7�	9��6�6�(�8�,�-��
�
�
�~�?�?�
@�	F�B��"�"�8�D�4D�4D�"�E�	F�����R�\�\�*�3�	5��6�6�,�x�0�1��
�
�
�~�?�?�
@�	F�B��"�"�8�D�4D�4D�"�E�	F�����R�\�\�*�C�	E��6�6�,�x�0�1��
�
�
�~�?�?�
@�	F�B��"�"�8�D�4D�4D�"�E�	F�����R�\�\�*�@�	A�
�'�'�(8�9��
�
�
�~�?�?�
@�	C�B��"�"�8�T�-A�-A�B�	C�����R�\�\�*�5�	7��'�'�(8�9��
�
�
�~�?�?�
@�	S�B��"�"�8�T�-A�-A�T�"�R�	S�����R�\�\�*�5�	7��'�'�(8�9��
�
�
�~�J�J�
K�	P�r��"�"�8�T�-A�-A�Q�"�O�	P�����R�\�\�*�S�	U��'�'�(8�9��
�
�
�~�J�J�
K�	P�r��"�"�8�T�-A�-A�Q�"�O�	P�����R�\�\�*�S�	U��'�'�(8�9��
�
�
�~�J�J�
K�	P�r��"�"�8�T�-A�-A�Q�"�O�	P�����R�\�\�*�S�	U��'�'�(8�9��
�
�
�~�?�?�
@�	P�B��"�"�8�T�-A�-A�Q�"�O�	P�����R�\�\�*�5�	7�}	F�	F��	F�	F��	F�	F��	F�	F��	C�	C��	S�	S��	P�	P��	P�	P��	P�	P��	P�	P�sw�S�S+�S8�T�;T�1T�)T,�!T9�U�U�S(�+S5�8T�T�T�T)�,T6�9U�U�U)r�NrS)
r@rArBr�r�r�r�r�rrr"r!rr�r��s'������>�@?�D7r!r�c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zejej�d
�d��Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"y)�BugsTestc����fd�}tjd�}||�tjd�}d|_||�tjd�}d|_||�tjd�}|j	dd�||�tjd�}|j	dd�||�y)Nc����jt�5}t|�ddd��jt	j
�d�y#1swY�/xYw)Nzcannot serialize 123 (type int))r��	TypeErrorrQr{r�r�)rLr�r5s  �rr�z-BugsTest.test_bug_xmltoolkit21.<locals>.check�sK����"�"�9�-�
 ���$��
 ����S����.�5�
7�
 �
 �s�A�A�{rL�123)r=rzrwrvr�)r5r�rLs`  r�test_bug_xmltoolkit21zBugsTest.test_bug_xmltoolkit21�s����	7��z�z�#���
�d���z�z�&�!����	�
�d���z�z�&�!����	�
�d���z�z�&�!������e��
�d���z�z�&�!��������
�d�r!c���tjt�}tj|�}|j	|jd�d�|j	|jd�d�y)NrUrwr�rb)r=r�r�r/r{r�)r5rLrPs   r�test_bug_xmltoolkit25zBugsTest.test_bug_xmltoolkit25�sR���v�v�j�!���~�~�d�#��������u�-�v�6�������}�5�y�Ar!c���tjd�}|jt|j	d��g�|jt|j	d��dg�y)N�"<doc><table><tbody/></table></doc>z.//theadz.//tbody�tbody)r=r�r{rWr��r5rPs  r�test_bug_xmltoolkit28zBugsTest.test_bug_xmltoolkit28�sQ���v�v�:�;���������Z�(@�A�2�F��������Z�(@�A�G�9�Mr!c���tjd�}tj�5}tj	|�|j|j
�d�ddd�y#1swYyxYw)Nrz$<doc><table><tbody /></table></doc>
)r=r�rr�r�r{rJ)r5rPr�s   r�test_bug_xmltoolkitX1zBugsTest.test_bug_xmltoolkitX1�s]���v�v�:�;��
�
$�
$�
&�	Y�&��G�G�D�M����V�_�_�.�0W�X�	Y�	Y�	Y�s�6A)�)A2c��tjd�}|jtj|d�d�tjd�}|j|jddi�|jtj|d�d�tjd�}|jtj|d�d	�tjd
�}|jtj|d�d�tjd�}|j
dd�|jtj|d�d�y)Ns2<?xml version='1.0' encoding='iso-8859-1'?><t�g />rs<täg />sD<?xml version='1.0' encoding='iso-8859-1'?><tag �ttr='v&#228;lue' />uättruvälues<tag ättr="välue" />s:<?xml version='1.0' encoding='iso-8859-1'?><t�g>text</t�g>s<täg>text</täg>r�rU)r=r�r{rrxrzr�rs  r�test_bug_xmltoolkit39zBugsTest.test_bug_xmltoolkit39�s���v�v�N�O��������T�7�3�5F�G��v�v�6�7��������y�*�&=�>�������T�7�3�5�	7��v�v�/�0��������T�7�3�0�	2��z�z�*�%��������T�7�3�5F�G��z�z�%� ������l�+�������T�7�3�5�	7r!c��tjd�}|jt|d��d�|jt|�d�y)Nz=<!DOCTYPE doc [<!ENTITY ldots '&#x8230;'>]><doc>&ldots;</doc>r�rs<doc>&#33328;</doc>u<doc>舰</doc>r/r,s  r�test_bug_xmltoolkit54zBugsTest.test_bug_xmltoolkit54�sF��
�F�F�(�
)������1�z�:�&�	(�����1��':�;r!c���|jtj�5}tjd�ddd�|j	tj�d�y#1swY�/xYw)Ns?<!DOCTYPE doc SYSTEM 'doc.dtd'><doc>&ldots;&ndots;&rdots;</doc>z+undefined entity &ldots;: line 1, column 36)r�r=rXr�r{r�r�)r5r�s  r�test_bug_xmltoolkit55zBugsTest.test_bug_xmltoolkit55�s\���
�
�r�}�}�
-�	8���F�F�7�
8�	8�	
����R�\�\�*�=�	?�	8�	8�s�A$�$A-c�l�Gd�d�}|jttj|��y)Nc��eZdZd�Zy)�5BugsTest.test_bug_xmltoolkit60.<locals>.ExceptionFilec��t�rS)r��r5r�s  rrz:BugsTest.test_bug_xmltoolkit60.<locals>.ExceptionFile.read�s���
r!N)r@rArBrr"r!r�
ExceptionFiler �s��
r!r#)r�r�r=r)r5r#s  r�test_bug_xmltoolkit60zBugsTest.test_bug_xmltoolkit60�s&��	�	�	
���'�2�8�8�]�_�=r!c��ddd�}tj�}|jj|�|j	d�|j�}|j
|jd�jd�y)Nu’u‘)�rsquo�lsquoaF<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE patent-application-publication SYSTEM "pap-v15-2001-01-31.dtd" []>
<patent-application-publication>
<subdoc-abstract>
<paragraph id="A-0001" lvl="0">A new cultivar of Begonia plant named &lsquo;BCT9801BEG&rsquo;.</paragraph>
</subdoc-abstract>
</patent-application-publication>z.//paragraphu7A new cultivar of Begonia plant named ‘BCT9801BEG’.)	r=rr2�updaterrr{r�rw)r5�ENTITIESr �ts    r�test_bug_xmltoolkit62zBugsTest.test_bug_xmltoolkit62�sl��&��9��������
�
���X�&����%�	&�
�L�L�N���������/�4�4�K�	Mr!zSkips under coverage.c��d�}|�tjd�}td�D]	}|��|jtjd�|�y)Nc��tj�}|jdi�|jd�|j	d�y)NrUrw)r=rr>r*r1)rPs r�xmltoolkit63z4BugsTest.test_bug_xmltoolkit63.<locals>.xmltoolkit63s3���>�>�#�D��J�J�u�b�!��I�I�f���H�H�U�Or!i�)rc�getrefcountr�r{)r5r.�countr�s    r�test_bug_xmltoolkit63zBugsTest.test_bug_xmltoolkit63	sM��	�	������%���t��	�A��N�	��������.��6r!c	��tjdd��}|jtj|�d�|jtj	tj|��jd�d�|jtjtj	tj|���d�y)N�SomeTagzdef _f():
  return 3
�rws0<SomeTag text="def _f():&#10;  return 3&#10;" />rw)r=rzr{rr�rjr,s  r�test_bug_200708_newlinez BugsTest.test_bug_200708_newlines���
�J�J�y�'@�J�A��������Q��C�	E����������A��/�3�3�F�;�)�	+�������R�V�V�B�K�K��N�%;�<�C�	Er!c�b�tj�}|jd�|j|j	�j
d�Gd�d�}tj|���}|jd�|j|j	�j
d�y)Nz<element>some text</element>r�c��eZdZd�Zy)�2BugsTest.test_bug_200708_close.<locals>.EchoTargetc�,�tjd�S)Nr��r=rzr�s rrz8BugsTest.test_bug_200708_close.<locals>.EchoTarget.close+s���z�z�)�,�,r!N�r@rArBrr"r!r�
EchoTargetr8*s��
-r!r<r)r=rrr{rrU)r5r r<s   r�test_bug_200708_closezBugsTest.test_bug_200708_close#s}����������2�3��������+�+�Y�7�	-�	-����Z�\��2�����2�3��������+�+�Y�7r!c��tjd�}tj|d�}|jt	|d��d�tjd�}tj|d�}tj|d�}|jt	|d��d�tjd�}tj|d�}tj|d�}|jt�5}t	|d��ddd�|jtj�d�y#1swY�/xYw)	Nz
{default}elemr�)r�z%<elem xmlns="default"><elem /></elem>z{not-default}elemzI<elem xmlns="default" xmlns:ns1="not-default"><elem /><ns1:elem /></elem>rLz<cannot use non-qualified names with default_namespace option)	r=rzrdr{rQr�r�r�r�)r5r��sr�s    r�!test_bug_200709_default_namespacez*BugsTest.test_bug_200709_default_namespace1s���J�J��'���M�M�!�_�-������1�	�B�7�	9�
�J�J��'���M�M�!�_�-���M�M�!�0�1������1�	�B�
�	�
�J�J��'���M�M�!�_�-���M�M�!�V�$��
�
�
�z�
*�	6�b��a�9�5�	6�����R�\�\�*�N�	P�	6�	6�s�=D9�9Ec��tjd�}|jtj|�d�tj	dd�tjd�}|jtj|�d�tjd�}|jtj|�d�y)Nz/{http://namespace.invalid/does/not/exist/}titlesB<ns0:title xmlns:ns0="http://namespace.invalid/does/not/exist/" />r�z(http://namespace.invalid/does/not/exist/sB<foo:title xmlns:foo="http://namespace.invalid/does/not/exist/" />z'{http://purl.org/dc/elements/1.1/}titles8<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/" />)r=rzr{r�register_namespacer,s  r�"test_bug_200709_register_namespacez+BugsTest.test_bug_200709_register_namespaceHs����J�J�H�I��������Q��Q�	S�
���e�%O�P��J�J�H�I��������Q��Q�	S�

�J�J�@�A��������Q��G�	Ir!c��tjd�}|jtjd��|j	|dj
tj�tjd�}|jtj
d��|j	|dj
tj�y)Nr�r�r)r=rzr�rer{rUr�)r5r�s  r�test_bug_200709_element_commentz(BugsTest.test_bug_200709_element_commentWs��
�J�J�s�O��	������E�"�#�����1����2�:�:�.��J�J�s�O��	������u�������1����2�5�5�)r!c�l�tjd�}tj|d�}tj|d�}tjd�}|jd|�|j	t|�gd��|jd|�|j	t|�gd��y)	Nr�r�r�r�r)r�r�r�r�)r�r�r�r�)r=rzrdr�r{rW�r5r�r�r�r�s     r�test_bug_200709_element_insertz'BugsTest.test_bug_200709_element_insertcs����J�J�s�O���M�M�!�S�!���M�M�!�S�!���J�J�s�O��	����A�������*�O�<�	����Q�������*�,@�Ar!c�4�tjd�}tj|d�}tjd�}|j	|�|jt
|jtj��tjg�y)Nr�r�zTEST-b)r=rzrdrer�r{rWr�)r5r�r��	comment_bs    r�test_bug_200709_iter_commentz%BugsTest.test_bug_200709_iter_commentmsa���J�J�s�O���M�M�!�S�!���J�J�x�(�	�	������������r�z�z�(:�;�b�j�j�\�Jr!c���tj�}|jd�}|jdi�}|j	d�}|j�}|j
t|�d�y)Nr*rUr)r=rr*r>r1rr{rQ)r5r�r�s   r�test_bug_1534630zBugsTest.test_bug_1534630wsX���n�n����H�H�V����I�I�e�R� ���G�G�E�N���I�I�K������1��y�1r!c���tjd�}|jtj|d�d�tjd�}|jtj|d�d�y)Ns7<?xml version='1.0' encoding='utf-8'?><body>tãg</body>r%s<<?xml version='1.0' encoding='ascii'?>
<body>t&#227;g</body>s;<?xml version='1.0' encoding='iso-8859-1'?><body>t�g</body>r�r,s  r�test_issue6233zBugsTest.test_issue6233sj���F�F�.�
/��������Q��0�)�	*�
�F�F�*�
+��������Q��0�)�	*r!c���tjd�}|jt|�dg�tjt�}|dd|dd|jt|�gd��y)Nr�rU�rUrUrR)r=r�r{rWr�)r5rL�newelems   r�test_issue6565zBugsTest.test_issue6565�sY���v�v�+�,�������-��w�7��&�&��$���!�*��Q�������-�/H�Ir!c�\�tjdd�tjdd�y)N�	test10777z
http://myuri/)r=rBr�s r�test_issue10777zBugsTest.test_issue10777�s$��	���k�?�;�
���k�?�;r!c�2��G�fd�d�}tjd��|��_�j�}t	|�}|j||�|j�jt�|j�jd�y)Nc���eZdZ�fd�Zy)�%BugsTest.test_lost_text.<locals>.Textc���d�_y)N�changedTr4r,s �r�__bool__z.BugsTest.test_lost_text.<locals>.Text.__bool__�s
���"���r!N�r@rArBr\�r�s�rr�rY�����
r!r�rUr[)r=rzrwr�rTryr�r{�r5r�r�r*r�s    @r�test_lost_textzBugsTest.test_lost_text�sr���	�	�

�J�J�u�������
�J�J�L����G�����a��&����a�f�f�c�*��������+r!c���G�fd�d�}tjd���jtjd��|��d_�j	�}t|�}|j
||�|j
�djt�|j�djd�y)Nc���eZdZ�fd�Zy)�%BugsTest.test_lost_tail.<locals>.Textc���d�d_y�Nr[rT)rvr,s �rr\z.BugsTest.test_lost_tail.<locals>.Text.__bool__�s���%��!��	�r!Nr]r^s�rr�rd�r_r!r�r4rUrr[)	r=rzr�rvr�rTryr�r{r`s    @r�test_lost_tailzBugsTest.test_lost_tail�s����	�	�

�J�J�v���	������E�"�#��F��!��	�
�J�J�L����G�����a��&����a��d�i�i��-�����1����I�.r!c����G��fd�d�}tjd���jtj|����jtjd���jd��	t	��}|jj|�|j�djt�|j�djd�y#t
$r|j
d�Y�{wxYw)Nc���eZdZ��fd�Zy)�$BugsTest.test_lost_elem.<locals>.Tagc�L��tjd��d<t��yrf)r=rzrT)r5r�r�r�s  ��r�__eq__z+BugsTest.test_lost_elem.<locals>.Tag.__eq__�s����z�z�)�,��!���Q��r!N�r@rArBrl)r�r�s��rr�rj�s���
r!r�r4rUzgenerators are not reentrantrr[)r=rzr�r�rTr��skipTestryrUr�r{)r5r�r*r�r�s   @@r�test_lost_elemzBugsTest.test_lost_elem�s����	�	�
�J�J�v���	������C�E�"�#�	������E�"�#�
�F�F�5�M��	:��Q��A�	
���a�e�e�S�)����a��d�h�h��,�����1����9�-��	�	:��M�M�8�9�	:�s�C.�.D�
Dc��d|z}tj|�}|j|jd�|j	d��y)Ns<a b="%s"/>r�r)r=r�r{rj�decode)r5rwr�r4s    r�check_expat224_utf8_bugz BugsTest.check_expat224_utf8_bug�s:���t�#���v�v�c�{��������#�����G�(<�=r!c�P�d}|j|�d}|j|�y)Nsààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààsxàààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààà)rrrus  r�test_expat224_utf8_bugzBugsTest.test_expat224_utf8_bug�s*��"���$�$�T�*�(���$�$�T�*r!c�h�ttd�5}|j�}ddd�tj	�}|jd�}|j
d�j�}|jdd�}|dd}|j|jd�|�y#1swY��xYw)NrNr�rrr�����)
r�UTF8_BUG_XMLFILErr=r�rjrq�stripr&r{)r5�fp�rawr4�xmlattrrws      r�test_expat224_utf8_bug_filez$BugsTest.test_expat224_utf8_bug_file�s���
�"�D�
)�	�R��'�'�)�C�	��}�}�S�!���(�(�3�-���z�z�'�"�(�(�*���|�|�F�C�(���A�b�z��������#���-�	�	�s�B(�(B1c���|jttj�jd�|jttj�jdd�y)NrU)r�rr=rr>r�s r�test_39495_treebuilder_startz%BugsTest.test_39495_treebuilder_start�sB�����)�R�^�^�%5�%;�%;�U�C����)�R�^�^�%5�%;�%;�U�D�Ir!N)#r@rArBrrrrrrrr$r+�unittest�skipIfrc�gettracer1r5r=r@rCrErHrKrMrOrSrVrargrorrrtr}rr"r!rrr�s����8B�N�Y�7�2<�?�>�M�"�X�_�_�\�S�\�\�^�%<�=�7�>�7�	E�8�P�.
I�
*�B�K�2�
*�J�<�
,�/� .�(>�

+�.�Jr!rc�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�BasicElementTestc���d}ddi}tj||�}|j|tj�|jdt	|��|jdt	|��|jdt	|��|jdt	|��|j|j|�|j|j�|j|j�|j|j|�|j|j|�d|d	<|j|j|�|j|j|�y)
Nr��zix�wyprUrxrwrv�bazr�)
r=rzryr�r�r{rUr�rwrvr
rxr�)r5rUrx�element_foos    r�
test___init__zBasicElementTest.test___init__�s&�����%�!���j�j��f�-��	
���k�2�:�:�6��
�
�e�S��-�.��
�
�h��K� 0�1��
�
�f�c�+�.�/��
�
�f�c�+�.�/�	
������#�.����+�*�*�+����+�*�*�+�	
����+�+�V�4�����+�+�V�4���u�
�����+�+�V�4����K�.�.��7r!c��tjdddi�}|jtjdddi��tj|�}|j	||�|j|j|j�|j|j|j�|j|j|j�|jt|�t|��tj||�D]\}}|j||��|j|j|j�y�Nr�r�r�r�r��qix)r=rzr�r�r
r{rUrwrvr|�	itertools�zip_longest�assertIsrx�r5r��element_foo2r�r�s     r�
test___copy__zBasicElementTest.test___copy__	s���j�j��%��(8�9�����2�:�:�e�u�e�-=�>�?��y�y��-��	
����{�3�	
����)�)�;�?�?�;�����*�*�K�,<�,<�=�����*�*�K�,<�,<�=�	
����\�*�C��,<�=�!*� 5� 5�k�<� P�	*��V�V��M�M�&�&�)�	*�	
����,�,�k�.@�.@�Ar!c��tjdddi�}|jtjdddi��tj|�}|j||�|j
|j|j�|j
|j|j�|j
|j|j�|j
t|�t|��tj||�D]\}}|j||��|j|j|j�|j
|j|j�d|jd<|j|j|j�|j|j|j�yr�)r=rzr�r�r�r
r{rUrwrvr|r�r�rxr�r�s     r�test___deepcopy__z"BasicElementTest.test___deepcopy__(	s|���j�j��%��(8�9�����2�:�:�e�u�e�-=�>�?��}�}�[�1��	
����{�3�	
����)�)�;�?�?�;�����*�*�K�,<�,<�=�����*�*�K�,<�,<�=�	
����\�*�C��,<�=�!*� 5� 5�k�<� P�	-��V�V����V�V�,�	-�	
����,�,�k�.@�.@�A�����,�,�k�.@�.@�A�%*����5�!�����,�,�k�.@�.@�A����L�/�/��1C�1C�Dr!c�R�tjd�}|jt|jd�|jt|j
tjd�dg�|jt|jdd�tjd�g|dd|jt�5d|d<ddd�|jt�5tjd�dg|ddddd�t|d�r*ddgdd	d
d�}|jt|j|�t|d�rKGd
�dtj�}|d�g|dd|jttj|�yy#1swY��xYw#1swY��xYw)N�joer�r�r�r�__setstate__rUr�rvrw)rU�	_childrenrxrvrw�__deepcopy__c��eZdZd�Zy)�9BasicElementTest.test_augmentation_type_errors.<locals>.Ec��yrSr")r5�memos  rr�zFBasicElementTest.test_augmentation_type_errors.<locals>.E.__deepcopy__]	s��r!N)r@rArBr�r"r!r�Er�\	s�� r!r�)r=rzr�rr�r�r�r�r�r�r�)r5r��stater�s    r�test_augmentation_type_errorsz.BasicElementTest.test_augmentation_type_errorsF	s_���J�J�u������)�Q�X�X�s�3����)�Q�X�X��
�
�5�0A�5�/I�J����)�Q�X�X�q�%�8��
�
�5�!�"��!��
�
�
�y�
)�	��A�a�D�	�
�
�
�y�
)�	.��J�J�u�%�u�-�A�a�D�	.��1�n�%��"�V� ����E�
���i�����?��1�n�%�
 �B�J�J�
 ��e�H�:�A�a�D����i�����:�&�	�	��	.�	.�s�=F� F�F�F&c��Gd�d�}|�}tjd|��|_tj|�}~t�|j
|��tjd�}|�}||_tj|�}tj|d|��}~~~t�|j
|��tjd�}tjd�}tjd�}|j|�|j|�|j|�tj|�}~~~t�|j
|��y)	Nc��eZdZy)�.BasicElementTest.test_cyclic_gc.<locals>.DummyN�r@rArBr"r!r�Dummyr�c	���r!r�r�)r�r�r�r�r�)	r=rz�dummyref�weakref�refr
r�rdr�)r5r�r��wrefr�r�r�r�s        r�test_cyclic_gczBasicElementTest.test_cyclic_gcb	s��	�	�
�G���Z�Z��A�Z�.��
��{�{�1�~��
������$�&�!�
�J�J�u����G����
��{�{�1�~��
�]�]�1�e�!�]�
,��
�q�"������$�&�!��Z�Z��
��
�Z�Z��
��
�Z�Z��
��
�	�	�"�
�
�	�	�"�
�
�	�	�"�
��{�{�2�����B������$�&�!r!c���d��fd�}tjd�}tj||�}|j	|�j
d�~t
�|j	�d�|j	|�d�y)NFc�
��d�y�NTr")�w�flags �r�wref_cbz.BasicElementTest.test_weakref.<locals>.wref_cb�	s����Dr!r�T)r=rzr�r�r{rUr
)r5r�r�r�r�s    @r�test_weakrefzBasicElementTest.test_weakref�	sl�����	�
�J�J�s�O���{�{�1�g�&���������S�)�
�������t�$�������&r!c���tjdddd��}|j|jdd��d�|j|jd	d��d�y)
Nr�r�r�r�)r�r��zr��)r�r�)r=rzr{rj)r5r�s  r�test_get_keyword_argsz&BasicElementTest.test_get_keyword_args�	sR��
�Z�Z��!�q�A�Z�
.���������Q��/��3��������Q��/��3r!c	��tdtjdz�D�]6}t|jd��D�]\}}|jdd��}d|_d|_|j|d	�j|jd
��|j|jd	��|jd�djd
d�|j|d|||�}|j|jd�|j|jdd�|jt!|�d�|j#||�����9y)Nr�r���repeatr��*)r�ztext goes herezopposite of head�child�
grandchildz
.//grandchildrr�zother valuer8r�)r�rd�HIGHEST_PROTOCOLrr]rzrwrvrdr�r�r�rtr{rUrxr|r)r5rormrnr�r�s      r�test_picklezBasicElementTest.test_pickle�	s(���1�f�5�5��9�:�	0�E�")�$�,�,�q�"A�
0�����N�N�5�b�N�1��)���+����!�!�!�W�-�4�4�V�^�^�L�5Q�R��������0�1��	�	�/�*�1�-�1�1�&�-�H��)�)�!�-D�*0�&�%�A��� � �����/�� � ����5�!1�2�6�� � ��R��!�,��(�(��B�/�
0�	0r!c	��tdtjdz�D]�}t|jd��D]�\}}d}|j|�}|j
|j�dd�|j|d|||�}|j
|jd�|j
|djd	�����y)
Nr�r�r�z\<?xml version="1.0"?>
                    <group><dogs>4</dogs>
                    </group>rU�groupr8r�dogs)
r�rdr�rr]r�r{�__getstate__rtrU)r5rormrn�XMLTEXTr�r�s       r�test_pickle_issue18997z'BasicElementTest.test_pickle_issue18997�	s����1�f�5�5��9�:�
	4�E�")�$�,�,�q�"A�	
4���� ���&�&�w�/��� � ����!2�5�!9�7�C��)�)�"�.E�*0�&�%�A��� � �����1�� � ��A����F�3�	
4�
	4r!N)r@rArBr�r�r�r�r�r�r�r�r�r"r!rr�r��s2��8�6B�0E�<;�8!"�F'�4�
0�&4r!r�c�r�eZdZd�Zd�Zd�Zejd�d��Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zy)
�BadElementTestc�,��G�fd�d�}|�g�tjd�}	|j��Gd�d|tj�}|d�g�tjd�}|j��y#t$rY�UwxYw)Nc�"��eZdZe�fd��Zy)�2BadElementTest.test_extend_mutable_list.<locals>.Xc�V��tjd�g�ddtjS)Nr�r:�r5�Ls �r�	__class__z<BadElementTest.test_extend_mutable_list.<locals>.X.__class__�	s"����
�
�5�)�*��!���z�z�!r!N�r@rArB�propertyr��r�s�r�Xr��	����
�
"��
"r!r�r�c��eZdZy)�2BadElementTest.test_extend_mutable_list.<locals>.YNr�r"r!r�Yr��	r�r!r�r��r=rzr�r�r5r�r�r�r�s    @r�test_extend_mutable_listz'BadElementTest.test_extend_mutable_list�	s����	"�	"�
�S�E���J�J�u���	�
�H�H�Q�K�	��2�:�:�	�
�s�V�H���J�J�u���	�������	��	�s�B�	B�Bc�|��G�fd�d�}|�tjd�g�tjd�}	|j��Gd�d|tj�}|d�tjd�g�tjd�}|j��y#t$rY�iwxYw)Nc�"��eZdZe�fd��Zy)�3BadElementTest.test_extend_mutable_list2.<locals>.Xc�.���dd�=tjSrSr:r�s �rr�z=BadElementTest.test_extend_mutable_list2.<locals>.X.__class__�	s����a�D��z�z�!r!Nr�r�s�rr�r��	r�r!r�r�r�c��eZdZy)�3BadElementTest.test_extend_mutable_list2.<locals>.YNr�r"r!rr�r��	r�r!r�r�r�r�s    @r�test_extend_mutable_list2z(BadElementTest.test_extend_mutable_list2�	s����	"�	"�
�S�"�*�*�U�#�$���J�J�u���	�
�H�H�Q�K�	��2�:�:�	�
�u�X�r�z�z�%�(�)���J�J�u���	�������	��	�s�B/�/	B;�:B;c���G�fd�dtj�}tjd���j|d�g�|jt�j
tjd��tjd���jtjd�g�|jt�j
|d��y)Nc���eZdZ�fd�Zy)�3BadElementTest.test_remove_with_mutating.<locals>.Xc����dd�=y)NFr")r5�or�s  �rrlz:BadElementTest.test_remove_with_mutating.<locals>.X.__eq__�	s
����a�D�r!Nrmr^s�rr�r��	s���
r!r�r�r�r�)r=rzr�r�r�r��r5r�r�s  @r�test_remove_with_mutatingz(BadElementTest.test_remove_with_mutating�	s����	��
�
�	�
�J�J�u���	���!�E�(������*�a�h�h��
�
�5�0A�B��J�J�u���	���"�*�*�U�#�$�%����*�a�h�h��%��9r!�c���tjd�}t|d|�5|jt�5t|�ddd�ddd�y#1swY�xYw#1swYyxYw)Nr�rU)r=rzrr��RuntimeErrorr�r,s  r�test_recursive_reprz"BadElementTest.test_recursive_repr�	sb��
�J�J�u���
�q�%��
#�	��"�"�<�0�
��Q��
�	�	�
�
��	�	�s"�A"�A�A"�A	�A"�"A+c�`��G�fd�dt�}tj�}|jdi�|j	d�|j	|d��|j	d�|jd�|j
��|j�jd�y)Nc���eZdZ�fd�Zy)�/BadElementTest.test_element_get_text.<locals>.Xc�>��	�jy#t$rYywxYwrS)rw�	NameErrorrfs �r�__del__z7BadElementTest.test_element_get_text.<locals>.X.__del__�	s!�����I�I�� ����s��	�N�r@rArBr��rLs�rr�r��	����
r!r�rU�ABCD�EFGH�IJKL�ABCDEFGHIJKL)	r�r=rr>r*r1rr{rw�r5r�r�rLs   @r�test_element_get_textz$BadElementTest.test_element_get_text�	s{���	��	�
�N�N���	����r��	���v��	���q��y��	���v��	���e���w�w�y��������N�3r!c���G�fd�dt�}tj�}|jdi�|jdi�|j	d�|jd�|j|d��|jd�|j	d�|j
��|j�djd	�y)
Nc���eZdZ�fd�Zy)�/BadElementTest.test_element_get_tail.<locals>.Xc�D��	�djy#t$rYywxYwr�)rvr�rfs �rr�z7BadElementTest.test_element_get_tail.<locals>.X.__del__

s%������G�L�L�� ����s��	�Nr�r�s�rr�r�	
r�r!r�r4rUr�r�r�rr�)	r�r=rr>r1r*rr{rvr�s   @r�test_element_get_tailz$BadElementTest.test_element_get_tail
s����	��	�
�N�N���	������	����r��	���e��	���v��	���q��y��	���v��	���f�
��w�w�y������a����~�6r!c���G�fd�d�}tjd���jtjd���d|��jtjd���dd|��y)Nc���eZdZ�fd�Zy)�%BadElementTest.test_subscr.<locals>.Xc����dd�=y�Nr�r"r,s �r�	__index__z/BadElementTest.test_subscr.<locals>.X.__index__
s
����a�D�r!N�r@rArBrr^s�rr�r
����
r!r�rLr�rr�)r=rzr�r�s  @r�test_subscrzBadElementTest.test_subscr
sa���	�	�

�J�J�v���	������G�$�%�	�$�1�3��	������G�$�%�	�!�B�q�s�(�r!c����G�fd�d�}tjd��td�D]'}�jdtjd���)g�dd|��<y)Nc���eZdZ�fd�Zy)�)BadElementTest.test_ass_subscr.<locals>.Xc���g�ddyrr"r,s �rrz3BadElementTest.test_ass_subscr.<locals>.X.__index__-
s�����!��r!Nrr^s�rr�r,
rr!r�rLr�rr�)r=rzr�r�)r5r�r,r�s   @r�test_ass_subscrzBadElementTest.test_ass_subscr*
sZ���	�	�

�J�J�v����r��	-�A�
�H�H�Q��
�
�7�+�,�	-���!�B�q�s�(�r!c���d�}tj|��}|jdi�|jd�|j	t
|jdi�~t
�y)Nc��gSrSr"�r�r�s  r�element_factoryz>BadElementTest.test_treebuilder_start.<locals>.element_factory9
����Ir!�rrUr�r�)r=rr>r*r��AttributeErrorr
�r5rr�s   r�test_treebuilder_startz%BadElementTest.test_treebuilder_start7
sP��	��N�N�?�N�;��	����r��	���v�����.�!�'�'�6�2�>�
��r!c���d�}tj|��}|jdi�|jd�|j	t
|jd�~t�y)Nc��gSrSr"rs  rrz<BadElementTest.test_treebuilder_end.<locals>.element_factoryE
rr!rrUr�)r=rr>r*r�rr1r
rs   r�test_treebuilder_endz#BadElementTest.test_treebuilder_endC
sN��	��N�N�?�N�;��	����r��	���v�����.�!�%�%��7�
��r!N)r@rArBr�r�r�r�infinite_recursionr�r�r�rr
rrr"r!rr�r��	sP���&�&:� �W����#��$��4�&7�*��
�
r!r�c��eZdZd�Zd�Zy)�MutatingElementPathc�@�tj|g|���}||_|SrS)r��__new__rL)r_rLrr5s    rrzMutatingElementPath.__new__Q
s!���{�{�3�&��&����	��r!c�"�|jdd�=yr�r��r5r�s  rrlzMutatingElementPath.__eq__U
s���I�I�a�L�r!N)r@rArBrrlr"r!rrrP
s���r!rc��eZdZd�Zy)�BadElementPathc��ddz�)Nr�rr"r s  rrlzBadElementPath.__eq__[
s����c�	r!Nrmr"r!rr"r"Z
s��r!r"c�X��eZdZ�fd�Z�fd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Z�xZ
S)�BadElementPathTestc�^��t�|��ddlm}|j|_i|_y�Nrr2)�super�setUpr4r3r��
path_cache�r5r3r�s  �rr)zBadElementPathTest.setUp`
s$���
��
��)�%�,�,�����r!c�P��ddlm}|j|_t�|��yr')r4r3r*r�r(�tearDownr+s  �rr-zBadElementPathTest.tearDownf
s���)�!�_�_���
���r!c��tjd�}|jtjd�g�|jt	|d��y�Nr�r�r�)r=rzr�r�rr,s  r�test_find_with_mutatingz*BadElementPathTest.test_find_with_mutatingk
s<���J�J�u���	���"�*�*�U�#�$�%�	���"�1�c�*�+r!c���tjd�}|jtjd�g�	|jt	d��y#t
$rYywxYwr/)r=rzr�r�r"�ZeroDivisionErrorr,s  r�test_find_with_errorz'BadElementPathTest.test_find_with_errorp
sP���J�J�u���	���"�*�*�U�#�$�%�	�
�F�F�>�#�&�'�� �	��	���A�	A#�"A#c��tjd�}|jtjd�g�|jt	|d��yr/)r=rzr�r�rr,s  r�test_findtext_with_mutatingz.BadElementPathTest.test_findtext_with_mutatingx
s<���J�J�u���	���"�*�*�U�#�$�%�	�
�
�&�q�#�.�/r!c���tjd�}|jtjd�g�	|jt	d��y#t
$rYywxYwr/)r=rzr�r�r"r2r,s  r�test_findtext_with_errorz+BadElementPathTest.test_findtext_with_error}
sP���J�J�u���	���"�*�*�U�#�$�%�	�
�J�J�~�c�*�+�� �	��	�r4c���tjd�}tj|d�}dddgdig}|D]*}||_|j	|jd�|��,y)Nr�r�rErFr"�./bar�r=rzrdrwr{r�)r5�	root_elem�sub_elem�falsey�vals     r�(test_findtext_with_falsey_text_attributez;BadElementPathTest.test_findtext_with_falsey_text_attribute�
sc���J�J�u�%�	��=�=��E�2���a���B��+���	?�C��H�M����Y�/�/��8�#�>�	?r!c��tjd�}tj|d�}d|_|j	|jd�d�y)Nr�r�r:rEr;)r5r<r=s   r�&test_findtext_with_none_text_attributez9BadElementPathTest.test_findtext_with_none_text_attribute�
sB���J�J�u�%�	��=�=��E�2����
�����+�+�G�4�b�9r!c��tjd�}|jtjd�g�|jt	|d��yr/)r=rzr�r�rr,s  r�test_findall_with_mutatingz-BadElementPathTest.test_findall_with_mutating�
s<���J�J�u���	���"�*�*�U�#�$�%�	�	�	�%�a��-�.r!c���tjd�}|jtjd�g�	|jt	d��y#t
$rYywxYwr/)r=rzr�r�r"r2r,s  r�test_findall_with_errorz*BadElementPathTest.test_findall_with_error�
sP���J�J�u���	���"�*�*�U�#�$�%�	�
�I�I�n�S�)�*�� �	��	�r4)r@rArBr)r-r0r3r6r8r@rBrDrF�
__classcell__)r�s@rr%r%_
s5��� ��
,�
�0�
�?�:�/�
r!r%c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�ElementTreeTypeTestc��|jtjt�|jtjt�|jtj
t�|jtjt�|jtjt�|jtjt�yrS)	ryr=rXrer<r/rzrrr�s r�test_istypezElementTreeTypeTest.test_istype�
sz�����b�m�m�T�2����b�h�h��-����b�n�n�d�3����b�j�j�$�/����b�n�n�d�3����b�l�l�D�1r!c�(�Gd�dtj�}|d�}|j|tj�|j||�|j|jd�d|_|j|j
d�y)Nc��eZdZy)�DElementTreeTypeTest.test_Element_subclass_trivial.<locals>.MyElementNr�r"r!r�	MyElementrN�
r�r!rOr�r�)r=rzryr{rUrw�r5rO�myes   r�test_Element_subclass_trivialz1ElementTreeTypeTest.test_Element_subclass_trivial�
ss��	��
�
�	��������c�2�:�:�.����c�9�-�������%�(����������5�)r!c����G�fd�dtj���dddd�dd�	�}|j|jd
�|jt	|j��gd��y)Nc�&���eZdZif��fd�	Z�xZS)�HElementTreeTypeTest.test_Element_subclass_constructor.<locals>.MyElementc�.��t�|�|dz|fi|��y)N�__)r(r�)r5rUrx�extrarOr�s    ��rr�zQElementTreeTypeTest.test_Element_subclass_constructor.<locals>.MyElement.__init__�
s����i��/��d�
�F�L�e�Lr!)r@rArBr�rG)r�rOs@�rrOrU�
s���+-�
M�
Mr!rOr�r�r�)r�r�r��)r�r��foo__))r�r�)r�r�)r�r�)r�rY)r=rzr{rUrr�)r5rQrOs  @r�!test_Element_subclass_constructorz5ElementTreeTypeTest.test_Element_subclass_constructor�
s^���	M��
�
�	M���Q�Q�/�1��:��������'�*������	�	��,�4�	6r!c��Gd�dtj�}|d�}|j|j�d�y)Nc��eZdZd�Zy)�GElementTreeTypeTest.test_Element_subclass_new_method.<locals>.MyElementc��|jSrSrTr�s r�	newmethodzQElementTreeTypeTest.test_Element_subclass_new_method.<locals>.MyElement.newmethod�
s���x�x�r!N)r@rArBr`r"r!rrOr^�
s��
 r!rOr�)r=rzr{r`rPs   r� test_Element_subclass_new_methodz4ElementTreeTypeTest.test_Element_subclass_new_method�
s4��	 ��
�
�	 ������������%�0r!c���Gd�dtj�}tjd�}d|_|d�}d|_|j|�|j	|jd�d�|j	|j
d�jd�t|jd��}|j	t|�d|�|j	|djd�y)	Nc��eZdZy)�AElementTreeTypeTest.test_Element_subclass_find.<locals>.MyElementNr�r"r!rrOrd�
r�r!rOr�rwr�rbr�r)r=rzrwr�r{r�r�rUr}r�r|)r5rOr��sub�founds     r�test_Element_subclass_findz.ElementTreeTypeTest.test_Element_subclass_find�
s���	��
�
�	�
�J�J�u�������������	����
�������E�*�I�6���������*�*�E�2��Q�Y�Y�u�%�&������U��Q��.�����q����u�-r!N)r@rArBrKrRr[rargr"r!rrIrI�
s��2�*�6�1�
.r!rIc�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�ElementFindTestc��tjt�}|j|j	d�j
d�|j|j	d�j
d�|j|j	d�j
d�tjt�|d<|j|j	d�j
d�|j|jd�d�|j|jd�d�|j|jd�d	�|j|jdd
�d	�|j|jd��|j|jdd
�d
�|jtjd�jd
�d	�y)NrUr��./tagr�zsection/nexttag�nexttagrwrbrEr��togz<tag><empty /></tag>�empty)	r=r�r�r{r�rU�SAMPLE_SECTIONr�r�r,s  r�test_find_simplez ElementFindTest.test_find_simple�
sb���F�F�:�����������*�*�E�2�������
�.�2�2�E�:���������,�,�e�4��v�v�n�%��!�������� 1�2�6�6�	�B�������G�,�f�5�������M�2�I�>�	
������$5�6��;�������$5�y�A�2�F�	
���!�*�*�U�+�,�������E�9�5�y�A�	
������ 6�7�@�@��I�2�Nr!c��d}tj|�}|j|jd�jdd�|j|jd�jdd�|j|jd�jdd�|j|jd	�jdd
�|j|jd�jdd�|jtd|jd
�|jtd|jd�|jtd|jd�|jtd|jd�y)Nz�
        <body>
            <tag class='a'/>
            <tag class='b'/>
            <tag class='c'/>
            <tag class='d'/>
        </body>z./tag[1]�classr�z./tag[2]r�z
./tag[last()]r�z./tag[last()-1]r�z./tag[last()-2]�XPathz./tag[0]z	./tag[-1]z./tag[last()-0]z./tag[last()+1])r=r�r{r�rxr��SyntaxError)r5�
LINEAR_XMLr�s   r�test_find_xpathzElementFindTest.test_find_xpath�
s3���
�
�F�F�:���	
������
�+�2�2�7�;�S�A�������
�+�2�2�7�;�S�A��������0�7�7��@�#�F������� 1�2�9�9�'�B�C�H������� 1�2�9�9�'�B�C�H����{�G�Q�V�V�Z�H����{�G�Q�V�V�[�I����{�G�Q�V�V�=N�O����{�G�Q�V�V�=N�Or!c��tjt�}tjt�|d<|j	t|j
d��dg�|j	t|j
d��ddg�|j	t|j
d��g�|j	t|j
d��g�|j	t|j
d��gd��|j	t|j
d	��dgd
z�|j	t|j
d��dg�|j	t|j
d��dgdz�|j	t|j
d
��gd��|j	t|j
d��gd��|j	t|j
d��gd��|j	t|j
d��gd��|j	t|j
d��gd��|j	t|j
d��dg�|j	t|j
d��dg�|j	t|j
d��dgdz�|j	t|j
d��dgdz�|j	t|j
d��dgdz�|j	t|j
d��dg�|j	t|j
d��dgdz�|j	t|j
d��dgdz�|j	t|j
d��dg�|j	t|j
d��dg�|j	t|j
d��d g�|j	t|j
d!��g�|j	t|j
d"��g�|j	t|j
d#��dgdz�|j	|j
d$�|j
d��|j	t|j
d%��d g�|j	t|j
d&��d g�|j	t|j
d'��d g�|j	t|j
d(��d g�|j	t|j
d)��d g�|j	t|j
d*��g�|j	t|j
d+��g�|j	t|j
d,��g�|j	t|j
d-��g�|j	t|j
d.��g�|j	t|j
d/��dg�|j	t|j
d0��dg�|j	t|j
d1��dg�|j	t|j
d2��dg�|j	t|j
d3��dg�|j	t|j
d4��g�|j	t|j
d5��g�|j	t|j
d6��dgdz�|j	t|j
d7��dgdz�|j	t|j
d8��dgdz�|j	t|j
d9��dgdz�|j	t|j
d:��dgdz�|j	t|j
d;��dgd
z�|j	t|j
d<��dgd
z�|d|d=<|j	t|j
d(��d d g�|j	t|j
d3��ddg�y)>Nr�rWr&rUrmztog/foor�rQz.//tagrYr�zsection//tagz	section/*)rUrl�nextsectionz
section//*)rUrlrxrUzsection/.//*z*/*z*//*z*/tagz*/./tagrkz././tagz.//tag[@class]r�z.//tag[@class="a"]z.//tag[@class!="a"]z.//tag[@class="b"]z.//tag[@class!="b"]z.//tag[@id]z.//section[tag]rRz.//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.//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']z.//tag[.!='subtext']z.//tag[. !='subtext']z.//tag[.!= "subtext"]z.//tag[ . != "subtext" ]z.//tag[. != 'subtext']z.//tag[. != 'subtext ']z.//tag[.!= ' subtext']r�)r=r�r�ror{rWr�r,s  r�test_findallzElementFindTest.test_findalls����F�F�:����v�v�n�%��!�������	�	�#��7�&��B������	�	�%�(8�9�E�5�>�J������	�	�%�(8�9�2�>������	�	�)�(<�=�r�B������	�	�#��7�%�	'������	�	�(�(;�<�
�G�a�K�	������	�	�-�(@�A�E�7�K������	�	�.�(A�B�U�G�a�K�P������	�	�+�(>�?�-�	/������	�	�,�(?�@�4�	6������	�	�.�(A�B�4�	6������	�	�%�(8�9�-�	/������	�	�&�(9�:�4�	6������	�	�'�(:�;�e�W�E������	�	�)�(<�=��w�G������	�	�'�(:�;�e�W�q�[�I������	�	�)�(<�=��w��{�K������	�	�2B�(C�D�
�G�a�K�	������	�	�2F�(G�H�
�G�	������	�	�2G�(H�I�
�G�a�K�	������	�	�2F�(G�H�
�G�a�K�	������	�	�2G�(H�I�
�G�	������	�	�-�(@�A�
�G�	������	�	�2C�(D�E�
�K�	������	�	�2G�(H�I�2�N������	�	�(�(;�<�b�A������	�	�2B�(C�D�
�G�a�K�	�������;�/����<�1H�I������	�	�2M�(N�O�
�K�	������	�	�2N�(O�P�
�K�	������	�	�2N�(O�P�
�K�	������	�	�2O�(P�Q�
�K�	������	�	�2Q�(R�S�
�K�	�
	
�����	�	�2N�(O�P��	������	�	�2O�(P�Q��	������	�	�2O�(P�Q��	������	�	�2P�(Q�R��	������	�	�2R�(S�T��	�	
�����	�	�2G�(H�I���	"������	�	�2H�(I�J���	"������	�	�2H�(I�J���	"������	�	�2K�(L�M���	"������	�	�2I�(J�K���	"������	�	�2J�(K�L��	������	�	�2I�(J�K��	�
	
�����	�	�2H�(I�J���1��	&������	�	�2I�(J�K���1��	&������	�	�2I�(J�K���1��	&������	�	�2L�(M�N���1��	&������	�	�2J�(K�L���1��	&�	
�����	�	�2K�(L�M���1��	&������	�	�2J�(K�L���1��	&���t��!�������	�	�2O�(P�Q�#�Y�/�	1������	�	�2I�(J�K����	)r!c�B�tjt�}|jt	|jd��g�|jt	|jd��dgdz�|jt	|jd��dgdz�y)NrUz{http://effbot.org/ns}tagr�z.//{http://effbot.org/ns}tagr�)r=r�r7r{rWr�r,s  r�test_test_find_with_nsz&ElementFindTest.test_test_find_with_nsws����F�F�=�!�������	�	�%�(8�9�2�>�����1�9�9�%@�A�B�
(�)�A�-�	/�	
����1�9�9�%C�D�E�
(�)�A�-�	/r!c�X�tjd�}ddi}|jt|j	d|���d�|jt|j	d|���d�ddi}|jt|j	d|���d	�|jt|j	d|���d�ddd
�}|jt|j	d|���d�|jt|j	d|���d	�y)N��
            <a xmlns:x="X" xmlns:y="Y">
                <x:b><c/></x:b>
                <b/>
                <c><x:b/><b/></c><y:b/>
            </a>�xxr�z.//xx:b)rEr��.//br�r�)r~rE)r=r�r{r|r�)r5r4�nsmaps   r�test_findall_different_nsmapsz-ElementFindTest.test_findall_different_nsmaps�s����v�v�����s�������T�\�\�)��\�F�G��K�����T�\�\�&�U�\�C�D�a�H��s�������T�\�\�)��\�F�G��K�����T�\�\�&�U�\�C�D�a�H���$������T�\�\�)��\�F�G��K�����T�\�\�&�U�\�C�D�a�Hr!c�~�tjd�}|jtjd��|j	t|j
d��gd��|j	t|j
d��dg�|j	t|j
d��dg�|j	t|j
d	��d
g�|j	t|j
d��ddg�|j	t|j
d
��dg�|j	t|j
d
��t|j
d���|j	t|j
d��gd��|j	t|j
d�|dgz�t|j
d���|j	t|j
d��gd��|j	t|j
d��ddg�|j	t|j
d��ddg�|j	t|j
d��d
g�|j	t|j
d��gd��|j	t|j
d��ddg�|j	t|j
d��t|j
d���y)Nr}rz{*}b)�{X}br��{Y}bz{*}cr�z{X}*r�z{Y}*r�r`r�z{}brb)r�r�r�r�r�r�z.//{*}b)r�r�r�r�r�z.//{*}cz.//{X}*z.//{Y}*z.//{}*)r�r�r�r�z.//{}br)r=r�r�rer{rWr�r�s  r�test_findall_wildcardz%ElementFindTest.test_findall_wildcard�s����v�v����	
���B�J�J�v�&�'��������V�(<�=�.�	0��������V�(<�=���	 ��������V�(<�=� ��	#��������V�(<�=� ��	#��������U�(;�<��s��	%��������U�(;�<���	 ��������U�(;�<�'����S�(9�:�	<��������V�(<�=�3�	5�	
�������V�(<��R��z�(I�J�'����S�(9�:�	<�	
�������Y�(?�@�;�	=��������Y�(?�@��s��	%��������Y�(?�@� �&�)�	+��������Y�(?�@� ��	#��������X�(>�?�-�	/��������X�(>�?��s��	%��������X�(>�?�'����V�(<�=�	?r!c��tjt�}|jtd�5|jd�ddd�y#1swYyxYw)Nzcannot use absolute pathz/tag)r=r�r�r�rtr�r,s  r�
test_bad_findzElementFindTest.test_bad_find�sB���F�F�:���
�
#�
#�K�1K�
L�	�
�I�I�f��	�	�	�s�A�Ac�|�tjt�}|jtj	|�jd�jd�|jtj	|�jd�d�|jttj	|�jd��dgdz�d}|jt|�5tj	|�jd�}ddd�|jt�dgdz�y#1swY�)xYw)NrUrwr�z�This 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//tagr�)r=r�r�r{r/r�rUr�rWr��assertWarnsRegex�
FutureWarning)r5r�r�r�s    r�test_find_through_ElementTreez-ElementFindTest.test_find_through_ElementTree�s����F�F�:����������*�/�/��6�:�:�E�B��������*�3�3�E�:�F�C��������q�(9�(A�(A�%�(H�I�
�G�a�K�	�#���
"�
"�=�#�
6�	4�����"�*�*�7�3�B�	4������+�e�W�q�[�9�	4�	4�s�%%D2�2D;N)r@rArBrprvryr{r�r�r�r�r"r!rriri�
s0��O�.P�,n)�`/�I�"*?�X�
:r!ric�2�eZdZdd�Zd�Zd�Zd�Zd�Zd�Zy)	�ElementIterTestNc�6�t|j|��SrS)rWr�)r5rLrUs   r�_ilistzElementIterTest._ilist�s���d�i�i��n�-�-r!c��tjd�}|j|j|�gd��|j|j|j	d��ddg�|jt|j
��jd�|jdj|j��d�|jdj|j	d�j��d�|jt|j��d	�t|d
��}|jttj|��dd
�t|d
��}tjtj���}|jttj||���dd
�tjd�}|jt |j�tjd�}|jdj|j��d�y)Nz7<html><body>this is a <i>paragraph</i>.</body>..</html>)r+r&r�r&r�r+rEzthis is a paragraph...zthis is a paragraph.z
this is a F)rMrr1r)r z*<root>a&amp;<sub>b&amp;</sub>c&amp;</root>za&b&c&)r=r�r{r�r�rTr�rUr(r�rQrSrrr/r�r)r5rO�
sourcefiler rPs     r�
test_basiczElementIterTest.test_basic�s����f�f�N�O��������S�)�+@�A�������S�X�X�f�%5�6���
�F�����c�h�h�j�)�-�-�v�6�����������0�2J�K����������&�!1�!:�!:�!<�=�"�	$�����c�l�l�n�-�|�<��s�e�4�
�����b�l�l�:�6�7��:�E�B��s�e�4�
����R�^�^�%5��6������b�l�l�:�f�l�E�F�q�I��	 ��~�~�d�#�����.�$�)�)�4��f�f�A�B������������0�(�;r!c�$�tjd�}|j|j|�dg�tj	|d�}|j|j|�ddg�tj	|d�}|j|j|�gd��tj	|d�}|j|j|�gd��|d|d<|d=|j|j|�ddg�y)	Nr�r�r�)r�r�r�r�)r�r�r�r�r�r)r=rzr{r�rdrGs     r�test_cornerszElementIterTest.test_corners�s����J�J�s�O��������Q��#��/�
�M�M�!�S�!��������Q��#�s��4�
�M�M�!�S�!��������Q���9�
�M�M�!�S�!��������Q��)=�>���t��!��
�a�D�������Q��#�s��4r!c��tjd�}|j|j|d�dgdz�|j|j|d�dgdz�|jt	|jd���dgdz�gd�}|jt	|j��|�|j|j|�|�|j|j|d�|�y)	NaJ
            <document>
                <house>
                    <room>bedroom1</room>
                    <room>bedroom2</room>
                </house>
                <shed>nothing here
                </shed>
                <house>
                    <room>bedroom8</room>
                </house>
            </document>�roomr��houser�rT)rPr�r�r��shedr�r�r�)r=r�r{r�rWr�)r5rO�all_tagss   r�test_iter_by_tagz ElementIterTest.test_iter_by_tags����f�f����	
������S�&�1�F�8�a�<�@�������S�'�2�W�I��M�B�	
����3�8�8��8�/�0�
�H�q�L�	�
-���������
�3�X�>�������S�)�8�4�������S�#�.��9r!c���tjd�}|j�}|jt�5tj
|�ddd�y#1swYyxYw)Nr�)r=rzr�r�rr�)r5r�r�s   rr�zElementIterTest.test_copy$sH���J�J�s�O��
�V�V�X��
�
�
�y�
)�	��I�I�b�M�	�	�	�s�A�A#c�0�tjd�}|j�}ttj
dz�D]F}|j
ttjf�5t	j||�ddd��Hy#1swY�SxYw)Nr�r�)
r=rzr�r�rdr�r�rrgre)r5r�r�ros    rr�zElementIterTest.test_pickle*sz���J�J�s�O��
�V�V�X���6�2�2�Q�6�7�	(�E��"�"�I�v�/C�/C�#D�E�
(����R��'�
(�
(�	(�
(�
(�s�*B�B	rS)	r@rArBr�r�r�r�r�r�r"r!rr�r��s ��.�<�65�,:�:�(r!r�c�n�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�TreeBuilderTestz�<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>text<div>subtext</div>tail</html>z<toplevel>sometext</toplevel>c��|j|jd�|j|jd�|j|jd�|j|ji�t|�}|jt
|�d�|d}|j|jd�|j|jd�|j|jd�|j|ji�y)Nr+rwr�r�divrbrv)r{rUrwrvrxr}r|)r5r��childrenr�s    r�_check_sample1_elementz&TreeBuilderTest._check_sample1_element:s����������'��������(��������&�������2�&���7������X���*�����������E�*�������Y�/�������V�,�������r�*r!c�6�Gd�d�}Gd�d|�}tj|���}|j|j�|j	|j�d�tj|���}|j|j�|j	|j�d�tjt
���}|j|j�|j|j��y)Nc��eZdZd�Zy)�<TreeBuilderTest.test_dummy_builder.<locals>.BaseDummyBuilderc��y)Nr�r"r�s rrzBTreeBuilderTest.test_dummy_builder.<locals>.BaseDummyBuilder.closeIs��r!Nr;r"r!r�BaseDummyBuilderr�Hs��
r!r�c��eZdZd�xZxZZy)�8TreeBuilderTest.test_dummy_builder.<locals>.DummyBuilderc��yrSr")r�s r�<lambda>zATreeBuilderTest.test_dummy_builder.<locals>.DummyBuilder.<lambda>M��r!N)r@rArBr*r>r1r"r!r�DummyBuilderr�Ls��!0�0�D�0�5�3r!r�rr�)r=rr�sample1r{r�objectr�)r5r�r�r s    r�test_dummy_builderz"TreeBuilderTest.test_dummy_builderGs���	�	�	1�+�	1����\�^��4�����D�L�L�!���������,����%5�%7��8�����D�L�L�!���������,����V�X��.�����D�L�L�!����&�,�,�.�)r!c��tj�}|j|jd�jtj
�|j|jd�jd�tjtj
��}|j|jd�jtj
�|j|jd�jd�tjt��}|j|jd�td��y)N�ctext)�comment_factory)r=rr{rcrUrerwr|�r5r�s  r�test_treebuilder_commentz(TreeBuilderTest.test_treebuilder_comment[s����N�N���������7�+�/�/����<�������7�+�0�0�'�:��N�N�2�:�:�N�6��������7�+�/�/����<�������7�+�0�0�'�:��N�N�3�N�/��������7�+�S��\�:r!c��tj�}|j|jdd�jtj
�|j|jdd�jd�tjtj
��}|j|jd�jtj
�|j|jd�jd�|j|jdd�jtj
�|j|jdd�jd�tjd���}|j|jd�td�df�|j|jdd�td�df�y)Nr)�
pi_factoryr�z text zpitarget  text c��t|�|fSrS)r|)rrws  rr�z5TreeBuilderTest.test_treebuilder_pi.<locals>.<lambda>rs��C��K��;N�r!)r=rr{r}rUr�rwr|r�s  r�test_treebuilder_piz#TreeBuilderTest.test_treebuilder_pigsE���N�N���������h��-�1�1�2�5�5�9�������h��-�2�2�H�=��N�N�b�e�e�N�,��������h��+�+�R�U�U�3�������h��,�,�h�7�������j�(�3�7�7����?�������j�(�3�8�8�:K�L��N�N�&N�N�O��������h��#�h�-��)>�?�������j�(�3�c�*�o�x�5P�Qr!c�f�Gd�dtj�}d}tj|�}|j|jd�tj|���}|j
|�|j�}|j|jd�d}tj|�}|j|jd�d}tj|���}|j
|�|j�}|j|jd�y)Nc��eZdZy)�;TreeBuilderTest.test_late_tail.<locals>.TreeBuilderSubclassNr�r"r!r�TreeBuilderSubclassr�xr�r!r�z<a>text<!-- comment -->tail</a>�texttailrz<a>text<?pi data?>tail</a>)r=rr�r{rwrrr)r5r�r�r�r s     r�test_late_tailzTreeBuilderTest.test_late_tailvs���	�"�.�.�	�0���M�M�#����������,����%8�%:��;�����C���L�L�N���������,�*���M�M�#����������,�*�����%8�%:��;�����C���L�L�N���������,r!c�2�Gd�dtj�}d}tjtjd����}|j|�|j	�}|j|djd�|j|djd	�|j|jd
�tj|d����}|j|�|j	�}|j|djd�|j|djd	�|j|jd
�d}tjtjd����}|j|�|j	�}|j|djd
�|j|djd�|j|jd�tj|d����}|j|�|j	�}|j|djd
�|j|djd�|j|jd�y)Nc��eZdZy)�KTreeBuilderTest.test_late_tail_mix_pi_comments.<locals>.TreeBuilderSubclassNr�r"r!rr�r��r�r!r�z/<a>text<?pi1?> <!-- comment -->
<?pi2?>tail</a>T)�insert_commentsrrr�z
tailztext z+<a>text<!-- comment -->
<?pi data?>tail</a>)�
insert_piszpi datarvztext
)r=rrrrr{rwrv)r5r�r�r r�s     r�test_late_tail_mix_pi_commentsz.TreeBuilderTest.test_late_tail_mix_pi_comments�s���	�"�.�.�	�A�����R�^�^�D�^�%I��J�����C���L�L�N������1����K�0�����1����H�-��������)����%8��%N��O�����C���L�L�N������1����K�0�����1����H�-��������)�<�����R�^�^�t�^�%D��E�����C���L�L�N������1����I�.�����1����F�+��������*����%8�D�%I��J�����C���L�L�N������1����I�.�����1����F�+��������*r!c���tjtjd����}|j|j�|j�}|j
|�y�Nrr)r=rrrr�rr��r5r r�s   r�$test_treebuilder_elementfactory_nonez4TreeBuilderTest.test_treebuilder_elementfactory_none�sF�����R�^�^�D�^�%I��J�����D�L�L�!��L�L�N���#�#�A�&r!c�*�Gd�dtj�}|�}|j|jd�d�tj	|��}|j|j�|j�}|j|�y)Nc��eZdZd�Zy)�4TreeBuilderTest.test_subclass.<locals>.MyTreeBuilderc��|dzS�Nr�r"r"s  rr�z;TreeBuilderTest.test_subclass.<locals>.MyTreeBuilder.foobar�����1�u�r!N�r@rArBr�r"r!r�
MyTreeBuilderr�����
r!r�r�r�r)	r=rr{r�rrr�rr��r5r��tbr r�s     r�
test_subclasszTreeBuilderTest.test_subclass�sl��	�B�N�N�	��_��������2���+����R��(�����D�L�L�!��L�L�N���#�#�A�&r!c��Gd�dtj�}|tjtj��}|j	|jd�d�tj
|��}|j|j�|jd�|j�}|j|�y)Nc��eZdZd�Zy)�?TreeBuilderTest.test_subclass_comment_pi.<locals>.MyTreeBuilderc��|dzSr�r"r"s  rr�zFTreeBuilderTest.test_subclass_comment_pi.<locals>.MyTreeBuilder.foobar�r�r!Nr�r"r!rr�r��r�r!r�)r�r�r�r�rz<!-- a comment--><?and a pi?>)r=rrer�r{r�rrr�rr�r�s     r�test_subclass_comment_piz(TreeBuilderTest.test_subclass_comment_pi�s���	�B�N�N�	��2�:�:�"�%�%�
H��������2���+����R��(�����D�L�L�!����3�4��L�L�N���#�#�A�&r!c����g��fd�}tj|��}tj|��}|j|j�|j�|j
�dg�y)Nc�R���j|�tj||�SrS)r�r=rz)rUrx�lsts  �r�	myfactoryz7TreeBuilderTest.test_element_factory.<locals>.myfactory�s����J�J�s�O��:�:�c�6�*�*r!rr�toplevel)r=rrr�sample2rr{)r5r�r�r r�s    @r�test_element_factoryz$TreeBuilderTest.test_element_factory�sZ�����	+�
�^�^�I�^�
6�����R��(�����D�L�L�!���������z�l�+r!c��tj|��}tj|��}|j|j�|j�}|j
||�|j|�yr�)r=rrrr�rryr�)r5r_r�r r�s     r�_check_element_factory_classz,TreeBuilderTest._check_element_factory_class�s[��
�^�^�C�^�
0�����R��(�����D�L�L�!��L�L�N�����a��%��#�#�A�&r!c�X�Gd�dtj�}|j|�y)Nc��eZdZy)�@TreeBuilderTest.test_element_factory_subclass.<locals>.MyElementNr�r"r!rrOr��r�r!rO)r=rzr�)r5rOs  r�test_element_factory_subclassz-TreeBuilderTest.test_element_factory_subclass�s ��	��
�
�	��)�)�)�4r!c��tj}|j|jd�Gd�d|t�}|j|�y)Nr8c��eZdZy)�LTreeBuilderTest.test_element_factory_pure_python_subclass.<locals>.MyElementNr�r"r!rrOr��r�r!rO)r=�_Element_Pyr{rAr�r�)r5�baserOs   r�)test_element_factory_pure_python_subclassz9TreeBuilderTest.test_element_factory_pure_python_subclass�s>���~�~��������*A�B�	��j�	��)�)�)�4r!c���Gd�d�}tj|���}|j|j�|j	|j�d�y)Nc��eZdZdZd�Zd�Zy)�3TreeBuilderTest.test_doctype.<locals>.DoctypeParserNc��|||f|_yrS��_doctype)r5rl�pubid�systems    r�doctypez;TreeBuilderTest.test_doctype.<locals>.DoctypeParser.doctype
s��!%�u�f� 5��
r!c��|jSrSr�r�s rrz9TreeBuilderTest.test_doctype.<locals>.DoctypeParser.close
s���}�}�$r!)r@rArBr�r�rr"r!r�
DoctypeParserr��s���H�
6�
%r!r�r�r+z&-//W3C//DTD XHTML 1.0 Transitional//ENz7http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)r=rrr�r{r)r5r�r s   r�test_doctypezTreeBuilderTest.test_doctype�sM��	%�	%����]�_��5�����D�L�L�!��������
H�	Ir!c���Gd�d�}tj|���dD]=}|jt|�5tj||���ddd��?tj|t����dD]^}tj||t����}|j|j�|j|j���`y#1swY��xYw)Nc��eZdZdefd�Zd�Zy)�BTreeBuilderTest.test_builder_lookup_errors.<locals>.RaisingBuilderNc� �||_||_yrS��raise_in�what)r5rrs   rr�zKTreeBuilderTest.test_builder_lookup_errors.<locals>.RaisingBuilder.__init__
s�� (��
� ��	r!c�`�||jk(r|j|j��d�}|S)Nc��yrSr")rs r�handlez^TreeBuilderTest.test_builder_lookup_errors.<locals>.RaisingBuilder.__getattr__.<locals>.handle
s��r!r�)r5rlrs   r�__getattr__zNTreeBuilderTest.test_builder_lookup_errors.<locals>.RaisingBuilder.__getattr__
s+���4�=�=�(��)�)�D�M�M�2�2���
r!)r@rArBr�r�rr"r!r�RaisingBuilderr�
s��(,�:�
!�
r!rr)r>r*r1rcr})r)	r=rr�r�rrr�r�r)r5rr�r s    r�test_builder_lookup_errorsz*TreeBuilderTest.test_builder_lookup_errors
s���
	�
	�	���N�,��-�>�	;�E��'�'�
�E�:�
;����N�5�$9��:�
;�
;�	;�	���N��?��@�>�	.�E��\�\���N�)S�\�T�F��K�K����%����f�l�l�n�-�	.�	
;�
;�s�C-�-C6	N)r@rArBr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr"r!rr�r�2s^��2�G�
2�G�+�*�(
;�
R�-�0"+�H'�'�
'�,�'�5�
5�I�".r!r�c�B�eZdZdZdZdZd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�
XMLParserTests<file><line>22</line></file>s�<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>text</html>uX<?xml version="1.0" encoding="iso-8859-1"?>
<money value="$£€𐅻">$£€𐅻</money>c��|j|jd�|j|djd�|j|djd�y)NrOr�line�22)r{rUrwr,s  r�_check_sample_elementz#XMLParserTest._check_sample_element2
sF���������'�����1����6�*�����1����D�)r!c���tjdtj���}|j|j�|j|j
��y)Nr)rEr)r=rrrr�r
r)r5r�s  r�test_constructor_argsz#XMLParserTest.test_constructor_args7
sE���,�,��&(�n�n�&6��8�����T�\�\�"��"�"�7�=�=�?�3r!c��Gd�dtj�}|�}|j|j�|j	|j��y)Nc��eZdZy)�-XMLParserTest.test_subclass.<locals>.MyParserNr�r"r!r�MyParserr>
r�r!r)r=rrr�r
r)r5rr s   rr�zXMLParserTest.test_subclass=
s=��	�r�|�|�	�������D�L�L�!��"�"�6�<�<�>�2r!c��tj�5tjdt�tj�}|j
|j�|j�ddd�y#1swYyxYw)N�error)	�warnings�catch_warnings�simplefilter�DeprecationWarningr=rrr�rr�s  r�test_doctype_warningz"XMLParserTest.test_doctype_warningD
sX��
�
$�
$�
&�	��!�!�'�+=�>��\�\�^�F��K�K����%��L�L�N�		�	�	�s�AA8�8Bc����d�G�fd�dtj�}|�}|jtd�5|j	|j
�ddd�|j
�|j��dx��tj�5tjdt�tjdt�G�fd�d�}||���}|j	|j
�|j
�|j��|j�d�ddd�y#1swY��xYw#1swYyxYw)	Nc���eZdZ�fd�Zy)�@XMLParserTest.test_subclass_doctype.<locals>.MyParserWithDoctypec���||f�yrSr")r5rrr�s   �rr�zHXMLParserTest.test_subclass_doctype.<locals>.MyParserWithDoctype.doctypeN
s��� �&�>�r!N�r@rArBr�r�s�r�MyParserWithDoctyperM
s���
*r!r r�rc���eZdZ�fd�Zy)�:XMLParserTest.test_subclass_doctype.<locals>.DoctypeParserc���|||f�yrSr")r5rlr�r��	_doctype2s    �rr�zBXMLParserTest.test_subclass_doctype.<locals>.DoctypeParser.doctype]
s���!%�u�f� 5�Ir!Nr)r$s�rr�r"\
s���6r!r�rr�)
r=rr��RuntimeWarningrr�rr�rrrrr{)r5r r r�r�r$s    @@r�test_subclass_doctypez#XMLParserTest.test_subclass_doctypeK
s�����	*�"�,�,�	*�
%�&��
�
"�
"�>�9�
=�	&��K�K����%�	&��������(�#�#�#��9�
�
$�
$�
&�	M��!�!�'�+=�>��!�!�'�>�:�
6�
6�
)�
��@�F��K�K����%��L�L�N����h�'����Y�L�
M�	M�	M�
	&�	&��	M�	M�s�E�BE�E	�Ec�T�tj�5tjdt�tjdt�Gd�dt
j�}|�}|j|j�|j�ddd�y#1swYyxYw)z:Ensure that ordinary usage is not deprecated (Issue 19176)rc��eZdZy)�DXMLParserTest.test_inherited_doctype.<locals>.MyParserWithoutDoctypeNr�r"r!r�MyParserWithoutDoctyper)n
s��r!r*N)
rrrrr%r=rrr�r)r5r*r s   r�test_inherited_doctypez$XMLParserTest.test_inherited_doctypei
su��
�
$�
$�
&�	��!�!�'�+=�>��!�!�'�>�:�
����
�+�-�F��K�K����%��L�L�N�	�	�	�s�BB�B'c�X�tjtj���}|j|j�|j�}|j
|jd�|j
|jdd�|j
|jd�y)Nr�moneyr�u
$£€𐅻)
r=rrr�sample3rr{rUrxrwr�s   r�test_parse_stringzXMLParserTest.test_parse_stringt
sw�����R�^�^�%5��6�����D�L�L�!��L�L�N���������(�������'�*�,C�D�������!8�9r!N)
r@rArBr�r�r.r
rr�rr&r+r/r"r!rr	r	)
s:��-�G��G�M�G�*�
4�3��M�<	�:r!r	c��eZdZd�Zy)�NamespaceParseTestc�B�ddd�}tjt�}|jt	|jd|��d�|jt	|jd|��d�|jt	|jd|��d�y)	N�hellor�)�hrz{hello}tabler�z.//{hello}tdr�z.//{foo}name)r=r��SAMPLE_XML_NS_ELEMSr{r|r�)r5r�rOs   r�test_find_with_namespacez+NamespaceParseTest.test_find_with_namespace~
s{���E�*���m�m�/�0������S�[�[���?�@�!�D�����S�[�[���?�@�!�D�����S�[�[���?�@�!�Dr!N)r@rArBr6r"r!rr1r1}
s��Er!r1c�T�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�ElementSlicingTestc�@�|D�cgc]}|j��c}Scc}wrSrT)r5�elemlistr�s   r�
_elem_tagszElementSlicingTest._elem_tags�
s��'�(�!����(�(��(rXc�6�|jt|��SrS)r;r}rfs  r�
_subelem_tagsz ElementSlicingTest._subelem_tags�
s�����t�D�z�*�*r!c��tjd�}t|�D]}tj|d|z��|S)zxCreate an Element with a tag 'a', with the given amount of children
           named 'a0', 'a1' ... and so on.

        r�za%s)r=rzr�rd)r5�numchildrenr�r�s    r�_make_elem_with_childrenz+ElementSlicingTest._make_elem_with_children�
s<��

�J�J�s�O���{�#�	(�A��M�M�!�U�Q�Y�'�	(��r!c���|jd��|j�djd�|j�djd�|jt�fd��|jt�fd��y)Nr�r��a1����a8c����dS)N�r"r^s�rr�z?ElementSlicingTest.test_getslice_single_index.<locals>.<lambda>�
s���a��e�r!c����dS)Ni�r"r^s�rr�z?ElementSlicingTest.test_getslice_single_index.<locals>.<lambda>�
s���a��f�r!)r@r{rUr��
IndexErrorr,s @r�test_getslice_single_indexz-ElementSlicingTest.test_getslice_single_index�
sc����)�)�"�-������1����4�(�����2����D�)����*�m�4����*�n�5r!c���|jd�}|j|j|dd�gd��|j|j|dd�gd��|j|j|dd�gd��|j|j|dd�ddg�|j|j|dd�ddg�|j|j|dd	�d
dg�y)Nrvr�)�a3�a4�a5�r�rKrLr�r��a0rB)r@r{r;r,s  r�test_getslice_rangez&ElementSlicingTest.test_getslice_range�
s����)�)�!�,���������1�2��/�1C�D��������1�Q��0�2D�E��������1�R��1�3E�F��������1�Q��0�4��,�?��������1�R��1�D�$�<�@��������2�A��/�$���>r!c	�L�|jd�}|j|j|ddd��ddg�|j|j|ddd��gd��|j|j|ddd��ddg�|j|j|ddd��d	dg�|j|j|ddtj��d
g�|j|j|ddtjdz��d
g�y)Nr��r�rD�a9r�)rOrK�a6rSrOrBrK�@�r@r{r;rc�maxsizer,s  r�test_getslice_stepsz&ElementSlicingTest.test_getslice_steps�
s���)�)�"�-���������1�R��6��3�d�D�\�B��������3�Q�3��0�2J�K��������3�Q�3��0�4��,�?��������1�4�a�4��1�D�$�<�@��������1�>�c�k�k�>�):�;�d�V�D��������1�+=�c�k�k�2�o�+=�)>�?�$��Hr!c	� �|jd�}|j|j|ddd��gd��|j|j|ddd��ddg�|j|j|ddtj��dg�|j|j|ddtjdz
��dg�|j|j|ddtjd	z��dg�y)
NrYr�)rK�a2rBrOrCrKrBr�r�rUrVr,s  r�test_getslice_negative_stepsz/ElementSlicingTest.test_getslice_negative_steps�
s����)�)�!�,���������4�R�4��1�3K�L��������4�R�4��1�D�$�<�@��������1�?�s�{�{�l�?�);�<�t�f�E��������1�+<�s�{�{�l�1�n�+<�)=�>���G��������1�+>�s�{�{�l�B�.>�+>�)?�@�4�&�Ir!c��|jd�}|dd�=|j|j|�ddg�|jd�}|dd�=|j|j|�g�|jd�}|ddd�=|j|j|�g�|jd�}|ddd�=|j|j|�ddg�|jd�}|d	dd�=|j|j|�ddg�|jd�}|ddd�=|j|j|�d
g�y)NrYrr�rZrKr�rCrOr�rB)r@r{r=r,s  r�
test_delslicez ElementSlicingTest.test_delslice�
sT���)�)�!�,��
�a��c�F�����+�+�A�.��t��=��)�)�!�,��
�a�b�E�����+�+�A�.��3��)�)�!�,��
�d��d�G�����+�+�A�.��3��)�)�!�,��
�d��d�G�����+�+�A�.��t��=��)�)�!�,��
�a�d��d�G�����+�+�A�.��t��=��)�)�!�,��
�c��c�F�����+�+�A�.���7r!c�`�|jd�}tjd�|d<|j|j	|�gd��tjd�|d<|j|j	|�gd��|jt�5tjd�|d	<ddd�|jt�5tjd�|d
<ddd�|j|j	|�gd��y#1swY�cxYw#1swY�9xYw)NrYr�r��rOr�rZrKr�rC)rOr�r�rKr�r����)r@r=rzr{r=r�rHr,s  r�test_setslice_single_indexz-ElementSlicingTest.test_setslice_single_index�
s����)�)�!�,���z�z�#���!������+�+�A�.�0G�H��
�
�3���"������+�+�A�.�0F�G�
�
�
�z�
*�	#��:�:�c�?�A�a�D�	#�
�
�
�z�
*�	$��J�J�s�O�A�b�E�	$�����+�+�A�.�0F�G�		#�	#��	$�	$�s�D�D$�D!�$D-c�J�|jd�}td�D�cgc]}tjd|z���c}|dd|j	|j|�gd��|jd�}tjd�g|dd|j	|j|�gd��|jd�}td�D�cgc]}tjd|z���c}|dd|j	|j|�gd	��ycc}wcc}w)
NrYr��b%sr�r�)rO�b0�b1rKr�)rOr�rK)rOrdre�b2rK)r@r�r=rzr{r=�r5r�r�s   r�test_setslice_rangez&ElementSlicingTest.test_setslice_range�
s����)�)�!�,��16�q��:�A�"�*�*�U�Q�Y�'�:��!�A������+�+�A�.�0H�I��)�)�!�,���*�*�S�/�"��!�A������+�+�A�.�0A�B��)�)�!�,��16�q��:�A�"�*�*�U�Q�Y�'�:��!�A������+�+�A�.�0N�O��;��;s�D�D c�`�|jd�}td�D�cgc]}tjd|z���c}|ddd�<|j	|j|�gd��|jd�}|j
t�5tjd�g|ddd�<ddd�|j
t�5td�D�cgc]}tjd|z���c}|ddd�<ddd�|j
t�5g|ddd�<ddd�|j	|j|�gd	��|jd
�}tjd�g|ddtj�<|j	|j|�gd��tjd�g|ddtjd
z�<|j	|j|�gd��ycc}w#1swY��ZxYwcc}w#1swY��xYw#1swY��xYw)Nrvr�rcr�r�)rOrdrZrerLrMr�r�)rOrBrZrKrLrMrYr_r�rU�rOr�rZrK�
r@r�r=rzr{r=r�r�rcrWrgs   r�test_setslice_stepsz&ElementSlicingTest.test_setslice_steps�
s����)�)�!�,��38��8�<�a�B�J�J�u�q�y�)�<��!�A�a�%������+�+�A�.�0T�U��)�)�!�,��
�
�
�z�
*�	)��
�
�3��(�A�a��!�e�H�	)�
�
�
�z�
*�	A�7<�Q�x�@�!��
�
�5�1�9�-�@�A�a��!�e�H�	A�
�
�
�z�
*�	��A�a��!�e�H�	�����+�+�A�.�0T�U��)�)�!�,���Z�Z��_�-��!�.�S�[�[�.������+�+�A�.�0G�H�!#���C�� 1��!�
�S�[�[�"�_�
������+�+�A�.�0G�H��!=�	)�	)��A�	A�	A��	�	�s;�H�H�
H�H�7	H�	H$�H�H�H!�$H-c��|jd�}td�D�cgc]}tjd|z���c}|ddd�<|j	|j|�gd��|jd�}|j
t�5tjd�g|ddd�<ddd�|j
t�5td�D�cgc]}tjd|z���c}|ddd�<ddd�|j
t�5g|ddd�<ddd�|j	|j|�gd	��|jd�}tjd�g|d
dtj�<|j	|j|�gd��tjd�g|d
dtjd
z
�<|j	|j|�gd
��tjd�g|d
dtjdz�<|j	|j|�gd��ycc}w#1swY���xYwcc}w#1swY��lxYw#1swY��SxYw)NrYr�rcrr�)rOrerdrKr�r�)rOrBrZrKr�r_r�rjr�rU)rOr�rZrKrkrgs   r�test_setslice_negative_stepsz/ElementSlicingTest.test_setslice_negative_stepss$���)�)�!�,��49�!�H�=�q�R�Z�Z���	�*�=��!�A�b�&�	�����+�+�A�.�0H�I��)�)�!�,��
�
�
�z�
*�	*����C��)�A�a��"�f�I�	*�
�
�
�z�
*�	B�8=�a��A�1����E�A�I�.�A�A�a��"�f�I�	B�
�
�
�z�
*�	��A�a��"�f�I�	�����+�+�A�.�0H�I��)�)�!�,�� �j�j��o�.��!�/�c�k�k�\�/������+�+�A�.�0G�H� "�
�
�3��0��!�
�c�k�k�\�!�^�
������+�+�A�.�0G�H�"$�*�*�S�/�!2��!�
�c�k�k�\�2�
�
������+�+�A�.�0G�H��%>�	*�	*��B�	B�	B��	�	�s;�I�I�
I*�I%�7	I*�	I7�I"�%I*�*I4�7JN)r@rArBr;r=r@rIrPrXr[r]rarhrlrnr"r!rr8r8�
sD��)�+��6�?�I�J�8�2H�P�I�(Ir!r8c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZGd
�d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�IOTestc	���tjd�}d|_|jt	|�d�dD]d}|j|�5|jt	||��d�|jt	||j
���d�ddd��fdD]�}|j|�5|jt	||��d|zj|��|j
�}|jt	||��d|zj|��ddd���tjd�}d	|_|jt	|�d
�|jt	|d��d�|jt	|d
��d�dD]1}|jt	||��d|zj|���3tjd�}d	|jd<|jt	|�d�|jt	|d��d�|jt	|d
��d�dD]1}|jt	||��d|zj|���3tjd�}d|_|jt	|�d�|jt	|d��d�|jt	|d
��d�dD]1}|jt	||��d|zj|���3tjd�}d|jd<|jt	|�d�|jt	|d��d�|jt	|d
��d�dD]1}|jt	||��d|zj|���3y#1swY���xYw#1swY��QxYw)NrUr�z<tag>abc</tag>)rr�rs<tag>abc</tag>)r�r��utf-32z2<?xml version='1.0' encoding='%s'?>
<tag>abc</tag>z<&"'>z<tag>&lt;&amp;"'&gt;</tag>rs<tag>&lt;&amp;"'&gt;</tag>r�z><?xml version='1.0' encoding='%s'?>
<tag>&lt;&amp;"'&gt;</tag>r�z"<tag key="&lt;&amp;&quot;'&gt;" />s"<tag key="&lt;&amp;&quot;'&gt;" />zF<?xml version='1.0' encoding='%s'?>
<tag key="&lt;&amp;&quot;'&gt;" />uåöö<>u<tag>åöö&lt;&gt;</tag>s<tag>åöö&lt;&gt;</tag>s%<tag>&#229;&#246;&#246;&lt;&gt;</tag>u=<?xml version='1.0' encoding='%s'?>
<tag>åöö&lt;&gt;</tag>u<tag key="åöö&lt;&gt;" />s<tag key="åöö&lt;&gt;" />s(<tag key="&#229;&#246;&#246;&lt;&gt;" />)r�r�r�r�rru@<?xml version='1.0' encoding='%s'?>
<tag key="åöö&lt;&gt;" />)	r=rzrwr{rQr��upperr)rx)r5rL�encrss    rr(zIOTest.test_encodings����z�z�%� ����	�����4��*:�;�(�	+�C����c�"�
+�� � ��4�#�!>�)�+�� � ��4�#�)�)�+�!F�)�+�
+�
+�	+�6�	@�C����c�"�
@�� � ��4�#�!>�*�,/�0�17����>��	�	���� � ��4�%�!@�*�,1�2�39�6�#�;�@�
@�
@�	@��z�z�%� ����	�����4��*G�H�����4�'�:�.�	0�����4�*�=�.�	0�5�	G�C����Y�t�c�:�3�58�9�:@�&��+�
G�	G�
�z�z�%� ��&����E������4��*O�P�����4�'�:�6�	8�����4�*�=�6�	8�5�	P�C����Y�t�c�:�<�>A�B�CI�6�#�;�
P�	P�
�z�z�%� ��$��	�����4��*K�L�����4�'�:�>�	@�����4�*�=�8�	:�5�	E�C����Y�t�c�:�1�36�7�8>��s��
E�	E�
�z�z�%� ��-����E������4��*N�O�����4�'�:�A�	C�����4�*�=�;�	=�M�	J�C����Y�t�c�:�6�8;�<�=C�V�C�[�
J�	J�u
+�
+��
@�
@�s�A	O�7A/O*�O'	�*O4	c�P�|jtjt�tjtj
d��}|jt�ttd�5}|j|j�d�ddd�y#1swYyxYw)N�<site>ø</site>rN�<site>&#248;</site>)rYrrZrr=r/r�rIrr{r�r5rPrs   r�test_write_to_filenamezIOTest.test_write_to_filenamecsv�����	�(�(�&�1��~�~�b�f�f�%<�=�>���
�
�6��
�&�$�
�	C�1����Q�V�V�X�'A�B�	C�	C�	C�s�2!B�B%c��|jtjt�tjtj
d��}|jtd��ttd�5}|j|j�d�ddd�|jtd��ttd�5}|j|j�td��ddd�y#1swY�cxYw#1swYyxYw)NrvrrrN�<site>ø</site>r��:<?xml version='1.0' encoding='ISO-8859-1'?>
<site>�</site>)rYrrZrr=r/r�rIrr{rr+rxs   r�$test_write_to_filename_with_encodingz+IOTest.test_write_to_filename_with_encodingjs������	�(�(�&�1��~�~�b�f�f�%<�=�>���
�
�6�G�
�,�
�&�$�
�	E�1����Q�V�V�X�'C�D�	E�	
�
�
�6�L�
�1�
�&�$�
�	8�1����Q�V�V�X�{�6�(7�
8�	8�	8�		E�	E��	8�	8�s�4!C7�*D�7D�Dc���|jtjt�t	td�5}|j
}ddd�tjt�tjtjd��}|jtd��t	td�5}|j|j�d�ddd�y#1swY��xYw#1swYyxYw)Nr�rvrDrrNr{)rYrrZrrrEr=r/r�rIr{r)r5rrErPs    r�!test_write_to_filename_as_unicodez(IOTest.test_write_to_filename_as_unicodews������	�(�(�&�1�
�&�#�
�	"�!��z�z�H�	"����� ��~�~�b�f�f�%<�=�>���
�
�6�I�
�.�
�&�$�
�	A�1����Q�V�V�X�'?�@�	A�	A�
	"�	"��	A�	A�s�
C�2!C(�C%�(C1c�>�|jtjt�tjtj
d��}ttdd��5}|j|d��|j|j�ddd�ttd�5}|j|j�d�ddd�ttddd	�
�5}|j|d��|j|j�ddd�ttd�5}|j|j�d�ddd�ttdd��5}|j|d��|j|j�ddd�ttd�5}|j|j�d
�ddd�y#1swY��IxYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY�uxYw#1swYyxYw)Nrvr�rrrDrNr{r%�xmlcharrefreplace)rE�errorsrwr�s<site>�</site>�
rYrrZrr=r/r�rrIrUrVr{rrxs   r�test_write_to_text_filezIOTest.test_write_to_text_file�s������	�(�(�&�1��~�~�b�f�f�%<�=�>��
�&�#��
0�	'�A��J�J�q�9�J�-����Q�X�X�&�	'��&�$�
�	E�1����Q�V�V�X�'C�D�	E��&�#��8K�
L�	'�PQ��J�J�q�9�J�-����Q�X�X�&�	'��&�$�
�	D�1����Q�V�V�X�(B�C�	D��&�#��
5�	'���J�J�q�9�J�-����Q�X�X�&�	'��&�$�
�	A�1����Q�V�V�X�'?�@�	A�	A�	'�	'��	E�	E��	'�	'��	D�	D��	'�	'��	A�	A�sH�/G�&!G"�"/G/�)!G;�$/H�+!H�G�"G,�/G8�;H�H�Hc���|jtjt�tjtj
d��}ttd�5}|j|�|j|j�ddd�ttd�5}|j|j�d�ddd�y#1swY�CxYw#1swYyxYw)NrvrQrNrwr�rxs   r�test_write_to_binary_filez IOTest.test_write_to_binary_file�s������	�(�(�&�1��~�~�b�f�f�%<�=�>��
�&�$�
�	'�1��J�J�q�M����Q�X�X�&�	'��&�$�
�	C�1����Q�V�V�X�'A�B�	C�	C�	'�	'��	C�	C�s�-C�"!C�C�C!c��|jtjt�tjtj
d��}ttd�5}|j|d��|j|j�ddd�ttd�5}|j|j�d�ddd�ttd�5}|j|d��|j|j�ddd�ttd�5}|j|j�d�ddd�y#1swY��xYw#1swY��xYw#1swY�[xYw#1swYyxYw)	NrvrQrrrNr{r�r|r�rxs   r�'test_write_to_binary_file_with_encodingz.IOTest.test_write_to_binary_file_with_encoding�s7�����	�(�(�&�1��~�~�b�f�f�%<�=�>��
�&�$�
�	'�1��J�J�q�7�J�+����Q�X�X�&�	'��&�$�
�	E�1����Q�V�V�X�'C�D�	E��&�$�
�	'�1��J�J�q�<�J�0����Q�X�X�&�	'��&�$�
�	7�1����Q�V�V�X�6�
7�	7�	7�	'�	'��	E�	E��	'�	'��	7�	7�s0�/E�$!E�/E&�$!E2�E�E#�&E/�2E;c�<�|jtjt�tjtj
d��}ttd�5}|j|d��|j|j�ddd�ttd�5}|j|j�djd��ddd�ttdd��5}|j|d��|j|j�ddd�ttd�5}|j|j�djd��ddd�y#1swY��xYw#1swY��xYw#1swY�jxYw#1swYyxYw)	NrvrQr�rrNu7<?xml version='1.0' encoding='utf-16'?>
<site>ø</site>r)�	buffering)rYrrZrr=r/r�rrIrUrVr{rr)rxs   r�"test_write_to_binary_file_with_bomz)IOTest.test_write_to_binary_file_with_bom�sM�����	�(�(�&�1��~�~�b�f�f�%<�=�>��
�&�$�
�	'�1��J�J�q�8�J�,����Q�X�X�&�	'��&�$�
�	>�1����Q�V�V�X�,�,2�F�8�,<�
>�	>�
�&�$�!�
,�	'���J�J�q�8�J�,����Q�X�X�&�	'��&�$�
�	>�1����Q�V�V�X�,�,2�F�8�,<�
>�	>�	>�	'�	'��	>�	>��
	'�	'��	>�	>�s0�/E.�$0E:�./F�50F�.E7�:F�F�Fc���tj�}tjd�}|j	|�|j|j
�jd�y�Nz"<?xml version="1.0"?><site></site>�site)r=r/rFrHrr{r�rU�r5rPrs   r�test_read_from_stringiozIOTest.test_read_from_stringio�sE���~�~������E�F���
�
�6���������+�+�V�4r!c���tjtjd��}tj�}|j|d��|j
|j�d�y�NrvrDr)r=r/r�rFrHrIr{rJr�s   r�test_write_to_stringiozIOTest.test_write_to_stringio�sM���~�~�b�f�f�%<�=�>��������
�
�6�I�
�.�������*�,C�Dr!c���tj�}tjd�}|j	|�|j|j
�jd�y�Ns"<?xml version="1.0"?><site></site>r�)r=r/rFrGrr{r�rU�r5rPr{s   r�test_read_from_bytesiozIOTest.test_read_from_bytesio�sD���~�~����j�j�B�C���
�
�3���������+�+�V�4r!c���tjtjd��}tj�}|j|�|j
|j�d�y�Nrvrw)r=r/r�rFrGrIr{rJr�s   r�test_write_to_bytesiozIOTest.test_write_to_bytesio�sG���~�~�b�f�f�%<�=�>���j�j�l���
�
�3���������)C�Dr!c��eZdZy)�IOTest.dummyNr�r"r!r�dummyr��s��r!r�c��tjd�}|j�}|j|_tj�}|j
|�|j|j�jd�yr�)
rFrHr�rr=r/rr{r�rU)r5r�readerrPs    r�test_read_from_user_text_readerz&IOTest.test_read_from_user_text_reader�s[�����E�F��������k�k����~�~����
�
�6���������+�+�V�4r!c�$�tjtjd��}tj�}|j�}|j|_|j
|d��|j|j�d�yr�)	r=r/r�rFrHr�rIr{rJ)r5rPr�writers    r�test_write_to_user_text_writerz%IOTest.test_write_to_user_text_writer�sc���~�~�b�f�f�%<�=�>�������������|�|����
�
�6�I�
�.�������*�,C�Dr!c�6�tjd�}|j�}|j|_tj�}|j
|�|j|j�jd�tj�}yr�)
rFrGr�rr=r/rr{r�rU)r5r{r�rPs    r�!test_read_from_user_binary_readerz(IOTest.test_read_from_user_binary_reader�sg���j�j�B�C��������h�h����~�~����
�
�6���������+�+�V�4��~�~��r!c� �tjtjd��}tj�}|j�}|j|_|j
|�|j|j�d�yr�)	r=r/r�rFrGr�rIr{rJ�r5rPr{r�s    r� test_write_to_user_binary_writerz'IOTest.test_write_to_user_binary_writer�s^���~�~�b�f�f�%<�=�>���j�j�l��������y�y����
�
�6���������)C�Dr!c�t�tjtjd��}tj�}|j�}|j|_d�|_|j|_|j
|d��|j|j�djd��y)Nz<site />c��yr�r"r"r!rr�zBIOTest.test_write_to_user_binary_writer_with_bom.<locals>.<lambda>r�r!r�rz0<?xml version='1.0' encoding='utf-16'?>
<site />)r=r/r�rFrGr�rI�seekable�tellr{rJr)r�s    r�)test_write_to_user_binary_writer_with_bomz0IOTest.test_write_to_user_binary_writer_with_boms����~�~�b�f�f�^�4�5���j�j�l��������y�y���&����h�h����
�
�6�H�
�-���������%�v�h�/�	1r!c	�R�tjd�}|jtj|d�dj	tj|d���|jtj|d�dj	tj|d���y)Nz<tag>foo</tag>rDrEr�r!)r=r�r{rr(r)r�s  r�test_tostringlist_invariantz"IOTest.test_tostringlist_invariant
sy���}�}�-�.������K�K��i�(��G�G�B�O�O�D�)�4�5�	7�	
����K�K��h�'��H�H�R�_�_�T�8�4�5�	7r!c��tjd�}|jtj|d�d�|jtj|dd��d�|jtj|dd��d�y)Nz<tag>a<x />b<y></y>c</tag>rDz<tag>a<x />b<y />c</tag>T)�short_empty_elementsFz<tag>a<x></x>b<y></y>c</tag>)r=r�r{rr�s  r�test_short_empty_elementsz IOTest.test_short_empty_elementssz���}�}�9�:������K�K��i�(�&�	(�	
����K�K��i�d�K�C�&�	(�	
����K�K��i�e�K�D�*�	,r!N)r@rArBr(ryr}rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"r!rrprpsv��CJ�JC�8�	A�A�*C�7�">�(5�E�5�E�
�
�5�E� �E�
1�7�
,r!rpc�$�eZdZd�Zd�Zd�Zd�Zy)�ParseErrorTestc�T�|jtj�t�yrS)ryr=rXrtr�s rr�zParseErrorTest.test_subclass$s�����b�m�m�o�{�;r!c�t�	tj|�y#tj$r}|cYd}~Sd}~wwxYwrS)r=r�rX)r5r?r�s   r�
_get_errorzParseErrorTest._get_error's,��	��M�M�!����}�}�	��H��	�s��7�2�7�7c��|j|jd�jd�|j|jd�jd�|j|jd�jd�y)Nr�)r�rz<tag>&foo;</tag>)r�r�zfoobar<)r�rv)r{r��positionr�s r�test_error_positionz"ParseErrorTest.test_error_position-s`���������/�8�8�&�A�������);�<�E�E�v�N��������3�<�<�f�Er!c��ddlmcmcm}|j	|jd�j|j|j�y)Nrr�)	�xml.parsers.expat.errors�parsers�expatr�r{r��code�codes�XML_ERROR_SYNTAX)r5�ERRORSs  r�test_error_codezParseErrorTest.test_error_code2s9��1�1��������/�4�4����V�4�4�5�	7r!N)r@rArBr�r�r�r�r"r!rr�r�#s��<��F�
7r!r�c��eZdZd�Zy)�KeywordArgsTestc��tjd�}|j|jdd�|jdd���|j|j	ddd�|j	ddd���|j|jdd�|jdd���|jt
|jdd��t
|jdd����|jtjd�ji�tjdtdd���tjdtdd����tjdtd�	�d�
�tjddd��tjdtdd��dd��g}|D]E}|j|jd�|j|jtdd����Gtj|ddd
di��}|j|jd
d�|jtd�5tjdd�ddd�|jtd�5tjdd��ddd�y#1swY�@xYw#1swYyxYw)Nz
<a>foo</a>r�)�pathrE)r�r�rE�#r�)r�r�)rx)r�)r�rr��key1�value1zmust be dict, not strzI'm not a dict)r=r�r{r�r�r�r}r�rzrxrhrUrdr�r)r5r��elementsr�r�s     r�test_issue14818zKeywordArgsTest.test_issue14818;sM���F�F�<� ���������T�*����S�T��:�	<�������C��t�4�����d�t��L�	N�������3��-�������=�	?�����a�j�j��d�3�4��a�j�j�c�d�j�C�D�	F�	
������C��/�/��4��J�J�s�D�c�e�4�5��J�J�s�4�S�U�#;�J�<��J�J�s�D�c�N�u�J�5��J�J�s���J�/��J�J�s�D�c�e�4�3�5�J�I�
���	A�A����Q�U�U�C�(����Q�X�X�t���'?�@�	A��]�]�8�A�;��&�(�9K�]�
L��������6�*�H�5�
�
#�
#�I�/F�
G�	.��J�J�s�,�-�	.�
�
#�
#�I�/F�
G�	5��J�J�s�#3�J�4�	5�	5�	.�	.��	5�	5�s�J5�K�5J>�K
N)r@rArBr�r"r!rr�r�8s��5r!r�c�"�eZdZed��Zd�Zy)�NoAcceleratorTestc�F�tturtjd��y)Nzonly for the Python version)r=r\r��SkipTestr^s rr`zNoAcceleratorTest.setUpClass]s ��
�T�>��#�#�$A�B�B�r!c���|jtjjtj
�|jtjjtj
�yrS)ryr\rzr��types�FunctionTyperr�s r�test_correct_import_pyETz*NoAcceleratorTest.test_correct_import_pyETcsD��	
���d�l�l�3�3�U�5G�5G�H����d�n�n�5�5�u�7I�7I�Jr!N)r@rArBr�r`r�r"r!rr�r�\s���C��C�
Kr!r�c��eZdZd�Zy)�BoolTestc�~�tjd�}d}|jt|�5t	|�}ddd�|jd�tj
|d�|jt|�5t	|�}ddd�|jd�y#1swY�nxYw#1swY�(xYw)Nz<a style="new"></a>z�Testing an element's truth value will raise an exception in future versions.  Use specific 'len\(elem\)' or 'elem is not None' test instead.Fr�T)r=r�r�r�boolr�rd)r5r�r�rq�
new_results     r�test_warningzBoolTest.test_warningms����M�M�/�0��
N�	��
"�
"�#5�s�
;�	��!�W�F�	�	
�
�
�f�e�$�	�
�
�a���
�
"�
"�#5�s�
;�	!��a��J�	!��
�
�j�$�'�	�	��	!�	!�s�B'�B3�'B0�3B<N)r@rArBr�r"r!rr�r�ls��(r!r�c�.�tj|fi|��SrS)r\�canonicalize)r�rNs  r�c14n_roundtripr��s�����S�,�G�,�,r!c�"�eZdZdZd�Zd�Zd�Zy)�C14NTestNc�:�|jtd�d�|jtd�d�|jtd�d�|jtd�d�|jtd	�d
�|jtd�d�|jtd
�d�|jtd�d�|jtd�d�|jtd�d�|jtd�d�|jtd�d�d}|jt|�|�d}|jt|�|�d}|jt|�|�y)Nz<doc/>z<doc></doc>z<doc xmlns='uri'/>z<doc xmlns="uri"></doc>z <prefix:doc xmlns:prefix='uri'/>z,<prefix:doc xmlns:prefix="uri"></prefix:doc>z+<doc xmlns:prefix='uri'><prefix:bar/></doc>z7<doc><prefix:bar xmlns:prefix="uri"></prefix:bar></doc>z�<elem xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' />z
<elem></elem>z*<doc>Hello, world!<!-- Comment 1 --></doc>z<doc>Hello, world!</doc>z<value>&#x32;</value>z<value>2</value>zG<compute><![CDATA[value>"0" && value<"10" ?"valid":"error"]]></compute>zI<compute>value&gt;"0" &amp;&amp; value&lt;"10" ?"valid":"error"</compute>zS<compute expr='value>"0" &amp;&amp; value&lt;"10" ?"valid":"error"'>valid</compute>z{<compute expr="value>&quot;0&quot; &amp;&amp; value&lt;&quot;10&quot; ?&quot;valid&quot;:&quot;error&quot;">valid</compute>z7<norm attr=' &apos;   &#x20;&#13;&#xa;&#9;   &apos; '/>z/<norm attr=" '    &#xD;&#xA;&#x9;   ' "></norm>z6<normNames attr='   A   &#x20;&#13;&#xa;&#9;   B   '/>z=<normNames attr="   A    &#xD;&#xA;&#x9;   B   "></normNames>z7<normId id=' &apos;   &#x20;&#13;&#xa;&#9;   &apos; '/>z1<normId id=" '    &#xD;&#xA;&#x9;   ' "></normId>z5<X xmlns="http://nps/a"><Y targets="abc,xyz"></Y></X>zJ<X xmlns="http://nps/a"><Y xmlns="http://nsp/b" targets="abc,xyz"></Y></X>zN<X xmlns="http://nps/a"><Y xmlns:b="http://nsp/b" b:targets="abc,xyz"></Y></X>)r{r��r5r�s  r�test_simple_roundtripzC14NTest.test_simple_roundtrip�s��������1�=�A�����(<�=�)�	+�����(J�K�:�	<�����(U�V�E�	G�����)M�N��	�	
����(T�U�&�	(�����(?�@��	 �����(q�r�W�	Y�����)B�C�
J�	K�����(a�b�?�	A�����(`�a�K�	M�����(a�b�A�	C�F�������,�c�2�Z�������,�c�2�^�������,�c�2r!c�"�tjd�}|jt|d��d�|jt|ddg��d�|jt|ddg�	�d
�|jt|ddgdg��d�|jt|dd
dg�	�d�|jt|d
dg��d�|jt|dddg�	�d�|jt|ddg��d�y)Nz�        <root xmlns:x="http://example.com/x">
            <a x:attr="attrx">
                <b>abtext</b>
            </a>
            <b>btext</b>
            <c>
                <x:d>dtext</x:d>
            </c>
        </root>
        T)�
strip_textz�<root><a xmlns:x="http://example.com/x" x:attr="attrx"><b>abtext</b></a><b>btext</b><c><x:d xmlns:x="http://example.com/x">dtext</x:d></c></root>z{http://example.com/x}attr)r��
exclude_attrszc<root><a><b>abtext</b></a><b>btext</b><c><x:d xmlns:x="http://example.com/x">dtext</x:d></c></root>z{http://example.com/x}d)r��exclude_tagszb<root><a xmlns:x="http://example.com/x" x:attr="attrx"><b>abtext</b></a><b>btext</b><c></c></root>)r�r�r�z4<root><a><b>abtext</b></a><b>btext</b><c></c></root>r�r�zC<root><c><x:d xmlns:x="http://example.com/x">dtext</x:d></c></root>)r�za<root>
    
    
    <c>
        <x:d xmlns:x="http://example.com/x">dtext</x:d>
    </c>
</root>zI<root><a xmlns:x="http://example.com/x" x:attr="attrx"></a><c></c></root>zu<root>
    <a xmlns:x="http://example.com/x" x:attr="attrx">
        
    </a>
    
    <c>
        
    </c>
</root>)r�r�r{r�r�s  r�test_c14n_exclusionzC14NTest.test_c14n_exclusion�sA���o�o�
�

��	
����3�4�0�
�	�	
����3�4�@\�?]�^�
�	�	
����3�4�?X�>Y�Z�
�	�	
����3�4�@\�?]�)B�(C�
E�
�	�	
����3�4�s�C�j�I�
�	�
	
����3�c�3�Z�8�
�	�	
����3�4�?X�Z]�>^�_�
�	�	
����3�.G��-M�N�
�
	r!c�	�tdd��}ttjj|�}ttj|��D�cgc]}|jd�r|dd��}}|D�cgc]}|jd�r|��}}|D��cic]�}|jd�rv|tj||�dz�j�D�cic]?}|jjd�d	|jxsd
j�|f��Ac}���}}}|D��cic]W}||D�cgc]H}|jd|�d��r1|j!dd
�d	|vr|||j!dd
�d	f��Jc}��Y}	}}|j#dt%|	j'�D�
�cgc]}
|
D]}|���
c}}
��d.d�}|	j)�D�]�\}}
|
D�]\}}
||
d�dk(}||
d�dk(}||
d�dk(}d|
vr�|
dd
j+d�D�cgc](}d|j-d��d|j-d�����*}}|
dd
j+d�D�cgc](}d|j-d��d|j-d�����*}}ndx}}dj	d�t|
j)��D��}|j/|�d|�d��5|dk(r|s|j1d |���|d!k(r|s|j1d |���d|
vr,|
dd
j3d"�	�|j1d#|���||dz�}|d$k(rqt5|d%�d&�5}t5|d&�5}t7j8|j;�j=d'|j;���}ddd�ddd�tj?||||||�(�}t5||dz�d)d*�+�5}|j;�}|d,k(r$|j=d-d
�}|j=d-d
�}ddd�|j#|�ddd�������ycc}wcc}wcc}wcc}}wcc}wcc}}wcc}}
wcc}wcc}w#1swY��xYw#1swY��xYw#1swY�rxYw#1swY���xYw)/Nzc14n-20rrz.xmlrw�in�c14n�}r�rE�out_r,r��c�0�|j||df�dS)Nr"r)rj)�config�option_namer�s   r�
get_optionz+C14NTest.test_xml_c14n2.<locals>.get_option%s���:�:�k�G�R�=�9�!�<�<r!�IgnoreComments�true�
TrimTextNodes�
PrefixRewrite�
sequential�
QNameAwarez/{http://www.w3.org/2010/xml-c14n2}QualifiedAttr�{�NS�Namez){http://www.w3.org/2010/xml-c14n2}Element�,c3�jK�|]+\}\}}|�d|xsdjd�|D�������-y�w)�=r�c3�XK�|]"}|jjd�d���$y�w)r�r�N)rU�split)�.0r�s  r�	<genexpr>z4C14NTest.test_xml_c14n2.<locals>.<genexpr>.<genexpr>@s"����/W�������C�0@��0D�/W�s�(*N)r()rrlr�r�s    rrz*C14NTest.test_xml_c14n2.<locals>.<genexpr>?sA����(�/��/�u�h��f�A�e�W�s�x�x�/W�h�/W�'W�X�Y�(�s�13�(�)�
inNsRedeclz2Redeclared namespace handling is not supported in �inNsSuperfluousz.{http://www.w3.org/2010/xml-c14n2}XPathElementz2QName rewriting in XPath text is not supported in �inC14N5z	world.txtrNs&ent2;)�	from_file�
with_commentsr��rewrite_prefixes�qname_aware_tags�qname_aware_attrs�rr�r�inC14N3z attr="default"rS) r	rr'r�r(r�listdir�endswith�
startswithr=rr�rUr�rwry�rsplitr{r|�valuesr�r�rjr�rnr�rrFrGrr&r�)r5�datadir�	full_path�filename�files�input_files�option�configs�
input_file�tests�output_files�output_filer�r��
keep_commentsr�r	r��qattrs�qtags�config_descrr�entity_filerwr�s                         r�test_xml_c14n2zC14NTest.test_xml_c14n2s���9�]�;���B�G�G�L�L�'�2�	�/5�b�j�j��6I�/J�/�8��%�%�f�-��#�2��/��/�&+�
�!��"�"�4�(�
�
��
�"�

���"�"�6�*�

�!�h�h�y��':�V�'C�D�L�L�N����
�
� � ��%�b�)�V�[�[�->�B�,E�,E�,G��+P�P��
�
��
�"*�
��

� %����&�&��j�\��';�<��O�O�C��+�B�/�7�:��7�8�?�?�3��#:�2�#>�?�@��
�
��
�	
����S�,1�L�L�N�"-�(�+�"-��
�"-��"-�.�	/�	=�).���
�<	5�$�J��'3�;
5�#��V� *��,�!.�17�!8�
�'��O�-�06�7�
�#-��O�$-�0<�$=� ��6�)�#)��"6�q�"9�"A�"A�M�#O����R�V�V�D�\�N�"�R�V�V�F�^�,<�=��F��#)��"6�q�"9�"A�"A�G�#I����R�V�V�D�\�N�"�R�V�V�F�^�,<�=��E��&*�)�E�F� #�x�x�(�39�&�,�,�.�3I�(� ��
�\�\�[�M��<�.��"B�C� 5�!�\�1�:J��
�
�P�Q\�P]�^�`�!�%6�6�?O��
�
�P�Q\�P]�^�`�#�v�-�&��2F�q�2I�2N�2N�L�3N�UY�3Z��
�
�P�Q\�P]�^�`�"�*�v�"5�6�A�!�Y�.�!�)�K�"8�$�?�`�;�!%�a���`�!�$&�J�J�q�v�v�x�/?�/?�	�;�K[�K[�K]�/^�$_��`�`��?�?�"#�&3�#-�)9�).�&�+�J�D��i��f�(<�=�s�V�T�G�XY�#$�6�6�8��%��2�'/�'7�'7�8I�2�'N�H�#'�<�<�0A�2�#F�D�G��$�$�X�t�4�A 5� 5�7;
5�<	5��E/��
��
��
����
��"-�� ��
�<`�`��`�`��G�G��5 5� 5�s��Q/�5Q4�AQ>�AQ9�Q>�,
R	�6A
R�R	�/R�0-R�8-R�2B	S�;
R+	�AR�
R+	�:S�:R7	�S�9Q>�R	�R(�$R+	�+R4
�0S�7S
�<S�S
)r@rArB�maxDiffr�r�r#r"r!rr�r��s���G�
&3�PG�`b5r!r�c��tddg��a|�t}|ad�}tj|�ddlm}tjj}|j�}tj|j|�tj|j�|j}tjt|d|�|j�|_ttd�rWtjtj tj"�}tjtjg|���yy)	Nr8r9)�blockedc��dxaayrS)r=r\r"r!r�cleanupzsetUpModule.<locals>.cleanupus�����Tr!rr2r��_set_factories)r
r\r=r��addModuleCleanupr4r3rB�_namespace_mapr�r(r�r��setattrr�r)rer�)�moduler(r3r��
nsmap_copyr*�
old_factoriess       r�setUpModuler0hs����6�(6�'7�9�D�
�~���
�B��
���g�&�&��!�!�0�0�E�����J����e�l�l�J�7����e�k�k�*��#�#�J����g�{�H�j�I�#���*�K���r�#�$��)�)�"�*�*�b�e�e�<�
��!�!�"�"3�"3�D�m�D�%r!�__main__)TrDrS)Tr�rr+rFr�r�r'rdrcr�r�r�rr�rrrrr�test.supportrrr	r
rr�test.support.import_helperr
�test.support.os_helperrr\r=r�r)�UnicodeEncodeErrorr�rrxr�ror7r5r3r4r�r#r+�TestCaser-rQrWrZr�r�r��format�escaperr�rr�r�r�r�__hash__r"r%rIrir�r�r	r1r8rpr�r�r�r�r�r�r0r@�mainr"r!r�<module>r;s	�����	���	�
�
�������%��"�(�C�C�:�)���	���,�}�=��A����'�"��_�]�C���3�M�J���
����
���"�
�����#(��4�
L��"�"�
L��&�=�=�@YP�h�'�'�YP�x$p?��)�)�p?�l��������	������!����������������������F�;�4�;�;�~�t�,�-�
	���	'��	"�#�����X����X����	����	����	��p7�8�$�$�p7�l]J�x� � �]J�HB4���(9�(9�B4�JU�_�h�&7�&7�U�p�#�� #�|�|����S���,�,���?��(�*;�*;�?�D5.�(�+�+�5.�pv:�h�'�'�v:�r](�h�'�'�](�@t.�h�'�'�t.�nQ:�H�%�%�Q:�hE��*�*�E�SI��*�*�SI�lC,�X�
�
�C,�L7�X�&�&�7�* 5�h�'�'� 5�HK��)�)�K� (�x� � �(�(-�`5�x� � �`5�H"E�J�z���H�M�M�O���EC�A�
�(�
�
�?�
@�@�A�s�M�M'