403Webshell
Server IP : 46.62.235.243  /  Your IP : 216.73.216.217
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/supervisor/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/supervisor/tests/__pycache__/test_templating.cpython-312.pyc
�

k��c����@�ddlZddlZddlZdZdZdZdZdZdZdZ	d	Z
Gd
�dej�ZGd�d
ej�Z
Gd�dej�ZGd�dej�ZGd�dej�Zd�Zd�Zd�Zd�Zedk(re�yy)�Na<?xml version="1.0"?>
<root xmlns:meld="https://github.com/Supervisor/supervisor">
  <list meld:id="list">
    <item meld:id="item">
       <name meld:id="name">Name</name>
       <description meld:id="description">Description</description>
    </item>
  </list>
</root>z�<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:meld="https://github.com/Supervisor/supervisor">
   <body meld:id="body">Hello!</body>
</html>z�<html>
  <body>
    <area/><base/><basefont/><br/><col/><frame/><hr/><img/><input/><isindex/>
    <link/><meta/><param/>
  </body>
</html>a?<html>
  <body>
  <tag selected="true"/>
  <tag checked="true"/>
  <tag compact="true"/>
  <tag declare="true"/>
  <tag defer="true"/>
  <tag disabled="true"/>
  <tag ismap="true"/>
  <tag multiple="true"/>
  <tag nohref="true"/>
  <tag noresize="true"/>
  <tag noshade="true"/>
  <tag nowrap="true"/>
  </body>
</html>z^
<html>
<head></head>
<body>
  <!-- test entity references -->
  <p>&nbsp;</p>
</body>
</html>a:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:meld="https://github.com/Supervisor/supervisor"
      xmlns:bar="http://foo/bar">
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
    <title meld:id="title">This will be escaped in html output: &amp;</title>
    <script>this won't be escaped in html output: &amp;</script>
    <script type="text/javascript">
            //<![CDATA[
              // this won't be escaped in html output
              function match(a,b) {
                 if (a < b && a > 0) then { return 1 }
                }
             //]]>
    </script>
    <style>this won't be escaped in html output: &amp;</style>
  </head>
  <!-- a comment -->
  <body>
    <div bar:baz="slab"/>
    <div meld:id="content_well">
      <form meld:id="form1" action="." method="POST">
      <img src="foo.gif"/>
      <table border="0" meld:id="table1">
        <tbody meld:id="tbody">
          <tr meld:id="tr" class="foo">
            <td meld:id="td1">Name</td>
            <td meld:id="td2">Description</td>
          </tr>
        </tbody>
      </table>
      <input type="submit" name="submit" value=" Next "/>
      </form>
    </div>
  </body>
</html>a<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
  <title meld:id="title">test doc</title>
</head>
<body>
 <!-- comment! -->
 Oh yeah...<br>
<br>
<table style="text-align: left; width: 100px;" border="1" cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td>Yup</td>
      <td>More </td>
      <td>Stuff</td>
      <td>Oh Yeah</td>
    </tr>
    <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
  </tbody>
</table>
<br>
<a href=".">And an image...</a><br>
<br>
<img style="width: 2048px; height: 1536px;" alt="dumb" src="IMG_0102.jpg">
</body>
</html>aO
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <title>Emergency Contacts</title>
</head>
<body>
   <div class="header">Emergency Contacts</div>

   <form action="." method="POST">
    <table>

      <tbody meld:id="tbody">

	<tr>
	  <th>Title</th>
	  <td>
	    <input type="text" name="honorific" size="6" value=""
		   meld:id="honorific"/>
	  </td>
	</tr>

	<tr>
	  <th>First Name</th>
	  <td>
	    <input type="text" name="firstname" size="20" value=""
		   meld:id="firstname"/>
	  </td>
	</tr>

	<tr>
	  <th>Middle Name</th>
	  <td>
	    <input type="text" name="middlename" size="15" value=""
		   meld:id="middlename"/>
	  </td>
	</tr>

	<tr>
	  <th>Last Name</th>
	  <td>
	    <input type="text" name="lastname" size="20" value=""
		   meld:id="lastname"/>
	  </td>
	</tr>

	<tr>

	  <th>Suffix</th>
	  <td style="width: 554px;">
          <select name="suffix" meld:id="suffix">
	      <option value="Jr.">Jr.</option>
	      <option value="Sr.">Sr.</option>
	      <option value="III">III</option>
	    </select>
          </td>

        </tr>

	<tr>
	  <th>Address 1</th>
	  <td>
	    <input type="text" name="address1" size="30" value=""
		   meld:id="address1"/>
	  </td>
	</tr>

	<tr>
	  <th>Address 2</th>
	  <td>
	    <input type="text" name="address2" size="30" value=""
		   meld:id="address2"/>
	  </td>
	</tr>

	<tr>
	  <th>City</th>
	  <td>
	    <input type="text" name="city" size="20" value=""
		   meld:id="city"/>
	  </td>
	</tr>

	<tr>
	  <th>State</th>
	  <td>
	    <input type="text" name="state" size="5" value=""
		   meld:id="state"/>
	  </td>
	</tr>

	<tr>
	  <th>ZIP</th>
	  <td>
	    <input type="text" name="zip" size="8" value=""
		   meld:id="zip"/>
	  </td>
	</tr>

	<tr>
	  <th>Home Phone</th>
	  <td>
	    <input type="text" name="homephone" size="12" value=""
		   meld:id="homephone"/>
	  </td>
	</tr>

	<tr>
	  <th>Cell/Mobile Phone</th>
	  <td>
	    <input type="text" name="cellphone" size="12" value=""
		   meld:id="cellphone"/>
	  </td>
	</tr>

	<tr>
	  <th>Email Address</th>
	  <td>
	    <input type="text" name="email" size="20" value=""
		   meld:id="email"/>
	  </td>
	</tr>

	<tr>
	  <th>Over 18? (Checkbox Boolean)</th>
	  <td>
            <input type="checkbox" name="over18" meld:id="over18"
                   value="true" checked="true"/>
	  </td>
	</tr>

	<tr>

	  <th>Mail OK? (Checkbox Ternary)</th>
          <td style="width: 554px;" meld:id="mailok:inputgroup">
            <input type="hidden" name="mailok:default"
                   value="false"/>
            <input type="checkbox" name="mailok"
                   value="true" checked/>
            <input type="checkbox" name="mailok"
                   value="false"/>
          </td>

        </tr>

	<tr>

	  <th>Favorite Color (Radio)</th>
          <td style="width: 554px;" meld:id="favorite_color:inputgroup">
            Red   <input type="radio" name="favorite_color"
                         value="Red"/>
            Green <input type="radio" name="favorite_color"
                         value="Green"/>
            Blue  <input type="radio" name="favorite_color"
                         value="Blue"/>
          </td>

        </tr>

	<tr>
	  <th></th>
	  <td>
	    <input type="submit" value=" Update " name="edit:method" />
	  </td>
	</tr>

      </tbody>
    </table>
    </form>

<p><a href="..">Return to list</a></p>
</body>
</html>
c�f�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zy)�MeldAPITestsc��ddlm}||�S�Nr��parse_xmlstring��supervisor.templatingr)�self�stringrs   �B/usr/lib/python3/dist-packages/supervisor/tests/test_templating.py�_makeElementzMeldAPITests._makeElement8s��9��v�&�&�c��ddlm}||�S�Nr��parse_htmlstring�r
r)rrrs   r
�_makeElementFromHTMLz!MeldAPITests._makeElementFromHTML<s��:���'�'rc���|jt�}|jd�}|j|jd�|jd�}|j|j
d�y)N�item�name�Name)r�_SIMPLE_XML�findmeld�assertEqual�tag�text)r�rootrrs    r
�
test_findmeldzMeldAPITests.test_findmeld@sV��� � ��-���}�}�V�$��������6�*��}�}�V�$��������F�+rc��|jt�}|jd�}|j|jd�|jdd�}|j|d�|j|jd�d�y)Nr�unknown�foo)rrrrr)rrrr"s    r
�test_findmeld_defaultz"MeldAPITests.test_findmeld_defaultGsm��� � ��-���}�}�V�$��������6�*��-�-�	�5�1������%�(�������y�1�4�8rc��|jt�}|jd�}|j|jd�ddd�ddd�g}|j|�D]7\}}|d|jd�_|d|jd�_�9|j|d	jd�|j|d
jd�y)Nr�Jeff Buckley�ethereal�r�description�Slipknot�heavyrr)r��rrrrr�repeatr)rrr�data�element�ds      r
�test_repeat_nochildz MeldAPITests.test_repeat_nochildOs���� � ��-���}�}�V�$��������6�*�&�j�A�"�'�:�<���+�+�d�+�	D�J�G�Q�,-�f�I�G���V�$�)�34�]�3C�G���]�+�0�	D�	
����a����~�6�����a����z�2rc�D�|jt�}|jd�}|j|jd�ddd�ddd�g}|j|d�D]7\}}|d|jd�_|d	|jd	�_�9|j|d
d
jd�|j|d
djd�|j|dd
jd�|j|ddjd�y)N�listr&r'r(r*r+rrr)rr,r-)rrr4r/r0r1s      r
�test_repeat_childzMeldAPITests.test_repeat_child[s��� � ��-���}�}�V�$��������6�*�&�j�A�"�'�:�<���+�+�d�F�3�	D�J�G�Q�,-�f�I�G���V�$�)�34�]�3C�G���]�+�0�	D�	
����a������.�9�����a������*�5�����a������*�5�����a������'�2rc���|jt�}|ddd�z|jd�}|j|jd�|jd�}|j|jd�y)Nr#�bar)r)rrr))rrrrr)rrr�descs    r
�test_modzMeldAPITests.test_modisc��� � ��-���e�E�2�2��}�}�V�$��������E�*��}�}�]�+��������E�*rc���|jt�}|jdiddd���}|jd�}|j	|j
d�|j	|dg�y)Nr#�a)r)�jammyjamr)r<�)rr�	fillmeldsrrr)rr�unfilledr8s    r
�test_fillmeldszMeldAPITests.test_fillmeldsqs^��� � ��-��!�4�>�>�J�5�S�$I�J���}�}�]�+��������E�*�����J�<�0rc��idd�dd�dd�dd�d	d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd �idd�dd!�dd"�dd#�d	d$�dd%�d
d&�dd'�dd(�dd)�dd*�dd+�dd,�dd-�dd.�dd/�idd!�dd"�dd#�d	d$�dd%�d
d&�dd'�dd(�dd)�dd*�dd+�dd0�dd-�dd.�dd1�d2d3�g}|jt�}|j�}|jd9i|d4��}|j	|g�|j	|jd�jd5d�|j	|jd�jd5d�|jd�}|j	|jd5d�|jd�}|j	|d3jd6d6�|j	|jd�jd7d7�|jd�}|j	|d3jd7d7�|jd�}|j	|d3jd7d7�|j�}|jd9i|d3��}|j	|dg�|j	|jd�jjd7�d�|jd�}|j	|d8jd7d7�|j	|d3jjd7�d�|j�}|jd9i|d8��}|j	t|�d2dg�|j	|jd�jd�|jd�}|j	|d8jd7d7�|j	|d3jjd7�d�y):N�	honorificzMr.�	firstname�Chris�
middlename�Phillips�lastname�	McDonough�address1z802 Caroline St.�address2zApt. 2B�city�Fredericksburg�state�VA�zip�22401�	homephonez555-1212�	cellphonez555-1313�emailzuser@example.com�suffixzSr.�over18Tzmailok:inputgroup�truezfavorite_color:inputgroup�Green�Fred��Rogersz1 Imaginary LanezApt. 3AzNever Never Land�LA�00001z555-1111z555-4444zfred@neighborhood.comzJr.F�false�Yellow�IV�Blue�nottherer,r�value�selected�checked�r=)
r�_FILLMELDFORM_HTML�clone�fillmeldhtmlformrr�attrib�get�sortedr)	rr/rrgr?rErT�mailok�
favoritecolors	         r
�test_fillmeldhtmlformz"MeldAPITests.test_fillmeldhtmlformxs#��
N�[��
N��G�
N�\�*�
N�
��
N�%/�0B�
N�
�	�
N�#)�*:�
N�<C�T�
N��7�
N�(�
�
N�5@�
�
N��'�	
N�*2�%�	
N�:B�$�	
N�
!��
N�
*E�W�
N�
P�[��
P��F�
P�L��
P�
��
P�",�-?�
P�
�	�
P�#)�*<�
P�>E�t�
P��7�
P�(�
�
P�5@�
�
P��,�	
P�/7�u�	
P�?G�u�	
P�
!��
P�
*E�X�
P�
�[��
��b�
�
��
�",�-?�
�
�	�
�#)�*<�
�>E�t�
��7�
�(�
�
�5@�
�
��,�	
�/7�t�	
�>F�e�	
�
!��
�
+F�f�
���

���*�(�(�);�<���
�
���)�5�)�)�4�D��G�4������2�&��������4�;�;�G�D�e�L��������4�;�;�G�D�g�N��^�^�L�1�
�����*�*�7�3�Z�@�����)��������)�)�*�5�z�B��������1�8�8��C�Y�O���� 3�4��������)�)�)�4�i�@����'B�C�
�����q�)�0�0��;�Y�G��
�
���)�5�)�)�4�D��G�4������$?�#@�A��������1�8�8�<�<�Y�G��N���� 3�4��������)�)�)�4�i�@�������)�)�-�-�i�8�$�?��
�
���)�5�)�)�4�D��G�4�������)�J��+A�B��������4�9�9�4�@����'B�C�
�����q�)�0�0��;�Y�G�����q�)�0�0�4�4�Y�?��Frc��ddlm}|jt�}|j	d�}|jd�|d}|j
|j|�|j
t|j��d�y)Nr��Replacer4�this is a textual replacementr,)
r
rqrrr�replacerr�len�getchildren)rrqr�L�Rs     r
�!test_replace_removes_all_elementsz.MeldAPITests.test_replace_removes_all_elements�sk��1�� � ��-���M�M�&�!��	�	�	�1�2���G���������(�����T�-�-�/�0�!�4rc��ddlm}|jt�}|j	d�}|jd�|j
t|j��d�|d}|j
|jd�|j
t|j��d�|d}|j
|jd�|j
t|j��d�|d}|j
|jd	�|j
t|j��d�|d}|j
|j|�|j
|jd�|j
t|j��d�|j
|jd
�y�Nrrpr)rrr,r4rrerF)r
rqrrrrsrrtrurr�	structure)rrqr�Drv�I�Ns       r
�'test_replace_replaces_the_right_elementz4MeldAPITests.test_replace_replaces_the_right_element�sW��1�� � ��-���M�M�-�(��	�	�	�1�2�����T�-�-�/�0�!�4���G���������'�����Q�]�]�_�-�q�1�
�a�D���������'�����Q�]�]�_�-�q�1�
�a�D���������'�����Q�]�]�_�-�q�1�
�a�D���������(�������!@�A�����Q�]�]�_�-�q�1�������e�,rc�
�ddlm}|jt�}|j	d�}|jd�|j
t|j��d�|d}|j
|jd�|j
t|j��d�|d}|j
|jd�|j
t|j��d�|d}|j
|jd	�|j
t|j��d�|d}|j
|jd�|j
|jd�|j
t|j��d�|d}|j
|j|�|j
|jd�|j
|jd
�yrz)r
rqrrr�contentrrtrurrr{)rrqrr|rvr}r~�Ts        r
�test_contentzMeldAPITests.test_content�s���1�� � ��-���M�M�-�(��	�	�	�1�2�����T�-�-�/�0�!�4���G���������'�����Q�]�]�_�-�q�1�
�a�D���������'�����Q�]�]�_�-�q�1�
�a�D���������'�����Q�]�]�_�-�q�1�
�a�D��������
�.��������&�����Q�]�]�_�-�q�1�
�a�D���������(�������!@�A�������e�,rc���ddlm}|jt�}|j	d�}|jdddd��|j
|jd	dd
ddddd
dd|di�y)Nr��_MELD_ID�form1r7�1�2�#)r#�baz�g�actionr#r�r��method�POSTr�)r
r�r�_COMPLEX_XHTMLr�
attributesrri)rr�rr|s    r
�test_attributeszMeldAPITests.test_attributes�sk��2�� � ��0���M�M�'�"��	����C�3�s��;��������%��s�C���V�X�c��g�$�	 rc��ddlm}ddlm}|j	t
�}|j
d�}|j|dd��|dd���	�|j|jd
|dd��ddd
|dd��|di�y)Nrr���	as_stringr�r7�latin1��encodingr�)r#r�r#r�r�r�)
r
r��supervisor.compatr�rr�rr�rri)rr�r�rr|s     r
�test_attributes_unicodez$MeldAPITests.test_attributes_unicode�s���2�/�� � ��0���M�M�'�"��	����5�8�<�%�c�H�=�	�	?��������)�E�H�5��V�X�y��x�'H��g�$�	 rc�j�|jd�}|jt|jd��y)N�
<root></root>r,)r#)r�assertRaises�
ValueErrorr�)rrs  r
�$test_attributes_nonstringtype_raisesz1MeldAPITests.test_attributes_nonstringtype_raises�s+��� � ��1�����*�d�o�o�1��=rN)�__name__�
__module__�__qualname__rrr r$r2r5r9r@rnrxrr�r�r�r�r=rr
rr7sO��'�(�,�9�
3�3�+�1�5G�n5�-�*-�0 �
 �>rrc��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 y) �MeldElementInterfaceTestsc��ddlm}|S)Nr)�_MeldElementInterface)r
r�)rr�s  r
�_getTargetClassz)MeldElementInterfaceTests._getTargetClasss��?�$�$rc�2�|j�}||i|��S�N)r�)r�arg�kw�klasss    r
�_makeOnez"MeldElementInterfaceTests._makeOnes ���$�$�&���c� �R� � rc�D�|jdi�}ddlm}|jd|di�}|jd|di�}|jd|di�}|jd|di�}|j|�|j|�|j|�|j|�dd	d
�ddd
�g}|j	|�D]7\}}	|	d|jd�_|	d|jd�_�9|jt|�d
�|d}
|jt|
�d�|
d}|jt|�d
�|d}|d}
|j|jd�|j|
jd	�|d}|jt|�d�|d}|jt|�d
�|d}|d}|j|jd�|j|jd�y)Nrrr�r�recordrr)r&r'r(r*r+rer,)	r�r
r��appendr.rrrrt)rrr�rr�rr)r/r0r1�item1�record1�name1�desc1�item2�record2�name2�desc2s                  r
�test_repeatz%MeldElementInterfaceTests.test_repeats����}�}�V�R�(��2��}�}�V�h�v�%6�7�����x�(�8�)<�=���}�}�V�h�v�%6�7���m�m�M�H�]�3K�L���
�
�d���
�
�k�"����F�����D��&�j�A�"�'�:�<���+�+�d�+�	D�J�G�Q�,-�f�I�G���V�$�)�34�]�3C�G���]�+�0�	D�	
����T��A�&��Q�������U��Q�'���(������W��q�)���
����
��������^�4�������Z�0��Q�������U��Q�'���(������W��q�)���
����
��������Z�0�������W�-rc��|jdddi�}|jd�|jt|j�d�|jd}|j|j
|�|j|jd�|j|jd�ddlm	}|j|j|�y)	N�div�id�thediv�hellor,rFrp�r�r�rrt�	_children�parentrr{r
rqr�r�el�replacenoderqs    r
�test_content_simple_nostructurez9MeldElementInterfaceTests.test_content_simple_nostructure/s���
�]�]�5�4��/�
2��
�
�
�7������R�\�\�*�A�.��l�l�1�o������+�+�R�0�����)�)�7�3�����.�.��6�1�������'�2rc��|jdddi�}|jdd��|jt|j�d�|jd}|j|j
|�|j|jd�|j|jd�dd	lm	}|j|j|�y)
Nr�r�r�r�T�r{r,rrpr�r�s    r
�test_content_simple_structurez7MeldElementInterfaceTests.test_content_simple_structure:s���
�]�]�5�4��/�
2��
�
�
�7�d�
�+�����R�\�\�*�A�.��l�l�1�o������+�+�R�0�����)�)�7�3�����.�.��5�1�������'�2rc�z�ddlm}|jd|di�}|j|j	d�|�y)Nrr�r�r�)r
r�r�rr)rr�r�s   r
�test_findmeld_simplez.MeldElementInterfaceTests.test_findmeld_simpleEs3��2�
�]�]�5�8�H�"5�
6��������X�.��3rc���ddlm}|jd|di�}|jd|di�}|j|�|j	|jd�|�y)Nrr�r�r��span�thespan�r
r�r�r�rr)rr�r�r�s    r
�!test_findmeld_simple_oneleveldownz;MeldElementInterfaceTests.test_findmeld_simple_oneleveldownJsS��2�
�]�]�5�8�H�"5�
6���}�}�V�h�y�%9�:��
�	�	�$��������Y�/��6rc��ddlm}|jd|di�}|jd|di�}|jd|di�}|j|�|j|�|j	|jd�|�y)	Nrr�r�r�r�r�r;�thear�)rr�r�r�r;s     r
�"test_findmeld_simple_twolevelsdownz<MeldElementInterfaceTests.test_findmeld_simple_twolevelsdownQss��2�
�]�]�5�8�H�"5�
6���}�}�V�h�y�%9�:���M�M�#���0�1�����A��
�	�	�$��������V�,�a�0rc���|jdddi�}|j|jd�|j|jd�|j|jddi�y)Nr�r�r�)r�rr�rri)r�ifaces  r
�	test_ctorz#MeldElementInterfaceTests.test_ctorZsV���
�
�e�d�8�_�5��������t�,�������E�*��������X��7rc��|jdddi�}|j�}|jt|�d�|j|d|�y)Nr�r�r�r,r)r��getiteratorrrt)rr��iterators   r
�test_getiterator_simplez1MeldElementInterfaceTests.test_getiterator_simple`sJ���m�m�E�D��?�3���?�?�$������X���*�����!��c�*rc� �|jdddi�}|jdi�}|jdddi�}|jdddi�}d|_d	|_|j|�|j|�|j|�|j	�}|jt
|�d
�|j|d|�|j|d|�|j|d
|�|j|d|�y)Nr�r�r�r�r��span3�3�abc�  �rr,re��r�r�tailr�r�rrt�rr�r��span2r��its      r
�test_getiteratorz*MeldElementInterfaceTests.test_getiteratorfs����m�m�E�D��?�3���}�}�V�R�(���
�
�f�t�C�j�1���
�
�g��S�z�2����
���
��
�
�4�����E��
���U��
�_�_�
������R��!�$�����A���$�����A���%�����A���&�����A���&rc�$�|jdddi�}|jdi�}|jdddi�}|jdddi�}d|_d	|_|j|�|j|�|j|�|j	d�
�}|jt
|�d�|j|d|�|j|d
|�|j|d|�|j|d|�y)Nr�r�r�r�r�r�r�r�r�)rr�rr,rer�r�r�s      r
�test_getiterator_tag_ignoredz6MeldElementInterfaceTests.test_getiterator_tag_ignoredxs����m�m�E�D��?�3���}�}�V�R�(���
�
�f�t�C�j�1���
�
�g��S�z�2����
���
��
�
�4�����E��
���U��
�_�_��_�
'������R��!�$�����A���$�����A���%�����A���&�����A���&rc���|jdddi�}|jdi�}|j|�|j|djd�|j|j|�y)Nr�r�r�r�r)r�r�rrr��rr�r�s   r
�test_appendz%MeldElementInterfaceTests.test_append�s^���m�m�E�D��?�3���}�}�V�R�(���
�
�4������Q����V�,�������c�*rc�b�|jdddi�}|jdi�}|jdddi�}|j|�||d<|j|djd�|j|djddi�|j|dj
|�y)Nr�r�r�r�r�r)r�r�rrrir��rr�r�r�s    r
�test__setitem__z)MeldElementInterfaceTests.test__setitem__�s����m�m�E�D��?�3���}�}�V�R�(���
�
�f�t�C�j�1���
�
�4����A������Q����V�,�����Q�����c�
�3�����Q�����,rc�6�|jdddi�}|jdi�}|jdddi�}|j|�|jd|�|j|djd�|j|dj
ddi�|j|dj|�|j|djd�|j|dj
i�|j|dj|�y)Nr�r�r�r�r�rr,)r�r��insertrrrir�r�s    r
�test_insertz%MeldElementInterfaceTests.test_insert�s����m�m�E�D��?�3���}�}�V�R�(���
�
�f�t�C�j�1���
�
�4���
�
�1�e������Q����V�,�����Q�����c�
�3�����Q�����,�����Q����V�,�����Q�����+�����Q�����,rc��|jdddi�}d|_d|_|jdi�}|j|�|j	�y)Nr�r�r�r�z   r�)r�rr�r�rgr�s   r
�test_clone_simplez+MeldElementInterfaceTests.test_clone_simple�sI���m�m�E�D��?�3���������}�}�V�R�(���
�
�4���	�	�rc�z�|jdddi�}|jdi�}|jdddi�}|jdddi�}d|_d	|_|j|�|j|�|j|�|j	�}|j|j|j�|j|j|j�|j|d
j|d
j�|j|d
j|d
j�|j|d
d
j|d
d
j�|j|d
d
j|d
d
j�|j|d
d
d
j|d
d
d
j�|j|d
d
d
j|d
d
d
j�|j|d
d
d
j|d
d
d
j�|j|d
d
d
j|d
d
d
j�|jt|�t|��|jt|d
�t|d
��|jt|d
d
�t|d
d
��|jt|d
d
d
�t|d
d
d
��y)Nr�r�r�r�r�r�r�r�r�r)
r�rr�r�rgrrri�assertNotEqualr�)rr�r�r�r��div2s      r
�
test_clonez$MeldElementInterfaceTests.test_clone�s����m�m�E�D��?�3���}�}�V�R�(���
�
�f�t�C�j�1���
�
�g��S�z�2����
���
��
�
�4�����E��
���U���y�y�{��������$�(�(�+�������T�[�[�1�����Q����T�!�W�[�[�1�����Q�����Q����7�����Q�������Q���
���7�����Q����)�)�4��7�1�:�+<�+<�=�����Q����1��)�)�4��7�1�:�a�=�+<�+<�=�����Q����1��,�,�d�1�g�a�j��m�.B�.B�C�����Q����1��*�*�D��G�A�J�q�M�,>�,>�?�����Q����1��*�*�D��G�A�J�q�M�,>�,>�?����B�s�G�R��X�.����B�s�1�v�J��4��7��4����B�s�1�v�a�y�M�2�d�1�g�a�j�>�:����B�s�1�v�a�y��|�,�b��a����A��.?�@rc��|jdi�}|j|jd�|j�|j|jd�y)Nr�)r�rr��deparent)rr�s  r
�test_deparent_noparentz0MeldElementInterfaceTests.test_deparent_noparent�sC���m�m�E�2�&��������T�*�����������T�*rc���|jdi�}|j|jd�|jdi�}|j|�|j|jd�|j|j|�|j|d|�|j	�|j|jd�|jt|jd�y)Nr��childr)r�rr�r�r�r��
IndexError�__getitem__)rr�r�s   r
�test_deparent_withparentz2MeldElementInterfaceTests.test_deparent_withparent�s������x��,���������-��
�
�g�r�*���
�
�e���������-�������v�.�������E�*�
����������t�,����*�f�&8�&8�!�<rc��|jdi�}|jdi�}|jdi�}|jdi�}|||f}||dd|j|j|�|j|j|�|j|j|�|j|jt	|��y)Nr��child1�child2�child3rre)r�rr�r�r4�rr�rrr�childrens      r
�
test_setslicez'MeldElementInterfaceTests.test_setslice�s������x��,�����x��,�����x��,�����x��,���F�F�+����q����������/��������/��������/�����)�)�4��>�:rc��|jdi�}|jdi�}|jdi�}|jdi�}|||f}||dd|dd�=|j|jd�|j|jd�|j|j|�|jt|j�d�y)Nr�rrrrrer,)r�rr�rtr�rs      r
�
test_delslicez'MeldElementInterfaceTests.test_delslice�s������x��,�����x��,�����x��,�����x��,���F�F�+����q����1�Q�3�K��������-��������-��������/�����V�-�-�.��2rc��|jdi�}|jdi�}|j|�|j|�|j|jd�|jt|j�d�y)Nr�rr)r�r��removerr�rtr�)rr�rs   r
�test_removez%MeldElementInterfaceTests.test_remove�si�����x��,�����x��,���
�
�f���
�
�f���������-�����V�-�-�.��2rc�X�ddlm}|jd|di�}|jd|di�}|jd|di�}|jd|di�}|jd|d	i�}|jd|d
i�}|jd|di�}|jdi�}	|jd|di�}
|j|�|j|�|j|�|j|	�|	j|�|j|�|j|�|j|
�d
�}|j	||j��dg�|j	||j��ddg�|j	||j��gd��|j	||j��gd��|j	||	j��gd��|j	||j��gd��|j	||j��gd��|j	||j��gd��|j	||
j��ddg�y)Nrr�r��div1r��span1r�r��span4�span5�span6r�c�H�|D�cgc]}|j���c}Scc}wr�)�meldid)rv�xs  r
�idsz3MeldElementInterfaceTests.test_lineage.<locals>.idss��)*�,�A�Q�X�X�Z�,�,��,s�)r�rr
)r�r�rr
)Nr�r�rr
)rNr�r�rr
)rrNr�r�rr
)rrrNr�r�rr
)r
r�r�r�r�lineage)rr�r
rr�r�rrrr"r�rs            r
�test_lineagez&MeldElementInterfaceTests.test_lineage�sJ��2��}�}�U�X�f�$5�6���
�
�f�x��&8�9���
�
�f�x��&8�9���
�
�f�x��&8�9���
�
�f�x��&8�9���
�
�f�x��&8�9���
�
�f�x��&8�9���-�-���+���}�}�V�h�v�%6�7�����E��
���U��
���U��
���W�����u��
���U��
���U�����D��	-�����T�\�\�^�,�v�h�7�����U�]�]�_�-���/@�A�����U�]�]�_�-�/I�J�����U�]�]�_�-�0<�	=�����W�_�_�.�/�2:�	;�	
����U�]�]�_�-�0@�	A�	
����U�]�]�_�-�0@�	A�	
����U�]�]�_�-�0D�	E�	
����T�\�\�^�,�v�v�.>�?rc�f�ddlm}|jdddi�}|jdi�}|jdddi�}|jdddi�}|j|�|j|�|j|�|j	�}|j||d	d
���y)Nr��as_bytesr�r�r
r�r�r�zM<div id="div1"><span><span id="2"></span></span><div2 id="div2"></div2></div>r�r�)r�rr�r��	shortreprr)rrr�r�r�r��rs       r
�test_shortreprz(MeldElementInterfaceTests.test_shortrepr)s���.��m�m�E�D��=�1���}�}�V�R�(���
�
�f�t�C�j�1���}�}�V�d�6�]�3���
�
�4�����E���
�
�4���M�M�O�������5�?G�
I�	Jrc��ddlm}ddlm}|t�}|j�}|j
||dd���y)Nrrrz�<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
     [...]
</head>
  <!--  a comment  -->
   [...]
</html>r�r�)r
rr�rr�rr)rrrrrs     r
�test_shortrepr2z)MeldElementInterfaceTests.test_shortrepr27s@��9�.��~�.���N�N���������$,�
-�	.rc���ddlm}ddlm}|t�}|j	�}|jd|di�}|j
|�|jd�}|j�|jd�}|j�|j
|�|j|�}|d}	|	d	D�
cgc]}
|
j|��}}
|	d
D�
cgc]}
|
j|��}}
|	dD�
cgc]}
|
j|��}
}
|j�|j�|
j�|j|dg�|j|gd��|j|
dg�|d
}	|	d	D�
cgc]}
|
j|��}}
|	d
D�
cgc]}
|
j|��}}
|	dD�
cgc]}
|
j|��}
}
|j�|j�|
j�|j|dg�|j|dg�|j|
dg�ycc}
wcc}
wcc}
wcc}
wcc}
wcc}
w)Nrrr�r��newdiv�tr�title�	unreduced�added�removed�moved)�td1�td2r"�reduced)
r
rr�r�rgr�r�rr��diffmeldri�sortr)rrr�rrgr�r"r#�diff�changesr�	addedtags�removedtags�	movedtagss              r
�test_diffmeld1z(MeldElementInterfaceTests.test_diffmeld1Fs'��9�2��~�.���
�
����m�m�E�H�X�#6�7��
���S��
�^�^�D�
!��
���
����w�'��
����
���U���}�}�U�#���{�#��29�'�2B�D�Q�a�h�h�x�(�D�	�D�3:�9�3E�G�a�q�x�x��)�G��G�29�'�2B�D�Q�a�h�h�x�(�D�	�D�����������������H�:�.�����%9�:�����W�I�.��y�/��29�'�2B�D�Q�a�h�h�x�(�D�	�D�3:�9�3E�G�a�q�x�x��)�G��G�29�'�2B�D�Q�a�h�h�x�(�D�	�D�����������������H�:�.�����d�V�,�����W�I�.��)E��G��D��E��G��Ds$�>I
�I�<I�
I�)I�I#c�.�d}d}ddlm}||�}||�}|j|�}|ddD�cgc]}|j���}}dg}	|j	|	|�|ddD�cgc]}|j���}}g}	|j	|	|�|dd	D�cgc]}|j���}}g}	|j	|	|�|d
dD�cgc]}|j���}}dg}	|j	|	|�|d
dD�cgc]}|j���}}g}	|j	|	|�|d
d	D�cgc]}|j���}}g}	|j	|	|�ycc}wcc}wcc}wcc}wcc}wcc}w)Nzi
        <root>
          <a meld:id="a">
             <b meld:id="b"></b>
          </a>
        </root>zd
        <root>
          <a meld:id="a"></a>
          <b meld:id="b"></b>
        </root>
        rrr$r'�br%r&r*�r
rr+rr�
r�source�targetr�source_root�target_rootr.r�actual�expecteds
          r
�test_diffmeld2z(MeldElementInterfaceTests.test_diffmeld2ls�������	;�&�v�.��&�v�.���&�&�{�3��'.�k�&:�7�&C�D��!�(�(�*�D��D��5������6�*�&-�k�&:�7�&C�D��!�(�(�*�D��D�������6�*�&-�k�&:�9�&E�F��!�(�(�*�F��F�������6�*�'.�i�&8��&A�B��!�(�(�*�B��B��5������6�*�&-�i�&8��&A�B��!�(�(�*�B��B�������6�*�&-�i�&8��&C�D��!�(�(�*�D��D�������6�*��/E��E��G��
C��C��Es#�E9�.E>�%F�F�F
�Fc�<�d}d}ddlm}||�}||�}|j|�}|ddD�cgc]}|j���}}ddg}	|j	|	|�|dd	D�cgc]}|j���}}d
dg}	|j	|	|�|ddD�cgc]}|j���}}d
dg}	|j	|	|�|ddD�cgc]}|j���}}dg}	|j	|	|�|dd	D�cgc]}|j���}}d
g}	|j	|	|�|ddD�cgc]}|j���}}d
g}	|j	|	|�ycc}wcc}wcc}wcc}wcc}wcc}w)Nz�
        <root>
          <a meld:id="a">
             <b meld:id="b">
               <c meld:id="c"></c>
             </b>
          </a>
          <z meld:id="z">
            <y meld:id="y"></y>
          </z>
        </root>
        z�
        <root>
          <b meld:id="b">
            <c meld:id="c"></c>
          </b>
          <a meld:id="a"></a>
          <d meld:id="d">
             <e meld:id="e"></e>
          </d>
        </root>
        rrr$r'r4�cr%r1�er&�z�yr*r5r6s
          r
�test_diffmeld3z(MeldElementInterfaceTests.test_diffmeld3�s�����
��	;�&�v�.��&�v�.���&�&�{�3��'.�k�&:�7�&C�D��!�(�(�*�D��D���:������6�*�&-�k�&:�7�&C�D��!�(�(�*�D��D���:������6�*�&-�k�&:�9�&E�F��!�(�(�*�F��F���:������6�*�'.�i�&8��&A�B��!�(�(�*�B��B��5������6�*�&-�i�&8��&A�B��!�(�(�*�B��B��5������6�*�&-�i�&8��&C�D��!�(�(�*�D��D��5������6�*��/E��E��G��
C��C��Es#�F�/F�(F
�!F�F�Fc�>�d}d}ddlm}||�}||�}|j|�}|ddD�cgc]}|j���}}ddg}	|j	|	|�|dd	D�cgc]}|j���}}d
dg}	|j	|	|�|ddD�cgc]}|j���}}gd
�}	|j	|	|�|ddD�cgc]}|j���}}dg}	|j	|	|�|dd	D�cgc]}|j���}}d
g}	|j	|	|�|ddD�cgc]}|j���}}ddg}	|j	|	|�ycc}wcc}wcc}wcc}wcc}wcc}w)N�!
        <root>
          <a meld:id="a">
             <b meld:id="b">
               <c meld:id="c">
                 <d meld:id="d"></d>
               </c>
             </b>
          </a>
          <z meld:id="z">
            <y meld:id="y"></y>
          </z>
        </root>
        a
        <root>
          <p>
            <a meld:id="a">
               <b meld:id="b"></b>
            </a>
          </p>
          <p>
            <m meld:id="m">
              <n meld:id="n"></n>
            </m>
          </p>
        </root>
        rrr$r'r;r4r%�m�nr&)r?r1rArBr*r?rAr5r6s
          r
�test_diffmeld4z(MeldElementInterfaceTests.test_diffmeld4�s���
��
��	;�&�v�.��&�v�.���&�&�{�3��'.�k�&:�7�&C�D��!�(�(�*�D��D���:������6�*�&-�k�&:�7�&C�D��!�(�(�*�D��D���:������6�*�&-�k�&:�9�&E�F��!�(�(�*�F��F�'������6�*�'.�i�&8��&A�B��!�(�(�*�B��B��5������6�*�&-�i�&8��&A�B��!�(�(�*�B��B��5������6�*�&-�i�&8��&C�D��!�(�(�*�D��D���:������6�*��/E��E��G��
C��C��Es#�F�/F�(F�!F�F�Fc�2�d}d}ddlm}||�}||�}|j|�}|ddD�cgc]}|j���}}gd�}	|j	|	|�|ddD�cgc]}|j���}}g}	|j	|	|�|dd	D�cgc]}|j���}}g}	|j	|	|�|d
dD�cgc]}|j���}}ddg}	|j	|	|�|d
dD�cgc]}|j���}}g}	|j	|	|�|d
d	D�cgc]}|j���}}g}	|j	|	|�ycc}wcc}wcc}wcc}wcc}wcc}w)
NrEa}
        <root>
          <p>
            <a meld:id="a">
               <b meld:id="b">
                 <p>
                   <c meld:id="c">
                     <d meld:id="d"></d>
                   </c>
                 </p>
               </b>
            </a>
          </p>
          <z meld:id="z">
            <y meld:id="y"></y>
          </z>
        </root>
        rrr$r')r;r4r?r1r%r&r*r;r?r5r6s
          r
�test_diffmeld5z(MeldElementInterfaceTests.test_diffmeld5s���
����$	;�&�v�.��&�v�.���&�&�{�3��'.�k�&:�7�&C�D��!�(�(�*�D��D�'������6�*�&-�k�&:�7�&C�D��!�(�(�*�D��D�������6�*�&-�k�&:�9�&E�F��!�(�(�*�F��F�������6�*�'.�i�&8��&A�B��!�(�(�*�B��B���:������6�*�&-�i�&8��&A�B��!�(�(�*�B��B�������6�*�&-�i�&8��&C�D��!�(�(�*�D��D�������6�*��/E��E��G��
C��C��Es#�E;�/F�&F�F
�F�
FN)!r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrr2r=rCrHrJr=rr
r�r��s���%�!�%.�N	3�	3�4�
7�1�8�+�'�$'�$+�-�-��A�8+�
=�
;�3�3�'@�TJ�
.�$/�L*+�Z5+�n:+�x>+rr�c�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�ParserTestsc��ddlm}||�}|Srr	)r�argsrrs    r
�_parsezParserTests._parseOs��9���%���rc��ddlm}||�}|Srr)rrNrrs    r
�_parse_htmlzParserTests._parse_htmlTs��:���&���rc��ddlm}|jt�}|j	|j
d�|j	|jd�|d}|j	|j
d�|j	|j|�|j	|j|d�|d}|j	|j
d�|j	|j|�|j	|j|d�|d}|d}|j	|j
d�|j	|j|�|j	|j|d�|j	|j
d�|j	|j|�|j	|j|d�y)	Nrr�rr4rr,rr))r
r�rOrrrr�ri)rr�r�l1strrr)s       r
�test_parse_simple_xmlz!ParserTests.test_parse_simple_xmlYsg��2��{�{�;�'��������6�*�������d�+��A�w��������6�*�������d�+�������X�.��7��A�w��������6�*�������d�+�������X�.��7��A�w���1�g��������6�*�������d�+�������X�.��7�������-�8�����+�+�T�2�����+�+�H�5�}�Erc��d}ddlm}|jt�}|j	|j
|dz�|j	|ji�|j	|jd�|d}|j	|j
|dz�|j	|j|d�|j	|j|�y)N� {http://www.w3.org/1999/xhtml}%srr��html�body)r
r�rO�
_SIMPLE_XHTMLrrrir�)r�xhtml_nsr�rrXs     r
�test_parse_simple_xhtmlz#ParserTests.test_parse_simple_xhtmlos���5��2��{�{�=�)��������8�f�#4�5�������b�)�������d�+��A�w��������8�f�#4�5�������X�.��7�������d�+rc�>�d}ddlm}|jt�}|j	|j
|dz�|j	|ji�|j	|jd�|d}|j	|j
|dz�|j	|ji�|j	|j|�|d}|j	|j
|dz�|j	|jdd�|j	|j|�|d	}|j	|j
|d
z�|j	|j|d
�|j	|j|�|d}|j	|j
|dz�|j	|ji�|j	|j|�|d}|j	|j
|d
z�|j	|jddi�|j	|j|�|d	}	|j	|	j
|d
z�|j	|	j|d�|j	|	j|�|	d}
|j	|
j
|dz�|j	|
j|d�|j	|
jdd�|j	|
jdd�|j	|
j|	�|
d}|j	|j
|dz�|j	|j|
�|
d	}|j	|j
|dz�|j	|j|d�|j	|jdd�|j	|j|
�|d}
|j	|
j
|dz�|j	|
j|d�|j	|
j|�|
d}|j	|j
|dz�|j	|j|d�|j	|jdd�|j	|j|
�|d}|j	|j
|d z�|j	|j|d!�|j	|j|�|d	}|j	|j
|d z�|j	|j|d"�|j	|j|�y)#NrVrr�rW�head�metar��text/html; charset=ISO-8859-1r,r#rerXr�z{http://foo/bar}baz�slab�content_well�formr�r��.r�r��img�table�table1�border�0�tbodyr"�classr#�tdr(r))r
r�rOr�rrrir�)rrZr�rr]r^r#rXr
r�rbrdrerir"r(r)s                 r
�test_parse_complex_xhtmlz$ParserTests.test_parse_complex_xhtml|s���5��2��{�{�>�*��������8�f�#4�5�������b�)�������d�+��A�w��������8�f�#4�5�������b�)�������d�+��A�w��������8�f�#4�5�������Y�/�8�	:�������d�+��Q���������H�w�$6�7�������h�/��9�������t�,��A�w��������8�f�#4�5�������b�)�������d�+��A�w��������8�e�#3�4�������'<�f�&E�F�������d�+��A�w��������8�e�#3�4�������X�.��?�������d�+��A�w��������8�f�#4�5�������X�.��8�������X�.��4�������X�.��7�������d�+��1�g��������(�U�"2�3�������T�*��Q���������H�w�$6�7�������h�/��:�������h�/��5�������t�,��a���������H�w�$6�7�������h�/��9�������u�-�
�1�X���������D��1�������8�,�d�3�������7�+�U�3�������E�*���e��������(�T�/�2�������H�-�u�5�������R�(���e��������(�T�/�2�������H�-�u�5�������R�(rc��ddlm}ddlm}|jt�}|j|jd�|j|ji�|j|jd�|d}|j|jd�|j|ji�|j|j|�|d}|j|jd�|j|jdd�|d	}|j|jd
�|j|j|d
�|j|j|�|d	}|j|jd�|j|ji�|j|j|�|d}|j|j|�|d}	|j|	jd
�|j|	jddddd��|j|	j|�|d}
|j|
jd�|d}|j|jd�y)Nrr�)�CommentrWr]r^r�r_r,r#rXr�reztext-align: left; width: 100px;r�r�)�stylerg�cellpadding�cellspacing�r;�rd)	r
r�rnrQ�	_NVU_HTMLrrrir�)rr�rnrr]r^r#rX�commentre�hrefrds            r
�
test_nvu_htmlzParserTests.test_nvu_html�s��2�1����	�*��������6�*�������b�)�������d�+��A�w��������6�*�������b�)�������d�+��A�w��������6�*�������Y�/�8�	:��Q���������G�,�������h�/��9�������t�,��A�w��������6�*�������b�)�������d�+��q�'��������g�.��Q���������G�,�������(I�14�69�69�	(;�	<�
	
������t�,��A�w��������3�'��1�g��������%�(rc�T�d}d|z}|jt|j|�y�Nz(https://github.com/Supervisor/supervisorzF<html xmlns:meld="%s" meld:id="repeat"><body meld:id="repeat"/></html>)r�r�rO�r�meld_ns�repeateds   r
�!test_dupe_meldids_fails_parse_xmlz-ParserTests.test_dupe_meldids_fails_parse_xml�s-��<��6�8?�@�����*�d�k�k�8�<rc�T�d}d|z}|jt|j|�yry)r�r�rQrzs   r
�"test_dupe_meldids_fails_parse_htmlz.ParserTests.test_dupe_meldids_fails_parse_html�s/��<��6�8?�@�����*�d�&6�&6��ArN)r�r�r�rOrQrTr[rlrwr}rr=rr
rLrLNs/���
�
F�,,�H)�T')�T=�BrrLc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�	UtilTestsc�L�ddlm}d}||�}d}|j||�y)Nr��insert_doctyper�z�<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><root></root>�r
r�r�rr��origr;r<s     r
�test_insert_xhtml_doctypez#UtilTests.test_insert_xhtml_doctype�s,��8�����%��\�������*rc�L�ddlm}d}||�}d}|j||�y)Nrr��5<?xml version="1.0" encoding="latin-1"?><root></root>z�<?xml version="1.0" encoding="latin-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><root></root>r�r�s     r
�!test_insert_doctype_after_xmldeclz+UtilTests.test_insert_doctype_after_xmldecls,��8�F����%��D�������*rc�L�ddlm}d}||�}d}|j||�y)Nr)�insert_meld_ns_declr�zk<?xml version="1.0" encoding="latin-1"?><root xmlns:meld="https://github.com/Supervisor/supervisor"></root>)r
r�r)rr�r�r;r<s     r
�test_insert_meld_ns_declz"UtilTests.test_insert_meld_ns_decls,��=�F��$�T�*��A�������*rc�L�ddlm}d}||�}d}|j||�y)Nr��prefeedzD<?xml version="1.0" encoding="latin-1"?><root xmlns:meld="#"></root>z�<?xml version="1.0" encoding="latin-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><root xmlns:meld="#"></root>�r
r�r)rr�r�r;r<s     r
�'test_prefeed_preserves_existing_meld_nsz1UtilTests.test_prefeed_preserves_existing_meld_nss+��1�U������S�������*rc�H�ddlm}d}||�}|j||�y)Nrr�z�<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><root xmlns:meld="https://github.com/Supervisor/supervisor"></root>r�)rr�r�r;s    r
�'test_prefeed_preserves_existing_doctypez1UtilTests.test_prefeed_preserves_existing_doctypes&��1�B�����������&rN)r�r�r�r�r�r�r�r�r=rr
r�r��s��+�+�+�+�'rr�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)y())�WriterTestsc�"�ddlm}||�}|Srr	)r�xmlrrs    r
rOzWriterTests._parse!s��9��s�#���rc�"�ddlm}||�}|Srr)rr�rrs    r
rQzWriterTests._parse_html&s��:���$���rc��	ddlm}|�}||fi|��|jd�|j	�}|S#ddlm}Y�=xYw)Nr)�BytesIO)�StringIO)�ior�r��seek�read)r�fnr�r��outr;s      r
�_writezWriterTests._write+sC��	5�"��i��
�3�
�"�
������������
��
	5�4�s	�;�Ac�<�|j|jfi|��Sr�)r��	write_xml�r�noder�s   r
�
_write_xmlzWriterTests._write_xml6s���t�{�{�4�>�>�0�R�0�0rc�<�|j|jfi|��Sr�)r��
write_htmlr�s   r
�_write_htmlzWriterTests._write_html9s���t�{�{�4�?�?�1�b�1�1rc�<�|j|jfi|��Sr�)r��write_xhtmlr�s   r
�_write_xhtmlzWriterTests._write_xhtml<s���t�{�{�4�+�+�2�r�2�2rc��ddlm}t||d���}t||d���}|j||�y�Nrr�r�r��r�r��
normalize_xmlr�rr;r4r�s    r
�assertNormalizedXMLEqualz$WriterTests.assertNormalizedXMLEqual?�7��/��)�A��9�:���)�A��9�:������A�rc��ddlm}t||d���}t||d���}|j||�yr�r�r�s    r
�assertNormalizedHTMLEqualz%WriterTests.assertNormalizedHTMLEqualEr�rc��|jt�}|j|�}d}|j||�|j	d�jd�D]I\}}t
|d�|j	d�_t
|d�|j	d�_�K|j|�}d}|j||�y)	Nz�<?xml version="1.0"?><root>
  <list>
    <item>
       <name>Name</name>
       <description>Description</description>
    </item>
  </list>
</root>r))r,rerrr,r)z�<?xml version="1.0"?><root>
  <list>
    <item>
       <name>1</name>
       <description>2</description>
    </item>
  </list>
</root>)rOrr�r�rr.�strr)rrr;r<r�r/s      r
�test_write_simple_xmlz!WriterTests.test_write_simple_xmlKs����{�{�;�'������&����	
�%�%�f�h�7��
�
�f�-�4�4�X�>�	;�H�B��'*�4��7�|�B�K�K���$�.1�$�q�'�l�B�K�K�
�&�+�	;�����&����	
�%�%�f�h�7rc�x�|jt�}|j|�}d}|j||�y)N��<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><body>Hello!</body></html>�rOrYr�r��rrr;r<s    r
�test_write_simple_xhtmlz#WriterTests.test_write_simple_xhtmlfs8���{�{�=�)���"�"�4�(��s���%�%�f�h�7rc�x�|jt�}|j|�}d}|j||�y)Nz�<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
   <body>Hello!</body>
</html>)rOrYr�r�r�s    r
�test_write_simple_xhtml_as_htmlz+WriterTests.test_write_simple_xhtml_as_htmlls9���{�{�=�)���!�!�$�'����	
�&�&�v�x�8rc�x�|jt�}|j|�}d}|j||�y)Na<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
    <title>This will be escaped in html output: &amp;</title>
    <script>this won't be escaped in html output: &</script>
    <script type="text/javascript">
            //
              // this won't be escaped in html output
              function match(a,b) {
                 if (a < b && a > 0) then { return 1 }
                }
             //
    </script>
    <style>this won't be escaped in html output: &</style>
  </head>
  <!-- a comment -->
  <body>
    <div></div>
    <div>
      <form action="." method="POST">
      <img src="foo.gif">
      <table border="0">
        <tbody>
          <tr class="foo">
            <td>Name</td>
            <td>Description</td>
          </tr>
        </tbody>
      </table>
      <input name="submit" type="submit" value=" Next ">
      </form>
    </div>
  </body>
</html>)rOr�r�r�r�s    r
� test_write_complex_xhtml_as_htmlz,WriterTests.test_write_complex_xhtml_as_htmlus:���{�{�>�*���!�!�$�'��"��H	
�&�&�v�x�8rc�x�|jt�}|j|�}d}|j||�y)NaV<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
    <title>This will be escaped in html output: &amp;</title>
    <script>this won't be escaped in html output: &amp;</script>
    <script type="text/javascript">
            //
              // this won't be escaped in html output
              function match(a,b) {
                 if (a &lt; b &amp;&amp; a > 0) then { return 1 }
                }
             //
    </script>
    <style>this won't be escaped in html output: &amp;</style>
  </head>
  <!--  a comment  -->
  <body>
    <div ns0:baz="slab" xmlns:ns0="http://foo/bar" />
    <div>
      <form action="." method="POST">
      <img src="foo.gif" />
      <table border="0">
        <tbody>
          <tr class="foo">
            <td>Name</td>
            <td>Description</td>
          </tr>
        </tbody>
      </table>
      <input name="submit" type="submit" value=" Next " />
      </form>
    </div>
  </body>
</html>)rOr�r�r�r�s    r
�!test_write_complex_xhtml_as_xhtmlz-WriterTests.test_write_complex_xhtml_as_xhtml�s<���{�{�>�*���"�"�4�(��"��F	
�%�%�f�h�7rc��ddlm}|jt�}|j	|�}d}|j||d��|�y)Nrr�z�<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <body>
    <area><base><basefont><br><col><frame><hr><img><input><isindex>
    <link><meta><param>
  </body>
</html>r�r�)r�r�rO�_EMPTYTAGS_HTMLr�r)rr�rr;r<s     r
�test_write_emptytags_htmlz%WriterTests.test_write_emptytags_html�sC��/��{�{�?�+���!�!�$�'����	
����6�H�=�x�Hrc�x�|jt�}|j|�}d}|j||�y)Na�<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <body>
  <tag selected></tag>
  <tag checked></tag>
  <tag compact></tag>
  <tag declare></tag>
  <tag defer></tag>
  <tag disabled></tag>
  <tag ismap></tag>
  <tag multiple></tag>
  <tag nohref></tag>
  <tag noresize></tag>
  <tag noshade></tag>
  <tag nowrap></tag>
  </body>
</html>)rO�_BOOLEANATTRS_XHTMLr�r�r�s    r
�%test_write_booleanattrs_xhtml_as_htmlz1WriterTests.test_write_booleanattrs_xhtml_as_html�s:���{�{�.�/���!�!�$�'����"	
�&�&�v�x�8rc�|�|jt�}|j|d��}d}|j||�y)NT��pipelinez�<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><body ns0:id="body" xmlns:ns0="https://github.com/Supervisor/supervisor">Hello!</body></html>r�r�s    r
� test_write_simple_xhtml_pipelinez,WriterTests.test_write_simple_xhtml_pipeline�s=���{�{�=�)���"�"�4�$�"�7��v���%�%�f�h�7rc�|�|jt�}|j|d��}d}|j||�y)NTr�a<?xml version="1.0"?><root>
  <list ns0:id="list" xmlns:ns0="https://github.com/Supervisor/supervisor">
    <item ns0:id="item">
       <name ns0:id="name">Name</name>
       <description ns0:id="description">Description</description>
    </item>
  </list>
</root>�rOrr�r�r�s    r
�test_write_simple_xml_pipelinez*WriterTests.test_write_simple_xml_pipeline��;���{�{�;�'��������5����	
�%�%�f�h�7rc�|�|jt�}|j|d��}d}|j||�y)N�latin-1r�z�<?xml version="1.0" encoding="latin-1"?><root>
  <list>
    <item>
       <name>Name</name>
       <description>Description</description>
    </item>
  </list>
</root>r�r�s    r
�'test_write_simple_xml_override_encodingz3WriterTests.test_write_simple_xml_override_encodings;���{�{�;�'������	��:����	
�%�%�f�h�7rc�|�|jt�}|j|d��}d}|j||�y)NT��fragment�<root>
  <list>
    <item>
       <name>Name</name>
       <description>Description</description>
    </item>
  </list>
</root>r�r�s    r
�!test_write_simple_xml_as_fragmentz-WriterTests.test_write_simple_xml_as_fragmentr�rc��|jt�}ddlm}|j	||j
��}d}|j
||�y)Nr��doctypea<?xml version="1.0"?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><root>
  <list>
    <item>
       <name>Name</name>
       <description>Description</description>
    </item>
  </list>
</root>�rOrr
r�r��xhtmlr��rrr�r;r<s     r
�"test_write_simple_xml_with_doctypez.WriterTests.test_write_simple_xml_with_doctypesB���{�{�;�'��1�����w�}�}��=����	
�%�%�f�h�7rc��|jt�}ddlm}|j	|d|j
��}d}|j
||�y)Nrr�F��declarationr�z�<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><root>
  <list>
    <item>
       <name>Name</name>
       <description>Description</description>
    </item>
  </list>
</root>r�r�s     r
�+test_write_simple_xml_doctype_nodeclarationz7WriterTests.test_write_simple_xml_doctype_nodeclaration-sJ���{�{�;�'��1�����5�)0���!�8����	
�%�%�f�h�7rc��|jt�}ddlm}|j	|d|j
d��}d}|j
||�y)Nrr�T�r�r�r�r�r�r�s     r
�<test_write_simple_xml_fragment_kills_doctype_and_declarationzHWriterTests.test_write_simple_xml_fragment_kills_doctype_and_declaration<sM���{�{�;�'��1�����4�)0����!�G����	
�%�%�f�h�7rc�~�|jt�}|j|dd��}d}|j||�y)Nr�T)r�r�z�<?xml version="1.0" encoding="latin-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><body>Hello!</body></html>r�r�s    r
�)test_write_simple_xhtml_override_encodingz5WriterTests.test_write_simple_xhtml_override_encodingKs?���{�{�=�)���"�"�4�)��"�N��[���%�%�f�h�7rc�|�|jt�}|j|d��}d}|j||�y�NTr�� <html><body>Hello!</body></html>r�r�s    r
�#test_write_simple_xhtml_as_fragmentz/WriterTests.test_write_simple_xhtml_as_fragmentQs:���{�{�=�)���"�"�4�$�"�7��9���%�%�f�h�7rc��|jt�}ddlm}|j	||j
��}d}|j
||�y)Nrr�r��rOrYr
r�r�r�r�r�s     r
�$test_write_simple_xhtml_with_doctypez0WriterTests.test_write_simple_xhtml_with_doctypeWsD���{�{�=�)��1��"�"�4����"�?��s���%�%�f�h�7rc��|jt�}ddlm}|j	|d|j
��}d}|j
||�y)Nrr�Fr�r�r�r�s     r
�-test_write_simple_xhtml_doctype_nodeclarationz9WriterTests.test_write_simple_xhtml_doctype_nodeclaration^sK���{�{�=�)��1��"�"�4�U�)0���#�8��s���%�%�f�h�7rc��|jt�}ddlm}|j	|d|j
d��}d}|j
||�y)Nrr�Tr�r�r�r�s     r
�>test_write_simple_xhtml_fragment_kills_doctype_and_declarationzJWriterTests.test_write_simple_xhtml_fragment_kills_doctype_and_declarationfsK���{�{�=�)��1��"�"�4�T�)0����#�G��9���%�%�f�h�7rc�|�|jt�}|j|d��}d}|j||�yr��rOrYr�r�r�s    r
�(test_write_simple_xhtml_as_html_fragmentz4WriterTests.test_write_simple_xhtml_as_html_fragmentns:���{�{�=�)���!�!�$��!�6��9���%�%�f�h�7rc�x�|jt�}|j|�}d}|j||�y)Nz�
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><body>Hello!</body></html>r�r�s    r
�,test_write_simple_xhtml_with_doctype_as_htmlz8WriterTests.test_write_simple_xhtml_with_doctype_as_htmlts9���{�{�=�)���!�!�$�'��$��	
�%�%�f�h�7rc��|jt�}ddlm}|j	||j
��}d}|j
||�y)Nrr�z|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><body>Hello!</body></html>)rOrYr
r�r��html_strictr�r�s     r
�+test_write_simple_xhtml_as_html_new_doctypez7WriterTests.test_write_simple_xhtml_as_html_new_doctype|sG���{�{�=�)��1��!�!�$��0C�0C�!�D��$��	
�%�%�f�h�7rc�j�ddlm}|j|jtf|j
d�y)Nr)�expatz.<html><head></head><body>&fleeb;</body></html>)�xml.parsersrr��error�SyntaxErrorrO)rrs  r
�test_unknown_entityzWriterTests.test_unknown_entity�s(��%����5�;�;��4�d�k�k�J�	Lrc��|jt�}|jd�}|jdd��|j	|�}d}|j||�y)Nr)�description &<foo>&amp;<bar>Fr�z�<?xml version="1.0"?>
        <root>
        <list>
        <item>
        <name>Name</name>
          <description>description &amp;&lt;foo>&amp;&lt;bar></description>
        </item>
        </list>
        </root>�rOrrr�r�r��rrr|r;r<s     r
�test_content_nostructurez$WriterTests.test_content_nostructure��V���{�{�;�'���M�M�-�(��	�	�	�0�E�	�B�����&����	
�%�%�f�h�7rc��|jt�}|jd�}|jdd��|j	|�}d}|j||�y)Nr)�description &<foo> <bar>Tr�z�<?xml version="1.0"?>
        <root>
        <list>
        <item>
        <name>Name</name>
          <description>description &<foo> <bar></description>
        </item>
        </list>
        </root>rrs     r
�test_content_structurez"WriterTests.test_content_structure��V���{�{�;�'���M�M�-�(��	�	�	�,��	�=�����&����	
�%�%�f�h�7rc��|jt�}|jd�}|jdd��|j	|�}d}|j||�y)Nr)rFr�z�<?xml version="1.0"?>
        <root>
        <list>
        <item>
        <name>Name</name>
          description &amp;&lt;foo>&amp;&lt;bar>
        </item>
        </list>
        </root>�rOrrrsr�r�rs     r
�test_replace_nostructurez$WriterTests.test_replace_nostructure�r
rc��|jt�}|jd�}|jdd��|j	|�}d}|j||�y)Nr)rTr�z�<?xml version="1.0"?>
        <root>
        <list>
        <item>
        <name>Name</name>
          description &<foo> <bar>
        </item>
        </list>
        </root>rrs     r
�test_replace_structurez"WriterTests.test_replace_structure�rrc�`�ddlm}ddlm}d}|j	|dd��||��y)Nrr��
_escape_cdata�O< > &lt;&amp; &&apos; && &foo "" http://www.example.com?foo=bar&bang=baz &#123;zf&lt; > &lt;&amp; &amp;&apos; &amp;&amp; &amp;foo "" http://www.example.com?foo=bar&amp;bang=baz &#123;r�r�)r�rr
rr)rrrr;s    r
�test_escape_cdatazWriterTests.test_escape_cdata�s8��.�7�>������J�&�
(�
�!��		rc��ddlm}ddlm}ddlm}||dd��d��}|j|dd��||d	��y)
Nrrrr��€r�r��&#128;�ascii)r
rr�rr�r)rrrr�r;s     r
�test_escape_cdata_unicodeerrorz*WriterTests.test_escape_cdata_unicodeerror�s?��7�.�/��h�v��9�H�M������(�X�>�&�q�'�2�	4rc�b�ddlm}ddlm}d}|j	|dd��||d��y)Nr��_escape_attribrrzp&lt; > &lt;&amp; &amp;&apos; &amp;&amp; &amp;foo &quot;&quot; http://www.example.com?foo=bar&amp;bang=baz &#123;r�r�)r
r r�rr)rr rr;s    r
�test_escape_attribzWriterTests.test_escape_attrib�s<��8�.�>������J�'�
(�
�1�d�#�	%rc��ddlm}ddlm}ddlm}||dd��d��}|j|dd��||d	��y)
Nrrrr�rr�r�rr)r
r r�rr�r)rr rr�r;s     r
�test_escape_attrib_unicodeerrorz+WriterTests.test_escape_attrib_unicodeerror�s?��8�.�/��h�v��9�H�M������(�X�>�'��7�3�	5rN)*r�r�r�rOrQr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr	r
rrrrr!r#r=rr
r�r� s����
�
	�1�2�3���8�68�9�'9�R-8�^I�9�,8�8�8�8�
8�
8�
8�8�8�8�8�8�8�8�8�L�8� 8� 8� 8� 	�4�
%�5rr�c�b�tjdd|�}tjdd|�}|S)Nz[ \t]+� z/>�>��re�sub��ss r
�normalize_htmlr,�s+��
���y�#�q�!�A�
���u�c�1��A��Hrc��tjdd|�}tjdd|�}tjdd|�}|S)Nz\s+r%z(?s)\s+<�<z(?s)>\s+r&r'r*s r
r�r��s=��
���v�s�A��A�
���{�C��#�A�
���{�C��#�A��Hrc�V�tjtjt�Sr�)�unittest�
findTestCases�sys�modulesr�r=rr
�
test_suiter4�s���!�!�#�+�+�h�"7�8�8rc�0�tjd��y)Nr4)�defaultTest)r0�mainr=rr
r7r7s���M�M�l�+r�__main__)r0r(r2rrYr�r��_ENTITIES_XHTMLr�rtrf�TestCaserr�rLr�r�r,r�r4r7r�r=rr
�<module>r;s����	�
����
�
����"��$��L%
�	�Nm��^F>�8�$�$�F>�PK	+�� 1� 1�K	+�^lB�(�#�#�lB�\"'��!�!�"'�HP5�(�#�#�P5�d
�

�9�,��z���F�r

Youez - 2016 - github.com/yon3zu
LinuXploit