Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_xml_etree.cpython-311.pyc
�

�Ke}��l�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZmZddlmZddlmZddlmZddlmZmZmZmZddlmZdd	lmZdadaed
d���Z 	e �!d
��n#e"$rej#d���wxYwedd���Z$edd���Z%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dd�d�Z-d�Z.Gd�dej/��Z0dod �Z1d!�Z2Gd"�d#��Z3Gd$�d%ej/��Z4Gd&�d'ej/��Z5iZ6d(e6d)<d*e6d+<d,e6d-<d.e6d/<d0e6d1<d2e6d3<d4e6d5<d6e6d7<d8�7ej8e d����e6d9<d:e6d;<iZ9d<e9d=<d>e9d?<d@e6dA<dBe6dC<dDe6dE<GdF�dGej/��Z:GdH�dIej/��Z;GdJ�dKe3ej/��Z<GdL�dMe3ej/��Z=GdN�dOe>��Z?e>j@e?_@GdP�dQe>��ZAe>j@eA_@GdR�dSe3ej/��ZBGdT�dUej/��ZCGdV�dWej/��ZDGdX�dYej/��ZEGdZ�d[ej/��ZFGd\�d]ej/��ZGGd^�d_ej/��ZHGd`�daej/��ZIGdb�dcej/��ZJGdd�deej/��ZKGdf�dgej/��ZLGdh�diej/��ZMdj�ZNGdk�dlej/��ZOdpdm�ZPeQdnkreP��dSdS)q�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�B������fd�}tj|���|S)Nc�l��tj�d�i�5�|i|��ddd��dS#1swxYwYdS)Nr)r�check_warnings)�args�kwargs�filtersr�tests  ����=/usr/local/apps/python3/lib/python3.11/test/test_xml_etree.py�newtestz1checkwarnings.<locals>.decorator.<locals>.newtest}s���� �/��F��F�F�
&�
&���d�%�f�%�%�%�
&�
&�
&�
&�
&�
&�
&�
&�
&�
&�
&�
&����
&�
&�
&�
&�
&�
&s�	)�-�-)�	functools�update_wrapper)rrrrs` ��r�	decoratorz checkwarnings.<locals>.decorator|sA����	&�	&�	&�	&�	&�	&�	&�	� ��$�/�/�/����)rrr s`` r�
checkwarningsr#{s*�����������r!c�f�|�dtj�����S)N�
)�replace�os�linesep�encode)�datas r�convlinesepr+�s$���<�<��r�z�0�0�2�2�3�3�3r!c��eZdZd�Zd�ZdS)�
ModuleTestc�*�ddlm}ddlm}ddlm}dS)Nr)�ElementTree��ElementInclude��ElementPath)�	xml.etreer/r1r3)�selfr/r1r3s    r�test_sanityzModuleTest.test_sanity�s@��	*�)�)�)�)�)�,�,�,�,�,�,�)�)�)�)�)�)�)�)r!c�D�d}tj|t|d���dS)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�?�K�K�K�K�K�Kr!N)�__name__�
__module__�__qualname__r6r?r"r!rr-r-�s7������*�*�*�L�L�L�L�Lr!r-T�unicodec�
�|dkrtj��}ntj��}t�|��}|j|fd|i|��|r|���S|�d��|S)NrC�encodingr)�io�BytesIO�StringIOr=r/�write�getvalue�seek)�elem�	to_stringrE�options�file�trees      r�	serializerQ�s���9����z�|�|����{�}�}��
�>�>�$���D��D�J�t�2�2�h�2�'�2�2�2����}�}�����	�	�!�����r!c��d�|D��S)Nc��g|]	}|j��
Sr"��tag��.0rLs  r�
<listcomp>z"summarize_list.<locals>.<listcomp>�s��%�%�%��D�H�%�%�%r!r")�seqs r�summarize_listrZ�s��%�%��%�%�%�%r!c�0�eZdZed���Zd�Zd�ZdS)�ElementTestCasec�,�tth|_dS�N)�pyETr=�modules)�clss r�
setUpClasszElementTestCase.setUpClass�s���R�j����r!c� �	ttj||��5tj||��}ddd��n#1swxYwYttj||��5tj|��}ddd��n#1swxYwYn|#tj$rj}ttdftdfg��}	tjd|�d|	�||���d|	�||������|�d}~wwxYw|S)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�5�
0�
0��|�C��/�/��
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0����
0�
0�
0�
0��3�;��f�5�5�
,�
,���d�+�+��
,�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,����
,�
,�
,�
,����#�	L�	L�	L��2�u�+��f�~�6�7�7�E��$�$�(+���(-�	�	�&�&�(A�(A�(A�(A�(-�	�	�&�&�(A�(A�(A�&C�D�D�JL�
L�����	L�����
s\�B�?�B�A�B�A�B�%B�:B�B
�
B�
B
�B�D�!A%D�Dc� �|�|tjtjf��|�|tjtjf��|�tt
|����tt
|������t||��D]\}}|�||���tj
dddd��}|�||��||����dS)NrU�tail�text�attrib)�assertIsInstancer=�Elementr_�assertEqual�len�list�zip�assertEqualElements�operator�
attrgetter)r5�alice�bob�x�y�
propertiess      rr�z#ElementTestCase.assertEqualElements�s������e�b�j�$�,�%?�@�@�@����c�B�J���#=�>�>�>�����T�%�[�[�)�)�3�t�C�y�y�>�>�:�:�:���s�O�O�	+�	+�D�A�q��$�$�Q��*�*�*�*��(�����I�I�
������E�*�*�J�J�s�O�O�<�<�<�<�<r!N)r@rArB�classmethodrbrvr�r"r!rr\r\�sK�������!�!��[�!�
�
�
�=�=�=�=�=r!r\c��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/d.S)/�ElementTreeTestc�L�|�t|��|��dSr^)r}rQ)r5rL�expecteds   r�serialize_checkzElementTreeTest.serialize_check�s$������4���(�3�3�3�3�3r!c�F������fd��t�d��}�|��t�|��}�|�����t�dd���}t�|��}��t|��d��t�dd���}�fd���|j���|j���|j���|j	���|j
���|j���|j���|j
���|j���|j���|j���|j���|j���|j���|j���fd�}||�d����||�d	����||�d����||�d	������tjtj����tjtj��dS)
Nc�P����t�|��d���t|��}dD]E}��t	||��d|z�����||d|z����F��|jt����|j	t��|j� ��|jt��|j� ��|jt��|D]
}�|���dS)Nznot an element��msg)rUrzryrxzno %s memberzno %s visible by dir)
�
assertTruer=�	iselement�dir�hasattr�assertInr{rU�strrzrjryrx)�element�direlem�attrrL�
check_elementr5s    ��rr�z5ElementTreeTest.test_interface.<locals>.check_element�s9����O�O�B�L�L��1�1�7G�O�H�H�H��'�l�l�G�7�
;�
;�������� 6� 6�*�T�1� �3�3�3��
�
�d�G�2�T�9��;�;�;�;�
�!�!�'�+�s�3�3�3��!�!�'�.�$�7�7�7��|�'��%�%�g�l�C�8�8�8��|�'��%�%�g�l�C�8�8�8��
$�
$���
�d�#�#�#�#�
$�
$r!rU�täg�value��keyz^<Element 't\xe4g' at 0x.*>$c�X����t|d��d|z���dS)N�__call__z%s not callabler�)r�r�)�methodr5s �r�check_methodz4ElementTreeTest.test_interface.<locals>.check_method�s<����O�O�G�F�J�7�7�)�F�2�
�
4�
4�
4�
4�
4r!c�(���|j��dSr^)�__next__)�itr�s �r�
check_iterz2ElementTreeTest.test_interface.<locals>.check_iters����L���%�%�%�%�%r!�*)r=r|r/�getroot�assertRegex�repr�append�extend�insert�remove�find�iterfind�findall�findtext�clearrl�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�n�%�%�%��*�*�X�7�*�3�3���~�~�g�&�&������g���(G�H�H�H��*�*�U��*�0�0��	4�	4�	4�	4�	4�	��W�^�$�$�$���W�^�$�$�$���W�^�$�$�$���W�^�$�$�$���W�\�"�"�"���W�%�&�&�&���W�_�%�%�%���W�%�&�&�&���W�]�#�#�#���W�[�!�!�!���W�[�!�!�!���W�\�"�"�"���W�]�#�#�#���W�\�"�"�"���W�%�&�&�&�	&�	&�	&�	&�	&�	�
�7�#�#�E�*�*�+�+�+��
�7�#�#�C�(�(�)�)�)��
�4�=�=��'�'�(�(�(��
�4�=�=��%�%�&�&�&�	
�������/�/�/������� 8�9�9�9�9�9r!c�F�t�d��}|�|jd��d|_|�|jd��d|_|�|jd��|�|j��d|_|�|jd��d|_|�|jd��|�|j��d|_|�|jd��d|_|�|jd��|�|ji��dd	d
�|_|�|jdd	d
���ddd
�|_|�|jddd
���dS)NrU�Tag�TAG�Text�TEXT�Tail�TAIL�b�d)�a�c�B�D)�A�C)r=r|r}rU�assertIsNoneryrxrz)r5r�s  r�test_set_attributez"ElementTreeTest.test_set_attributes����*�*�U�#�#�������e�,�,�,���������e�,�,�,���������e�,�,�,����'�,�'�'�'���������v�.�.�.���������v�.�.�.����'�,�'�'�'���������v�.�.�.���������v�.�.�.�������,�,�,�"��-�-��������s��)=�)=�>�>�>�"��-�-��������s��)=�)=�>�>�>�>�>r!c��t�d��}|�|d��t�d��}|�|��|�|d��|�|��|�|d��|�d|��|�|d��|�|��|�|g��|�|d��|�|��|�t|g����|�|d��|�|��t�dd�	��}|�|d
��t�d��}|�|��|�|d��|�d|��|�|d
��|�|��|�|d��|�|��|�|d
��|�	t��5}|�|��ddd��n#1swxYwY|�t|j
��d��|�|d
��|||g|dd�<|�|dd��|�|dd�|d|dg��|�|ddd�|d|dg��|dd�=|�|d
��dS)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�r|r�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�B�B����A�������T�#9�:�:�:����A�q�������T�#A�B�B�B����A�������Q�C�������T�#A�B�B�B����A�������D�!��I�I�������T�#A�B�B�B����A�����*�*�U��*�0�0�����W�&;�<�<�<��Z�Z��)�)�
����z�"�"�"����W�&I�J�J�J����q�*�%�%�%����W�=�	?�	?�	?����z�"�"�"����W�&I�J�J�J����z�"�"�"����W�&;�<�<�<�
�
�
�z�
*�
*�	'�b��N�N�:�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�����R�\�*�*�,K�L�L�L����W�&;�<�<�<�"�J�
�;���!������W�Q�Z��6�6�6������1�����
�G�A�J�'?�@�@�@������!�A������W�Q�Z�(@�A�A�A��A�a�C�L����W�=�	?�	?�	?�	?�	?s�J&�&J*�-J*c��|�t�d��d��|�t�d��d��|�t�d��d��dS)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�7�"�	$�	$�	$����R�V�V�$O�P�P�"�	$�	$�	$����R�V�V�$B�C�C�"�	$�	$�	$�	$�	$r!c�D�tjt�d����}t�|���}|�|�d��jd��|�|�d��jd��t�t���}|�|�d��jd��|�|�d��jd��dS)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�
� 1� 1�'� :� :�;�;�
��~�~�:�~�.�.��������5�)�)�-�u�5�5�5�������=�1�1�5�u�=�=�=��~�~�>�~�2�2��������9�-�-�1�9�=�=�=�������#=�>�>�B��	!�	!�	!�	!�	!r!c���ddlm}t�t��}td��D]?}t�|���dt|��z���@t|j
��}td��D]?}t�|���dt|��z���@|�t|j
��|��td��D]?}t�|���dt|��z���@|�t|j
��|��td��D]?}t�|���dt|��z���@|�
t|j
��d��dS)Nrr2�
z./�iXi�)r4r3r=r�r��ranger/r�r�r~�_cacher}�
assertGreater�
assertLess)r5r3rL�i�cache_len_10s     r�test_path_cachezElementTreeTest.test_path_cachejs���	*�)�)�)�)�)��v�v�j�!�!���r���B�B�A�B�N�N�4�0�0�5�5�d�3�q�6�6�k�B�B�B�B��;�-�.�.���r���B�B�A�B�N�N�4�0�0�5�5�d�3�q�6�6�k�B�B�B�B�����[�/�0�0�,�?�?�?��r���B�B�A�B�N�N�4�0�0�5�5�d�3�q�6�6�k�B�B�B�B����3�{�1�2�2�L�A�A�A��s���C�C�A�R�^�^�D�1�1�6�6�t�C��F�F�{�C�C�C�C�����K�.�/�/��5�5�5�5�5r!c�:�ddl}t�d��}|j|��}|j|��}d|�d��_|�|d��|�|d��|�|d��dS)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_copyys���	����
�V�V�,�
-�
-��
�T�Y�r�]�]��
�T�]�2�
�
��"�����������R�!:�;�;�;����R�!:�;�;�;����R�!:�;�;�;�;�;r!c�l�t�d��}|�d��|�|�dd��d��|�dd��|�|�d��d��t�dd���}|�|�d��d��|�|jddi��ddi}t�d|��}|���|�|�d��d��|�|jddi��ddi}tjdi|��}|���|�|�d��d��|�|jddi��t�dddid���}|�|�d��d��|�|jddi��t�d��}d|_|�d	d
��|�dd��|�t�|��d
��|�t|�
����d	dg��|�t|�����ddg��|�|jdd��d|jd<d|jd<|�t�|��d��t�d��}|�dd��|�dd��|�dd��|�dd��|�t�|��d��dS)NrUr��defaultr�r��otherr�aa�testa�testval�testb�test2s-<test testa="testval" testb="test2">aa</test>)rr)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=r|rlr}r�rzr�ry�tostring�sortedr�r�)r5rLrzs   r�test_attribzElementTreeTest.test_attrib�s����z�z�%� � ���������������%��3�3�Y�?�?�?������ � � �������%���'�2�2�2��z�z�%�W�z�-�-��������%���'�2�2�2������u�g�&6�7�7�7���!���z�z�%��(�(��������������%���'�2�2�2������u�g�&6�7�7�7���!���z�*�*�6�*�*��������������%���'�2�2�2������u�g�&6�7�7�7��z�z�%�%��!1�w�z�?�?��������%���'�2�2�2������u�g�&6�7�7�7��z�z�&�!�!����	�����)�$�$�$�����'�"�"�"�������T�*�*�@�	B�	B�	B������	�	���,�,�w��.@�A�A�A������
�
���-�-�%�'9�:�	<�	<�	<������W�-�w�7�7�7�&���G��&���G��������T�*�*�N�	P�	P�	P��z�z�&�!�!������d��������f��������i� � � �����&�'�'�'�������T�*�*�n�	p�	p�	p�	p�	pr!c��t�d��}ddi}|�d|��}|�|j|d���|�|��|�|d��|���|�|d��|�|��|�|d��|�||g��|�|d	��|g|dd�<|�|d��t|g��|dd�<|�|d��dS)
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=r|�makeelement�assertIsNotrzr�r�r�r��tuple)r5rLrz�subelems    r�test_makeelementz ElementTreeTest.test_makeelement�sX���z�z�%� � ����!���"�"�8�V�4�4��������5F��G�G�G����G�������T�#F�G�G�G��
�
�������T�9�-�-�-����G�������T�#F�G�G�G����W�g�&�'�'�'����T�[�	]�	]�	]��)��Q�Q�Q�����T�#F�G�G�G���	�"�"��Q�Q�Q�����T�#F�G�G�G�G�Gr!c��t�t��}tj��}|�|d���|�|���d��t�t��}tj��}|�|d���|�|���d��tt��5}|�
��}ddd��n#1swxYwYt���}|�|j
d��|�|��|�|���d��t���}t�|���}|�|��|�|���d��dS)NrC�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�s����x�x��'�'��������
�
�6�I�
�.�.�.�������*�*��	�	�	��x�x�)�*�*��������
�
�6�I�
�.�.�.�������*�*��	�	�	��.�
!�
!�	�Q��6�6�8�8�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�������������4�4�4����D�������V�\�\�^�^��	�	�	����!�!�����V��,�,�����D�������V�\�\�^�^��	�	�	�	�	s�7D�D�Dc���t�d��}|�t�|d���d��t�d��}|�t�|d���d��gd�}t�|��}|�t�|��d��|�d�t�|����d��|�t�|d��d��t�d��\}}|�t|��d	��t�d
��\}}|�t|��d��|�|dj
d��dS)
N�<html><body>text</body></html>rCr)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}r	r��fromstringlist�join�tostringlist�XMLIDr~rU)r5r��sequence�_�idss     r�test_parseliteralz!ElementTreeTest.test_parseliteral�s����&�&�9�:�:��������W�y��A�A�0�	2�	2�	2��-�-� @�A�A��������W�y��A�A�0�	2�	2�	2�=�=�=���#�#�H�-�-��������W�-�-�1�	3�	3�	3�������"�/�/�'�":�":�;�;�1�	3�	3�	3�������W�g�6�6�2�	3�	3�	3����:�;�;���3�����S���1�%�%�%����D�E�E���3�����S���1�%�%�%�����V���&�1�1�1�1�1r!c��tj}|t��}t|��\}}|�||jfd��|�d�|D��gd���|�|jjd��|t��}|�d�|D��gd���d}|t|��}|�d�|D��g��d}|t|�	��}|�d
�|D��g��d}|t|��}|�d�|D��gd
���d}|t|��}|�d�|D��gd���d}|tj	d��|��}d�|D��}|�|ddg��d}ttd��5}|�t��5}|||��ddd��n#1swxYwY|�
|j��ddd��n#1swxYwY|�t|j��d��t#j|��5|�t��5}|t|��ddd��n#1swxYwY|�t|j��d��~ddd��n#1swxYwYtjd��}	d}||	|��}|�d�|D��ddg��tj	d��}	||	��}
t|
��\}}|�||jfd��|�tj��5}t|
��ddd��n#1swxYwY|�t|j��d ��|�t,jt0��tt0d!��5}|�d"��ddd��n#1swxYwY|t0��}
t|
��\}}|�||jfd��t#j|��5|�tj��5}t|
��ddd��n#1swxYwY|�t|j��d ��~~
ddd��n#1swxYwYt#j|��5|t0��}
~
ddd��n#1swxYwY|�t4��5|d#��ddd��dS#1swxYwYdS)$N��endr�c�&�g|]\}}||jf��Sr"rT�rW�actionrLs   rrXz2ElementTreeTest.test_iterparse.<locals>.<listcomp>�#��I�I�I����6�4�8�,�I�I�Ir!)r2�r3r��r3�rootr:c�&�g|]\}}||jf��Sr"rTr5s   rrXz2ElementTreeTest.test_iterparse.<locals>.<listcomp>$r7r!)�r3�{namespace}elementr<�r3�{namespace}empty-element�r3�{namespace}rootr"c�&�g|]\}}||jf��Sr"rTr5s   rrXz2ElementTreeTest.test_iterparse.<locals>.<listcomp>-r7r!��eventsc�&�g|]\}}||jf��Sr"rTr5s   rrXz2ElementTreeTest.test_iterparse.<locals>.<listcomp>1r7r!��startr3c�&�g|]\}}||jf��Sr"rTr5s   rrXz2ElementTreeTest.test_iterparse.<locals>.<listcomp>5r7r!��rGr:�rGr�r2rKr2)rGr�r8r9)rGr3�start-ns�end-nsc�6�g|]\}}|dvr	||jfn||f��S)rFrTr5s   rrXz2ElementTreeTest.test_iterparse.<locals>.<listcomp>BsH��7�7�7�*�f�d�17�:J�0J�0J�6�4�8�,�,�39�4�.�7�7�7r!)
�rL)��	namespace�rGrA�rGr=r<rSr<�rGr?r>r@�rMN�rLrMz<root xmlns=''/>c��g|]\}}|��Sr"r"r5s   rrXz2ElementTreeTest.test_iterparse.<locals>.<listcomp>Ss��2�2�2�,�&�$�v�2�2�2r!rLrM�rGr3�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>
)rLc��g|]	\}}||f��
Sr"r"r5s   rrXz2ElementTreeTest.test_iterparse.<locals>.<listcomp>is ��E�E�E�\�V�T�6�4�.�E�E�Er!)rL)rPuhttp://éffbot.org/ns)rL)uclé�http://effbot.org/nsz<document />junk)r3�documentz.junk after document element: line 1, column 12�wbs<document />junk�nonexistent)r=�	iterparser��nextr}rUr:rrFrHrr�r��assertFalse�closedr�r�r�check_no_resource_warningrG�
ParseError�
addCleanupr�unlinkrrI�FileNotFoundError)r5r`�contextr6rLrD�resr!r��sourcer�s           r�test_iterparsezElementTreeTest.test_iterparses����L�	��)�N�+�+���G�}�}�������&�$�(�+�-?�@�@�@����I�I��I�I�I�L�L�L�	�	�	�
	
�����)�6�2�2�2��)�-�.�.�����I�I��I�I�I�L�L�L�	�	�	����)�N�F�3�3�����I�I��I�I�I�2�N�N�N����)�N�6�:�:�:�����I�I��I�I�I�2�N�N�N�!���)�N�F�3�3�����I�I��I�I�I�	L�	L�	L�		�		�		�8���)�-�v�6�6�����7�7�.5�7�7�7�9�9�9�
	�
	�
	�(���)�B�K�(;�<�<�f�E�E��2�2�'�2�2�2������z�8�4�5�5�5�*��
�.�$�
'�
'�	'�1��"�"�:�.�.�
%�"��	�!�V�$�$�$�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%����
%�
%�
%�
%����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�	
����R�\�*�*�,C�D�D�D�
�
6�t�
<�
<�	�	��"�"�:�.�.�
2�"��	�.�&�1�1�1�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2����
2�
2�
2�
2����S���.�.�0G�H�H�H��		�	�	�	�	�	�	�	�	�	�	����	�	�	�	���
G�H�H�����)�F�F�+�+�����E�E�W�E�E�E�=�@�H�	�	�	�
��/�0�0��
�Y�v�
�
���B�x�x�������&�$�(�+�-@�A�A�A�
�
�
�r�}�
-�
-�	����H�H�H�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����R�\�*�*�@�	B�	B�	B�	
���	�(�&�1�1�1�
�&�$�
�
�	)�1�
�G�G�'�(�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�
�Y�v�
�
���B�x�x�������&�$�(�+�-@�A�A�A�
�
6�t�
<�
<�	�	��"�"�2�=�1�1�
�R��R����
�
�
�
�
�
�
�
�
�
�
����
�
�
�
����S���.�.�D�
F�
F�
F��B�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��
6�t�
<�
<�	�	���6�"�"�B��	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��
�
�0�
1�
1�	%�	%��I�m�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�	%�	%s��,I�
H �I� H$	�$I�'H$	�(I�I�I�L�3K�L�K	�L�K	�,L�L�L�
O)�)O-�0O-�Q8�8Q<�?Q<� U�6T�U�T	�U�T	�-U�U�U�2V�V�V�5W�W�Wc�
�t�d��}d|_|�|d��dt�|d��_|�|d��d|_|�|d��|�dt�d	����|�|d
��t�dd��|d<|�|d
��dS)NrUryz<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=r|ryr��
SubElementrUr��Commentr��r5rLs  r�test_writefilezElementTreeTest.test_writefile�s����z�z�%� � ����	����T�#4�5�5�5�-6��
�
�d�H�%�%�*����T�#L�M�M�M�������T�#A�B�B�B����A�r�z�z�)�,�,�-�-�-����T�<�	>�	>�	>��%�%��w�'�'��Q�����T�#N�O�O�O�O�Or!c��tt��5}|���}ddd��n#1swxYwYGd�dt��}|��}t�|���}|�|��|�|gd���tt��5}|���}ddd��n#1swxYwYGd�dt��}|��}t�|���}|�|��|�|gd���dS)Nc� �eZdZd�Zd�Zd�ZdS)�4ElementTreeTest.test_custom_builder.<locals>.Builderc�4�|�d|f��dS�NrG�r��r5rUrzs   rrGz:ElementTreeTest.test_custom_builder.<locals>.Builder.start�������W�c�N�+�+�+�+�+r!c�4�|�d|f��dS�Nr3ry�r5rUs  rr3z8ElementTreeTest.test_custom_builder.<locals>.Builder.end�������U�C�L�)�)�)�)�)r!c��dSr^r"�r5rys  rr*z9ElementTreeTest.test_custom_builder.<locals>.Builder.data�����r!N)r@rArBrGr3r*r"r!r�Builderrv�sA������
,�
,�
,�
*�
*�
*�
�
�
�
�
r!r�rrIc�8�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	dS)	rvc�4�|�d|f��dSrxryrzs   rrGz:ElementTreeTest.test_custom_builder.<locals>.Builder.start�r{r!c�4�|�d|f��dSr}ryr~s  rr3z8ElementTreeTest.test_custom_builder.<locals>.Builder.end�rr!c��dSr^r"r�s  rr*z9ElementTreeTest.test_custom_builder.<locals>.Builder.data�r�r!c�6�|�d||f��dS)N�piry)r5rr*s   rr�z7ElementTreeTest.test_custom_builder.<locals>.Builder.pi�s!�����T�6�4�0�1�1�1�1�1r!c�4�|�d|f��dS)Nrory)r5r*s  rroz<ElementTreeTest.test_custom_builder.<locals>.Builder.comment�s�����Y��-�.�.�.�.�.r!c�6�|�d||f��dS)NrLry)r5�prefix�uris   r�start_nsz=ElementTreeTest.test_custom_builder.<locals>.Builder.start_ns�s!�����Z���5�6�6�6�6�6r!c�4�|�d|f��dS�NrMry�r5r�s  r�end_nsz;ElementTreeTest.test_custom_builder.<locals>.Builder.end_ns�������X�v�.�/�/�/�/�/r!N)
r@rArBrGr3r*r�ror�r�r"r!rr�z4ElementTreeTest.test_custom_builder.<locals>.Builder�s}������
,�
,�
,�
*�
*�
*�
�
�
�
2�
2�
2�
/�
/�
/�
7�
7�
7�
0�
0�
0�
0�
0r!))r�r�r*)ro�	 comment )rLrPrQrRrSr<rSr<rTr>r@�rMrP)	rr�rrr=rrr}r)r5r!r*r��builderr"s      r�test_custom_builderz#ElementTreeTest.test_custom_builder�s����.�
!�
!�	�Q��6�6�8�8�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	�	�	�	�d�	�	�	��'�)�)�����W��-�-�����D��������	#�	#�	#�		�		�		��#�
$�
$�	���6�6�8�8�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	0�	0�	0�	0�	0�d�	0�	0�	0��'�)�)�����W��-�-�����D��������
#�
#�
#�
	�
	�
	�
	�
	s�6�:�:�:C�C�"Cc���Gd�dt��}|��}t�|���}|�t	jd����|�|gd���dS)Nc��eZdZd�ZdS)�@ElementTreeTest.test_custom_builder_only_end_ns.<locals>.Builderc�4�|�d|f��dSr�ryr�s  rr�zGElementTreeTest.test_custom_builder_only_end_ns.<locals>.Builder.end_ns�r�r!N)r@rArBr�r"r!rr�r��s#������
0�
0�
0�
0�
0r!r�ra            <?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>
            ))rMr�)rM�pr�)rr=rr�textwrap�dedentr})r5r�r�r"s    r�test_custom_builder_only_end_nsz/ElementTreeTest.test_custom_builder_only_end_ns�s���	0�	0�	0�	0�	0�d�	0�	0�	0��'�)�)�����W��-�-�����H�O�%���	�	�	�	
����#�#�#�	�	�	�	�	r!c��t�d���}|�|jtj��t���}|�|jtj��dS)Nr)r=rr{rr)r5r"�parser2s   r�%test_initialize_parser_without_targetz5ElementTreeTest.test_initialize_parser_without_target�s^�����T��*�*�����f�m�R�^�<�<�<��,�,�.�.�����g�n�b�n�=�=�=�=�=r!c��ttd��5}t�|��}ddd��n#1swxYwY|�d�|������D��gd�gggg��|�d�|���D��gd�gggg��t�t��}|�tt|����d��|�tt|d����d��|�|dd�t|����|d}|d}|dd�=|�tt|����d��|�||d��|�||d��||g|dd�<|�||d��|�||d��|�||d��|���|�t|��g��dS)	NrZc�,�g|]}t|����Sr"�rZrVs  rrXz1ElementTreeTest.test_children.<locals>.<listcomp>�s0��=�=�=�"�)��.�.�=�=�=r!)r�r�r�c�,�g|]}t|����Sr"r�rVs  rrXz1ElementTreeTest.test_children.<locals>.<listcomp>s0��3�3�3�"�)��.�.�3�3�3r!�r�r�r)
rr�r=rr}r�r�r�r�r~r�assertNotEqualr�)r5r!rPrL�child1�child2s      r�
test_childrenzElementTreeTest.test_children�s����.�$�
'�
'�	�1��8�8�A�;�;�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	����=�=�&*�l�l�n�n�&9�&9�&;�&;�=�=�=�7�7�7����	?�	�	�	�	
���3�3�&*�i�i�k�k�3�3�3�7�7�7����	5�	�	�	��v�v�j�!�!������T�$�Z�Z���!�,�,�,�����T�$�q�'�]�]�+�+�Q�/�/�/�����a�a�a��$�t�*�*�-�-�-��a����a�����1��I�����T�$�Z�Z���!�,�,�,������a��)�)�)������a��)�)�)��V�$��Q�q�S�	������a��)�)�)������a��)�)�)����F�D��G�,�,�,��
�
��������d���R�(�(�(�(�(s�=�A�Ac�&�t�d��}|�t�|��d��t�d��}|�t�|��d��dS)Nr%r&)r=r�r}r	r�rrs  r�test_writestringz ElementTreeTest.test_writestringsr���v�v�6�7�7��������T�*�*�,M�N�N�N��}�}�=�>�>��������T�*�*�,M�N�N�N�N�Nr!c��t�d��}t�|��|�t�|��d��t�d��}t�|��|�t�|��d��t�d��}t�|��|�t�|��d��t�d��}t�|��|�t�|��d��t�d��}t�|��|�t�|��d	��t�d
��}t�|��|�t�|��d��dS)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}r	rrs  r�test_indentzElementTreeTest.test_indent$s����v�v�o�&�&��
�	�	�$����������T�*�*�K�8�8�8��v�v�6�7�7��
�	�	�$����������T�*�*�,S�T�T�T��v�v�9�:�:��
�	�	�$����������T�*�*�,S�T�T�T��v�v�:�;�;��
�	�	�$����������T�*�*�,U�V�V�V��v�v�W�X�X��
�	�	�$��������K�K����
�	
�	
�	
��v�v�P�Q�Q��
�	�	�$��������K�K����
�	
�	
�	
�	
�	
r!c��t�d��}t�|d���|�t�|��d��t�d��}t�|d���|�t�|��d��dS)Nr��	)�spacesD<html>
	<body>
		<p>pre<br />post</p>
		<p>text</p>
	</body>
</html>rPs><html>
<body>
<p>pre<br />post</p>
<p>text</p>
</body>
</html>r�rrs  r�test_indent_spacez!ElementTreeTest.test_indent_spacePs����v�v�P�Q�Q��
�	�	�$�d�	�#�#�#�����K�K����
�	
�	
�	
��v�v�P�Q�Q��
�	�	�$�b�	�!�!�!�����K�K����
�	
�	
�	
�	
�	
r!c��t�d��}t�|��|�d�|���D��hd���|�d�|���D��hd���|�td�|���D����td�|���D������dS)Nz@<html><body><p>par</p><p>text</p><p><br/></p><p /></body></html>c��h|]	}|j��
Sr"�rx�rW�els  r�	<setcomp>z<ElementTreeTest.test_indent_space_caching.<locals>.<setcomp>m���+�+�+��R�W�+�+�+r!>N�
�
  �
    c��h|]	}|j��
Sr"�ryr�s  rr�z<ElementTreeTest.test_indent_space_caching.<locals>.<setcomp>qr�r!>N�
      �parryr�r�c��h|]	}|j��
Sr"r�r�s  rr�z<ElementTreeTest.test_indent_space_caching.<locals>.<setcomp>us��/�/�/�R���/�/�/r!c�6�h|]}t|j����Sr")�idrxr�s  rr�z<ElementTreeTest.test_indent_space_caching.<locals>.<setcomp>vs ��3�3�3���B�G���3�3�3r!)r=r�r�r}r�r~rrs  r�test_indent_space_cachingz)ElementTreeTest.test_indent_space_cachingis���v�v�X�Y�Y��
�	�	�$�������+�+�t�y�y�{�{�+�+�+�*�*�*�	
�	
�	
�	
���+�+�t�y�y�{�{�+�+�+�?�?�?�	
�	
�	
�	
����/�/�4�9�9�;�;�/�/�/�0�0��3�3�t�y�y�{�{�3�3�3�4�4�	
�	
�	
�	
�	
r!c��t�d��}|�t��5t�|d���ddd��n#1swxYwY|�t�|��d��t�|d���|�t�|��d��t�d��}t�|dd�	��|�t�|��d
��dS)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}r	rrs  r�test_indent_levelz!ElementTreeTest.test_indent_levelysc���v�v�P�Q�Q��
�
�
�z�
*�
*�	&�	&��I�I�d�"�I�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�����K�K����H�	
�	
�	
�
	�	�	�$�a�	� � � �����K�K����
�	
�	
�	
��v�v�P�Q�Q��
�	�	�$�a�s�	�+�+�+�����K�K����
�	
�	
�	
�	
�	
s�A�A"�%A"c��t�d��}|�t�|d���d��|�t�|dd���d��dS)N�0<body xmlns="http://effbot.org/ns"><tag/></body>rCr�A<ns0:body xmlns:ns0="http://effbot.org/ns"><ns0:tag /></ns0:body>r\�rE�default_namespace�1<body xmlns="http://effbot.org/ns"><tag /></body>�r=r�r}r	rrs  r�test_tostring_default_namespacez/ElementTreeTest.test_tostring_default_namespace�s���v�v�H�I�I������K�K��y�K�1�1�O�	
�	
�	
�	
����K�K��y�DZ�K�[�[�?�	
�	
�	
�	
�	
r!c��t�d��}|�t�|dd���d��dS)Nr�rC�foobarr�zP<ns1:body xmlns="foobar" xmlns:ns1="http://effbot.org/ns"><ns1:tag /></ns1:body>r�rrs  r�3test_tostring_default_namespace_different_namespacezCElementTreeTest.test_tostring_default_namespace_different_namespace�sN���v�v�H�I�I������K�K��y�H�K�M�M�^�	
�	
�	
�	
�	
r!c���t�d��}d}|�t|��5t�|dd���ddd��dS#1swxYwYdS)Nr�z>^cannot use non-qualified names with default_namespace option$rCr�r�)r=r��assertRaisesRegexr�r	)r5rL�EXPECTED_MSGs   r�5test_tostring_default_namespace_original_no_namespacezEElementTreeTest.test_tostring_default_namespace_original_no_namespace�s����v�v�+�,�,��W��
�
#�
#�J��
=�
=�	N�	N��K�K��y�H�K�M�M�M�	N�	N�	N�	N�	N�	N�	N�	N�	N�	N�	N�	N����	N�	N�	N�	N�	N�	Ns�A#�#A'�*A'c��t�d��}|�t�|d���d��dS)Nr�rCrr�r�rrs  r� test_tostring_no_xml_declarationz0ElementTreeTest.test_tostring_no_xml_declaration�sL���v�v�+�,�,������K�K��y�K�1�1�"�	
�	
�	
�	
�	
r!c��t�d��}|�t�|dd���d��dS)Nr��utf8T�rE�xml_declarations:<?xml version='1.0' encoding='utf8'?>
<body><tag /></body>r�rrs  r�test_tostring_xml_declarationz-ElementTreeTest.test_tostring_xml_declaration�sN���v�v�+�,�,������K�K��v�t�K�D�D�J�	
�	
�	
�	
�	
r!c��t�d��}|�t�|dd���d��dS)Nr�rCTr��;<?xml version='1.0' encoding='utf-8'?>
<body><tag /></body>r�rrs  r�.test_tostring_xml_declaration_unicode_encodingz>ElementTreeTest.test_tostring_xml_declaration_unicode_encoding�sN���v�v�+�,�,������K�K��y�$�K�G�G�J�	
�	
�	
�	
�	
r!c	��t�d��}gd�}|D]j\}}}|�d|�d|����5|�t�|||���|��ddd��n#1swxYwY�kdS)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�rCN)r�NF)r�r�F)r�r�F)s<body><tag>�</tag></body>r�F)r�rCF)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>rCTz	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�3��
�
�
�	�<;D�
	�
	�6�O�X�����C�(�C�C�1@�C�C�D�D�	
�	
�� � ��K�K��!)�(7� ���
$�
���	
�	
�	
�	
�	
�	
�	
�	
�	
�	
�	
����	
�	
�	
�	
��
	�
	s�2B�B	�B	c	�H�t�d��}|�d�t�|d�����d��|�d�t�|dd�����d��dS)	Nr�rPrCrr�r\r�r�)r=r�r}r*r+rrs  r�#test_tostringlist_default_namespacez3ElementTreeTest.test_tostringlist_default_namespace�s����v�v�H�I�I������G�G�B�O�O�D�9�O�=�=�>�>�O�	
�	
�	
�	
����G�G�B�O�O�D�9�Pf�O�g�g�h�h�?�	
�	
�	
�	
�	
r!c�J�t�d��}|�d�t�|d�����d��|�d�t�|d�����d	��t�|dd�
��}|�d�|��d��|�|dd
��|�gd�|dd���dS)Nr�rPrCrr�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_declaration�s���v�v�+�,�,������G�G�B�O�O�D�9�O�=�=�>�>�"�	
�	
�	
�	
����H�H�R�_�_�T�4�_�@�@�A�A�N�	
�	
�	
�
�_�_�T�I�t�_�T�T�
�����G�G�J���J�	
�	
�	
�	
����A��(P�Q�Q�Q����A�A�A�:�a�b�b�>�R�R�R�R�Rr!c
�X���d�fd�	}|dd��|dd��|dd��|dd	��|d
d��|dd
��d���fd�}gd�}|D]Q}��t�t�||������d���Rgd�}|D]1}��t
tj||�����2gd�}|D]6}��tjtj||�����7��t
tj�d���d������ttj�d���d����dS)NrPc���d|�d|�d�}��t�|�|����j|����t�|��j|��dS)Nz<?xml version='1.0' encoding='z'?><xml>z</xml>)r}r=r�r)ry)rEr(�xmlr5s   �r�checkz,ElementTreeTest.test_encoding.<locals>.checkss�����H�H�d�d�d�$�C����R�V�V�C�J�J�x�$8�$8�9�9�>��E�E�E����R�V�V�C�[�[�-�t�4�4�4�4�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>.xmls
��?�(�J�Jr!c�@���|���|��Sr^)r))rEr�s �r�bxmlz+ElementTreeTest.test_encoding.<locals>.bxmls����3�x�=�=�'�'��1�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-latin2rzmac-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)rP)	r}r=r	r�r�r�rer)�LookupError)r5r�r�supported_encodingsrE�&unsupported_ascii_compatible_encodings�(unsupported_ascii_incompatible_encodingsr�s`      @r�
test_encodingzElementTreeTest.test_encodings����	5�	5�	5�	5�	5�	5�
	��g�s����
��j�#����
��l�F�#�#�#�
��m�X�&�&�&�
��g�x� � � �
��k�8�$�$�$�	K�	K�	K�	2�	2�	2�	2�	2�
�
�
��",�	N�	N�H����R�[�[������X���)?�)?�@�@�*�M�M�M�M�2
�2
�2
�.�?�	B�	B�H����j�"�&�$�$�x�.�.�A�A�A�A�4
�4
�4
�0�A�	E�	E�H����b�m�R�V�T�T�(�^�^�D�D�D�D����*�b�f�c�c�+�.>�.>�.E�.E�g�.N�.N�O�O�O����+�r�v�s�s�5�z�z�/@�/@��/I�/I�J�J�J�J�Jr!c��t�d��}d|_|�t	|��d��|�t	|d���d��|�t	|d���d��|�t	|d���d��|�t	|d���d	��dS)
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>
ryz1 < 2
)r=r�rxr}rQ�r5r�s  r�test_methodszElementTreeTest.test_methodsKs���
�F�F�B�C�C���������1���B�	D�	D�	D�����1�T�2�2�2�B�	D�	D�	D�����1�U�3�3�3�B�	D�	D�	D�����1�V�4�4�4�=�	?�	?�	?�����1�V�4�4�4�i�@�@�@�@�@r!c���t�d��}|�t|��d��|�t|d���d��dS)Nz(<html><CamelCase>text</CamelCase></html>rCrB�r=r�r}rQrDs  r�test_issue18347zElementTreeTest.test_issue18347Zsk���F�F�=�>�>������1���:�	<�	<�	<�����1�V�4�4�4�:�	<�	<�	<�	<�	<r!c�h�t�d��}|�t|d���d��|�|d��|�tj��5}t�d��ddd��n#1swxYwY|�t|j��d��|�tj��5}t�t��ddd��n#1swxYwY|�t|j��d��t�
��}d	|jd
<|�t��|�
��}|�|d��|�tj��5}t�t��ddd��n#1swxYwY|�t|j��d��dS)
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 10ry�entityz<document>text</document>z,undefined entity &entity;: line 4, column 10)r=r�r}rQr�r�rer�r��
ENTITY_XMLrrJrr�EXTERNAL_ENTITY_XML)r5r�r�r"r:s     r�test_entityzElementTreeTest.test_entityas���

�F�F�?�@�@������1�z�:�:�:�=�	?�	?�	?����Q� J�K�K�K��
�
�r�}�
-�
-�	4���F�F�2�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�����R�\�*�*�5�	7�	7�	7��
�
�r�}�
-�
-�	���F�F�:����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����R�\�*�*�>�	@�	@�	@�
������"(��
�h�����J�����|�|�~�~�����T�#>�?�?�?��
�
�r�}�
-�
-�	(���F�F�&�'�'�'�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�����R�\�*�*�>�	@�	@�	@�	@�	@s6�5B�B �#B �. D�D�!D� G?�?H�Hc���t�d��}|�|d��t�d��}|�|d��t�d��}|�|d��t�d��}|�|d��t�t��}|�|d	��dS)
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_NSrrs  r�test_namespacezElementTreeTest.test_namespace�s��
�v�v�-�.�.�����T�#:�;�;�;��v�v�[�\�\�����T�Q�	S�	S�	S��v�v�O�P�P�����T�E�	G�	G�	G��v�v�_�`�`�����T�S�	U�	U�	U��v�v�m�$�$�����T�
�	�	�	�	�	r!c�J�t�d��}|�|d��t�t�d����}|�|d��t�t�dd����}|�|d��t�t�dd����}t�|t�dd����}t�|t�dd����}|�|d��|���d|jd	<|�|d
��|���d|jt�d	��<|�|d
��|���d|jd	<|�|d��|���t�d��|jd	<|�|d
��|���t�d��}t�d��|jd<|�|��|�|��|�|d��|�tt�dd����d��|�tt�d����d��t�dd��}t�dd��}|�||��t�dd��}|�
||��|�
|d��|�|d��dS)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=r|r��QNamerpr�rzr�r}r�r�)r5rLr�q1�q2s     r�
test_qnamezElementTreeTest.test_qname�s|��
�z�z�*�%�%�����T�#@�A�A�A��z�z�"�(�(�:�.�.�/�/�����T�#@�A�A�A��z�z�"�(�(�5�%�0�0�1�1�����T�#@�A�A�A��z�z�"�(�(�5�%�0�0�1�1���-�-��b�h�h�u�f�&=�&=�>�>���-�-��b�h�h�u�f�&=�&=�>�>�����T�I�	K�	K�	K�
	
�
�
����")���J�����T�9�	;�	;�	;�	
�
�
����,3���B�H�H�Z�(�(�)����T�9�	;�	;�	;�	
�
�
����".���J�����T�>�	@�	@�	@�	
�
�
����"$�(�(�<�"8�"8���J�����T�=�	?�	?�	?�	
�
�
�����*�*�U�#�#��&(�h�h�}�&=�&=���{�#����G�������G�������T�
�	�	�	�	
����R�X�X�d�E�2�2�3�3�Y�?�?�?�����R�X�X�i�0�0�1�1�9�=�=�=�
�X�X�d�E�
"�
"��
�X�X�d�E�
"�
"������R� � � �
�X�X�d�K�
(�
(�����B��#�#�#����B��)�)�)�����Y�'�'�'�'�'r!c�:�t�d��}dS)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�rrs  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=���dS)?Nrr2c�p����d���||��D��|��dS)Nc��g|]	\}}|p|��
Sr"r")rW�oprUs   rrXzGElementTreeTest.test_xpath_tokenizer.<locals>.check.<locals>.<listcomp>�s6��Y�Y�Y�")�"�c�!�i�C�Y�Y�Yr!)r}�xpath_tokenizer)r�r��
namespacesr3r5s   ��rr�z3ElementTreeTest.test_xpath_tokenizer.<locals>.check�sY������Y�Y�-8�-H�-H��J�-W�-W�Y�Y�Y�%�
'�
'�
'�
'�
'r!r�ztext()ry�()z@name�@rnz@*zpara[1])�para�[�1�]zpara[last()])rbrc�lastr`rez*/para)r��/rbz/doc/chapter[5]/section[2])rg�docrg�chapterrc�5rerg�sectionrc�2rez
chapter//para)ri�//rbz//pararmrbz//olist/item)rm�olistrg�item�.z.//para)rprmrb�..z../@lang)rqrgra�langzchapter[title])rirc�titlerez#employee[@secretary and @assistant])
�employeercra�	secretaryrP�andrPra�	assistantrez	@{ns}attrz{ns}attr�{http://spam}eggz
./spam.egg)rprgzspam.eggz.//{http://spam}egg)rprmrxz{ns}*�{}*�{*}tag�{*}*z	.//{*}tag)rprmrzz
./xsd:type)rprg�&{http://www.w3.org/2001/XMLSchema}type�xsdz http://www.w3.org/2001/XMLSchema�typer|rPz	@xsd:typez@typez@{*}typez{*}type)rPrSr^)r4r3)r5r�r3s` @r�test_xpath_tokenizerz$ElementTreeTest.test_xpath_tokenizer�s�����)�)�)�)�)�)�	'�	'�	'�	'�	'�	'�	'�	��c�C�5����
��h����'�'�'�
��g��V�}�%�%�%�
��d�S�#�J����
��i�0�0�0�1�1�1�
��n�>�>�>�?�?�?�
��h�*�*�*�+�+�+�
��*�.�.�.�	/�	/�	/�	��o�8�8�8�9�9�9�
��h��v��'�'�'�
��n�:�:�:�;�;�;�
��c�C�5����
��i�,�,�,�-�-�-�
��d�T�F����
��j�2�2�2�3�3�3�
��� >� >� >�?�?�?�
��3�6K�6K�6K�	L�	L�	L�	��k�C��,�-�-�-�
�� �#5�"6�7�7�7�
��l�2�2�2�3�3�3�
��#�%D�%D�%D�E�E�E�	��g��y�!�!�!�
��e�e�W����
��h��
�#�#�#�
��f�v�h����
��k�0�0�0�1�1�1�	��l�P�P�P��8�9�	;�	;�	;�
��f�?�@��5�6�	8�	8�	8�
��k�C�!I�J��8�9�	;�	;�	;�
��g��V�}��5�6�	8�	8�	8�
��j�3�	�*��5�6�	8�	8�	8�
��k�C��,�5�7�9�9�	:�	:�	:�	:�	:r!c�@�|�t�t�dd����d��|�t�t�dd����d��|�t�t�dd����d��|�t�t�dd��d��d��dS)	Nr�instructions<?test instruction?>z
<testing&>s<?test <testing&>?>u<testing&>ãzlatin-1s=<?xml version='1.0' encoding='latin-1'?>
<?test <testing&>�?>)r}r=r	r�r�r�s r�test_processinginstructionz*ElementTreeTest.test_processinginstruction*s���	
������R�%=�%=�f�m�%T�%T�U�U�'�	)�	)�	)�������R�U�U�6�=�%A�%A�B�B�'�	)�	)�	)�
	
������R�U�U�6�<�%@�%@�A�A�&�	(�	(�	(�������R�U�U�6�3C�%D�%D�i�P�P�+�	,�	,�	,�	,�	,r!c�\�dD]�}||���fD]�}d|z}tt�d|z��d���}|�||��tt�d|�d|�d���d���}|�||������dS)	N)�AREA�BASE�BASEFONT�BR�COL�EMBED�FRAME�HR�IMG�INPUT�ISINDEX�LINK�META�PARAM�SOURCE�TRACK�WBRz<%s>z<%s />rCrB�<z></r�)�lowerrQr=r�r})r5r�rLr��
serializeds     r�#test_html_empty_elems_serializationz3ElementTreeTest.test_html_empty_elems_serialization:s���2�		7�		7�G�!�'�-�-�/�/�2�
7�
7��!�D�=��&�r�v�v�h��o�'>�'>�v�N�N�N�
�� � ��X�6�6�6�&�r�v�v�v�T�T�T�$�$�$�.G�'H�'H�.4�6�6�6�
�� � ��X�6�6�6�6�

7�		7�		7r!c��t�ddd���}tj��5}t�|��ddd��n#1swxYwY|�|���d��dS)N�
cirriculum�public�example��status�companyz1<cirriculum status="public" company="example" />
)r=r|r�captured_stdout�dumpr}rJ)r5r��stdouts   r�test_dump_attribute_orderz)ElementTreeTest.test_dump_attribute_orderHs����J�J�|�H�i�J�H�H��
�
$�
&�
&�	�&��G�G�A�J�J�J�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�������*�*�M�	O�	O�	O�	O�	Os�A�A�Ac���t�ddd���}|�t|��d��|�t|d���d��dS)	Nr�r�r�r�z0<cirriculum status="public" company="example" />rCrBz;<cirriculum status="public" company="example"></cirriculum>)r=r|r}rQ�r5r:s  r�test_tree_write_attribute_orderz/ElementTreeTest.test_tree_write_attribute_orderPsx���z�z�,�x��z�K�K������4���K�	M�	M�	M�����4��7�7�7�M�	O�	O�	O�	O�	Or!c��t�t��}|�|djddi��dS)Nrz*{http://www.w3.org/XML/1998/namespace}lang�eng)r=r��ATTLIST_XMLr}rzr�s  r�test_attlist_defaultz$ElementTreeTest.test_attlist_defaultXsJ���}�}�[�)�)������a���F��N�	P�	P�	P�	P�	Pr!N)0r@rArBr�r�r�r�r�r�r�r�rrr#r0rlrsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r@rErHrMrPrWrYrr�r�r�r�r�r"r!rr�r��s�������4�4�4�A:�A:�A:�F?�?�?�6*?�*?�*?�X$�$�$�	!�	!�	!�
6�
6�
6�
<�
<�
<�4p�4p�4p�lH�H�H�,+�+�+�Z2�2�2�,v%�v%�v%�pP�P�P�";�;�;�z���,>�>�>�#)�#)�#)�JO�O�O�*
�*
�*
�X
�
�
�2
�
�
� 
�
�
�@	
�	
�	
�
�
�
�N�N�N�
�
�
�
�
�
�
�
�
�*�*�*�X	
�	
�	
�S�S�S�&9K�9K�9K�v
A�
A�
A�<�<�<�#@�#@�#@�J���B?(�?(�?(�B%�%�%�8:�8:�8:�t,�,�,� 7�7�7�O�O�O�O�O�O�P�P�P�P�Pr!r�c�p�eZdZdd�Zdd�Zdd�Zdd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�ZdS)�XMLPullParserTestNc��|�|�|��dStdt|��|��D]"}|�||||z����#dS�Nr)rr�r~)r5r"r*�
chunk_sizer�s     r�_feedzXMLPullParserTest._feedasm�����K�K��������1�c�$�i�i��4�4�
2�
2�����D��1�Z�<��0�1�1�1�1�
2�
2r!c��|�d�t|���|��D��|��dS)Nc�4�g|]\}}||j|jff��Sr")rUry)rW�eventrLs   rrXz3XMLPullParserTest.assert_events.<locals>.<listcomp>js@��
J�
J�
J�����d�h��	�*�
+�
J�
J�
Jr!)r}r�read_events�r5r"r��
max_eventss    r�
assert_eventszXMLPullParserTest.assert_eventshs^�����
J�
J� &�v�'9�'9�';�';�Z� H� H�
J�
J�
J��	�	�	�	�	r!c��|�tt|���|����|��dSr^)r}rrr�r�s    r�assert_event_tuplesz%XMLPullParserTest.assert_event_tuplesnsH��������*�*�,�,�j�9�9�:�:��	�	�	�	�	r!c��t|���|��}|�d�|D��|��dS)Nc�&�g|]\}}||jf��Sr"rTr5s   rrXz7XMLPullParserTest.assert_event_tags.<locals>.<listcomp>us#��H�H�H����6�4�8�,�H�H�Hr!)rr�r})r5r"r�r�rDs     r�assert_event_tagsz#XMLPullParserTest.assert_event_tagsssS����*�*�,�,�j�9�9�����H�H��H�H�H�!�	#�	#�	#�	#�	#r!c��dD�]�}|�|���5t���}|�|g��|�|d|��|�|g��|�|d|��|�|g��|�|d|��|�|dg��|�|d|��|�|d|��|�|dd	g��|�|d
|��|�|dg��|�|�����ddd��n#1swxYwY���dS)N)Nr��)r��<!-- comment -->
z+<root>
  <element key='value'>text</element�>
r2�<element>text</element>tail
�<empty-element/>
r8�</root>
r9)r�r=�
XMLPullParserr�r�r�r)r5r�r"s   r�test_simple_xmlz!XMLPullParserTest.test_simple_xmlxs���&�	2�	2�J������4�4�
2�
2��)�)�+�+���&�&�v�r�2�2�2��
�
�6�#7��D�D�D��&�&�v�r�2�2�2��
�
�6�I�%�'�'�'��&�&�v�r�2�2�2��
�
�6�5�*�5�5�5��&�&�v�0B�/C�D�D�D��
�
�6�#B�J�O�O�O��
�
�6�#7��D�D�D��&�&�v�&�,�0�����
�
�6�;�
�;�;�;��&�&�v��/@�A�A�A��!�!�&�,�,�.�.�1�1�1�'
2�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2����
2�
2�
2�
2��	2�	2s�EE;�;E?	�E?	c��t���}|���}|�|d��t	|��\}}|�||jfd��|�|d��t	|��\}}|�||jfd��|�t��5t	|��ddd��dS#1swxYwYdS)Nz-<root>
  <element key='value'>text</element>
r2r�r9)	r=r�r�r�rar}rUr��
StopIteration)r5r"r�r6rLs     r�test_feed_while_iteratingz+XMLPullParserTest.test_feed_while_iterating�s)���!�!�#�#��
�
�
�
!�
!���
�
�6�L�M�M�M��B�x�x�������&�$�(�+�-?�@�@�@��
�
�6�;�'�'�'��B�x�x�������&�$�(�+�_�=�=�=�
�
�
�}�
-�
-�	�	���H�H�H�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�C/�/C3�6C3c��t���}|�|g��|�|d��|�|g��|�|d��|�|g��|�|d��|�|g��|�|d��|�|dg��|�|d��|�|d��|�|ddg��|�|d	��|�|d
g��|�|�����dS)Nr��<root xmlns='namespace'>
�"<element key='value'>text</elementr�r<r�r�r>r�r@)r=r�r�r�r�r�r5r"s  r�test_simple_xml_with_nsz)XMLPullParserTest.test_simple_xml_with_ns�sy���!�!�#�#�����v�r�*�*�*��
�
�6�/�0�0�0����v�r�*�*�*��
�
�6�7�8�8�8����v�r�*�*�*��
�
�6�?�@�@�@����v�r�*�*�*��
�
�6�5�!�!�!����v�(E�'F�G�G�G��
�
�6�:�;�;�;��
�
�6�/�0�0�0����v�)�/�(�	�	�	�	
�
�
�6�;�'�'�'����v�(B�'C�D�D�D����&�,�,�.�.�)�)�)�)�)r!c��t�d���}|�|d��|�|d��|�t	|�����dg��|�|d��|�|d��|�|d��|�|d	��|�|d
��|�t	|�����dg��|�|�����dS)NrVrCr�r�rOr�r�r�r�r�rU)r=r�r�r}rr�r�rr�s  r�test_ns_eventsz XMLPullParserTest.test_ns_events�s1���!�!�)?�!�@�@���
�
�6�/�0�0�0��
�
�6�7�8�8�8������#�#�%�%�&�&�
,�-�	/�	/�	/�	
�
�
�6�?�@�@�@��
�
�6�5�!�!�!��
�
�6�:�;�;�;��
�
�6�/�0�0�0��
�
�6�;�'�'�'�����f�0�0�2�2�3�3�6F�5G�H�H�H����&�,�,�.�.�)�)�)�)�)r!c��t�d���}|�|d��|�|ddgd���|�|dgd	���|�|d
��|�|ddg��|�|d
��|���|�|dg��dS)N)rLrGr3rC� <tag xmlns='abc' xmlns:p='xyz'>
�rL)rP�abc�rL)r��xyzr��r��rG�{abc}tagr��
<child />
�rG�
{abc}child�r3r��</tag>
�r3r��r=r�r�r�r�rr�s  r�test_ns_events_startz&XMLPullParserTest.test_ns_events_start�s���!�!�)E�!�F�F���
�
�6�>�?�?�?�� � ��%�&�*
��	!�	�	�	�	
���v�!�(
��	�	�	�	�	
�
�
�6�=�)�)�)����v�#�!�(
�	�	�	�
	
�
�
�6�:�&�&�&����������v��(
�	�	�	�	�	r!c���t�d���}|�|d��|�|ddgd���|�|dgd	���|�|d
��|�|ddg��|�|d
��|���|�|dgd	���|�|ddg��dS)N)rLrGr3rMrCr�r�r�r�r�r�r�r�r�r�r�r�rUr�r�s  r�test_ns_events_start_endz*XMLPullParserTest.test_ns_events_start_end�sB���!�!�)O�!�P�P���
�
�6�>�?�?�?�� � ��%�&�*
��	!�	�	�	�	
���v�!�(
��	�	�	�	�	
�
�
�6�=�)�)�)����v�#�!�(
�	�	�	�
	
�
�
�6�:�&�&�&����������v��(
��	�	�	�	�	
� � ����*
�	�	�	�	�	r!c���t�d���}|�|d��|�|g��t�d���}|�|d��|�|g��t�d���}|�|d��|�|dg��|�|d��|�|d	g��|�|d
��|�|dg��|�|d��|�|gd
���|�|d��|�|�����|�|dg��t�d���}|�|d��|�|g��|�|d��|�|dg��|�|d��|�|d	g��|�|d
��|�|g��|�|d��|�|ddg��|�|d��|�|�����dS)Nr"rCz<root/>
rF�<!-- text here -->
z<root>
rJr�rKr�r2z8<element xmlns='foo'>text<empty-element/></element>tail
)�rG�{foo}element�rG�{foo}empty-element)r3r�)r3r�z</root>r9)rGr�r�r�)r=r�r�r�r�r�rr�s  r�test_eventszXMLPullParserTest.test_events�s����!�!��!�,�,���
�
�6�;�'�'�'����v�r�*�*�*��!�!�)9�!�:�:���
�
�6�1�2�2�2����6�2�&�&�&��!�!�)9�!�:�:���
�
�6�:�&�&�&����v�(9�':�;�;�;��
�
�6�?�@�@�@����v�(<�'=�>�>�>��
�
�6�5�!�!�!����v�(:�';�<�<�<��
�
�6�N�	P�	P�	P����v�(�(�(�	�	�	�	
�
�
�6�9�%�%�%����&�,�,�.�.�)�)�)����v��'8�9�9�9��!�!��!�4�4���
�
�6�/�0�0�0����v�r�*�*�*��
�
�6�:�&�&�&����v�(9�':�;�;�;��
�
�6�?�@�@�@����v�(<�'=�>�>�>��
�
�6�5�!�!�!����v�r�*�*�*��
�
�6�N�	P�	P�	P����v�%�+�(�	�	�	�	
�
�
�6�9�%�%�%����&�,�,�.�.�)�)�)�)�)r!c�t�t�d���}|�|d��|�|dtjdffg��|�|d��|�|dtjdffg��|�|d��|�|d	g��|�|d
��|�|dtjdffg��|�|d��|�|d
g��|�|d��|�|dtjdffg��t�d���}|�|d��|�|dtjdffg��dS)N)rGror3rCr�roz text here z<!-- more text here -->
z more text here z<root-tag>text)rG�root-tagz<!-- inner comment-->
z inner commentz</root-tag>
)r3r�z<!-- outer comment -->
z outer comment )ro)r=r�r�r�rqr�r�s  r�test_events_commentz%XMLPullParserTest.test_events_comments����!�!�)D�!�E�E���
�
�6�1�2�2�2����6�Y���]�0K�$L�#M�N�N�N��
�
�6�6�7�7�7����6�Y���=O�0P�$Q�#R�S�S�S��
�
�6�+�,�,�,����v�(=�'>�?�?�?��
�
�6�4�5�5�5����6�Y���=M�0N�$O�#P�Q�Q�Q��
�
�6�?�+�+�+����v�(;�'<�=�=�=��
�
�6�5�6�6�6����6�Y���=N�0O�$P�#Q�R�R�R��!�!��!�6�6���
�
�6�1�2�2�2����6�Y���]�0K�$L�#M�N�N�N�N�Nr!c�^�t�d���}|�|d��|�|dtjdffg��t�d���}|�|d��|�|dtjdffg��dS)	N)rGr�r3rCz
<?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_pi2s����!�!�)?�!�@�@���
�
�6�+�,�,�,����6�T�B�E�:�+>�$?�#@�A�A�A��!�!��!�1�1���
�
�6�6�7�7�7����6�T�B�E�3H�+I�$J�#K�L�L�L�L�Lr!c�\�ddh}t�|���}|�|d��|�|ddg��Gd�d��}t�|�����}|�|d��|�|ddg��dS)	Nr3rGrCz<foo>bar</foo>)rGr�)r3r�c� �eZdZd�Zd�Zd�ZdS)�9XMLPullParserTest.test_events_sequence.<locals>.DummyIterc�2�tgd���|_dS)N)rGr3rL)r�rDr�s r�__init__zBXMLPullParserTest.test_events_sequence.<locals>.DummyIter.__init__Bs��"�#?�#?�#?�@�@����r!c��|Sr^r"r�s r�__iter__zBXMLPullParserTest.test_events_sequence.<locals>.DummyIter.__iter__Ds���r!c�*�t|j��Sr^)rarDr�s rr�zBXMLPullParserTest.test_events_sequence.<locals>.DummyIter.__next__Fs���D�K�(�(�(r!N)r@rArBr�r�r�r"r!r�	DummyIterr�AsD������
A�
A�
A�
�
�
�
)�
)�
)�
)�
)r!r�)r=r�r�r�)r5�eventsetr"r�s    r�test_events_sequencez&XMLPullParserTest.test_events_sequence:s����7�#���!�!��!�2�2���
�
�6�+�,�,�,����v�(8�.�'I�J�J�J�	)�	)�	)�	)�	)�	)�	)�	)��!�!�����!�5�5���
�
�6�+�,�,�,����v�(8�.�'I�J�J�J�J�Jr!c��|�t��5t�d���ddd��dS#1swxYwYdS)NrXrC)r�r�r=r�r�s r�test_unknown_eventz$XMLPullParserTest.test_unknown_eventMs���
�
�
�z�
*�
*�	?�	?����$=��>�>�>�	?�	?�	?�	?�	?�	?�	?�	?�	?�	?�	?�	?����	?�	?�	?�	?�	?�	?s�A�A�Ar^)r@rArBr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"r!rr�r�_s������2�2�2�2���������
#�#�#�#�
2�2�2�.
�
�
�*�*�*�*
*�
*�
*����.���6,*�,*�,*�\O�O�O�&M�M�M�K�K�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�Zdd�Zd�Zd�Zd�Zd�Zd	�Z	dS)�XIncludeTestr�Nc��	t|}n#t$rtd���wxYw|dkrt�|��}|S)N�resource not foundr�)�XINCLUDE�KeyError�OSErrorr=r�)r5�hrefrrEr*s     r�xinclude_loaderzXIncludeTest.xinclude_loader�sY��	0��D�>�D�D���	0�	0�	0��.�/�/�/�	0�����E�>�>��6�6�$�<�<�D��s�
�*c��dSr^r")r5rr"rEs    r�none_loaderzXIncludeTest.none_loader�s���tr!c��|dkrVt|d��5}t�|�����cddd��S#1swxYwYdSdS)Nr�rZ)rr=rr�)r5rrr!s    r�
_my_loaderzXIncludeTest._my_loader�s����E�>�>��d�D�!�!�
-�Q��x�x��{�{�*�*�,�,�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-����
-�
-�
-�
-�
-�
-��4s�,A�A�Ac��ddlm}|�d��}|�||j��|�t
|��d��dS)Nrr0rz�<document>
  <p>Example.</p>
  <root>
   <element key="value">text</element>
   <element>text</element>tail
   <empty-element />
</root>
</document>)r4r1r�includerr}rQ)r5r1rhs   r�test_xinclude_defaultz"XIncludeTest.test_xinclude_default�sn��,�,�,�,�,�,��"�"�=�1�1�����s�D�O�4�4�4�����3���
�	�	�	�	�	r!c��ddlm}|�d��}|�||j��|�t|��d��|�d��}|�||j��|�t|��d��|�d��}|�||j��|�t|��d��|�d	��}|�||j��|�t|��d
��|�d��}|�t��5}|�||j��ddd��n#1swxYwY|�t|j	��d��|�t|��d
��dS)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>rzX<document>
  <p>This document has been <em>accessed</em>
  324387 times.</p>
</document>rz�<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>rraI<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>)
r4r1rrr}rQr�rr�r��r5r1r]r�s    r�
test_xincludezXIncludeTest.test_xinclude�s^��,�,�,�,�,�,��'�'��1�1�����x��)=�>�>�>�����8�,�,�
�	�	�	��'�'��1�1�����x��)=�>�>�>�����8�,�,�
�	�	�	��'�'�	�2�2�����x��)=�>�>�>�����8�,�,�
�	�	�	��'�'��1�1�����x��)=�>�>�>�����8�,�,�
�	�	�	��'�'��1�1��
�
�
�w�
'�
'�	C�2��"�"�8�T�-A�B�B�B�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C����	C�	C�	C�	C�����R�\�*�*�,@�A�A�A�����8�,�,�
�		�		�		�		�		s�F*�*F.�1F.c���ddlm}|�d��}|�||j��|�dt|�d������dS)Nrr0rr�z.//p)r4r1rrr}r~r�)r5r1r]s   r�test_xinclude_repeatedz#XIncludeTest.test_xinclude_repeated;ss��,�,�,�,�,�,��'�'�(A�B�B�����x��)=�>�>�>������H�$4�$4�V�$<�$<� =� =�>�>�>�>�>r!c�v�ddlm}t�td��}|�|j��5}|�||j���ddd��n#1swxYwY|�	t|j��d��t�td��}|�|j��5}|�||j���ddd��n#1swxYwY|�	t|j��d��t�td��}|�|j��5}|�||j���ddd��n#1swxYwY|�	t|j��d	��t�td
��}|�|j��5}|�||j���ddd��n#1swxYwY|�	t|j��d��|�
d��}|�|j��5}|�||j
��ddd��n#1swxYwY|�	t|j��d
��|�
d��}|�|j��5}|�||j
d���ddd��n#1swxYwY|�	t|j��d
��|�
d��}|�|j��5}|�||j
d���ddd��n#1swxYwY|�	t|j��d��|�
d��}|�|j��5}|�||j
d���ddd��n#1swxYwY|�	t|j��d��|�
d��}|�|j��5}|�||j
d���ddd��n#1swxYwY|�	t|j��d��|�
d��}|�|j��5}|�||j
d���ddd��n#1swxYwY|�	t|j��d
��dS)Nrr0r�)rpz%cannot load 'disclaimer.xml' as 'xml'r�z!cannot load 'count.txt' as 'text'rz1unknown parse type in xi:include tag ('BAD_TYPE')rzYxi:fallback tag must be child of xi:include ('{http://www.w3.org/2001/XInclude}fallback')rz#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��FatalIncludeErrorrrr}r�r��XINCLUDE_BADr�LimitedRecursiveIncludeErrorrs    r�test_xinclude_failuresz#XIncludeTest.test_xinclude_failuresBss��,�,�,�,�,�,��6�6�(�8�,�-�-��
�
�
�~�?�
@�
@�	F�B��"�"�8�D�4D�"�E�E�E�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F����	F�	F�	F�	F�����R�\�*�*�7�	9�	9�	9��6�6�(�8�,�-�-��
�
�
�~�?�
@�
@�	F�B��"�"�8�D�4D�"�E�E�E�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F����	F�	F�	F�	F�����R�\�*�*�3�	5�	5�	5��6�6�,�x�0�1�1��
�
�
�~�?�
@�
@�	F�B��"�"�8�D�4D�"�E�E�E�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F����	F�	F�	F�	F�����R�\�*�*�C�	E�	E�	E��6�6�,�x�0�1�1��
�
�
�~�?�
@�
@�	F�B��"�"�8�D�4D�"�E�E�E�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F����	F�	F�	F�	F�����R�\�*�*�@�	A�	A�	A�
�'�'�(8�9�9��
�
�
�~�?�
@�
@�	C�B��"�"�8�T�-A�B�B�B�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C����	C�	C�	C�	C�����R�\�*�*�5�	7�	7�	7��'�'�(8�9�9��
�
�
�~�?�
@�
@�	S�B��"�"�8�T�-A�T�"�R�R�R�	S�	S�	S�	S�	S�	S�	S�	S�	S�	S�	S����	S�	S�	S�	S�����R�\�*�*�5�	7�	7�	7��'�'�(8�9�9��
�
�
�~�J�
K�
K�	P�r��"�"�8�T�-A�Q�"�O�O�O�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P����	P�	P�	P�	P�����R�\�*�*�S�	U�	U�	U��'�'�(8�9�9��
�
�
�~�J�
K�
K�	P�r��"�"�8�T�-A�Q�"�O�O�O�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P����	P�	P�	P�	P�����R�\�*�*�S�	U�	U�	U��'�'�(8�9�9��
�
�
�~�J�
K�
K�	P�r��"�"�8�T�-A�Q�"�O�O�O�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P����	P�	P�	P�	P�����R�\�*�*�S�	U�	U�	U��'�'�(8�9�9��
�
�
�~�?�
@�
@�	P�B��"�"�8�T�-A�Q�"�O�O�O�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P�	P����	P�	P�	P�	P�����R�\�*�*�5�	7�	7�	7�	7�	7s��A/�/A3�6A3�!D
�
D�D�<F%�%F)�,F)�I�I�I�"K
�
K�K�,M�M�M�8O"�"O&�)O&�Q.�.Q2�5Q2�S:�:S>�S>�V�V
�
V
)r�Nr^)
r@rArBrrrrrrr"r"r!rr	r	�s���������������������>�>�>�@?�?�?�D7�D7�D7�D7�D7r!r	c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zej
ej��d
��d���Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"dS)�BugsTestc����fd�}t�d��}||��t�d��}d|_||��t�d��}d|_||��t�d��}|�dd��||��t�d��}|�dd��||��dS)Nc������t��5}t|��ddd��n#1swxYwY��t	|j��d��dS)Nzcannot serialize 123 (type int))r��	TypeErrorrQr}r�r�)rLr�r5s  �rr�z-BugsTest.test_bug_xmltoolkit21.<locals>.check�s�����"�"�9�-�-�
 ���$����
 �
 �
 �
 �
 �
 �
 �
 �
 �
 �
 ����
 �
 �
 �
 ����S���.�.�5�
7�
7�
7�
7�
7s�8�<�<�{rL�123)r=r|ryrxr�)r5r�rLs`  r�test_bug_xmltoolkit21zBugsTest.test_bug_xmltoolkit21�s����	7�	7�	7�	7�	7��z�z�#����
��d�����z�z�&�!�!����	�
��d�����z�z�&�!�!����	�
��d�����z�z�&�!�!������e����
��d�����z�z�&�!�!����������
��d�����r!c��t�t��}t�|��}|�|�d��d��|�|�d��d��dS)NrUryr�rn)r=r�r�r/r}r�)r5rLrPs   r�test_bug_xmltoolkit25zBugsTest.test_bug_xmltoolkit25�sp���v�v�j�!�!���~�~�d�#�#��������u�-�-�v�6�6�6�������}�5�5�y�A�A�A�A�Ar!c��t�d��}|�t|�d����g��|�t|�d����dg��dS)N�"<doc><table><tbody/></table></doc>z.//theadz.//tbody�tbody)r=r�r}rZr��r5rPs  r�test_bug_xmltoolkit28zBugsTest.test_bug_xmltoolkit28�sr���v�v�:�;�;���������Z�(@�(@�A�A�2�F�F�F��������Z�(@�(@�A�A�G�9�M�M�M�M�Mr!c��t�d��}tj��5}t�|��|�|���d��ddd��dS#1swxYwYdS)Nr.z$<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�M�M����V�_�_�.�.�0W�X�X�X�	Y�	Y�	Y�	Y�	Y�	Y�	Y�	Y�	Y�	Y�	Y�	Y����	Y�	Y�	Y�	Y�	Y�	Ys�AA>�>B�Bc�F�t�d��}|�t�|d��d��t�d��}|�|jddi��|�t�|d��d��t�d��}|�t�|d��d	��t�d
��}|�t�|d��d��t�d��}|�dd��|�t�|d��d��dS)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}r	rzr|r�r0s  r�test_bug_xmltoolkit39zBugsTest.test_bug_xmltoolkit39�sr���v�v�N�O�O��������T�7�3�3�5F�G�G�G��v�v�6�7�7�������y�*�&=�>�>�>�������T�7�3�3�5�	7�	7�	7��v�v�/�0�0��������T�7�3�3�0�	2�	2�	2��z�z�*�%�%��������T�7�3�3�5F�G�G�G��z�z�%� � ������l�+�+�+�������T�7�3�3�5�	7�	7�	7�	7�	7r!c���t�d��}|�t|d���d��|�t|��d��dS)Nz=<!DOCTYPE doc [<!ENTITY ldots '&#x8230;'>]><doc>&ldots;</doc>r�rs<doc>&#33328;</doc>u<doc>舰</doc>rGrDs  r�test_bug_xmltoolkit54zBugsTest.test_bug_xmltoolkit54�si��
�F�F�(�
)�
)������1�z�:�:�:�&�	(�	(�	(�����1���':�;�;�;�;�;r!c��|�tj��5}t�d��ddd��n#1swxYwY|�t|j��d��dS)Ns?<!DOCTYPE doc SYSTEM 'doc.dtd'><doc>&ldots;&ndots;&rdots;</doc>z+undefined entity &ldots;: line 1, column 36)r�r=rer�r}r�r�)r5r�s  r�test_bug_xmltoolkit55zBugsTest.test_bug_xmltoolkit55�s����
�
�r�}�
-�
-�	8���F�F�7�
8�
8�
8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8�	
����R�\�*�*�=�	?�	?�	?�	?�	?s�A�A�Ac�|�Gd�d��}|�ttj|����dS)Nc��eZdZd�ZdS)�5BugsTest.test_bug_xmltoolkit60.<locals>.ExceptionFilec��t�r^)r�r5r�s  rrz:BugsTest.test_bug_xmltoolkit60.<locals>.ExceptionFile.read�s���
r!N)r@rArBrr"r!r�
ExceptionFiler<�s#������
�
�
�
�
r!r?)r�rr=r)r5r?s  r�test_bug_xmltoolkit60zBugsTest.test_bug_xmltoolkit60�sR��	�	�	�	�	�	�	�	�	
���'�2�8�]�]�_�_�=�=�=�=�=r!c�$�ddd�}t���}|j�|��|�d��|���}|�|�d��jd��dS)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=rrJ�updaterrr}r�ry)r5�ENTITIESr"�ts    r�test_bug_xmltoolkit62zBugsTest.test_bug_xmltoolkit62�s���&��9�9���������
���X�&�&�&����%�	&�	&�	&�
�L�L�N�N���������/�/�4�K�	M�	M�	M�	M�	Mr!zSkips under coverage.c���d�}|��tjd��}td��D]}|���
|�tjd��|��dS)Nc��t���}|�di��|�d��|�d��dS)NrUry)r=rrGr*r3)rPs r�xmltoolkit63z4BugsTest.test_bug_xmltoolkit63.<locals>.xmltoolkit63	sJ���>�>�#�#�D��J�J�u�b�!�!�!��I�I�f�����H�H�U�O�O�O�O�Or!i�)re�getrefcountr�r})r5rJ�countr�s    r�test_bug_xmltoolkit63zBugsTest.test_bug_xmltoolkit63su��	�	�	�	��������%�%���t���	�	�A��L�N�N�N�N�������.�.��6�6�6�6�6r!c	��t�dd���}|�t�|��d��|�t�t�|�����d��d��|�t�t�t�|������d��dS)N�SomeTagzdef _f():
  return 3
r�s0<SomeTag text="def _f():&#10;  return 3&#10;" />ry)r=r|r}r	r�rlrDs  r�test_bug_200708_newlinez BugsTest.test_bug_200708_newlines���
�J�J�y�'@�J�A�A��������Q���C�	E�	E�	E����������A���/�/�3�3�F�;�;�)�	+�	+�	+�������R�V�V�B�K�K��N�N�%;�%;�<�<�C�	E�	E�	E�	E�	Er!c��t���}|�d��|�|���jd��Gd�d��}t�|�����}|�d��|�|���jd��dS)Nz<element>some text</element>r�c��eZdZd�ZdS)�2BugsTest.test_bug_200708_close.<locals>.EchoTargetc�6�t�d��S)Nr��r=r|r�s rrz8BugsTest.test_bug_200708_close.<locals>.EchoTarget.close(s���z�z�)�,�,�,r!N�r@rArBrr"r!r�
EchoTargetrS's#������
-�
-�
-�
-�
-r!rWr)r=rrr}rrU)r5r"rWs   r�test_bug_200708_closezBugsTest.test_bug_200708_close s������������2�3�3�3���������+�Y�7�7�7�	-�	-�	-�	-�	-�	-�	-�	-����Z�Z�\�\��2�2�����2�3�3�3���������+�Y�7�7�7�7�7r!c��t�d��}t�|d��}|�t	|d���d��t�d��}t�|d��}t�|d��}|�t	|d���d��t�d��}t�|d��}t�|d��}|�t��5}t	|d���ddd��n#1swxYwY|�t|j��d��dS)	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=r|rpr}rQr�r�r�r�)r5r��sr�s    r�!test_bug_200709_default_namespacez*BugsTest.test_bug_200709_default_namespace.s����J�J��'�'���M�M�!�_�-�-������1�	�B�B�B�7�	9�	9�	9�
�J�J��'�'���M�M�!�_�-�-���M�M�!�0�1�1������1�	�B�B�B�
�	�	�	�
�J�J��'�'���M�M�!�_�-�-���M�M�!�V�$�$��
�
�
�z�
*�
*�	6�b��a�9�5�5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�����R�\�*�*�N�	P�	P�	P�	P�	Ps�:E�E�Ec���t�d��}|�t�|��d��t�dd��t�d��}|�t�|��d��t�d��}|�t�|��d��dS)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=r|r}r	�register_namespacerDs  r�"test_bug_200709_register_namespacez+BugsTest.test_bug_200709_register_namespaceEs����J�J�H�I�I��������Q���Q�	S�	S�	S�
���e�%O�P�P�P��J�J�H�I�I��������Q���Q�	S�	S�	S�

�J�J�@�A�A��������Q���G�	I�	I�	I�	I�	Ir!c���t�d��}|�t�d����|�|djtj��t�d��}|�t�d����|�|djtj��dS)Nr�r�r)r=r|r�rqr}rUr�)r5r�s  r�test_bug_200709_element_commentz(BugsTest.test_bug_200709_element_commentTs���
�J�J�s�O�O��	������E�"�"�#�#�#�����1���2�:�.�.�.��J�J�s�O�O��	������u����������1���2�5�)�)�)�)�)r!c���t�d��}t�|d��}t�|d��}t�d��}|�d|��|�t|��gd���|�d|��|�t|��gd���dS)	Nr�r�r�r�r)r�r�r�r�)r�r�r�r�)r=r|rpr�r}rZ�r5r�r�r�r�s     r�test_bug_200709_element_insertz'BugsTest.test_bug_200709_element_insert`s����J�J�s�O�O���M�M�!�S�!�!���M�M�!�S�!�!���J�J�s�O�O��	����A���������*�*�O�O�O�<�<�<�	����Q���������*�*�,@�,@�,@�A�A�A�A�Ar!c�d�t�d��}t�|d��}t�d��}|�|��|�t
|�tj����tjg��dS)Nr�r�zTEST-b)r=r|rprqr�r}rZr�)r5r�r��	comment_bs    r�test_bug_200709_iter_commentz%BugsTest.test_bug_200709_iter_commentjs}���J�J�s�O�O���M�M�!�S�!�!���J�J�x�(�(�	�	��������������r�z�(:�(:�;�;�b�j�\�J�J�J�J�Jr!c�&�t���}|�d��}|�di��}|�d��}|���}|�t|��d��dS)Nr*rUr
)r=rr*rGr3rr}rQ)r5r�r�s   r�test_bug_1534630zBugsTest.test_bug_1534630tss���n�n�����H�H�V�����I�I�e�R� � ���G�G�E�N�N���I�I�K�K������1���y�1�1�1�1�1r!c�*�t�d��}|�t�|d��d��t�d��}|�t�|d��d��dS)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�rDs  r�test_issue6233zBugsTest.test_issue6233|s����F�F�.�
/�
/��������Q��0�0�)�	*�	*�	*�
�F�F�*�
+�
+��������Q��0�0�)�	*�	*�	*�	*�	*r!c�(�t�d��}|�t|��dg��t�t��}|dd�|dd�<|�t|��gd���dS)Nr�rU�rUrUrk)r=r�r}rZr�)r5rL�newelems   r�test_issue6565zBugsTest.test_issue6565�s����v�v�+�,�,�������-�-��w�7�7�7��&�&��$�$���!�!�!�*��Q�Q�Q�������-�-�/H�/H�/H�I�I�I�I�Ir!c�r�t�dd��t�dd��dS)N�	test10777z
http://myuri/)r=r]r�s r�test_issue10777zBugsTest.test_issue10777�s6��	���k�?�;�;�;�
���k�?�;�;�;�;�;r!c�`��G�fd�d��}t�d���|���_����}t	|��}|�||��|��jt��|��jd��dS)Nc���eZdZ�fd�ZdS)�%BugsTest.test_lost_text.<locals>.Textc���d�_dS)N�changedTr�rDs �r�__bool__z.BugsTest.test_lost_text.<locals>.Text.__bool__�s���"����tr!N�r@rArBrw�r�s�rr�rt��.�������
�
�
�
�
�
�
r!r�rUrv)r=r|ryr�rar{r�r}�r5r�r�rFr�s    @r�test_lost_textzBugsTest.test_lost_text�s����	�	�	�	�	�	�	�	�	�	�

�J�J�u����������
�J�J�L�L����G�G�����a��&�&�&����a�f�c�*�*�*�������+�+�+�+�+r!c����G�fd�d��}t�d�����t�d����|���d_����}t|��}|�||��|��djt��|��djd��dS)Nc���eZdZ�fd�ZdS)�%BugsTest.test_lost_tail.<locals>.Textc�"��d�d_dS�NrvrTr�rDs �rrwz.BugsTest.test_lost_tail.<locals>.Text.__bool__�s���%��!��	��tr!Nrxrys�rr�r�rzr!r�r:rUrrv)	r=r|r�rxr�rar{r�r}r{s    @r�test_lost_tailzBugsTest.test_lost_tail�s����	�	�	�	�	�	�	�	�	�	�

�J�J�v����	������E�"�"�#�#�#��D�F�F��!��	�
�J�J�L�L����G�G�����a��&�&�&����a��d�i��-�-�-�����1���I�.�.�.�.�.r!c�|���G��fd�d��}t�d�����t�|��������t�d������d���	t	���}n%#t
$r|�d��YnwxYw|�|j|��|��djt��|�
�djd��dS)Nc���eZdZ��fd�ZdS)�$BugsTest.test_lost_elem.<locals>.Tagc�`��t�d���d<t���dSr�)r=r|ra)r5r�r�r�s  ��r�__eq__z+BugsTest.test_lost_elem.<locals>.Tag.__eq__�s(����z�z�)�,�,��!���Q�����tr!N�r@rArBr�)r�r�s��rr�r��s3�������
�
�
�
�
�
�
�
r!r�r:rUzgenerators are not reentrantrrv)r=r|r�r�rar��skipTestr{rUr�r})r5r�rFr�r�s   @@r�test_lost_elemzBugsTest.test_lost_elem�s;����	�	�	�	�	�	�	�	�	�	�	�
�J�J�v����	������C�C�E�E�"�"�#�#�#�	������E�"�"�#�#�#�
�F�F�5�M�M��	:��Q���A�A���	:�	:�	:��M�M�8�9�9�9�9�9�	:�������a�e�S�)�)�)����a��d�h��,�,�,�����1���9�-�-�-�-�-s�%B5�5C�Cc��d|z}t�|��}|�|�d��|�d����dS)Ns<a b="%s"/>r�r)r=r�r}rl�decode)r5ryr�r:s    r�check_expat224_utf8_bugz BugsTest.check_expat224_utf8_bug�sM���t�#���v�v�c�{�{��������#������G�(<�(<�=�=�=�=�=r!c�b�d}|�|��d}|�|��dS)Nsààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààsxàààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààà)r�r�s  r�test_expat224_utf8_bugzBugsTest.test_expat224_utf8_bug�s<��"���$�$�T�*�*�*�(���$�$�T�*�*�*�*�*r!c���ttd��5}|���}ddd��n#1swxYwYt�|��}|�d��}|�d�����}|�dd��}|dd�}|�	|�d��|��dS)NrZr�rrr�����)
r�UTF8_BUG_XMLFILErr=r�rlr��stripr&r})r5�fp�rawr:�xmlattrrys      r�test_expat224_utf8_bug_filez$BugsTest.test_expat224_utf8_bug_file�s���
�"�D�
)�
)�	�R��'�'�)�)�C�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��}�}�S�!�!���(�(�3�-�-���z�z�'�"�"�(�(�*�*���|�|�F�C�(�(���A�b�D�z��������#����-�-�-�-�-s�7�;�;c���|�tt���jd��|�tt���jdd��dS)NrU)r�r'r=rrGr�s r�test_39495_treebuilder_startz%BugsTest.test_39495_treebuilder_start�sT�����)�R�^�^�%5�%5�%;�U�C�C�C����)�R�^�^�%5�%5�%;�U�D�I�I�I�I�Ir!N)#r@rArBr*r,r1r3r5r7r9r@rG�unittest�skipIfre�gettracerMrPrXr[r^r`rcrfrhrjrnrqr|r�r�r�r�r�r�r"r!rr$r$�s����������8B�B�B�N�N�N�Y�Y�Y�7�7�7�2<�<�<�?�?�?�>�>�>�M�M�M�"�X�_�\�S�\�^�^�%<�=�=�7�7�>�=�7�	E�	E�	E�8�8�8�P�P�P�.
I�
I�
I�
*�
*�
*�B�B�B�K�K�K�2�2�2�
*�
*�
*�J�J�J�<�<�<�
,�
,�
,�/�/�/� .�.�.�(>�>�>�

+�
+�
+�.�.�.�J�J�J�J�Jr!r$c�J�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZdS)�BasicElementTestc� �d}ddi}t�||��}|�|tj��|�dt	|����|�dt	|����|�dt	|����|�dt	|����|�|j|��|�|j��|�|j	��|�
|j|��|�|j|��d|d	<|�
|j|��|�|j|��dS)
Nr��zix�wyprUrzryrx�bazr�)
r=r|r{r�r�r}rUr�ryrxrrzr�)r5rUrz�element_foos    r�
test___init__zBasicElementTest.test___init__�sm�����%�!���j�j��f�-�-��	
���k�2�:�6�6�6��
�
�e�S��-�-�.�.�.��
�
�h��K� 0� 0�1�1�1��
�
�f�c�+�.�.�/�/�/��
�
�f�c�+�.�.�/�/�/�	
�����#�.�.�.����+�*�+�+�+����+�*�+�+�+�	
����+�V�4�4�4�����+�V�4�4�4���u�
�����+�V�4�4�4����K�.��7�7�7�7�7r!c�x�dttj��vrtjd���t�dddi��}|�t�dddi����|�t��5|���}ddd��n#1swxYwY|�	||��|�
|j|j��|�
|j|j��|�
|j
|j
��|�
t|��t|����tj||��D]\}}|�||���|�
|j|j��dS)	Nr�zElement.copy() not presentr�r�r�r�r��qix)r�r=r|r��SkipTestr��assertWarns�DeprecationWarningr�rr}rUryrxr~�	itertools�zip_longest�assertIsrz�r5r��element_foo2r�r�s     rr�zBasicElementTest.test_copy
	s�����R�Z���(�(��#�$@�A�A�A��j�j��%��(8�9�9�����2�:�:�e�u�e�-=�>�>�?�?�?�
�
�
�0�
1�
1�	.�	.�&�+�+�-�-�L�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	
����{�3�3�3�	
����)�;�?�;�;�;�����*�K�,<�=�=�=�����*�K�,<�=�=�=�	
����\�*�*�C��,<�,<�=�=�=�!*� 5�k�<� P� P�	*�	*��V�V��M�M�&�&�)�)�)�)�	
����,�k�.@�A�A�A�A�As�B8�8B<�?B<c��t�dddi��}|�t�dddi����tj|��}|�||��|�|j|j��|�|j|j��|�|j|j��|�t|��t|����tj||��D]\}}|�||���|�|j
|j
��dS�Nr�r�r�r�r�r�)r=r|r�r�rr}rUryrxr~r�r�r�rzr�s     r�
test___copy__zBasicElementTest.test___copy__*	sC���j�j��%��(8�9�9�����2�:�:�e�u�e�-=�>�>�?�?�?��y��-�-��	
����{�3�3�3�	
����)�;�?�;�;�;�����*�K�,<�=�=�=�����*�K�,<�=�=�=�	
����\�*�*�C��,<�,<�=�=�=�!*� 5�k�<� P� P�	*�	*��V�V��M�M�&�&�)�)�)�)�	
����,�k�.@�A�A�A�A�Ar!c��t�dddi��}|�t�dddi����tj|��}|�||��|�|j|j��|�|j|j��|�|j	|j	��|�t|��t|����tj||��D]\}}|�||���|�|j
|j
��|�|j
|j
��d|j
d<|�|j
|j
��|�|j
|j
��dSr�)r=r|r�r�r�rr}rUryrxr~r�r�rzr�r�s     r�test___deepcopy__z"BasicElementTest.test___deepcopy__B	s����j�j��%��(8�9�9�����2�:�:�e�u�e�-=�>�>�?�?�?��}�[�1�1��	
����{�3�3�3�	
����)�;�?�;�;�;�����*�K�,<�=�=�=�����*�K�,<�=�=�=�	
����\�*�*�C��,<�,<�=�=�=�!*� 5�k�<� P� P�	-�	-��V�V����V�V�,�,�,�,�	
����,�k�.@�A�A�A�����,�k�.@�A�A�A�%*���5�!�����,�k�.@�A�A�A����L�/��1C�D�D�D�D�Dr!c��t�d��}|�t|jd��|�t|jt�d��dg��|�t|jdd��t�d��g|dd�<|�t��5d|d<ddd��n#1swxYwY|�t��5t�d��dg|dd�<ddd��n#1swxYwYt|d��r*ddgdd	d
d�}|�t|j|��t|d��rQGd
�dtj��}|d��g|dd�<|�ttj
|��dSdS)N�joer�r�r�r�__setstate__rUr�rxry)rU�	_childrenrzrxry�__deepcopy__c��eZdZd�ZdS)�9BasicElementTest.test_augmentation_type_errors.<locals>.Ec��dSr^r")r5�memos  rr�zFBasicElementTest.test_augmentation_type_errors.<locals>.E.__deepcopy__w	s���4r!N)r@rArBr�r"r!r�Er�v	s#������ � � � � r!r�)r=r|r�r'r�r�r�r�r�r�r�)r5r��stater�s    r�test_augmentation_type_errorsz.BasicElementTest.test_augmentation_type_errors`	sX���J�J�u�������)�Q�X�s�3�3�3����)�Q�X��
�
�5�0A�0A�5�/I�J�J�J����)�Q�X�q�%�8�8�8��
�
�5�!�!�"��!�!�!��
�
�
�y�
)�
)�	�	��A�a�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�y�
)�
)�	.�	.��J�J�u�%�%�u�-�A�a�a�a�D�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.��1�n�%�%�	@��"�V� �����E�
���i����?�?�?��1�n�%�%�	;�
 �
 �
 �
 �
 �B�J�
 �
 �
 ��A�e�H�H�:�A�a�a�a�D����i����:�:�:�:�:�	;�	;s$�C%�%C)�,C)�
"D8�8D<�?D<c��Gd�d��}|��}t�d|���|_tj|��}~t��|�|����t�d��}|��}||_tj|��}t�|d|���}~~~t��|�|����t�d��}t�d��}t�d��}|�|��|�|��|�|��tj|��}~~~t��|�|����dS)	Nc��eZdZdS)�.BasicElementTest.test_cyclic_gc.<locals>.DummyN�r@rArBr"r!r�Dummyr�}	��������Dr!r�r�)r�r�r�r�r�)	r=r|�dummyref�weakref�refr
r�rpr�)r5r�r��wrefr�r�r�r�s        r�test_cyclic_gczBasicElementTest.test_cyclic_gc|	s���	�	�	�	�	�	�	�	�
�E�G�G���Z�Z��A�Z�.�.��
��{�1�~�~��
��������$�$�&�&�!�!�!�
�J�J�u�����E�G�G����
��{�1�~�~��
�]�]�1�e�!�]�
,�
,��
�q�"��������$�$�&�&�!�!�!��Z�Z��
�
��
�Z�Z��
�
��
�Z�Z��
�
��
�	�	�"�
�
�
�
�	�	�"�
�
�
�
�	�	�"�
�
�
��{�2������B��������$�$�&�&�!�!�!�!�!r!c�@��d��fd�}t�d��}tj||��}|�|��jd��~t
��|��d��|�|��d��dS)NFc���d�dS�NTr")�w�flags �r�wref_cbz.BasicElementTest.test_weakref.<locals>.wref_cb�	s����D�D�Dr!r�T)r=r|r�r�r}rUr
)r5r�r�r�r�s    @r�test_weakrefzBasicElementTest.test_weakref�	s������	�	�	�	�	�
�J�J�s�O�O���{�1�g�&�&����������S�)�)�)�
���������t�$�$�$���������&�&�&�&�&r!c���t�dddd���}|�|�dd���d��|�|�d	d���d��dS)
Nr�r�r�r�)r�r��zr��)r�r�)r=r|r}rl)r5r�s  r�test_get_keyword_argsz&BasicElementTest.test_get_keyword_args�	sm��
�Z�Z��!�q�A�Z�
.�
.���������Q��/�/��3�3�3��������Q��/�/��3�3�3�3�3r!c	��tdtjdz��D�]g}t|jd���D�]L\}}|�dd���}d|_d|_|�|d	���	|�d
����|�	|�d	����|�
d��d�d
d��|�|d|||��}|�
|jd��|�
|jdd��|�
t!|��d��|�||����N��idS)Nr�r���repeatr��*)r�ztext goes herezopposite of head�child�
grandchildz
.//grandchildrr�zother valuer8r�)r�rf�HIGHEST_PROTOCOLrr`r|ryrxrpr�r�r�rvr}rUrzr~r�)r5rqrorpr�r�s      r�test_picklezBasicElementTest.test_pickle�	s{���1�f�5��9�:�:�	0�	0�E�")�$�,�q�"A�"A�"A�
0�
0�����N�N�5�b�N�1�1��)���+����!�!�!�W�-�-�4�4�V�^�^�L�5Q�5Q�R�R�R��������0�0�1�1�1��	�	�/�*�*�1�-�1�1�&�-�H�H�H��)�)�!�-D�*0�&�%�A�A��� � ����/�/�/�� � ���5�!1�2�6�6�6�� � ��R���!�,�,�,��(�(��B�/�/�/�/�
0�	0�	0r!c	��tdtjdz��D]�}t|jd���D]�\}}d}|�|��}|�|���dd��|�|d|||��}|�|j	d��|�|dj	d	������dS)
Nr�r�r�z\<?xml version="1.0"?>
                    <group><dogs>4</dogs>
                    </group>rU�groupr8r�dogs)
r�rfr�rr`r�r}�__getstate__rvrU)r5rqrorp�XMLTEXTr�r�s       r�test_pickle_issue18997z'BasicElementTest.test_pickle_issue18997�	s����1�f�5��9�:�:�
	4�
	4�E�")�$�,�q�"A�"A�"A�	
4�	
4���� ���&�&�w�/�/��� � ����!2�!2�5�!9�7�C�C�C��)�)�"�.E�*0�&�%�A�A��� � ����1�1�1�� � ��A���F�3�3�3�3�	
4�
	4�
	4r!N)
r@rArBr�r�r�r�r�r�r�r�r�r�r"r!rr�r��s�������8�8�8�6B�B�B�:B�B�B�0E�E�E�<;�;�;�8!"�!"�!"�F'�'�'�4�4�4�
0�0�0�&4�4�4�4�4r!r�c�J�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZdS)�BadElementTestc�f��G�fd�d��}|��g�t�d��}	|����n#t$rYnwxYwGd�d|tj��}|d��g�t�d��}|����dS)Nc�*��eZdZe�fd���ZdS)�2BadElementTest.test_extend_mutable_list.<locals>.Xc�\��t�d��g�dd�<tjS)Nr�rU�r5�Ls �r�	__class__z<BadElementTest.test_extend_mutable_list.<locals>.X.__class__�	s'����
�
�5�)�)�*��!�!�!���z�!r!N�r@rArB�propertyr��r�s�r�Xr��	�8�������
�
"�
"�
"�
"��X�
"�
"�
"r!r�r�c��eZdZdS)�2BadElementTest.test_extend_mutable_list.<locals>.YNr�r"r!r�Yr��	r�r!r�r��r=r|r�r'�r5r�r�r�r�s    @r�test_extend_mutable_listz'BadElementTest.test_extend_mutable_list�	s����	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�
�Q�S�S�E���J�J�u����	�
�H�H�Q�K�K�K�K���	�	�	��D�	����	�	�	�	�	��2�:�	�	�	�
�Q�s�V�V�H���J�J�u����	��������s�A
�
A�Ac����G�fd�d��}|��t�d��g�t�d��}	|����n#t$rYnwxYwGd�d|tj��}|d��t�d��g�t�d��}|����dS)Nc�*��eZdZe�fd���ZdS)�3BadElementTest.test_extend_mutable_list2.<locals>.Xc�&���dd�=tjSr^rUr�s �rr�z=BadElementTest.test_extend_mutable_list2.<locals>.X.__class__�	s����a�a�a�D��z�!r!Nr�r�s�rr�r��	r�r!r�r�r�c��eZdZdS)�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
���	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�
�Q�S�S�"�*�*�U�#�#�$���J�J�u����	�
�H�H�Q�K�K�K�K���	�	�	��D�	����	�	�	�	�	��2�:�	�	�	�
�Q�u�X�X�r�z�z�%�(�(�)���J�J�u����	��������s�A&�&
A3�2A3c���G�fd�dtj��}t�d�����|d��g��|�t�jt�d����t�d�����t�d��g��|�t�j|d����dS)Nc���eZdZ�fd�ZdS)�3BadElementTest.test_remove_with_mutating.<locals>.Xc����dd�=dS)NFr")r5�or�s  �rr�z:BadElementTest.test_remove_with_mutating.<locals>.X.__eq__�	s����a�a�a�D��ur!Nr�rys�rr�r�	s.�������
�
�
�
�
�
�
r!r�r�r�r�)r=r|r�r�r�r��r5r�r�s  @r�test_remove_with_mutatingz(BadElementTest.test_remove_with_mutating�	s����	�	�	�	�	�	�	��
�	�	�	�
�J�J�u����	���!�!�E�(�(��������*�a�h��
�
�5�0A�0A�B�B�B��J�J�u����	���"�*�*�U�#�#�$�%�%�%����*�a�h���%���9�9�9�9�9r!c��t�d��}t|d|��5|�t��5t|��ddd��n#1swxYwYddd��dS#1swxYwYdS)Nr�rU)r=r|rr��RuntimeErrorr�rDs  r�test_recursive_reprz"BadElementTest.test_recursive_repr
s����J�J�u����
�q�%��
#�
#�	�	��"�"�<�0�0�
�
��Q����
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s5�A;�A#�A;�#A'	�'A;�*A'	�+A;�;A?�A?c���G�fd�dt��}t���}|�di��|�d��|�|d����|�d��|�d��|����|��jd��dS)Nc���eZdZ�fd�ZdS)�/BadElementTest.test_element_get_text.<locals>.Xc�:��	�jdS#t$rYdSwxYwr^)ry�	NameErrorrrs �r�__del__z7BadElementTest.test_element_get_text.<locals>.X.__del__
s5�����I�I�I�I�� �����D�D����s��
�N�r@rArBr�rLs�rr�r
�.�������
�
�
�
�
�
�
r!r�rU�ABCD�EFGH�IJKL�ABCDEFGHIJKL)	r�r=rrGr*r3rr}ry�r5r�r�rLs   @r�test_element_get_textz$BadElementTest.test_element_get_text
s����	�	�	�	�	�	�	��	�	�	�
�N�N����	����r����	���v����	���q�q��y�y����	���v����	���e�����w�w�y�y�������N�3�3�3�3�3r!c�
��G�fd�dt��}t���}|�di��|�di��|�d��|�d��|�|d����|�d��|�d��|����|��djd	��dS)
Nc���eZdZ�fd�ZdS)�/BadElementTest.test_element_get_tail.<locals>.Xc�F��	�djdS#t$rYdSwxYwr�)rxrrrs �rrz7BadElementTest.test_element_get_tail.<locals>.X.__del__#
s9������G�L�L�L�L�� �����D�D����s�
�
 � Nrrs�rr�r"
rr!r�r:rUrrrrr)	r�r=rrGr3r*rr}rxrs   @r�test_element_get_tailz$BadElementTest.test_element_get_tail 
s����	�	�	�	�	�	�	��	�	�	�
�N�N����	��������	����r����	���e����	���v����	���q�q��y�y����	���v����	���f�
�
�
��w�w�y�y������a���~�6�6�6�6�6r!c�X��G�fd�d��}t�d�����t�d�����d|�����t�d�����dd|���dS)Nc���eZdZ�fd�ZdS)�%BadElementTest.test_subscr.<locals>.Xc����dd�=dS�Nr�r"rDs �r�	__index__z/BadElementTest.test_subscr.<locals>.X.__index__8
s����a�a�a�D��qr!N�r@rArBr#rys�rr�r 7
�.�������
�
�
�
�
�
�
r!r�rLr�rr�)r=r|r�rs  @r�test_subscrzBadElementTest.test_subscr5
s����	�	�	�	�	�	�	�	�	�	�

�J�J�v����	������G�$�$�%�%�%�	�$�1�1�3�3�$���	������G�$�$�%�%�%�	�!�B�q�q�s�s�(����r!c���G�fd�d��}t�d���td��D]0}��dt�d�����1g�dd|���<dS)Nc���eZdZ�fd�ZdS)�)BadElementTest.test_ass_subscr.<locals>.Xc���g�dd�<dSr"r"rDs �rr#z3BadElementTest.test_ass_subscr.<locals>.X.__index__F
s�����!�!�!���qr!Nr$rys�rr�r)E
r%r!r�rLr�rr�)r=r|r�r�)r5r�r.r�s   @r�test_ass_subscrzBadElementTest.test_ass_subscrC
s����	�	�	�	�	�	�	�	�	�	�

�J�J�v�����r���	-�	-�A�
�H�H�Q��
�
�7�+�+�,�,�,�,���!�B�q�q�s�s�(���r!c��d�}t�|���}|�di��|�d��|�t
|jdi��~t
��dS)Nc��gSr^r"�r�r�s  r�element_factoryz>BadElementTest.test_treebuilder_start.<locals>.element_factoryR
����Ir!�r/rUrr�)r=rrGr*r��AttributeErrorr
�r5r/r�s   r�test_treebuilder_startz%BadElementTest.test_treebuilder_startP
ss��	�	�	��N�N�?�N�;�;��	����r����	���v�������.�!�'�6�2�>�>�>�
������r!c��d�}t�|���}|�di��|�d��|�t
|jd��~t��dS)Nc��gSr^r"r.s  rr/z<BadElementTest.test_treebuilder_end.<locals>.element_factory^
r0r!r1rUr)r=rrGr*r�r2r3r
r3s   r�test_treebuilder_endz#BadElementTest.test_treebuilder_end\
sq��	�	�	��N�N�?�N�;�;��	����r����	���v�������.�!�%��7�7�7�
������r!N)
r@rArBr�r�rr	rrr&r+r4r7r"r!rr�r��	s����������&���&:�:�:����4�4�4�&7�7�7�*������
�
�
�
�
�
�
�
r!r�c��eZdZd�Zd�ZdS)�MutatingElementPathc�8�tj|g|�R�}||_|Sr^)r��__new__rL)rarLrr5s    rr;zMutatingElementPath.__new__j
s%���{�3�&��&�&�&����	��r!c��|jdd�=dSr�r�r5rs  rr�zMutatingElementPath.__eq__n
s���I�a�a�a�L��tr!N)r@rArBr;r�r"r!rr9r9i
s2�������������r!r9c��eZdZd�ZdS)�BadElementPathc��ddz�)Nr�rr"r=s  rr�zBadElementPath.__eq__t
s����c�	r!Nr�r"r!rr?r?s
s#����������r!r?c�X��eZdZ�fd�Z�fd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Z�xZ
S)�BadElementPathTestc�z��t�����ddlm}|j|_i|_dS�Nrr2)�super�setUpr4r3r��
path_cache�r5r3r�s  �rrFzBadElementPathTest.setUpy
s>���
���
�
����)�)�)�)�)�)�%�,�������r!c�l��ddlm}|j|_t	�����dSrD)r4r3rGr�rE�tearDownrHs  �rrJzBadElementPathTest.tearDown
s;���)�)�)�)�)�)�!�_���
���������r!c���t�d��}|�t�d��g��|�t	|d����dS�Nr�r�r�)r=r|r�r�r9rDs  r�test_find_with_mutatingz*BadElementPathTest.test_find_with_mutating�
sW���J�J�u����	���"�*�*�U�#�#�$�%�%�%�	���"�1�c�*�*�+�+�+�+�+r!c��t�d��}|�t�d��g��	|�t	d����dS#t
$rYdSwxYwrL)r=r|r�r�r?�ZeroDivisionErrorrDs  r�test_find_with_errorz'BadElementPathTest.test_find_with_error�
s{���J�J�u����	���"�*�*�U�#�#�$�%�%�%�	�
�F�F�>�#�&�&�'�'�'�'�'�� �	�	�	��D�D�	�����
"A.�.
A<�;A<c���t�d��}|�t�d��g��|�t	|d����dSrL)r=r|r�r�r9rDs  r�test_findtext_with_mutatingz.BadElementPathTest.test_findtext_with_mutating�
sW���J�J�u����	���"�*�*�U�#�#�$�%�%�%�	�
�
�&�q�#�.�.�/�/�/�/�/r!c��t�d��}|�t�d��g��	|�t	d����dS#t
$rYdSwxYwrL)r=r|r�r�r?rOrDs  r�test_findtext_with_errorz+BadElementPathTest.test_findtext_with_error�
s{���J�J�u����	���"�*�*�U�#�#�$�%�%�%�	�
�J�J�~�c�*�*�+�+�+�+�+�� �	�	�	��D�D�	���rQc���t�d��}t�|d��}dddgdig}|D]2}||_|�|�d��|���3dS)Nr�r�rPrFr"�./bar�r=r|rpryr}r�)r5�	root_elem�sub_elem�falsey�vals     r�(test_findtext_with_falsey_text_attributez;BadElementPathTest.test_findtext_with_falsey_text_attribute�
s���J�J�u�%�%�	��=�=��E�2�2���a���B��+���	?�	?�C��H�M����Y�/�/��8�8�#�>�>�>�>�	?�	?r!c���t�d��}t�|d��}d|_|�|�d��d��dS)Nr�r�rWrPrX)r5rYrZs   r�&test_findtext_with_none_text_attributez9BadElementPathTest.test_findtext_with_none_text_attribute�
sW���J�J�u�%�%�	��=�=��E�2�2����
�����+�+�G�4�4�b�9�9�9�9�9r!c���t�d��}|�t�d��g��|�t	|d����dSrL)r=r|r�r�r9rDs  r�test_findall_with_mutatingz-BadElementPathTest.test_findall_with_mutating�
sW���J�J�u����	���"�*�*�U�#�#�$�%�%�%�	�	�	�%�a��-�-�.�.�.�.�.r!c��t�d��}|�t�d��g��	|�t	d����dS#t
$rYdSwxYwrL)r=r|r�r�r?rOrDs  r�test_findall_with_errorz*BadElementPathTest.test_findall_with_error�
s{���J�J�u����	���"�*�*�U�#�#�$�%�%�%�	�
�I�I�n�S�)�)�*�*�*�*�*�� �	�	�	��D�D�	���rQ)r@rArBrFrJrMrPrSrUr]r_rarc�
__classcell__)r�s@rrBrBx
s�������� � � � � ������
,�,�,�
���0�0�0�
���?�?�?�:�:�:�/�/�/�
������r!rBc�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�ElementTreeTypeTestc���|�tjt��|�tjt��|�tjt��|�tjt��|�tjt��|�tjt��dSr^)	r{r=rer~rTr/r|rrr�s r�test_istypezElementTreeTypeTest.test_istype�
s������b�m�T�2�2�2����b�h��-�-�-����b�n�d�3�3�3����b�j�$�/�/�/����b�n�d�3�3�3����b�l�D�1�1�1�1�1r!c�2�Gd�dtj��}|d��}|�|tj��|�||��|�|jd��d|_|�|jd��dS)Nc��eZdZdS)�DElementTreeTypeTest.test_Element_subclass_trivial.<locals>.MyElementNr�r"r!r�	MyElementrk�
r�r!rlr�r�)r=r|r{r}rUry�r5rl�myes   r�test_Element_subclass_trivialz1ElementTreeTypeTest.test_Element_subclass_trivial�
s���	�	�	�	�	��
�	�	�	��i��������c�2�:�.�.�.����c�9�-�-�-������%�(�(�(���������5�)�)�)�)�)r!c���G�fd�dtj����dddd�dd�	��}|�|jd
��|�t	|�����gd���dS)Nc�&���eZdZif��fd�	Z�xZS)�HElementTreeTypeTest.test_Element_subclass_constructor.<locals>.MyElementc�H��t�|��j|dz|fi|��dS)N�__)rEr�)r5rUrz�extrarlr�s    ��rr�zQElementTreeTypeTest.test_Element_subclass_constructor.<locals>.MyElement.__init__�
s4���/��i��&�&�/��d�
�F�L�L�e�L�L�L�L�Lr!)r@rArBr�rd)r�rls@�rrlrr�
sQ��������+-�
M�
M�
M�
M�
M�
M�
M�
M�
M�
M�
Mr!rlr�r�r�)r�r�r��)r�r��foo__))r�r�)r�r�)r�r�)r�rv)r=r|r}rUr
r�)r5rnrls  @r�!test_Element_subclass_constructorz5ElementTreeTypeTest.test_Element_subclass_constructor�
s����	M�	M�	M�	M�	M�	M�	M��
�	M�	M�	M��i��Q�Q�/�/�1��:�:�:�������'�*�*�*������	�	���,�,�4�4�4�	6�	6�	6�	6�	6r!c��Gd�dtj��}|d��}|�|���d��dS)Nc��eZdZd�ZdS)�GElementTreeTypeTest.test_Element_subclass_new_method.<locals>.MyElementc��|jSr^rTr�s r�	newmethodzQElementTreeTypeTest.test_Element_subclass_new_method.<locals>.MyElement.newmethod�
s	���x�r!N)r@rArBr}r"r!rrlr{�
s#������
 �
 �
 �
 �
 r!rlr�)r=r|r}r}rms   r� test_Element_subclass_new_methodz4ElementTreeTypeTest.test_Element_subclass_new_method�
sc��	 �	 �	 �	 �	 ��
�	 �	 �	 ��i�������������%�0�0�0�0�0r!c�B�Gd�dtj��}t�d��}d|_|d��}d|_|�|��|�|�d��d��|�|�d��jd��t|�	d����}|�t|��d|��|�|djd��dS)	Nc��eZdZdS)�AElementTreeTypeTest.test_Element_subclass_find.<locals>.MyElementNr�r"r!rrlr��
r�r!rlr�ryr�rnr�r)r=r|ryr�r}r�r�rUrr�r~)r5rlr��sub�founds     r�test_Element_subclass_findz.ElementTreeTypeTest.test_Element_subclass_find�
s��	�	�	�	�	��
�	�	�	�
�J�J�u��������i��������	����
�
�
�������E�*�*�I�6�6�6����������*�E�2�2�2��Q�Y�Y�u�%�%�&�&������U���Q��.�.�.�����q���u�-�-�-�-�-r!N)r@rArBrhrorxr~r�r"r!rrfrf�
s_������2�2�2�*�*�*�6�6�6�1�1�1�
.�
.�
.�
.�
.r!rfc�>�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�ElementFindTestc�h�t�t��}|�|�d��jd��|�|�d��jd��|�|�d��jd��t�t��|d<|�|�d��jd��|�|�d��d��|�|�d��d��|�|�d��d	��|�|�dd
��d	��|�|�d����|�|�dd
��d
��|�t�d���d
��d	��dS)NrUr��./tagr�zsection/nexttag�nexttagryrnrPr��togz<tag><empty /></tag>�empty)	r=r�r�r}r�rU�SAMPLE_SECTIONr�r�rDs  r�test_find_simplez ElementFindTest.test_find_simple�
s����F�F�:�������������*�E�2�2�2�������
�.�.�2�E�:�:�:����������,�e�4�4�4��v�v�n�%�%��!�������� 1�2�2�6�	�B�B�B�������G�,�,�f�5�5�5�������M�2�2�I�>�>�>�	
������$5�6�6��;�;�;�������$5�y�A�A�2�F�F�F�	
���!�*�*�U�+�+�,�,�,�������E�9�5�5�y�A�A�A�	
������ 6�7�7�@�@��I�I�2�N�N�N�N�Nr!c�V�d}t�|��}|�|�d��jdd��|�|�d��jdd��|�|�d��jdd��|�|�d	��jdd
��|�|�d��jdd��|�td|jd
��|�td|jd��|�td|jd��|�td|jd��dS)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�rzr��SyntaxError)r5�
LINEAR_XMLr�s   r�test_find_xpathzElementFindTest.test_find_xpath
sj���
�
�F�F�:����	
������
�+�+�2�7�;�S�A�A�A�������
�+�+�2�7�;�S�A�A�A��������0�0�7��@�#�F�F�F������� 1�2�2�9�'�B�C�H�H�H������� 1�2�2�9�'�B�C�H�H�H����{�G�Q�V�Z�H�H�H����{�G�Q�V�[�I�I�I����{�G�Q�V�=N�O�O�O����{�G�Q�V�=N�O�O�O�O�Or!c�2�t�t��}t�t��|d<|�t|�d����dg��|�t|�d����ddg��|�t|�d����g��|�t|�d����g��|�t|�d����gd���|�t|�d	����dgd
z��|�t|�d����dg��|�t|�d����dgdz��|�t|�d
����gd���|�t|�d����gd���|�t|�d����gd���|�t|�d����gd���|�t|�d����gd���|�t|�d����dg��|�t|�d����dg��|�t|�d����dgdz��|�t|�d����dgdz��|�t|�d����dgdz��|�t|�d����dg��|�t|�d����dgdz��|�t|�d����dgdz��|�t|�d����dg��|�t|�d����dg��|�t|�d����d g��|�t|�d!����g��|�t|�d"����g��|�t|�d#����dgdz��|�|�d$��|�d����|�t|�d%����d g��|�t|�d&����d g��|�t|�d'����d g��|�t|�d(����d g��|�t|�d)����d g��|�t|�d*����g��|�t|�d+����g��|�t|�d,����g��|�t|�d-����g��|�t|�d.����g��|�t|�d/����dg��|�t|�d0����dg��|�t|�d1����dg��|�t|�d2����dg��|�t|�d3����dg��|�t|�d4����g��|�t|�d5����g��|�t|�d6����dgdz��|�t|�d7����dgdz��|�t|�d8����dgdz��|�t|�d9����dgdz��|�t|�d:����dgdz��|�t|�d;����dgd
z��|�t|�d<����dgd
z��|d|d=<|�t|�d(����d d g��|�t|�d3����ddg��dS)>Nr�rpr(rUr�ztog/foor�rlz.//tagrvr�zsection//tagz	section/*)rUr��nextsectionz
section//*)rUr�r�rUzsection/.//*z*/*z*//*z*/tagz*/./tagr�z././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]rkz.//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�r�r}rZr�rDs  r�test_findallzElementFindTest.test_findall s���F�F�:�����v�v�n�%�%��!�������	�	�#���7�7�&��B�B�B������	�	�%�(8�(8�9�9�E�5�>�J�J�J������	�	�%�(8�(8�9�9�2�>�>�>������	�	�)�(<�(<�=�=�r�B�B�B������	�	�#���7�7�%�%�%�	'�	'�	'������	�	�(�(;�(;�<�<�
�G�a�K�	�	�	������	�	�-�(@�(@�A�A�E�7�K�K�K������	�	�.�(A�(A�B�B�U�G�a�K�P�P�P������	�	�+�(>�(>�?�?�-�-�-�	/�	/�	/������	�	�,�(?�(?�@�@�4�4�4�	6�	6�	6������	�	�.�(A�(A�B�B�4�4�4�	6�	6�	6������	�	�%�(8�(8�9�9�-�-�-�	/�	/�	/������	�	�&�(9�(9�:�:�4�4�4�	6�	6�	6������	�	�'�(:�(:�;�;�e�W�E�E�E������	�	�)�(<�(<�=�=��w�G�G�G������	�	�'�(:�(:�;�;�e�W�q�[�I�I�I������	�	�)�(<�(<�=�=��w��{�K�K�K������	�	�2B�(C�(C�D�D�
�G�a�K�	�	�	������	�	�2F�(G�(G�H�H�
�G�	�	�	������	�	�2G�(H�(H�I�I�
�G�a�K�	�	�	������	�	�2F�(G�(G�H�H�
�G�a�K�	�	�	������	�	�2G�(H�(H�I�I�
�G�	�	�	������	�	�-�(@�(@�A�A�
�G�	�	�	������	�	�2C�(D�(D�E�E�
�K�	�	�	������	�	�2G�(H�(H�I�I�2�N�N�N������	�	�(�(;�(;�<�<�b�A�A�A������	�	�2B�(C�(C�D�D�
�G�a�K�	�	�	�������;�/�/����<�1H�1H�I�I�I������	�	�2M�(N�(N�O�O�
�K�	�	�	������	�	�2N�(O�(O�P�P�
�K�	�	�	������	�	�2N�(O�(O�P�P�
�K�	�	�	������	�	�2O�(P�(P�Q�Q�
�K�	�	�	������	�	�2Q�(R�(R�S�S�
�K�	�	�	�
	
�����	�	�2N�(O�(O�P�P��	�	�	������	�	�2O�(P�(P�Q�Q��	�	�	������	�	�2O�(P�(P�Q�Q��	�	�	������	�	�2P�(Q�(Q�R�R��	�	�	������	�	�2R�(S�(S�T�T��	�	�	�	
�����	�	�2G�(H�(H�I�I���	"�	"�	"������	�	�2H�(I�(I�J�J���	"�	"�	"������	�	�2H�(I�(I�J�J���	"�	"�	"������	�	�2K�(L�(L�M�M���	"�	"�	"������	�	�2I�(J�(J�K�K���	"�	"�	"������	�	�2J�(K�(K�L�L��	�	�	������	�	�2I�(J�(J�K�K��	�	�	�
	
�����	�	�2H�(I�(I�J�J���1��	&�	&�	&������	�	�2I�(J�(J�K�K���1��	&�	&�	&������	�	�2I�(J�(J�K�K���1��	&�	&�	&������	�	�2L�(M�(M�N�N���1��	&�	&�	&������	�	�2J�(K�(K�L�L���1��	&�	&�	&�	
�����	�	�2K�(L�(L�M�M���1��	&�	&�	&������	�	�2J�(K�(K�L�L���1��	&�	&�	&���t��!�������	�	�2O�(P�(P�Q�Q�#�Y�/�	1�	1�	1������	�	�2I�(J�(J�K�K����	)�	)�	)�	)�	)r!c��t�t��}|�t	|�d����g��|�t	|�d����dgdz��|�t	|�d����dgdz��dS)NrUz{http://effbot.org/ns}tagr�z.//{http://effbot.org/ns}tagr�)r=r�rOr}rZr�rDs  r�test_test_find_with_nsz&ElementFindTest.test_test_find_with_ns�s����F�F�=�!�!�������	�	�%�(8�(8�9�9�2�>�>�>�����1�9�9�%@�A�A�B�B�
(�)�A�-�	/�	/�	/�	
����1�9�9�%C�D�D�E�E�
(�)�A�-�	/�	/�	/�	/�	/r!c���t�d��}ddi}|�t|�d|�����d��|�t|�d|�����d��ddi}|�t|�d|�����d	��|�t|�d|�����d��ddd
�}|�t|�d|�����d��|�t|�d|�����d	��dS)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)r_r��.//br�r�)r�rP)r=r�r}r~r�)r5r:�nsmaps   r�test_findall_different_nsmapsz-ElementFindTest.test_findall_different_nsmaps�sU���v�v������s�������T�\�\�)��\�F�F�G�G��K�K�K�����T�\�\�&�U�\�C�C�D�D�a�H�H�H��s�������T�\�\�)��\�F�F�G�G��K�K�K�����T�\�\�&�U�\�C�C�D�D�a�H�H�H���$�$������T�\�\�)��\�F�F�G�G��K�K�K�����T�\�\�&�U�\�C�C�D�D�a�H�H�H�H�Hr!c�R�t�d��}|�t�d����|�t|�d����gd���|�t|�d����dg��|�t|�d����dg��|�t|�d	����d
g��|�t|�d����ddg��|�t|�d
����dg��|�t|�d
����t|�d������|�t|�d����gd���|�t|�d��|dgz��t|�d������|�t|�d����gd���|�t|�d����ddg��|�t|�d����ddg��|�t|�d����d
g��|�t|�d����gd���|�t|�d����ddg��|�t|�d����t|�d������dS)Nr�rz{*}b)�{X}br��{Y}bz{*}cr�z{X}*r�z{Y}*r�ryr�z{}br{)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�rqr}rZr�r�s  r�test_findall_wildcardz%ElementFindTest.test_findall_wildcard�s����v�v�����	
���B�J�J�v�&�&�'�'�'��������V�(<�(<�=�=�.�.�.�	0�	0�	0��������V�(<�(<�=�=���	 �	 �	 ��������V�(<�(<�=�=� ��	#�	#�	#��������V�(<�(<�=�=� ��	#�	#�	#��������U�(;�(;�<�<��s��	%�	%�	%��������U�(;�(;�<�<���	 �	 �	 ��������U�(;�(;�<�<�'����S�(9�(9�:�:�	<�	<�	<��������V�(<�(<�=�=�3�3�3�	5�	5�	5�	
�������V�(<�(<��R��z�(I�J�J�'����S�(9�(9�:�:�	<�	<�	<�	
�������Y�(?�(?�@�@�;�;�;�	=�	=�	=��������Y�(?�(?�@�@��s��	%�	%�	%��������Y�(?�(?�@�@� �&�)�	+�	+�	+��������Y�(?�(?�@�@� ��	#�	#�	#��������X�(>�(>�?�?�-�-�-�	/�	/�	/��������X�(>�(>�?�?��s��	%�	%�	%��������X�(>�(>�?�?�'����V�(<�(<�=�=�	?�	?�	?�	?�	?r!c���t�t��}|�td��5|�d��ddd��dS#1swxYwYdS)Nzcannot use absolute pathz/tag)r=r�r�r�r�r�rDs  r�
test_bad_findzElementFindTest.test_bad_find�s����F�F�:����
�
#�
#�K�1K�
L�
L�	�	�
�I�I�f����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A�A"�%A"c��t�t��}|�t�|���d��jd��|�t�|���d��d��|�tt�|���	d����dgdz��d}|�
t|��5t�|���	d��}ddd��n#1swxYwY|�t|��dgdz��dS)NrUryr�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�rZr��assertWarnsRegex�
FutureWarning)r5r�r�r�s    r�test_find_through_ElementTreez-ElementFindTest.test_find_through_ElementTree�sx���F�F�:�����������*�*�/�/��6�6�:�E�B�B�B��������*�*�3�3�E�:�:�F�C�C�C��������q�(9�(9�(A�(A�%�(H�(H�I�I�
�G�a�K�	�	�	�#���
"�
"�=�#�
6�
6�	4�	4�����"�"�*�*�7�3�3�B�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4������+�+�e�W�q�[�9�9�9�9�9s�.E�E�EN)r@rArBr�r�r�r�r�r�r�r�r"r!rr�r��
s�������O�O�O�.P�P�P�,n)�n)�n)�`/�/�/�I�I�I�"*?�*?�*?�X���
:�:�:�:�:r!r�c�4�eZdZdd�Zd�Zd�Zd�Zd�Zd�ZdS)	�ElementIterTestNc�F�t|�|����Sr^)rZr�)r5rLrUs   r�_ilistzElementIterTest._ilist�s���d�i�i��n�n�-�-�-r!c���t�d��}|�|�|��gd���|�|�|�d����ddg��|�t|�����jd��|�d�|�	����d��|�d�|�d���	����d��|�t|�	����d	��t|d
���}|�tt�|����dd
��t|d
���}t�t�
�����}|�tt�||�����dd
��t�d��}|�t |j��t�d��}|�d�|�	����d��dS)Nz7<html><body>this is a <i>paragraph</i>.</body>..</html>)rCr(r�r(r�rCrPzthis is a paragraph...zthis is a paragraph.z
this is a F)rMrr3r)r"z*<root>a&amp;<sub>b&amp;</sub>c&amp;</root>za&b&c&)r=r�r}r�r�rar�rUr*r�rQr`rrr/r�r2)r5rh�
sourcefiler"rPs     r�
test_basiczElementIterTest.test_basic�sG���f�f�N�O�O��������S�)�)�+@�+@�+@�A�A�A�������S�X�X�f�%5�%5�6�6���
�F�F�F�����c�h�h�j�j�)�)�-�v�6�6�6������������0�0�2J�K�K�K����������&�!1�!1�!:�!:�!<�!<�=�=�"�	$�	$�	$�����c�l�l�n�n�-�-�|�<�<�<��s�e�4�4�4�
�����b�l�l�:�6�6�7�7��:�E�B�B�B��s�e�4�4�4�
����R�^�^�%5�%5��6�6������b�l�l�:�f�l�E�E�F�F�q�I��	 �	 �	 ��~�~�d�#�#�����.�$�)�4�4�4��f�f�A�B�B�������������0�0�(�;�;�;�;�;r!c��t�d��}|�|�|��dg��t�|d��}|�|�|��ddg��t�|d��}|�|�|��gd���t�|d��}|�|�|��gd���|d|d<|d=|�|�|��ddg��dS)	Nr�r�r�)r�r�r�r�)r�r�r�r�r�r)r=r|r}r�rprbs     r�test_cornerszElementIterTest.test_corners
s!���J�J�s�O�O��������Q���#��/�/�/�
�M�M�!�S�!�!��������Q���#�s��4�4�4�
�M�M�!�S�!�!��������Q������9�9�9�
�M�M�!�S�!�!��������Q���)=�)=�)=�>�>�>���t��!��
�a�D�������Q���#�s��4�4�4�4�4r!c��t�d��}|�|�|d��dgdz��|�|�|d��dgdz��|�t	|�d�����dgdz��gd�}|�t	|�����|��|�|�|��|��|�|�|d��|��dS)	NaJ
            <document>
                <house>
                    <room>bedroom1</room>
                    <room>bedroom2</room>
                </house>
                <shed>nothing here
                </shed>
                <house>
                    <room>bedroom8</room>
                </house>
            </document>�roomr��houser�rT)r]r�r�r��shedr�r�r�)r=r�r}r�rZr�)r5rh�all_tagss   r�test_iter_by_tagz ElementIterTest.test_iter_by_tag s/���f�f�����	
������S�&�1�1�F�8�a�<�@�@�@�������S�'�2�2�W�I��M�B�B�B�	
����3�8�8��8�/�/�0�0�
�H�q�L�	�	�	�
-�-�-���������
�
�3�3�X�>�>�>�������S�)�)�8�4�4�4�������S�#�.�.��9�9�9�9�9r!c���t�d��}|���}|�t��5tj|��ddd��dS#1swxYwYdS)Nr�)r=r|r�r�r'r�)r5r�r�s   rr�zElementIterTest.test_copy=s����J�J�s�O�O��
�V�V�X�X��
�
�
�y�
)�
)�	�	��I�b�M�M�M�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�	A+�+A/�2A/c�F�t�d��}|���}ttjdz��D]U}|�ttjf��5t	j	||��ddd��n#1swxYwY�VdS)Nr�r�)
r=r|r�r�rfr�r�r'rirg)r5r�r�rqs    rr�zElementIterTest.test_pickleCs����J�J�s�O�O��
�V�V�X�X���6�2�Q�6�7�7�	(�	(�E��"�"�I�v�/C�#D�E�E�
(�
(���R��'�'�'�
(�
(�
(�
(�
(�
(�
(�
(�
(�
(�
(����
(�
(�
(�
(��	(�	(s�3B�B	�B	r^)	r@rArBr�r�r�r�r�r�r"r!rr�r��ss������.�.�.�.�<�<�<�65�5�5�,:�:�:�:���(�(�(�(�(r!r�c�p�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�ZdS)�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�*�|�|jd��|�|jd��|�|jd��|�|ji��t|��}|�t
|��d��|d}|�|jd��|�|jd��|�|jd��|�|ji��dS)NrCryr�r�divrnrx)r}rUryrxrzrr~)r5r��childrenr�s    r�_check_sample1_elementz&TreeBuilderTest._check_sample1_elementSs���������'�'�'�������(�(�(�������&�&�&������2�&�&�&���7�7������X����*�*�*����������E�*�*�*������Y�/�/�/������V�,�,�,������r�*�*�*�*�*r!c��Gd�d��}Gd�d|��}t�|�����}|�|j��|�|���d��t�|�����}|�|j��|�|���d��t�t
�����}|�|j��|�|�����dS)Nc��eZdZd�ZdS)�<TreeBuilderTest.test_dummy_builder.<locals>.BaseDummyBuilderc��dS)Nr�r"r�s rrzBTreeBuilderTest.test_dummy_builder.<locals>.BaseDummyBuilder.closebs���rr!NrVr"r!r�BaseDummyBuilderr�as#������
�
�
�
�
r!r�c��eZdZd�xZxZZdS)�8TreeBuilderTest.test_dummy_builder.<locals>.DummyBuilderc��dSr^r")r�s r�<lambda>zATreeBuilderTest.test_dummy_builder.<locals>.DummyBuilder.<lambda>fs��D�r!N)r@rArBr*rGr3r"r!r�DummyBuilderr�es������!0��0�D�0�5�3�3�3r!r�rr�)r=rr�sample1r}r�objectr�)r5r�r�r"s    r�test_dummy_builderz"TreeBuilderTest.test_dummy_builder`s>��	�	�	�	�	�	�	�	�	1�	1�	1�	1�	1�+�	1�	1�	1����\�\�^�^��4�4�����D�L�!�!�!����������,�,�,����%5�%5�%7�%7��8�8�����D�L�!�!�!����������,�,�,����V�X�X��.�.�����D�L�!�!�!����&�,�,�.�.�)�)�)�)�)r!c���t���}|�|�d��jtj��|�|�d��jd��t�tj���}|�|�d��jtj��|�|�d��jd��t�t���}|�|�d��td����dS)N�ctext)�comment_factory)r=rr}rorUrqryr~�r5r�s  r�test_treebuilder_commentz(TreeBuilderTest.test_treebuilder_commentts����N�N����������7�+�+�/���<�<�<�������7�+�+�0�'�:�:�:��N�N�2�:�N�6�6��������7�+�+�/���<�<�<�������7�+�+�0�'�:�:�:��N�N�3�N�/�/��������7�+�+�S��\�\�:�:�:�:�:r!c��t���}|�|�dd��jtj��|�|�dd��jd��t�tj���}|�|�d��jtj��|�|�d��jd��|�|�dd��jtj��|�|�dd��jd��t�d����}|�|�d��td��df��|�|�dd��td��df��dS)Nr)�
pi_factoryr�z text zpitarget  text c�$�t|��|fSr^)r~)rrys  rr�z5TreeBuilderTest.test_treebuilder_pi.<locals>.<lambda>�s��C��K�K��;N�r!)r=rr}r�rUr�ryr~r�s  r�test_treebuilder_piz#TreeBuilderTest.test_treebuilder_pi�s����N�N����������h��-�-�1�2�5�9�9�9�������h��-�-�2�H�=�=�=��N�N�b�e�N�,�,��������h���+�R�U�3�3�3�������h���,�h�7�7�7�������j�(�3�3�7���?�?�?�������j�(�3�3�8�:K�L�L�L��N�N�&N�&N�N�O�O��������h���#�h�-�-��)>�?�?�?�������j�(�3�3�c�*�o�o�x�5P�Q�Q�Q�Q�Qr!c��Gd�dtj��}d}t�|��}|�|jd��t�|�����}|�|��|���}|�|jd��d}t�|��}|�|jd��d}t�|�����}|�|��|���}|�|jd��dS)Nc��eZdZdS)�;TreeBuilderTest.test_late_tail.<locals>.TreeBuilderSubclassNr�r"r!r�TreeBuilderSubclassr��r�r!r�z<a>text<!-- comment -->tail</a>�texttailrz<a>text<?pi data?>tail</a>)r=rr�r}ryrrr)r5r�r�r�r"s     r�test_late_tailzTreeBuilderTest.test_late_tail�s?��	�	�	�	�	�"�.�	�	�	�0���M�M�#����������,�,�,����%8�%8�%:�%:��;�;�����C�����L�L�N�N��������,�,�,�*���M�M�#����������,�,�,�*�����%8�%8�%:�%:��;�;�����C�����L�L�N�N��������,�,�,�,�,r!c���Gd�dtj��}d}t�t�d������}|�|��|���}|�|djd��|�|djd	��|�|jd
��t�|d������}|�|��|���}|�|djd��|�|djd	��|�|jd
��d}t�t�d������}|�|��|���}|�|djd
��|�|djd��|�|jd��t�|d������}|�|��|���}|�|djd
��|�|djd��|�|jd��dS)Nc��eZdZdS)�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 datarxztext
)r=rrrrr}ryrx)r5r�r�r"r�s     r�test_late_tail_mix_pi_commentsz.TreeBuilderTest.test_late_tail_mix_pi_comments�s���	�	�	�	�	�"�.�	�	�	�A�����R�^�^�D�^�%I�%I��J�J�����C�����L�L�N�N������1���K�0�0�0�����1���H�-�-�-�������)�)�)����%8�%8��%N�%N�%N��O�O�����C�����L�L�N�N������1���K�0�0�0�����1���H�-�-�-�������)�)�)�<�����R�^�^�t�^�%D�%D��E�E�����C�����L�L�N�N������1���I�.�.�.�����1���F�+�+�+�������*�*�*����%8�%8�D�%I�%I�%I��J�J�����C�����L�L�N�N������1���I�.�.�.�����1���F�+�+�+�������*�*�*�*�*r!c���t�t�d������}|�|j��|���}|�|��dS�Nr1r)r=rrrr�rr��r5r"r�s   r�$test_treebuilder_elementfactory_nonez4TreeBuilderTest.test_treebuilder_elementfactory_none�s^�����R�^�^�D�^�%I�%I��J�J�����D�L�!�!�!��L�L�N�N���#�#�A�&�&�&�&�&r!c�X�Gd�dtj��}|��}|�|�d��d��t�|���}|�|j��|���}|�|��dS)Nc��eZdZd�ZdS)�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�s���	�	�	�	�	�B�N�	�	�	��]�_�_��������2����+�+�+����R��(�(�����D�L�!�!�!��L�L�N�N���#�#�A�&�&�&�&�&r!c��Gd�dtj��}|tjtj���}|�|�d��d��t�|���}|�|j��|�d��|�	��}|�
|��dS)Nc��eZdZd�ZdS)�?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=rrqr�r}r�rrr�rr�r�s     r�test_subclass_comment_piz(TreeBuilderTest.test_subclass_comment_pi�s���	�	�	�	�	�B�N�	�	�	��]�2�:�"�%�
H�
H�
H��������2����+�+�+����R��(�(�����D�L�!�!�!����3�4�4�4��L�L�N�N���#�#�A�&�&�&�&�&r!c���g��fd�}t�|���}t�|���}|�|j��|���|��dg��dS)Nc�d����|��t�||��Sr^)r�r=r|)rUrz�lsts  �r�	myfactoryz7TreeBuilderTest.test_element_factory.<locals>.myfactory�s&����J�J�s�O�O�O��:�:�c�6�*�*�*r!r1r�toplevel)r=rrr�sample2rr})r5r�r�r"r�s    @r�test_element_factoryz$TreeBuilderTest.test_element_factory�s������	+�	+�	+�	+�	+�
�^�^�I�^�
6�
6�����R��(�(�����D�L�!�!�!�����������z�l�+�+�+�+�+r!c�$�t�|���}t�|���}|�|j��|���}|�||��|�|��dSr�)r=rrrr�rr{r�)r5rar�r"r�s     r�_check_element_factory_classz,TreeBuilderTest._check_element_factory_class�sy��
�^�^�C�^�
0�
0�����R��(�(�����D�L�!�!�!��L�L�N�N�����a��%�%�%��#�#�A�&�&�&�&�&r!c�`�Gd�dtj��}|�|��dS)Nc��eZdZdS)�@TreeBuilderTest.test_element_factory_subclass.<locals>.MyElementNr�r"r!rrlr
r�r!rl)r=r|r�)r5rls  r�test_element_factory_subclassz-TreeBuilderTest.test_element_factory_subclass
sH��	�	�	�	�	��
�	�	�	��)�)�)�4�4�4�4�4r!c��tj}|�|jd��Gd�d|t��}|�|��dS)Nr8c��eZdZdS)�LTreeBuilderTest.test_element_factory_pure_python_subclass.<locals>.MyElementNr�r"r!rrlr
r�r!rl)r=�_Element_Pyr}rAr�r�)r5�baserls   r�)test_element_factory_pure_python_subclassz9TreeBuilderTest.test_element_factory_pure_python_subclass

sj���~�������*A�B�B�B�	�	�	�	�	��j�	�	�	��)�)�)�4�4�4�4�4r!c���Gd�d��}t�|�����}|�|j��|�|���d��dS)Nc��eZdZdZd�Zd�ZdS)�3TreeBuilderTest.test_doctype.<locals>.DoctypeParserNc��|||f|_dSr^��_doctype)r5rn�pubid�systems    r�doctypez;TreeBuilderTest.test_doctype.<locals>.DoctypeParser.doctype
s��!%�u�f� 5��
�
�
r!c��|jSr^rr�s rrz9TreeBuilderTest.test_doctype.<locals>.DoctypeParser.close
s
���}�$r!)r@rArBrrrr"r!r�
DoctypeParserr
s7�������H�
6�
6�
6�
%�
%�
%�
%�
%r!rr�rCz&-//W3C//DTD XHTML 1.0 Transitional//ENz7http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)r=rrr�r}r)r5rr"s   r�test_doctypezTreeBuilderTest.test_doctype
s���	%�	%�	%�	%�	%�	%�	%�	%����]�]�_�_��5�5�����D�L�!�!�!���������
H�	I�	I�	I�	I�	Ir!c�T�Gd�d��}t�|�����dD]Y}|�t|��5t�||�����ddd��n#1swxYwY�Zt�|t������dD]n}t�||t������}|�|j��|�|������odS)Nc� �eZdZdefd�Zd�ZdS)�BTreeBuilderTest.test_builder_lookup_errors.<locals>.RaisingBuilderNc�"�||_||_dSr^��raise_in�what)r5rrs   rr�zKTreeBuilderTest.test_builder_lookup_errors.<locals>.RaisingBuilder.__init__*
s�� (��
� ��	�	�	r!c�V�||jkr|�|j���d�}|S)Nc��dSr^r")rs r�handlez^TreeBuilderTest.test_builder_lookup_errors.<locals>.RaisingBuilder.__getattr__.<locals>.handle1
s���Dr!r)r5rnr s   r�__getattr__zNTreeBuilderTest.test_builder_lookup_errors.<locals>.RaisingBuilder.__getattr__.
s7���4�=�(�(��)�)�D�M�2�2�2�����
r!)r@rArBr�r�r!r"r!r�RaisingBuilderr)
s<������(,�:�
!�
!�
!�
!�
�
�
�
�
r!r"r)rGr*r3ror�)r)	r=rr�r�r2rr�r�r)r5r"r�r"s    r�test_builder_lookup_errorsz*TreeBuilderTest.test_builder_lookup_errors(
sr��
	�
	�
	�
	�
	�
	�
	�
	�	���N�N�,�,��-�-�-�>�	;�	;�E��'�'�
�E�:�:�
;�
;����N�N�5�$9�$9��:�:�:�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;����
;�
;�
;�
;��	���N�N��?�?�?��@�@�@�>�	.�	.�E��\�\����N�)S�)S�)S�\�T�T�F��K�K���%�%�%����f�l�l�n�n�-�-�-�-�	.�	.s�%B�B	�B	N)r@rArBr�r�r�r�r�r�r�r�r�r�r�r�r�rr	rr#r"r!rr�r�Ks
������2�G�
2�G�+�+�+�*�*�*�(
;�
;�
;�
R�
R�
R�-�-�-�0"+�"+�"+�H'�'�'�'�'�'�
'�
'�
'�,�,�,�'�'�'�5�5�5�
5�5�5�I�I�I�".�.�.�.�.r!r�c�D�eZdZdZdZdZd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZdS)�
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��|�|jd��|�|djd��|�|djd��dS)NrOr�line�22)r}rUryrDs  r�_check_sample_elementz#XMLParserTest._check_sample_elementK
sX��������'�'�'�����1���6�*�*�*�����1���D�)�)�)�)�)r!c���t�dt������}|�|j��|�|�����dS)Nr)rEr)r=rrrr�r)r)r5r�s  r�test_constructor_argsz#XMLParserTest.test_constructor_argsP
s_���,�,��&(�n�n�&6�&6��8�8�����T�\�"�"�"��"�"�7�=�=�?�?�3�3�3�3�3r!c���Gd�dtj��}|��}|�|j��|�|�����dS)Nc��eZdZdS)�-XMLParserTest.test_subclass.<locals>.MyParserNr�r"r!r�MyParserr.W
r�r!r/)r=rrr�r)r)r5r/r"s   rr�zXMLParserTest.test_subclassV
so��	�	�	�	�	�r�|�	�	�	���������D�L�!�!�!��"�"�6�<�<�>�>�2�2�2�2�2r!c� �tj��5tjdt��t���}|�|j��|���ddd��dS#1swxYwYdS)N�error)	�warnings�catch_warnings�simplefilterr�r=rrr�rr�s  r�test_doctype_warningz"XMLParserTest.test_doctype_warning]
s���
�
$�
&�
&�	�	��!�'�+=�>�>�>��\�\�^�^�F��K�K���%�%�%��L�L�N�N�N�		�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A"B�B�
Bc����d�G�fd�dtj��}|��}|�td��5|�|j��ddd��n#1swxYwY|���|����dx��tj	��5tj
dt��tj
dt��G�fd�d��}||�����}|�|j��|���|����|��d��ddd��dS#1swxYwYdS)	Nc���eZdZ�fd�ZdS)�@XMLParserTest.test_subclass_doctype.<locals>.MyParserWithDoctypec���||f�dSr^r")r5rrrs   �rrzHXMLParserTest.test_subclass_doctype.<locals>.MyParserWithDoctype.doctypeg
s��� �&�>���r!N�r@rArBrrs�r�MyParserWithDoctyper8f
s.�������
*�
*�
*�
*�
*�
*�
*r!r;rr1c���eZdZ�fd�ZdS)�:XMLParserTest.test_subclass_doctype.<locals>.DoctypeParserc���|||f�dSr^r")r5rnrr�	_doctype2s    �rrzBXMLParserTest.test_subclass_doctype.<locals>.DoctypeParser.doctypev
s���!%�u�f� 5�I�I�Ir!Nr:)r?s�rrr=u
s.�������6�6�6�6�6�6�6r!rrr)
r=rr��RuntimeWarningrr�rr�r2r3r4r�r})r5r;r"rrr?s    @@r�test_subclass_doctypez#XMLParserTest.test_subclass_doctyped
sL������	*�	*�	*�	*�	*�	*�	*�"�,�	*�	*�	*�
%�$�&�&��
�
"�
"�>�9�
=�
=�	&�	&��K�K���%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&����������(�#�#�#�#�#��9�
�
$�
&�
&�	M�	M��!�'�+=�>�>�>��!�'�>�:�:�:�
6�
6�
6�
6�
6�
6�
6�
6�
6�
6�
)�(�
�
���@�@�@�F��K�K���%�%�%��L�L�N�N�N����h�'�'�'����Y�L�
M�
M�
M�	M�	M�	M�	M�	M�	M�	M�	M�	M�	M�	M�	M����	M�	M�	M�	M�	M�	Ms%�A+�+A/�2A/�6B1E4�4E8�;E8c�f�tj��5tjdt��tjdt��Gd�dt
j��}|��}|�|j��|�	��ddd��dS#1swxYwYdS)z:Ensure that ordinary usage is not deprecated (Issue 19176)r1c��eZdZdS)�DXMLParserTest.test_inherited_doctype.<locals>.MyParserWithoutDoctypeNr�r"r!r�MyParserWithoutDoctyperD�
s�������r!rEN)
r2r3r4r�r@r=rrr�r)r5rEr"s   r�test_inherited_doctypez$XMLParserTest.test_inherited_doctype�
s���
�
$�
&�
&�	�	��!�'�+=�>�>�>��!�'�>�:�:�:�
�
�
�
�
���
�
�
�+�+�-�-�F��K�K���%�%�%��L�L�N�N�N�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�BB&�&B*�-B*c�t�t�t������}|�|j��|���}|�|jd��|�|jdd��|�|j	d��dS)Nr�moneyr�u
$£€𐅻)
r=rrr�sample3rr}rUrzryr�s   r�test_parse_stringzXMLParserTest.test_parse_string�
s������R�^�^�%5�%5��6�6�����D�L�!�!�!��L�L�N�N��������(�(�(������'�*�,C�D�D�D������!8�9�9�9�9�9r!N)
r@rArBr�r�rIr)r+r�r5rArFrJr"r!rr%r%B
s�������-�G��G�M�G�*�*�*�
4�4�4�3�3�3����M�M�M�<	�	�	�:�:�:�:�:r!r%c��eZdZd�ZdS)�NamespaceParseTestc��ddd�}t�t��}|�t	|�d|����d��|�t	|�d|����d��|�t	|�d|����d��dS)	N�hellor�)�hr!z{hello}tabler�z.//{hello}tdr�z.//{foo}name)r=r��SAMPLE_XML_NS_ELEMSr}r~r�)r5r�rhs   r�test_find_with_namespacez+NamespaceParseTest.test_find_with_namespace�
s����E�*�*���m�m�/�0�0������S�[�[���?�?�@�@�!�D�D�D�����S�[�[���?�?�@�@�!�D�D�D�����S�[�[���?�?�@�@�!�D�D�D�D�Dr!N)r@rArBrQr"r!rrLrL�
s(������E�E�E�E�Er!rLc�V�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
S)�ElementSlicingTestc��d�|D��S)Nc��g|]	}|j��
Sr"rT)rWr�s  rrXz1ElementSlicingTest._elem_tags.<locals>.<listcomp>�
s��(�(�(�!���(�(�(r!r")r5�elemlists  r�
_elem_tagszElementSlicingTest._elem_tags�
s��(�(�x�(�(�(�(r!c�F�|�t|����Sr^)rWrrrs  r�
_subelem_tagsz ElementSlicingTest._subelem_tags�
s�����t�D�z�z�*�*�*r!c��t�d��}t|��D] }t�|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=r|r�rp)r5�numchildrenr�r�s    r�_make_elem_with_childrenz+ElementSlicingTest._make_elem_with_children�
sJ��

�J�J�s�O�O���{�#�#�	(�	(�A��M�M�!�U�Q�Y�'�'�'�'��r!c�.��|�d���|��djd��|��djd��|�t�fd���|�t�fd���dS)Nr�r��a1����a8c����dS)N�r"rys�rr�z?ElementSlicingTest.test_getslice_single_index.<locals>.<lambda>�
s���a��e�r!c����dS)Ni�r"rys�rr�z?ElementSlicingTest.test_getslice_single_index.<locals>.<lambda>�
s���a��f�r!)r\r}rUr��
IndexErrorrDs @r�test_getslice_single_indexz-ElementSlicingTest.test_getslice_single_index�
s�����)�)�"�-�-������1���4�(�(�(�����2���D�)�)�)����*�m�m�m�m�4�4�4����*�n�n�n�n�5�5�5�5�5r!c��|�d��}|�|�|dd���gd���|�|�|dd���gd���|�|�|dd���gd���|�|�|dd���ddg��|�|�|dd���ddg��|�|�|dd	���d
dg��dS)Nr�r�)�a3�a4�a5�r�rgrhr�r��a0r^)r\r}rWrDs  r�test_getslice_rangez&ElementSlicingTest.test_getslice_range�
s8���)�)�!�,�,���������1�2�2��/�/�1C�1C�1C�D�D�D��������1�Q�3��0�0�2D�2D�2D�E�E�E��������1�R�4��1�1�3E�3E�3E�F�F�F��������1�Q�3��0�0�4��,�?�?�?��������1�R�4��1�1�D�$�<�@�@�@��������2�A�2��/�/�$���>�>�>�>�>r!c	���|�d��}|�|�|ddd���ddg��|�|�|ddd���gd���|�|�|ddd���ddg��|�|�|ddd���d	dg��|�|�|ddtj���d
g��|�|�|ddtjdz���d
g��dS)Nr��r�r`�a9r�)rkrg�a6rorkr^rg�@�r\r}rWre�maxsizerDs  r�test_getslice_stepsz&ElementSlicingTest.test_getslice_steps�
sF���)�)�"�-�-���������1�R��6��3�3�d�D�\�B�B�B��������3�3�Q�3��0�0�2J�2J�2J�K�K�K��������3�3�Q�3��0�0�4��,�?�?�?��������1�4�a�4��1�1�D�$�<�@�@�@��������1�>�c�k�>�):�;�;�d�V�D�D�D��������1�+=�c�k�2�o�+=�)>�?�?�$��H�H�H�H�Hr!c	��|�d��}|�|�|ddd���gd���|�|�|ddd���ddg��|�|�|ddtj���dg��|�|�|ddtjdz
���dg��|�|�|ddtjd	z���dg��dS)
Nrvr�)rg�a2r^rkr_rgr^r�r�rqrrrDs  r�test_getslice_negative_stepsz/ElementSlicingTest.test_getslice_negative_steps�
s$���)�)�!�,�,���������4�4�R�4��1�1�3K�3K�3K�L�L�L��������4�4�R�4��1�1�D�$�<�@�@�@��������1�?�s�{�l�?�);�<�<�t�f�E�E�E��������1�+<�s�{�l�1�n�+<�)=�>�>���G�G�G��������1�+>�s�{�l�B�.>�+>�)?�@�@�4�&�I�I�I�I�Ir!c�@�|�d��}|dd�=|�|�|��ddg��|�d��}|dd�=|�|�|��g��|�d��}|ddd�=|�|�|��g��|�d��}|ddd�=|�|�|��ddg��|�d��}|d	dd�=|�|�|��ddg��|�d��}|ddd�=|�|�|��d
g��dS)Nrvrr�rvrgr�r_rkr�r^)r\r}rYrDs  r�
test_delslicez ElementSlicingTest.test_delslice�
s����)�)�!�,�,��
�a��c�F�����+�+�A�.�.��t��=�=�=��)�)�!�,�,��
�a�b�b�E�����+�+�A�.�.��3�3�3��)�)�!�,�,��
�d�d��d�G�����+�+�A�.�.��3�3�3��)�)�!�,�,��
�d�d��d�G�����+�+�A�.�.��t��=�=�=��)�)�!�,�,��
�a�d��d�G�����+�+�A�.�.��t��=�=�=��)�)�!�,�,��
�c�c��c�F�����+�+�A�.�.���7�7�7�7�7r!c���|�d��}t�d��|d<|�|�|��gd���t�d��|d<|�|�|��gd���|�t��5t�d��|d	<ddd��n#1swxYwY|�t��5t�d��|d
<ddd��n#1swxYwY|�|�|��gd���dS)Nrvr�r��rkr�rvrgr�r_)rkr�r�rgr�r����)r\r=r|r}rYr�rdrDs  r�test_setslice_single_indexz-ElementSlicingTest.test_setslice_single_index�
s����)�)�!�,�,���z�z�#����!������+�+�A�.�.�0G�0G�0G�H�H�H��
�
�3����"������+�+�A�.�.�0F�0F�0F�G�G�G�
�
�
�z�
*�
*�	#�	#��:�:�c�?�?�A�a�D�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�
�
�
�z�
*�
*�	$�	$��J�J�s�O�O�A�b�E�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�����+�+�A�.�.�0F�0F�0F�G�G�G�G�Gs$�C*�*C.�1C.�D9�9D=�D=c�>�|�d��}d�td��D��|dd�<|�|�|��gd���|�d��}t�d��g|dd�<|�|�|��gd���|�d��}d	�td��D��|dd�<|�|�|��gd
���dS)Nrvc�H�g|]}t�d|z���� S�zb%srU�rWr�s  rrXz:ElementSlicingTest.test_setslice_range.<locals>.<listcomp>�(��:�:�:�A�"�*�*�U�Q�Y�'�'�:�:�:r!r�r�r�)rk�b0�b1rgr�)rkr�rgc�H�g|]}t�d|z���� Sr�rUr�s  rrXz:ElementSlicingTest.test_setslice_range.<locals>.<listcomp>r�r!)rkr�r��b2rg)r\r�r}rYr=r|rDs  r�test_setslice_rangez&ElementSlicingTest.test_setslice_range�
s���)�)�!�,�,��:�:��q���:�:�:��!�A�#������+�+�A�.�.�0H�0H�0H�I�I�I��)�)�!�,�,���*�*�S�/�/�"��!�A�#������+�+�A�.�.�0A�0A�0A�B�B�B��)�)�!�,�,��:�:��q���:�:�:��!�A�#������+�+�A�.�.�0N�0N�0N�O�O�O�O�Or!c��|�d��}d�td��D��|ddd�<|�|�|��gd���|�d��}|�t
��5t�d��g|ddd�<ddd��n#1swxYwY|�t
��5d�td	��D��|ddd�<ddd��n#1swxYwY|�t
��5g|ddd�<ddd��n#1swxYwY|�|�|��gd
���|�d��}t�d��g|ddtj	�<|�|�|��gd���t�d
��g|ddtj	dz�<|�|�|��gd���dS)Nr�c�H�g|]}t�d|z���� Sr�rUr�s  rrXz:ElementSlicingTest.test_setslice_steps.<locals>.<listcomp>
s(��<�<�<�a�B�J�J�u�q�y�)�)�<�<�<r!r�r�r�)rkr�rvr�rhrir�c�H�g|]}t�d|z���� Sr�rUr�s  rrXz:ElementSlicingTest.test_setslice_steps.<locals>.<listcomp>s(��@�@�@�!��
�
�5�1�9�-�-�@�@�@r!r�)rkr^rvrgrhrirvr{r�rq�rkr�rvrg�
r\r�r}rYr�r�r=r|rersrDs  r�test_setslice_stepsz&ElementSlicingTest.test_setslice_stepss����)�)�!�,�,��<�<�5��8�8�<�<�<��!�A�a�%������+�+�A�.�.�0T�0T�0T�U�U�U��)�)�!�,�,��
�
�
�z�
*�
*�	)�	)��
�
�3���(�A�a��!�e�H�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�
�
�
�z�
*�
*�	A�	A�@�@�u�Q�x�x�@�@�@�A�a��!�e�H�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A����	A�	A�	A�	A�
�
�
�z�
*�
*�	�	��A�a��!�e�H�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����+�+�A�.�.�0T�0T�0T�U�U�U��)�)�!�,�,���Z�Z��_�_�-��!�.�S�[�.������+�+�A�.�.�0G�0G�0G�H�H�H�!#���C��� 1��!�
�S�[�"�_�
������+�+�A�.�.�0G�0G�0G�H�H�H�H�H�6�"B=�=C�C�" D�D�D�3	E�E�Ec�@�|�d��}d�td��D��|ddd�<|�|�|��gd���|�d��}|�t
��5t�d��g|ddd�<ddd��n#1swxYwY|�t
��5d�td	��D��|ddd�<ddd��n#1swxYwY|�t
��5g|ddd�<ddd��n#1swxYwY|�|�|��gd
���|�d��}t�d��g|ddtj	�<|�|�|��gd���t�d
��g|ddtj	dz
�<|�|�|��gd���t�d��g|ddtj	dz�<|�|�|��gd���dS)Nrvc�H�g|]}t�d|z���� Sr�rUr�s  rrXzCElementSlicingTest.test_setslice_negative_steps.<locals>.<listcomp>!s(��=�=�=�q�R�Z�Z���	�*�*�=�=�=r!r�rr�)rkr�r�rgr�c�H�g|]}t�d|z���� Sr�rUr�s  rrXzCElementSlicingTest.test_setslice_negative_steps.<locals>.<listcomp>(s(��A�A�A�1����E�A�I�.�.�A�A�Ar!r�)rkr^rvrgr�r{r�r�r�rq)rkr�rvrgr�rDs  r�test_setslice_negative_stepsz/ElementSlicingTest.test_setslice_negative_stepssE���)�)�!�,�,��=�=�E�!�H�H�=�=�=��!�A�b�&�	�����+�+�A�.�.�0H�0H�0H�I�I�I��)�)�!�,�,��
�
�
�z�
*�
*�	*�	*����C���)�A�a��"�f�I�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*�
�
�
�z�
*�
*�	B�	B�A�A��a���A�A�A�A�a��"�f�I�	B�	B�	B�	B�	B�	B�	B�	B�	B�	B�	B����	B�	B�	B�	B�
�
�
�z�
*�
*�	�	��A�a��"�f�I�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����+�+�A�.�.�0H�0H�0H�I�I�I��)�)�!�,�,�� �j�j��o�o�.��!�/�c�k�\�/������+�+�A�.�.�0G�0G�0G�H�H�H� "�
�
�3���0��!�
�c�k�\�!�^�
������+�+�A�.�.�0G�0G�0G�H�H�H�"$�*�*�S�/�/�!2��!�
�c�k�\�2�
�
������+�+�A�.�.�0G�0G�0G�H�H�H�H�Hr�N)r@rArBrWrYr\rerlrtrwryr}r�r�r�r"r!rrSrS�
s�������)�)�)�+�+�+����6�6�6�?�?�?�I�I�I�J�J�J�8�8�8�2H�H�H�P�P�P�I�I�I�(I�I�I�I�Ir!rSc��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�ZdS)�IOTestc	�	�t�d��}d|_|�t	|��d��dD]�}|�|��5|�t	||���d��|�t	||������d��ddd��n#1swxYwY��dD]�}|�|��5|�t	||���d|z�|����|���}|�t	||���d|z�|����ddd��n#1swxYwY��t�d��}d	|_|�t	|��d
��|�t	|d���d��|�t	|d
���d��dD]=}|�t	||���d|z�|�����>t�d��}d	|jd<|�t	|��d��|�t	|d���d��|�t	|d
���d��dD]=}|�t	||���d|z�|�����>t�d��}d|_|�t	|��d��|�t	|d���d��|�t	|d
���d��dD]=}|�t	||���d|z�|�����>t�d��}d|jd<|�t	|��d��|�t	|d���d��|�t	|d
���d��dD]=}|�t	||���d|z�|�����>dS)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�rrrr�u@<?xml version='1.0' encoding='%s'?>
<tag key="åöö&lt;&gt;" />)	r=r|ryr}rQr��upperr)rz)r5rL�encr�s    rr@zIOTest.test_encoding7s����z�z�%� � ����	�����4���*:�;�;�;�(�	+�	+�C����c�"�"�
+�
+�� � ��4�#�!>�!>�!>�)�+�+�+�� � ��4�#�)�)�+�+�!F�!F�!F�)�+�+�+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+��
6�	@�	@�C����c�"�"�
@�
@�� � ��4�#�!>�!>�!>�*�,/�0�17�����>�>�>��	�	����� � ��4�%�!@�!@�!@�*�,1�2�39�6�#�;�;�@�@�@�
@�
@�
@�
@�
@�
@�
@�
@�
@�
@�
@����
@�
@�
@�
@���z�z�%� � ����	�����4���*G�H�H�H�����4�'�:�:�:�.�	0�	0�	0�����4�*�=�=�=�.�	0�	0�	0�5�	G�	G�C����Y�t�c�:�:�:�3�58�9�:@�&��+�+�
G�
G�
G�
G��z�z�%� � ��&���E������4���*O�P�P�P�����4�'�:�:�:�6�	8�	8�	8�����4�*�=�=�=�6�	8�	8�	8�5�	P�	P�C����Y�t�c�:�:�:�<�>A�B�CI�6�#�;�;�
P�
P�
P�
P��z�z�%� � ��$��	�����4���*K�L�L�L�����4�'�:�:�:�>�	@�	@�	@�����4�*�=�=�=�8�	:�	:�	:�5�	E�	E�C����Y�t�c�:�:�:�1�36�7�8>��s���
E�
E�
E�
E��z�z�%� � ��-���E������4���*N�O�O�O�����4�'�:�:�:�A�	C�	C�	C�����4�*�=�=�=�;�	=�	=�	=�M�	J�	J�C����Y�t�c�:�:�:�6�8;�<�=C�V�C�[�[�
J�
J�
J�
J�	J�	Js&�AC�C	�C	�,BF�F	�
F	c��|�tjt��t�t�d����}|�t��ttd��5}|�	|�
��d��ddd��dS#1swxYwYdS)N�<site>ø</site>rZ�<site>&#248;</site>)rfrrgrr=r/r�rIrr}r�r5rPr!s   r�test_write_to_filenamezIOTest.test_write_to_filename|s������	�(�&�1�1�1��~�~�b�f�f�%<�=�=�>�>���
�
�6����
�&�$�
�
�	C�1����Q�V�V�X�X�'A�B�B�B�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C����	C�	C�	C�	C�	C�	Cs�)B=�=C�Cc��|�tjt��t�t�d����}|�td���ttd��5}|�	|�
��d��ddd��n#1swxYwY|�td���ttd��5}|�	|�
��td����ddd��dS#1swxYwYdS)Nr�rrrZ�<site>ø</site>r��:<?xml version='1.0' encoding='ISO-8859-1'?>
<site>�</site>)rfrrgrr=r/r�rIrr}rr+r�s   r�$test_write_to_filename_with_encodingz+IOTest.test_write_to_filename_with_encoding�s������	�(�&�1�1�1��~�~�b�f�f�%<�=�=�>�>���
�
�6�G�
�,�,�,�
�&�$�
�
�	E�1����Q�V�V�X�X�'C�D�D�D�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E����	E�	E�	E�	E�	
�
�
�6�L�
�1�1�1�
�&�$�
�
�	8�1����Q�V�V�X�X�{�6�(7�(7�
8�
8�
8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8�	8�	8s$�	)B>�>C�C�:6D=�=E�Ec�2�|�tjt��t	td��5}|j}ddd��n#1swxYwYtjt��t�t�d����}|�	td���t	td��5}|�
|���d��ddd��dS#1swxYwYdS)Nr�r�rCrrZr�)rfrrgrrrEr=r/r�rIr}r)r5r!rErPs    r�!test_write_to_filename_as_unicodez(IOTest.test_write_to_filename_as_unicode�sj�����	�(�&�1�1�1�
�&�#�
�
�	"�!��z�H�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"���� � � ��~�~�b�f�f�%<�=�=�>�>���
�
�6�I�
�.�.�.�
�&�$�
�
�	A�1����Q�V�V�X�X�'?�@�@�@�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A����	A�	A�	A�	A�	A�	As#�A�A�A�)D�D�Dc��|�tjt��t�t�d����}ttdd���5}|�|d���|�	|j
��ddd��n#1swxYwYttd��5}|�|���d��ddd��n#1swxYwYttddd	�
��5}|�|d���|�	|j
��ddd��n#1swxYwYttd��5}|�|���d��ddd��n#1swxYwYttdd���5}|�|d���|�	|j
��ddd��n#1swxYwYttd��5}|�|���d
��ddd��dS#1swxYwYdS)Nr�r�rrrCrZr�r'�xmlcharrefreplace)rE�errorsr�r�s<site>�</site>�
rfrrgrr=r/r�rrIrbrcr}rr�s   r�test_write_to_text_filezIOTest.test_write_to_text_file�s������	�(�&�1�1�1��~�~�b�f�f�%<�=�=�>�>��
�&�#��
0�
0�
0�	'�A��J�J�q�9�J�-�-�-����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'��&�$�
�
�	E�1����Q�V�V�X�X�'C�D�D�D�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E����	E�	E�	E�	E��&�#��8K�
L�
L�
L�	'�PQ��J�J�q�9�J�-�-�-����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'��&�$�
�
�	D�1����Q�V�V�X�X�(B�C�C�C�	D�	D�	D�	D�	D�	D�	D�	D�	D�	D�	D����	D�	D�	D�	D��&�#��
5�
5�
5�	'���J�J�q�9�J�-�-�-����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'��&�$�
�
�	A�1����Q�V�V�X�X�'?�@�@�@�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A����	A�	A�	A�	A�	A�	Asl�/2B-�-B1�4B1�
)D�D�	D�%2E#�#E'�*E'�)F8�8F<�?F<�2H�H�H�8)I.�.I2�5I2c��|�tjt��t�t�d����}ttd��5}|�|��|�	|j
��ddd��n#1swxYwYttd��5}|�|���d��ddd��dS#1swxYwYdS)Nr�r^rZr�r�r�s   r�test_write_to_binary_filez IOTest.test_write_to_binary_file�sc�����	�(�&�1�1�1��~�~�b�f�f�%<�=�=�>�>��
�&�$�
�
�	'�1��J�J�q�M�M�M����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'��&�$�
�
�	C�1����Q�V�V�X�X�'A�B�B�B�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C����	C�	C�	C�	C�	C�	Cs$�-0B)�)B-�0B-�	)C?�?D�Dc��|�tjt��t�t�d����}ttd��5}|�|d���|�	|j
��ddd��n#1swxYwYttd��5}|�|���d��ddd��n#1swxYwYttd��5}|�|d���|�	|j
��ddd��n#1swxYwYttd��5}|�|���d��ddd��dS#1swxYwYdS)	Nr�r^rrrZr�r�r�r�r�s   r�'test_write_to_binary_file_with_encodingz.IOTest.test_write_to_binary_file_with_encoding�s������	�(�&�1�1�1��~�~�b�f�f�%<�=�=�>�>��
�&�$�
�
�	'�1��J�J�q�7�J�+�+�+����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'��&�$�
�
�	E�1����Q�V�V�X�X�'C�D�D�D�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E����	E�	E�	E�	E��&�$�
�
�	'�1��J�J�q�<�J�0�0�0����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'��&�$�
�
�	7�1����Q�V�V�X�X�6�
7�
7�
7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�	7�	7sH�-2B+�+B/�2B/�)D�D�D� 2E�E"�%E"�>)F4�4F8�;F8c���|�tjt��t�t�d����}ttd��5}|�|d���|�	|j
��ddd��n#1swxYwYttd��5}|�|���d�
d����ddd��n#1swxYwYttdd���5}|�|d���|�	|j
��ddd��n#1swxYwYttd��5}|�|���d�
d����ddd��dS#1swxYwYdS)	Nr�r^rrrZu7<?xml version='1.0' encoding='utf-16'?>
<site>ø</site>r)�	buffering)rfrrgrr=r/r�rrIrbrcr}rr)r�s   r�"test_write_to_binary_file_with_bomz)IOTest.test_write_to_binary_file_with_bom�s������	�(�&�1�1�1��~�~�b�f�f�%<�=�=�>�>��
�&�$�
�
�	'�1��J�J�q�8�J�,�,�,����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'��&�$�
�
�	>�1����Q�V�V�X�X�,�,2�F�8�,<�,<�
>�
>�
>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>�
�&�$�!�
,�
,�
,�	'���J�J�q�8�J�,�,�,����Q�X�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'��&�$�
�
�	>�1����Q�V�V�X�X�,�,2�F�8�,<�,<�
>�
>�
>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>�	>�	>sH�-2B+�+B/�2B/�<D�D�D�52E3�3E7�:E7�<G�G �#G c���t���}tjd��}|�|��|�|���jd��dS�Nz"<?xml version="1.0"?><site></site>�site)r=r/rFrHrr}r�rU�r5rPr s   r�test_read_from_stringiozIOTest.test_read_from_stringio�sZ���~�~������E�F�F���
�
�6������������+�V�4�4�4�4�4r!c��t�t�d����}tj��}|�|d���|�|���d��dS�Nr�rCr)r=r/r�rFrHrIr}rJr�s   r�test_write_to_stringiozIOTest.test_write_to_stringio�sh���~�~�b�f�f�%<�=�=�>�>��������
�
�6�I�
�.�.�.�������*�*�,C�D�D�D�D�Dr!c���t���}tjd��}|�|��|�|���jd��dS�Ns"<?xml version="1.0"?><site></site>r�)r=r/rFrGrr}r�rU�r5rPr�s   r�test_read_from_bytesiozIOTest.test_read_from_bytesio�sW���~�~�����j�B�C�C���
�
�3������������+�V�4�4�4�4�4r!c�
�t�t�d����}tj��}|�|��|�|���d��dS�Nr�r�)r=r/r�rFrGrIr}rJr�s   r�test_write_to_bytesiozIOTest.test_write_to_bytesio�s_���~�~�b�f�f�%<�=�=�>�>���j�l�l���
�
�3������������)C�D�D�D�D�Dr!c��eZdZdS)�IOTest.dummyNr�r"r!r�dummyr��s�������r!r�c�$�tjd��}|���}|j|_t���}|�|��|�|���j	d��dSr�)
rFrHr�rr=r/rr}r�rU)r5r �readerrPs    r�test_read_from_user_text_readerz&IOTest.test_read_from_user_text_reader�sp����E�F�F���������k����~�~�����
�
�6������������+�V�4�4�4�4�4r!c�N�t�t�d����}tj��}|���}|j|_|�|d���|�|���d��dSr�)	r=r/r�rFrHr�rIr}rJ)r5rPr �writers    r�test_write_to_user_text_writerz%IOTest.test_write_to_user_text_writers~���~�~�b�f�f�%<�=�=�>�>��������������|����
�
�6�I�
�.�.�.�������*�*�,C�D�D�D�D�Dr!c�V�tjd��}|���}|j|_t���}|�|��|�|���j	d��t���}dSr�)
rFrGr�rr=r/rr}r�rU)r5r�r�rPs    r�!test_read_from_user_binary_readerz(IOTest.test_read_from_user_binary_reader	s}���j�B�C�C���������h����~�~�����
�
�6������������+�V�4�4�4��~�~�����r!c�J�t�t�d����}tj��}|���}|j|_|�|��|�|���d��dSr�)	r=r/r�rFrGr�rIr}rJ�r5rPr�r�s    r� test_write_to_user_binary_writerz'IOTest.test_write_to_user_binary_writersx���~�~�b�f�f�%<�=�=�>�>���j�l�l���������y����
�
�6������������)C�D�D�D�D�Dr!c��t�t�d����}tj��}|���}|j|_d�|_|j|_|�|d���|�	|�
��d�d����dS)Nz<site />c��dSr�r"r"r!rr�zBIOTest.test_write_to_user_binary_writer_with_bom.<locals>.<lambda>s��$�r!rrz0<?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�4�5�5���j�l�l���������y���&�,����h����
�
�6�H�
�-�-�-����������%�v�h�/�/�	1�	1�	1�	1�	1r!c	��t�d��}|�t�|d��d�t�|d������|�t�|d��d�t�|d������dS)Nz<tag>foo</tag>rCrPrr!)r=r�r}r	r*r+r�s  r�test_tostringlist_invariantz"IOTest.test_tostringlist_invariant&s����}�}�-�.�.������K�K��i�(�(��G�G�B�O�O�D�)�4�4�5�5�	7�	7�	7�	
����K�K��h�'�'��H�H�R�_�_�T�8�4�4�5�5�	7�	7�	7�	7�	7r!c�\�t�d��}|�t�|d��d��|�t�|dd���d��|�t�|dd���d��dS)Nz<tag>a<x />b<y></y>c</tag>rCz<tag>a<x />b<y />c</tag>T)�short_empty_elementsFz<tag>a<x></x>b<y></y>c</tag>)r=r�r}r	r�s  r�test_short_empty_elementsz IOTest.test_short_empty_elements/s����}�}�9�:�:������K�K��i�(�(�&�	(�	(�	(�	
����K�K��i�d�K�C�C�&�	(�	(�	(�	
����K�K��i�e�K�D�D�*�	,�	,�	,�	,�	,r!N)r@rArBr@r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"r!rr�r�6sx������CJ�CJ�CJ�JC�C�C�8�8�8�	A�	A�	A�A�A�A�*C�C�C�7�7�7�">�>�>�(5�5�5�E�E�E�5�5�5�E�E�E�
�
�
�
�
�
�
�
�5�5�5�E�E�E� � � �E�E�E�
1�
1�
1�7�7�7�
,�
,�
,�
,�
,r!r�c�&�eZdZd�Zd�Zd�Zd�ZdS)�ParseErrorTestc�j�|�t���t��dSr^)r{r=rer�r�s rr�zParseErrorTest.test_subclass=s&�����b�m�m�o�o�{�;�;�;�;�;r!c�x�	t�|��dS#tj$r}|cYd}~Sd}~wwxYwr^)r=r�re)r5rZr�s   r�
_get_errorzParseErrorTest._get_error@sO��	��M�M�!��������}�	�	�	��H�H�H�H�H�H�����	���s��9�4�9�9c��|�|�d��jd��|�|�d��jd��|�|�d��jd��dS)Nr�)r�rz<tag>&foo;</tag>)r�r�zfoobar<)r�r�)r}r��positionr�s r�test_error_positionz"ParseErrorTest.test_error_positionFsx���������/�/�8�&�A�A�A�������);�<�<�E�v�N�N�N��������3�3�<�f�E�E�E�E�Er!c��ddlmcmcm}|�|�d��j|j|j��dS)Nrr�)	�xml.parsers.expat.errors�parsers�expatr�r}r��code�codes�XML_ERROR_SYNTAX)r5�ERRORSs  r�test_error_codezParseErrorTest.test_error_codeKsf��1�1�1�1�1�1�1�1�1�1�1�1��������/�/�4���V�4�5�	7�	7�	7�	7�	7r!N)r@rArBr�r�r�r�r"r!rr�r�<sS������<�<�<����F�F�F�
7�7�7�7�7r!r�c��eZdZd�ZdS)�KeywordArgsTestc��t�d��}|�|�dd��|�dd�����|�|�ddd��|�ddd�����|�|�dd��|�dd�����|�t
|�dd����t
|�dd�������|�t�d��j	i��t�dtdd�����t�dtdd������t�dtd�	��d�
��t�ddd���t�dtdd���dd���g}|D]G}|�|jd��|�|j	tdd������Ht�|ddd
di���}|�|j	d
d��|�
td��5t�dd��ddd��n#1swxYwY|�
td��5t�dd���ddd��dS#1swxYwYdS)Nz
<a>foo</a>r�)�pathr_)r�r�r_�#r�)rr�)rz)r)r�rr��key1�value1zmust be dict, not strzI'm not a dict)r=r�r}r�r�r�rr�r|rzrjrUrpr�r')r5r��elementsr�r�s     r�test_issue14818zKeywordArgsTest.test_issue14818Ts|���F�F�<� � ���������T�*�*����S�T��:�:�	<�	<�	<�������C��t�4�4�����d�t��L�L�	N�	N�	N�������3��-�-�������=�=�	?�	?�	?�����a�j�j��d�3�3�4�4��a�j�j�c�d�j�C�C�D�D�	F�	F�	F�	
������C���/��4�4�4��J�J�s�D�c�e�4�4�4�5�5��J�J�s�4�S�U�#;�#;�#;�J�<�<��J�J�s�D�c�N�N�N�u�J�5�5��J�J�s���J�/�/��J�J�s�D�c�e�4�4�4�3�5�J�I�I�
���	A�	A�A����Q�U�C�(�(�(����Q�X�t���'?�'?�'?�@�@�@�@�
�]�]�8�A�;��&�(�9K�]�
L�
L�������6�*�H�5�5�5�
�
#�
#�I�/F�
G�
G�	.�	.��J�J�s�,�-�-�-�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�
�
#�
#�I�/F�
G�
G�	5�	5��J�J�s�#3�J�4�4�4�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s$�L�L�L�&M�M�MN)r@rArBr�r"r!rr�r�Qs#������5�5�5�5�5r!r�c��eZdZd�Zd�ZdS)�NoAcceleratorTestc�<�tstjd���dS)Nzonly for the Python version)r_r�r�r�s rrFzNoAcceleratorTest.setUpvs)���	C��#�$A�B�B�B�	C�	Cr!c���|�tjjtj��|�tjjtj��dSr^)r{r_r|r��types�FunctionTyperr�s r�test_correct_import_pyETz*NoAcceleratorTest.test_correct_import_pyET{sF��	
���d�l�3�U�5G�H�H�H����d�n�5�u�7I�J�J�J�J�Jr!N)r@rArBrFr�r"r!rr�r�us:������C�C�C�
K�K�K�K�Kr!r�c�&�tj|fi|��Sr^)r_�canonicalize)r�rNs  r�c14n_roundtripr��s����S�,�,�G�,�,�,r!c�$�eZdZdZd�Zd�Zd�ZdS)�C14NTestNc�,�|�td��d��|�td��d��|�td��d��|�td��d��|�td	��d
��|�td��d��|�td
��d��|�td��d��|�td��d��|�td��d��|�td��d��|�td��d��d}|�t|��|��d}|�t|��|��d}|�t|��|��dS)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�1�=�A�A�A�����(<�=�=�)�	+�	+�	+�����(J�K�K�:�	<�	<�	<�����(U�V�V�E�	G�	G�	G�����)M�N�N��	�	�	�	
����(T�U�U�&�	(�	(�	(�����(?�@�@��	 �	 �	 �����(q�r�r�W�	Y�	Y�	Y�����)B�C�C�
J�	K�	K�	K�����(a�b�b�?�	A�	A�	A�����(`�a�a�K�	M�	M�	M�����(a�b�b�A�	C�	C�	C�F�������,�,�c�2�2�2�Z�������,�,�c�2�2�2�^�������,�,�c�2�2�2�2�2r!c��tjd��}|�t|d���d��|�t|ddg���d��|�t|ddg�	��d
��|�t|ddgdg���d��|�t|dd
dg�	��d��|�t|d
dg���d��|�t|dddg�	��d��|�t|ddg���d��dS)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>)rrrz4<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>)rza<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�s����o�
�

�

��	
����3�4�0�0�0�
�	�	�	�	
����3�4�@\�?]�^�^�^�
�	�	�	�	
����3�4�?X�>Y�Z�Z�Z�
�	�	�	�	
����3�4�@\�?]�)B�(C�
E�
E�
E�
�	�	�	�	
����3�4�s�C�j�I�I�I�
�	�	�	�
	
����3�c�3�Z�8�8�8�
�	�	�	�	
����3�4�?X�Z]�>^�_�_�_�
�	�	�	�	
����3�.G��-M�N�N�N�
�
	�
	�
	�
	�
	r!c�����tdd���}ttjj|���d�ttj|����D���d��D��}�fd��D�����fd�|D��}|�dtd	�|�	��D������d+d
�}|�
��D�]�\}}|D�]�\}}||d��dk}	||d
��dk}
||d��dk}d|vrWd�|dd�d��D��}d�|dd�d��D��}
ndx}
}d�d�t|�
����D����}|�|�d|�d���5|dkr|s|�
d|����|dkr|s|�
d|����d|vr:|dd�d��	�|�
d|�����|dz��}|d kr�t�d!��d"��5}t|d"��5}t!j|����d#|�������}ddd��n#1swxYwYddd��n#1swxYwYt(�||	|
||
|�$��}t�|dz��d%d&�'��5}|���}|d(kr,|�d)d*��}|�d)d*��}ddd��n#1swxYwY|�||��ddd��n#1swxYwY�����dS),Nzc14n-20rrc�L�g|]!}|�d���|dd���"S)�.xmlNr�)�endswith�rW�filenames  rrXz+C14NTest.test_xml_c14n2.<locals>.<listcomp>sB��/�/�/�8��%�%�f�-�-�/��#�2�#��/�/�/r!c�<�g|]}|�d���|��S)�in)�
startswithr	s  rrXz+C14NTest.test_xml_c14n2.<locals>.<listcomp>
s<��
�
�
�!��"�"�4�(�(�
��
�
�
r!c	���i|]Z}|�d���|d�t��|��dz�����D����[S)�c14nc��i|]>}|j�d��d|jpd���|f��?S)�}r�rP)rU�splitryr�)rW�options  r�
<dictcomp>z6C14NTest.test_xml_c14n2.<locals>.<dictcomp>.<dictcomp>sY�������
� � ��%�%�b�)�V�[�->�B�,E�,E�,G�,G��+P���r!r)r
r=rr�)rWr
�	full_paths  �rrz+C14NTest.test_xml_c14n2.<locals>.<dictcomp>s����
�
�
���"�"�6�*�*�
����!�h�h�y�y��':�':�V�'C�D�D�L�L�N�N����
�
�
r!c�2���i|]����fd��D����S)c����g|]]}|�d��d���rB|�dd��d�v�9|�|�dd��df��^S)�out_r.r�r�)r
�rsplit)rWr
�configs�
input_files  ��rrXz6C14NTest.test_xml_c14n2.<locals>.<dictcomp>.<listcomp>s���������&�&�';�j�';�';�';�<�<���O�O�C��+�+�B�/�7�:�:��7�8�?�?�3��#:�#:�2�#>�?�@�;�:�:r!r")rWrr�filess @��rrz+C14NTest.test_xml_c14n2.<locals>.<dictcomp>sW����
�
�
��

������ %����
�
�
r!�c��g|]	}|D]}|���
Sr"r")rW�output_files�output_files   rrXz+C14NTest.test_xml_c14n2.<locals>.<listcomp>&s=��"-�"-�"-�(�+�"-�"-��
�"-�"-�"-�"-r!c�>�|�||df��dS)Nr"r�rl)�config�option_namer�s   r�
get_optionz+C14NTest.test_xml_c14n2.<locals>.get_option*s���:�:�k�G�R�=�9�9�!�<�<r!�IgnoreComments�true�
TrimTextNodes�
PrefixRewrite�
sequential�
QNameAwarec�j�g|]0}d|�d���d|�d������1S��{�NSr�Namer"r�s  rrXz+C14NTest.test_xml_c14n2.<locals>.<listcomp>6sL������>�R�V�V�D�\�\�=�=�R�V�V�F�^�^�=�=���r!r�z/{http://www.w3.org/2010/xml-c14n2}QualifiedAttrc�j�g|]0}d|�d���d|�d������1Sr-r"r�s  rrXz+C14NTest.test_xml_c14n2.<locals>.<listcomp>;sL������>�R�V�V�D�\�\�=�=�R�V�V�F�^�^�=�=���r!z){http://www.w3.org/2010/xml-c14n2}Element�,c3�nK�|]0\}\}}|�d|pd�d�|D������V��1dS)�=r2c3�VK�|]$}|j�d��dV��%dS)rr�N)rUr)rWr�s  r�	<genexpr>z4C14NTest.test_xml_c14n2.<locals>.<genexpr>.<genexpr>Es5����/W�/W������C�0@�0@��0D�/W�/W�/W�/W�/W�/Wr!N)r*)rWrnr�r�s    rr6z*C14NTest.test_xml_c14n2.<locals>.<genexpr>Dsm����(�(�/��/�u�h��Y�Y�e�W�s�x�x�/W�/W�h�/W�/W�/W�'W�'W�Y�Y�(�(�(�(�(�(r!�(�)�
inNsRedeclz2Redeclared namespace handling is not supported in �inNsSuperfluousz.{http://www.w3.org/2010/xml-c14n2}XPathElementz2QName rewriting in XPath text is not supported in r�inC14N5z	world.txtrZs&ent2;)�	from_file�
with_commentsr�rewrite_prefixes�qname_aware_tags�qname_aware_attrs�rr�r�inC14N3z attr="default"rPr^)r	rr'r�r*r
�listdirr}r~�valuesr�r�r�r�r�rrFrGrr&r=r�)r5�datadir�input_files�testsr%rrr r#�
keep_commentsrr>�qattrs�qtags�config_descrr!�entity_fileryr�rrrs                   @@@r�test_xml_c14n2zC14NTest.test_xml_c14n2s4������9�]�;�;�;���B�G�L�'�2�2�	�/�/�v�b�j��6I�6I�/J�/J�/�/�/��
�
�%*�
�
�
��
�
�
�
�"�

�
�
��
�
�
�
�
�*�
�
�
��	
����S�"-�"-�,1�L�L�N�N�"-�"-�"-�.�.�	/�	/�	/�	=�	=�	=�	=�).���
�
�<	5�<	5�$�J��'3�;
5�;
5�#��V� *�
��,�!.�!.�17�!8�
�'�Z��O�-�-�06�7�
�#-�:��O�$-�$-�0<�$=� ��6�)�)���"(��"6�q�"9�"A�"A�M�#O�#O����F�
��"(��"6�q�"9�"A�"A�G�#I�#I����E�E�&*�)�E�F� #�x�x�(�(�39�&�,�,�.�.�3I�3I�(�(�(� � ��
�\�\�[�"B�"B�<�"B�"B�"B�C�C� 5� 5�!�\�1�1�:J�1��
�
�^�Q\�^�^�`�`�`�!�%6�6�6�?O�6��
�
�^�Q\�^�^�`�`�`�#�v�-�-�&��2F�q�2I�2N�2N�L�3N�3N�UY�3Z��
�
�^�Q\�^�^�`�`�`�"�	�*�v�"5�6�6�A�!�Y�.�.�!�)�)�K�"8�"8�$�?�?�`�;�!%�a����`�!�$&�J�q�v�v�x�x�/?�/?�	�;�K[�K[�K]�K]�/^�/^�$_�$_��`�`�`�`�`�`�`�`�`�`�`����`�`�`�`�`�`�`�`�`�`�`�`�`�`�`����`�`�`�`��?�?�"#�&3�#-�)9�).�&�+�J�J�D��i�i��f�(<�=�=�s�V�T�T�T�G�XY�#$�6�6�8�8��%��2�2�'/�'7�'7�8I�2�'N�'N�H�#'�<�<�0A�2�#F�#F�D�G�G�G�G�G�G�G�G�G�G�G����G�G�G�G��$�$�X�t�4�4�4�A 5� 5� 5� 5� 5� 5� 5� 5� 5� 5� 5���� 5� 5� 5� 5��7;
5�<	5�<	5s��B,O�L	�A
K+�L	�+K/�/L	�2K/�3L	�6O�L
�O�	L
�
AO�AN	�O�N"
�"O�%N"
�&O�O�O)r@rArB�maxDiffr�rrMr"r!rr�r��sP�������G�
&3�&3�&3�PG�G�G�`b5�b5�b5�b5�b5r!r�c���tddg���a|�t}|attt
ttttttttttt t"t$t&t(g}ttur|�t,g��ddlm}tjj}|���}|j}|���|_t;td��r0t�tjtj ��}nd}	tCj"|�ddlm}|�#��|�$|��||_|�tj|�dxaadS#ddlm}|�#��|�$|��||_|�tj|�dxaawxYw)Nr8r9)�blockedrr2�_set_factories)%r
r_r=r-rSr�r�rBr�r�r�r	rfr�r�r�r%r�r$r�r�r�r�r4r3r]�_namespace_mapr�r�r�rQrqr�r�run_unittestr�rD)�module�test_classesr3r��
nsmap_copyrG�
old_factoriess       r�	test_mainrXns����6�(6�'7�9�9�9�D�
�~���
�B�	������������������%
�L�0�2�~�~������	�	�	�
&�%�%�%�%�%��!�0�E������J��#�J�#���*�*�K���r�#�$�$���)�)�"�*�b�e�<�<�
�
��
����l�+�+�)�)�)�)�)�)�
���
�
�
�
���Z� � � �'����$���}�-�-����T�T�T��	*�)�)�)�)�)�
���
�
�
�
���Z� � � �'����$���}�-�-����T����s
�F"�"AG.�__main__)TrCr^)Rr�rrCrFr�r�r'rfrer�r�r�r2r�rrrrr�test.supportrrr	r
rr�test.support.import_helperr
�test.support.os_helperrr_r=r�r)�UnicodeEncodeErrorr�rr�r�r�rOrPrKrLr�r#r+�TestCaser-rQrZr\r�r�r�format�escaper r	r$r�r�r�r9�__hash__r?rBrfr�r�r�r%rLrSr�r�r�r�r�r�rXr@r"r!r�<module>rbsL��������������	�	�	�	���������	�	�	�	�
�
�
�
�
�
�
�
���������������������������%�%�%�%�%�%�%�%�������"�"�"�"�"�"�(�(�(�(�(�(�C�C�C�C�C�C�C�C�C�C�C�C�:�:�:�:�:�:�)�)�)�)�)�)���	����,�}�=�=�=��A����'�"�"�"�"���A�A�A�
�(�
�?�
@�
@�@�A�����H�_�]�C�C�C���8�3�M�J�J�J���
����
���"�
�����#(������4�4�4�
L�
L�
L�
L�
L��"�
L�
L�
L�����&�&�&�=�=�=�=�=�=�=�=�@VP�VP�VP�VP�VP�h�'�VP�VP�VP�r$p?�p?�p?�p?�p?��)�p?�p?�p?�l��������	������!����������������������F�;�4�;�~�t�,�,�-�-�
	���	'��	"�#�����X����X����	����	����	��p7�p7�p7�p7�p7�8�$�p7�p7�p7�l]J�]J�]J�]J�]J�x� �]J�]J�]J�H_4�_4�_4�_4�_4���(9�_4�_4�_4�DT�T�T�T�T�_�h�&7�T�T�T�n�����#���� #�|��������S�����,���?�?�?�?�?��(�*;�?�?�?�D5.�5.�5.�5.�5.�(�+�5.�5.�5.�pv:�v:�v:�v:�v:�h�'�v:�v:�v:�r](�](�](�](�](�h�'�](�](�](�@t.�t.�t.�t.�t.�h�'�t.�t.�t.�nQ:�Q:�Q:�Q:�Q:�H�%�Q:�Q:�Q:�hE�E�E�E�E��*�E�E�E�SI�SI�SI�SI�SI��*�SI�SI�SI�lC,�C,�C,�C,�C,�X�
�C,�C,�C,�L7�7�7�7�7�X�&�7�7�7�* 5� 5� 5� 5� 5�h�'� 5� 5� 5�HK�K�K�K�K��)�K�K�K� -�-�-�`5�`5�`5�`5�`5�x� �`5�`5�`5�JB�B�B�B�J�z���
�I�K�K�K�K�K��s�B�B/