Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_sax.cpython-312.opt-1.pyc

�

'Μg������ddlmZmZmZmZmZddlZddlmZ	e�ddl	m
Z
mZmZm
Z
mZmZddlmZddlmZmZmZddlmZmZmZdd	lmZmZddlZddlZddl Z ddl!Z!ddl"Z"dd
l#m$Z$ddl%Z&ddl'm(Z(ddl'm)Z)dd
l*m+Z+m,Z,e)dd��Z-e)dd��Z.	e-j_d�e.j_d�dZ1ejdjfs+	e(jhj_e"jj��ejpe1d�Z9dZ:Gd�dejv�Z<d@d�Z=dAd�Z>dAd�Z?Gd�dejv�Z@Gd�d ejv�ZAGd!�d"ejv�ZBGd#�d$ejv�ZCGd%�d&�ZDGd'�d(eDejv�ZEGd)�d*eDejv�ZFGd+�d,eF�ZGGd-�d.eDejv�ZHGd/�d0eDejv�ZId1ZJGd2�d3ejv�ZKeLe.d4�5ZMeMj��ZOddd�Gd5�d6e<�ZPGd7�d8ejv�ZQGd9�d:e<�ZRGd;�d<ejv�ZSGd=�d>ejv�ZTeUd?k(rej��yy#e$rejd��wxYw#e0$rejd��wxYw#e6e7f$rdZ1Y���wxYw#1swY��xYw)B�)�make_parser�ContentHandler�SAXException�SAXReaderNotAvailable�SAXParseExceptionN)�mockzno XML parsers available)�XMLGenerator�escape�unescape�	quoteattr�
XMLFilterBase�prepare_input_source)�
create_parser)�feature_namespaces�feature_external_ges�LexicalHandler)�InputSource�AttributesImpl�AttributesNSImpl)�BytesIO�StringIO)�URLError)�	os_helper)�findfile)�FakePath�TESTFNztest.xml�xmltestdata)�subdirztest.xml.out�utf-8z!filename is not encodable to utf8TFz$Requires non-ascii filenames supportz%http://www.python.org/xml-ns/saxtest/c��eZdZd�Zd�Zd�Zy)�XmlTestBasec���|jt|jd�|jt|jd�|jt|jd�|jt|j
d�|jt|jd�|j|j�d�|j|j�g�|j|j�g�|jt|�d�|jd|�|jt|j��g�|j|jd�d�|j|jdd�d�|jt|j!��g�|jt|j#��g�y)N�attrr�attrs�)�assertRaises�KeyError�getValue�getValueByQName�getNameByQName�getQNameByName�__getitem__�assertEqual�	getLength�getNames�	getQNames�len�assertNotIn�list�keys�get�items�values��selfr$s  �*/usr/local/lib/python3.12/test/test_sax.py�verify_empty_attrszXmlTestBase.verify_empty_attrs7sf�����(�E�N�N�F�;����(�E�$9�$9�6�B����(�E�$8�$8�&�A����(�E�$8�$8�&�A����(�E�$5�$5�v�>�������*�A�.�������)�2�.�������*�B�/�����U��Q�'������'�����e�j�j�l�+�R�0�������7�+�T�2�������7�B�/��4�����e�k�k�m�,�b�1�����e�l�l�n�-�r�2�c�,�|jt|jtdf�|jt|jd�|jt|j
d�|jt|jtdf�|jt|jtdf�|j|j�d�|j|j�g�|j|j�g�|jt|�d�|jtdf|�|jt|j��g�|j|j!tdf�d�|j|j!tdfd�d�|jt|j#��g�|jt|j%��g�y)Nr#�ns:attrrr%)r&r'r(�ns_urir)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8s  r:�verify_empty_nsattrsz XmlTestBase.verify_empty_nsattrsHs������(�E�N�N�V�V�4D�E����(�E�$9�$9�9�E����(�E�$8�$8�)�D����(�E�$8�$8�6�6�:J�K����(�E�$5�$5���7G�H�������*�A�.�������)�2�.�������*�B�/�����U��Q�'����&�&�)�5�1�����e�j�j�l�+�R�0�������F�F�#3�4�d�;�������F�F�#3�R�8�"�=�����e�k�k�m�,�b�1�����e�l�l�n�-�r�2r<c���|j|j�d�|j|j�dg�|j|j�dg�|jt	|�d�|jd|�|jt
|j��dg�|j|jd�d�|j|jdd�d�|jt
|j��dg�|jt
|j��dg�|j|jd�d�|j|jd�d�|j|jd�d�|j|dd�|j|jd�d�y)N�r#�valr%)r#rC)r-r.r/r0r1�assertInr3r4r5r6r7r(r)r*r+r8s  r:�verify_attrs_wattrzXmlTestBase.verify_attrs_wattrYsw��������*�A�.�������)�F�8�4�������*�V�H�5�����U��Q�'��
�
�f�e�$�����e�j�j�l�+�f�X�6�������6�*�E�2�������6�2�.��6�����e�k�k�m�,��.?�@�����e�l�l�n�-��w�7��������/��7�����.�.�v�6��>�����-�-�f�5�v�>�����v���.�����-�-�f�5�v�>r<N)�__name__�
__module__�__qualname__r;r@rE�r<r:r!r!6s��3�"3�"?r<r!c��|�|Sd|�d|��S�N�<?xml version="1.0" encoding="�"?>
rI)�doc�encodings  r:�xml_strrPks�����
��8@�#�F�Fr<c�F�|dur|}t||�j|d�S)N.�xmlcharrefreplace)rP�encode)rNrO�
decl_encodings   r:�	xml_bytesrUps*����� �
��3�
�&�-�-�h�8K�L�Lr<c��|dur|}ttd|d��5}|jt||��ddd�y#1swYyxYw)N.�wrR)rO�errors)�openr�writerP)rNrOrT�fs    r:�
make_xml_filer\us@����� �
�	
�f�c�H�5H�	I�Q�	�����]�+�,�
J�	I�	I�s	�?�Ac�L�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�	ParseTestu,<money value="$£€𐅻">$£€𐅻</money>c�6�tjt�y�N)r�unlinkr�r9s r:�tearDownzParseTest.tearDowns������ r<c��ddlm}t�}||t|d��|j	|j�t
|jd��y)Nr)�parser)�xml.saxrerr	r-�getvaluerP�data)r9r[re�results    r:�check_parsezParseTest.check_parse�s?��!����
�a��f�g�.�/�������*�G�D�I�I�w�,G�Hr<c	���d}|D]�}|jtt|j|���t	|j|�ttd|��5}|j|�ddd�|jt|j��t	|j|d�ttd|��5}|j|�ddd���y#1swY�sxYw#1swY��xYw)N��us-ascii�
iso-8859-1r�utf-16�utf-16le�utf-16be�r�rO)rjrrPrhr\rYr�r9�	encodingsrOr[s    r:�test_parse_textzParseTest.test_parse_text�s���7�	�!�H����X�g�d�i�i��&B�C�D��$�)�)�X�.��f�c�H�5��� � ��#�6����X�d�i�i�0�1��$�)�)�X�t�4��f�c�H�5��� � ��#�6�5�"�6�5��6�5�s�C"�C.�"C+	�.C7	c
���d}|D�]}|jtt|j|���t	|j|�|jt
�t
t
d�5}|j|�ddd�|jtt|j|d���t	|j|d�|jt
�t
t
d�5}|j|�ddd���|jtt|jdd���t	|jdd�|jt
�t
t
d�5}|j|�ddd�|jtt|jdd���t	|jdd�|jt
�t
t
d�5}|j|�ddd�|jtt|jd���t	|jd�|jt
�t
t
d�5}|j|�ddd�|jt�5|jtt|jdd���ddd�t	|jdd�|jt�5|jt
�ddd�t
t
d�5}|jt�5|j|�ddd�ddd�y#1swY���xYw#1swY���xYw#1swY��xYw#1swY���xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY�kxYw#1swYyxYw)N�rmrrorprq�rb�	utf-8-sigrrn)	rjrrUrhr\rrYr&rrts    r:�test_parse_byteszParseTest.test_parse_bytes�s���L�	�!�H����W�Y�t�y�y�(�%C�D�E��$�)�)�X�.����V�$��f�d�#�q�� � ��#�$����W�Y�t�y�y�(�D�%I�J�K��$�)�)�X�t�4����V�$��f�d�#�q�� � ��#�$�#�"�	
�����4�9�9�k�7�!K�L�M��d�i�i��g�6����� �
�&�$�
�1����Q�� ������4�9�9�k�4�!H�I�J��d�i�i��d�3����� �
�&�$�
�1����Q�� �	
�����4�9�9�l�!C�D�E��d�i�i��.����� �
�&�$�
�1����Q�� ��
�
�|�
,����W�Y�t�y�y�,��%M�N�O�-��d�i�i��t�4�
�
�
�|�
,����V�$�-�
�&�$�
�1��"�"�<�0�� � ��#�1� �
�=$�#��
$�#�� �
��
 �
�� �
��-�
,��-�
,��1�0�� �
�sx�2N�7N�?N�N(�N5�60O�O�O&�O�0O&�N	�N	�N%�(N2�5N?�O�O�O#	�O&�&O/c�n�t|jdd�|jtt��y)Nr)r\rhrjrrrbs r:�test_parse_path_objectz ParseTest.test_parse_path_object�s%���d�i�i��$�/�����&�)�*r<c��t|jdd�ttd�5}t	�}|j|�|j
d�|j|�ddd�y#1swYyxYw)Nrnry)r\rhrYrr�
setByteStream�setEncodingrj)r9r[�inputs   r:�test_parse_InputSourcez ParseTest.test_parse_InputSource�s[���d�i�i��t�4�
�&�$�
�1��M�E�����"����l�+����U�#�	 �
�
�s�>A/�/A8c�^���t�d���fd�}tjd|��5t|jdd�|jt�5|jt�ddd�|j�j�ddd�y#1swY�-xYw#1swYyxYw)Nc����|���Sr`rI)�args�builtin_open�fileobjs ��r:�	mock_openz4ParseTest.test_parse_close_source.<locals>.mock_open�s���"�D�)�G��Nr<zxml.sax.saxutils.open)�side_effectrn)rYr�patchr\rhr&rrjr�
assertTrue�closed)r9r�r�r�s  @@r:�test_parse_close_sourcez!ParseTest.test_parse_close_source�s~�������	�
�Z�Z�/�Y�
G��$�)�)�\�4�8��"�"�<�0�� � ��(�1��O�O�G�N�N�+�	H�
G�0�0��H�
G�s#�-B#�B�+#B#�B 	�B#�#B,c��ddlm}t�}||t|d��|j	|j�t
|jd��y)Nr)�parseStringr)rfr�rr	r-rgrPrh)r9�sr�ris    r:�check_parseStringzParseTest.check_parseString�s?��'�����A�|�F�G�4�5�������*�G�D�I�I�w�,G�Hr<c��d}|D]'}|jt|j|���)|j|j�y)Nrl)r�rPrh�r9rurOs   r:�test_parseString_textzParseTest.test_parseString_text�s>��7�	�!�H��"�"�7�4�9�9�h�#?�@�"����t�y�y�)r<c�.�d}|D]M}|jt|j|��|jt|j|d���O|jt|jdd��|jt|jdd��|jt|jd��|jt�5|jt|jdd��ddd�y#1swYyxYw)Nrxrzrrn)r�rUrhr&rr�s   r:�test_parseString_bytesz ParseTest.test_parseString_bytes�s���L�	�!�H��"�"�9�T�Y�Y��#A�B��"�"�9�T�Y�Y��$�#G�H�"�	
���y����K��I�J����y����K��F�G����y����L�A�B�
�
�
�|�
,��"�"�9�T�Y�Y��d�#K�L�-�
,�
,�s�'D�DN)rFrGrHrhrcrjrvr{r}r�r�r�r�r�rIr<r:r^r^|s=��O�D�!�I�$�($�T+�$�
,�I�*�Mr<r^c�$�eZdZd�Zd�Zd�Zd�Zy)�MakeParserTestc��ddlm}|�}ddlm}|�}ddlm}|�}ddlm}|�}ddlm}|�}ddlm}|�}y)Nr�r)rfr)r9r�ps   r:�test_make_parser2z MakeParserTest.test_make_parser2�s@��	(��M��'��M��'��M��'��M��'��M��'��M�r<c��tdg�td�tdh�ttdh��tddi�ttdg��y)N�module)r��r�	frozenset�iterrbs r:�test_make_parser3z MakeParserTest.test_make_parser3
sK��	�X�J���L�!��X�J���I�x�j�)�*��X�t�$�%��D�(��$�%r<c���tg�tt��tt��tt��ti�tt	g��yr`)r�tuple�setr�r�rbs r:�test_make_parser4z MakeParserTest.test_make_parser4s:���B���E�G���C�E���I�K� ��B���D��H�r<c���tddg�td�tddh�ttddh��tddd��ttddg��y)N�module1�module2)r�r�r�rbs r:�test_make_parser5z MakeParserTest.test_make_parser5sX��	�Y�	�*�+��*�+��Y�	�*�+��I�y�)�4�5�6����6�7��D�)�Y�/�0�1r<N)rFrGrHr�r�r�r�rIr<r:r�r��s���"&��2r<r�c�T�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�SaxutilsTestc�:�|jtd�d�y)N�Donald Duck & Co�Donald Duck &amp; Co�r-r
rbs r:�test_escape_basiczSaxutilsTest.test_escape_basic/s������ 2�3�5K�Lr<c�:�|jtd�d�y)N�<Donald Duck & Co>�&lt;Donald Duck &amp; Co&gt;r�rbs r:�test_escape_allzSaxutilsTest.test_escape_all2s������ 4�5�7�	9r<c�@�|jtdddi�d�y�NuHei på deg�åz&aring;zHei p&aring; degr�rbs r:�test_escape_extrazSaxutilsTest.test_escape_extra6s!������
��y�/A�B�+�	-r<c�:�|jtd�d�y)Nr�r��r-rrbs r:�test_unescape_basicz SaxutilsTest.test_unescape_basic;s������"8�9�;M�Nr<c�:�|jtd�d�y)Nr�r�r�rbs r:�test_unescape_allzSaxutilsTest.test_unescape_all>s������"@�A�-�	/r<c�@�|jtdddi�d�yr�r�rbs r:�test_unescape_extraz SaxutilsTest.test_unescape_extraBs!������-�$��1C�D�+�	-r<c�@�|jtdddi�d�y)Nz	&amp;foo;z&foo;�splatr�rbs r:�test_unescape_amp_extraz$SaxutilsTest.test_unescape_amp_extraFs������+���/A�B�G�Lr<c�:�|jtd�d�y)Nr�z"Donald Duck &amp; Co"�r-rrbs r:�test_quoteattr_basicz!SaxutilsTest.test_quoteattr_basicJs������#5�6�1�	3r<c�:�|jtd�d�y)NzIncludes "double" quotesz'Includes "double" quotes'r�rbs r:�test_single_quoteattrz"SaxutilsTest.test_single_quoteattrN�������#=�>�7�	9r<c�:�|jtd�d�y)NzIncludes 'single' quotesz"Includes 'single' quotes"r�rbs r:�test_double_quoteattrz"SaxutilsTest.test_double_quoteattrRr�r<c�:�|jtd�d�y)Nz%Includes 'single' and "double" quotesz1"Includes 'single' and &quot;double&quot; quotes"r�rbs r:�test_single_double_quoteattrz)SaxutilsTest.test_single_double_quoteattrVs������#L�M�N�	Pr<c��tdg�}y)Nzxml.parsers.no_such_parserr�)r9r�s  r:�test_make_parserzSaxutilsTest.test_make_parser[s��
�5�6�7�r<N)rFrGrHr�r�r�r�r�r�r�r�r�r�r�r�rIr<r:r�r�-sB��M�9�-�
O�/�-�M�3�9�9�P�
8r<r�c�T�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�PrepareInputSourceTestc��tj|_t|jd�5}|j	d�ddd�y#1swYyxYw)NrWzThis was read from a file.)rr�filerYrZ)r9�tmps  r:�setUpzPrepareInputSourceTest.setUpcs8���$�$��	�
�$�)�)�S�
!�S��I�I�2�3�"�
!�
!�s�A�Ac�B�tj|j�yr`)rrar�rbs r:rczPrepareInputSourceTest.tearDownhs��������#r<c��td�S�NsThis is a byte stream.)rrbs r:�make_byte_streamz'PrepareInputSourceTest.make_byte_streamks���0�1�1r<c��td�S�NzThis is a character stream.)rrbs r:�make_character_streamz,PrepareInputSourceTest.make_character_streamns���5�6�6r<c��|j|�|j|j�|�|j�yr`)�assertIsNotNoner-�read�close)r9�stream�contents   r:�checkContentz#PrepareInputSourceTest.checkContentqs/�����V�$���������0����r<c��t|j�}|j|j��t	|�}|j|j
��|j|j�d�yr�)	rr��setCharacterStreamr�r�assertIsNone�
getByteStreamr��getCharacterStream�r9�src�preps   r:�test_character_streamz,PrepareInputSourceTest.test_character_streamwsd���$�)�)�$�����t�9�9�;�<�#�C�(�����$�,�,�.�/����$�1�1�3�7�	9r<c��t|j�}|j|j��t	|�}|j|j
��|j|j�d�yr�)	rr�rr�rr�r�r�r�r�s   r:�test_byte_streamz'PrepareInputSourceTest.test_byte_stream�sf���$�)�)�$�����$�/�/�1�2�#�C�(�����$�1�1�3�4����$�,�,�.�3�	5r<c���t|j�}t|�}|j|j	��|j|j
�d�y�NsThis was read from a file.)rr�rr�r�r�r�r�s   r:�test_system_idz%PrepareInputSourceTest.test_system_id�sO���$�)�)�$��#�C�(�����$�1�1�3�4����$�,�,�.�7�	9r<c��t|j�}|j|j��|j	|j�d�yr�)rr�r�r�r�r��r9r�s  r:�test_stringz"PrepareInputSourceTest.test_string�sC��#�D�I�I�.�����$�1�1�3�4����$�,�,�.�7�	9r<c��tt|j��}|j|j	��|j|j
�d�yr�)rrr�r�r�r�r�r�s  r:�test_path_objectsz(PrepareInputSourceTest.test_path_objects�sH��#�H�T�Y�Y�$7�8�����$�1�1�3�4����$�,�,�.�7�	9r<c��t|j��}|j|j��|j	|j�d�yr�)rr�r�r�r�r�r�s  r:�test_binary_filez'PrepareInputSourceTest.test_binary_file�sJ��$�D�$9�$9�$;�<�����$�1�1�3�4����$�,�,�.�3�	5r<c��t|j��}|j|j��|j	|j�d�yr�)rr�r�r�r�r�r�s  r:�test_text_filez%PrepareInputSourceTest.test_text_file�sJ��$�D�$>�$>�$@�A�����$�,�,�.�/����$�1�1�3�7�	9r<N)rFrGrHr�rcr�r�r�r�r�r�r�r�r�r�rIr<r:r�r�as>��4�
$�2�7��9�5�9�9�9�5�9r<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�Zy)�
XmlgenTestc��|j�}t|�}|j�|jdi�|j	d�|j�|j
|j�|jd��y)NrN�<doc></doc>�	�ioclassr	�
startDocument�startElement�
endElement�endDocumentr-rg�xml�r9ri�gens   r:�test_xmlgen_basiczXmlgenTest.test_xmlgen_basic�si��������6�"�����������#����u������������*�D�H�H�]�,C�Dr<c�"�|j�}t|d��}|j�|jdi�|j	d�|j�|j
|j�|jd��y)NT��short_empty_elementsrN�<doc/>r�rs   r:�test_xmlgen_basic_emptyz"XmlgenTest.test_xmlgen_basic_empty�sk��������6��=�����������#����u������������*�D�H�H�X�,>�?r<c�@�|j�}t|�}|j�|jdi�|j	d�|jd�|j
�|j|j�|jd��y)NrN�huhei�<doc>huhei</doc>�
rr	rr�
charactersrrr-rgrrs   r:�test_xmlgen_contentzXmlgenTest.test_xmlgen_content�sv��������6�"�����������#����w�����u������������*�D�H�H�5G�,H�Ir<c�D�|j�}t|d��}|j�|jdi�|j	d�|jd�|j
�|j|j�|jd��y)NTr
rNrrrrs   r:�test_xmlgen_content_emptyz$XmlgenTest.test_xmlgen_content_empty�sx��������6��=�����������#����w�����u������������*�D�H�H�5G�,H�Ir<c�B�|j�}t|�}|j�|jdd�|j	di�|jd�|j
�|j|j�|jd��y)N�testrhrNz<?test data?><doc></doc>)
rr	r�processingInstructionrrrr-rgrrs   r:�test_xmlgen_pizXmlgenTest.test_xmlgen_pi�s}��������6�"�������!�!�&�&�1������#����u������������*��H�H�/�0�	2r<c�@�|j�}t|�}|j�|jdi�|j	d�|jd�|j
�|j|j�|jd��y)NrNz<huhei&z<doc>&lt;huhei&amp;</doc>rrs   r:�test_xmlgen_content_escapez%XmlgenTest.test_xmlgen_content_escape�sy��������6�"�����������#����y�!����u������������*��H�H�0�1�	3r<c��|j�}t|�}|j�|jdddi�|jdddi�|j	d�|jdddi�|j	d�|jdddi�|j	d�|j	d�|j�|j
|j�|jd��y)	NrN�a�"�e�'z'"z

	zK<doc a='"'><e a="'"></e><e a="'&quot;"></e><e a="&#10;&#13;&#9;"></e></doc>r�rs   r:�test_xmlgen_attr_escapez"XmlgenTest.test_xmlgen_attr_escape�s���������6�"�����������c�
�+�����s�C�j�)����s������s�E�l�+����s������s�H�o�.����s�����u������������*�D�H�H�
1�-2�	3r<c�^�d}|D]�}|j�}t||��}|j�|jdddi�|j	d�|jd�|j
�|j|j�|jd|�����y)N�	ziso-8859-15rrzrorqrpzutf-32zutf-32bezutf-32lersrNr�€u<doc a="€">€</doc>r�r9rurOrirs     r:�test_xmlgen_encodingzXmlgenTest.test_xmlgen_encodings���7�	�"�H��\�\�^�F��v��9�C��������U�S�(�O�4��N�N�8�$��N�N�5�!��O�O�����V�_�_�.����7�(��K�
M�"r<c�L�|j�}t|d��}|j�|jdddi�|j	d�|jd�|j
�|j|j�|jdd���y)N�asciirsrNrr$z<doc a="&#8364;">&#8364;</doc>rrs   r:�test_xmlgen_unencodablez"XmlgenTest.test_xmlgen_unencodable s���������6�G�4�����������h��0����x� ����u������������*��H�H�5��H�H�	Jr<c�@�|j�}t|�}|j�|jdi�|j	d�|jd�|j
�|j|j�|jd��y)NrN� �<doc> </doc>�
rr	rr�ignorableWhitespacerrr-rgrrs   r:�test_xmlgen_ignorablez XmlgenTest.test_xmlgen_ignorable-sw��������6�"�����������#�����$����u������������*�D�H�H�^�,D�Er<c�D�|j�}t|d��}|j�|jdi�|j	d�|jd�|j
�|j|j�|jd��y)NTr
rNr+r,r-rs   r:�test_xmlgen_ignorable_emptyz&XmlgenTest.test_xmlgen_ignorable_empty9sy��������6��=�����������#�����$����u������������*�D�H�H�^�,D�Er<c��d}|D]�}|j�}t||��}|j�|jdddi�|j	dj|��|j
dj|��|jd�|j�|j|j�|jd|�����y)Nr#rsrNrr$r+u<doc a="€">€ </doc>)rr	rrrrSr.rrr-rgrr%s     r:�test_xmlgen_encoding_bytesz%XmlgenTest.test_xmlgen_encoding_bytesEs���7�	�"�H��\�\�^�F��v��9�C��������U�S�(�O�4��N�N�8�?�?�8�4�5��#�#�C�J�J�x�$8�9��N�N�5�!��O�O�����V�_�_�.����8�8��L�
N�"r<c���|j�}t|�}|j�|jdt�|jtdfdi�|jddi�|j
dd�|j
tdfd�|jd�|j�|j|j�|jdtz��y)N�ns1rN�ns1:doc�N�udocz/<ns1:doc xmlns:ns1="%s"><udoc></udoc></ns1:doc>�rr	r�startPrefixMappingr?�startElementNS�endElementNS�endPrefixMappingrr-rgrrs   r:�test_xmlgen_nszXmlgenTest.test_xmlgen_nsWs���������6�"���������u�f�-����F�E�?�I�r�:����>�4��4������.����&�%��)�4����U�#�����������*�D�H�H�<�)/�0�-1�	2r<c���|j�}t|d��}|j�|jdt�|jtdfdi�|jddi�|j
dd�|j
tdfd�|jd�|j�|j|j�|jdtz��y)NTr
r5rNr6r7z)<ns1:doc xmlns:ns1="%s"><udoc/></ns1:doc>r9rs   r:�test_xmlgen_ns_emptyzXmlgenTest.test_xmlgen_ns_emptyis���������6��=���������u�f�-����F�E�?�I�r�:����>�4��4������.����&�%��)�4����U�#�����������*�D�H�H�6�)/�0�-1�	2r<c�&�|j�}t|�}|j�|jddddi�|j	dd�|j�|j
|j�|jd��y)N�Nrr�N�b�cz
<a b="c"></a>�	rr	rr;r<rr-rgrrs   r:�test_1463026_1zXmlgenTest.test_1463026_1{st��������6�"���������;��k�#�->�?�����c�*�����������*�D�H�H�_�,E�Fr<c�*�|j�}t|d��}|j�|jddddi�|j	dd�|j�|j
|j�|jd��y)NTr
rBrrCrEz
<a b="c"/>rFrs   r:�test_1463026_1_emptyzXmlgenTest.test_1463026_1_empty�sv��������6��=���������;��k�#�->�?�����c�*�����������*�D�H�H�\�,B�Cr<c�h�|j�}t|�}|j�|jdd�|j	ddi�|jdd�|j
d�|j�|j|j�|jd��y)N�qux�rKrrz<a xmlns="qux"></a>�rr	rr:r;r<r=rr-rgrrs   r:�test_1463026_2zXmlgenTest.test_1463026_2�s���������6�"���������t�U�+����<��b�1�����s�+����T�"�����������*�D�H�H�5J�,K�Lr<c�l�|j�}t|d��}|j�|jdd�|j	ddi�|jdd�|j
d�|j�|j|j�|jd��y)NTr
rKrLrz<a xmlns="qux"/>rMrs   r:�test_1463026_2_emptyzXmlgenTest.test_1463026_2_empty�s���������6��=���������t�U�+����<��b�1�����s�+����T�"�����������*�D�H�H�5G�,H�Ir<c�l�|j�}t|�}|j�|jdd�|j	ddddi�|jdd�|j
d�|j�|j|j�|jd��y)N�myrKrLrrCrEz"<my:a xmlns:my="qux" b="c"></my:a>rMrs   r:�test_1463026_3zXmlgenTest.test_1463026_3�s���������6�"���������t�U�+����<��{�3�.?�@�����s�+����T�"�����������*��H�H�9�:�	<r<c�p�|j�}t|d��}|j�|jdd�|j	ddddi�|jdd�|j
d�|j�|j|j�|jd	��y)
NTr
rRrKrLrrCrEz<my:a xmlns:my="qux" b="c"/>rMrs   r:�test_1463026_3_emptyzXmlgenTest.test_1463026_3_empty�s���������6��=���������t�U�+����<��{�3�.?�@�����s�+����T�"�����������*��H�H�3�4�	6r<c�2�td�}t�}|jtd�|j	�}t|�}|j
|�|j|�|j|j�|jd��y)Nzb<?xml version="1.0"?><a:g1 xmlns:a="http://example.com/ns"><a:g2 xml:lang="en">Hello</a:g2></a:g1>T�M<a:g1 xmlns:a="http://example.com/ns"><a:g2 xml:lang="en">Hello</a:g2></a:g1>)rr�
setFeaturerrr	�setContentHandlerrer-rgr)r9�test_xml�parserrirs     r:�test_5027_1zXmlgenTest.test_5027_1�s����
���������,�d�3�������6�"��� � ��%����X��������*����#�$�	%r<c���|j�}t|�}|j�|jdd�|j	ddi�ddi}|j	dd|�|jd	�|j
dd�|j
dd�|jd�|j�|j|j�|jd
��y)Nr�http://example.com/ns)r^�g1r_)z$http://www.w3.org/XML/1998/namespace�lang�en)r^�g2rb�HellorW)rr	rr:r;rr<r=rr-rgr)r9rir�	lang_attrs    r:�test_5027_2zXmlgenTest.test_5027_2�s���������6�"���������s�$;�<����:�D�"�E�E�t�L�	����:�D�)�L����w�����8�$�?����8�$�?����S�!�����������*����#�$�	%r<c�p�|j�}d�}||�|j|j�y)Nc�^�t|�}|j�|jdi�y)NrN)r	rr)�outrs  r:�funcz+XmlgenTest.test_no_close_file.<locals>.func�s(���s�#�C��������U�B�'r<)r�assertFalser�)r9riris   r:�test_no_close_filezXmlgenTest.test_no_close_file�s-�������	(�	
�V��������'r<c	��|j�}t|�}|jdddi�|jd�|j	d�|jdddi�|j	d�|j|j
�|jd�t|jd	��d�y)
N�foor�1.0rc�barrDz2.0z+<foo a="1.0">Hello</foo><bar b="2.0"></bar>�)	rr	rrrr-rgrr1rs   r:�test_xmlgen_fragmentzXmlgenTest.test_xmlgen_fragments���������6�"��	�����e��-����w�����u�������e��-����u��	
������*��H�H�B�C�C����QS��DU�DV�W�	Yr<N)rFrGrHrr
rrrrr!r&r)r/r1r3r>r@rGrIrNrPrSrUr\rerkrqrIr<r:r�r��s���E�@�
J�
J�2�3�3�(M�"J�
F�
F�N�$2�$2�$	G�	D�M�J�<�6�%�4%�8(�
Yr<r�c��eZdZeZdd�ZdZy)�StringXmlgenTestc��d|�d|��SrKrI�r9rNrOs   r:rzStringXmlgenTest.xmls
��<D�c�J�Jr<N�rn)rFrGrHrrrr)rIr<r:rsrss���G�K�#�r<rsc��eZdZeZdd�Zy)�BytesXmlgenTestc�2�d|�d|��j|d�S)NrLrMrR�rSrus   r:rzBytesXmlgenTest.xml s���3� �!'���2E�!F�	Gr<Nrv)rFrGrHrrrrIr<r:rxrxs
���G�Gr<rxc�"�eZdZGd�de�Zy)�WriterXmlgenTestc�:�eZdZejZdZd�Zd�Zd�Z	y)�WriterXmlgenTest.ioclassFc��y�NTrIrbs r:�seekablez!WriterXmlgenTest.ioclass.seekable)s��r<c��t|�Sr`)r1rbs r:�tellzWriterXmlgenTest.ioclass.tell,s���t�9�r<c�$�dj|�S)Nr<)�joinrbs r:rgz!WriterXmlgenTest.ioclass.getvalue0s���8�8�D�>�!r<N)
rFrGrHr3�appendrZr�r�r�rgrIr<r:rr~%s��������	�	�	"r<rN)rFrGrHr3rrIr<r:r|r|$s��"�$�"r<r|c��eZdZd�Zdd�Zy)�StreamWriterXmlgenTestc�t�t�}tjd�|d�}|j|_|S)Nr(rR)r�codecs�	getwriterrg)r9�raw�writers   r:rzStreamWriterXmlgenTest.ioclass4s3���i��*��!�!�'�*�3�0C�D���,�,����
r<c�2�d|�d|��jdd�S�NrLrMr(rRrzrus   r:rzStreamWriterXmlgenTest.xml:����3� �!'���1D�!E�	Fr<Nrv)rFrGrHrrrIr<r:r�r�3s
���Fr<r�c�8�eZdZejdzZd�Zdd�Zy)�StreamReaderWriterXmlgenTestz-codecsc����tj�jdddd�����fd�}�j|��fd�}|�_�S)NrWr(rRr)rOrX�	bufferingc�d���j�tj�j�yr`)r�rra�fname)r9r�s��r:�cleanupz5StreamReaderWriterXmlgenTest.ioclass.<locals>.cleanupDs����L�L�N����T�Z�Z�(r<c����j�t�jd�5}|j�cddd�S#1swYyxYw�Nry)r�rY�namer�)r[r�s �r:rgz6StreamReaderWriterXmlgenTest.ioclass.<locals>.getvalueHs1����L�L�N��f�k�k�4�(�A��v�v�x�)�(�(�s�A�A)r�rYr��
addCleanuprg)r9r�rgr�s`  @r:rz$StreamReaderWriterXmlgenTest.ioclassAsG������T�Z�Z��w�$7�1�F��	)�	
���� �	 �
#����
r<c�2�d|�d|��jdd�Sr�rzrus   r:rz StreamReaderWriterXmlgenTest.xmlPr�r<Nrv)rFrGrHrrr�rrrIr<r:r�r�>s�����y�(�E�
�Fr<r�s,<?xml version="1.0" encoding="iso-8859-1"?>
c��eZdZd�Zy)�XMLFilterBaseTestc�|�t�}t|�}t�}|j|�|j	�|jdi�|j
d�|jd�|jd�|j�|j|j�tdz�y)NrNr�r+s<doc>content </doc>)
rr	r
rYrrrr.rrr-rg�start)r9rir�filters    r:�test_filter_basicz#XMLFilterBaseTest.test_filter_basicXs�������6�"������ � ��%��������E�2�&����)�$��"�"�3�'����%� �����������*�E�4J�,J�Kr<N)rFrGrHr�rIr<r:r�r�Ws��
Lr<r�ryc�z�eZdZd�Zd�Zed��Zd�Zd�ZGd�d�Z	Gd�d	�Z
d
�Zd�Zd�Z
Gd
�d�Zd�Zd�ZGd�de�Zd�Zd�Zd�Zd�Zd�Zd�Zed��Zd�Zd�Zd�Zd�Zej>e jBdkde jB�d ��d!��Z"d"�Z#d#�Z$d$�Z%ed%��Z&y&)'�ExpatReaderTestc��t�}t�}t|�}|j|�t	t
d�5}|j
|�ddd�|j|j�t�y#1swY�.xYwr��
rrr	rYrY�TEST_XMLFILErer-rg�xml_test_out�r9r[ri�xmlgenr[s     r:�test_expat_binary_filez&ExpatReaderTest.test_expat_binary_filetsf���������f�%��� � ��(�
�,��
%���L�L��O�&�	
������*�L�9�&�
%�s�B�B	c��t�}t�}t|�}|j|�t	t
dd��5}|j
|�ddd�|j|j�t�y#1swY�.xYw�N�rtrnrsr�r�s     r:�test_expat_text_filez$ExpatReaderTest.test_expat_text_filesh���������f�%��� � ��(�
�,��|�
<���L�L��O�=�	
������*�L�9�=�
<�s�B�Bc�v�tj}tjt|�|jtj|�t�}t�}t|�}|j|�|jt|d��|j|j�t�yr�)r�TESTFN_UNICODE�shutil�copyfiler�r�rarrr	rYrerYr-rgr��r9r�r[rir�s     r:�test_expat_binary_file_nonasciiz/ExpatReaderTest.test_expat_binary_file_nonascii�s���(�(������e�,����	�(�(�%�0��������f�%��� � ��(����T�%��&�'�������*�L�9r<c�B�tjt�}t�}t	�}t|�}|j
|�t|d�5}|j|�ddd�|j|j�t�y#1swY�.xYwr�)�os�fsencoder�rrr	rYrYrer-rgr�)r9r�r[rir�r[s      r:�!test_expat_binary_file_bytes_namez1ExpatReaderTest.test_expat_binary_file_bytes_name�st�����L�)���������f�%��� � ��(�
�%��
�!��L�L��O��	
������*�L�9��
�s�B�Bc�z�t�}t�}t|�}|j|�t	t
d�5}t	|j
�dd��5}|j|�ddd�ddd�|j|j�t�y#1swY�6xYw#1swY�:xYw)NryF)�closefd)rrr	rYrYr��filenorer-rgr�)r9r[rir�r[�f2s      r:�test_expat_binary_file_int_namez/ExpatReaderTest.test_expat_binary_file_int_name�s����������f�%��� � ��(�
�,��
%���a�h�h�j�$��6�"����R� �7�&�	
������*�L�9�7�6��&�
%�s$�B1�B%�0B1�%B.	�*B1�1B:c��eZdZd�Zd�Zd�Zy)�ExpatReaderTest.TestDTDHandlerc� �g|_g|_yr`)�
_notations�	_entitiesrbs r:�__init__z'ExpatReaderTest.TestDTDHandler.__init__�s�� �D�O� �D�Nr<c�@�|jj|||f�yr`)r�r�)r9r��publicId�systemIds    r:�notationDeclz+ExpatReaderTest.TestDTDHandler.notationDecl�s���O�O�"�"�D�(�H�#=�>r<c�B�|jj||||f�yr`)r�r�)r9r�r�r��ndatas     r:�unparsedEntityDeclz1ExpatReaderTest.TestDTDHandler.unparsedEntityDecl�s���N�N�!�!�4��8�U�"C�Dr<N)rFrGrHr�r�r�rIr<r:�TestDTDHandlerr��s��	!�	?�	Er<r�c��eZdZd�Zd�Zy)�"ExpatReaderTest.TestEntityRecorderc��g|_yr`)�entitiesrbs r:r�z+ExpatReaderTest.TestEntityRecorder.__init__�s	���D�Mr<c��|jj||f�t�}|j|�|j	|�|Sr`)r�r�r�setPublicId�setSystemId)r9r�r��sources    r:�
resolveEntityz0ExpatReaderTest.TestEntityRecorder.resolveEntity�sA���M�M� � �(�H�!5�6� �]�F����x�(����x�(��Mr<N)rFrGrHr�r�rIr<r:�TestEntityRecorderr��s��	�	r<r�c��t�}|j�}|j|�|jd�|jd�|jd�|jd�|jd�|j	�|j|jdg�|j|jdg�y)N�<!DOCTYPE doc [
z-  <!ENTITY img SYSTEM "expat.gif" NDATA GIF>
zW  <!NOTATION GIF PUBLIC "-//CompuServe//NOTATION Graphics Interchange Format 89a//EN">
�]>
r�)�GIFz;-//CompuServe//NOTATION Graphics Interchange Format 89a//ENN)�imgNz	expat.gifr�)rr��
setDTDHandler�feedr�r-r�r�)r9r[�handlers   r:�test_expat_dtdhandlerz%ExpatReaderTest.test_expat_dtdhandler�s�������%�%�'�����W�%����'�(����D�E����n�o����F�����M�"���������+�+�
Y�Z�	\�����*�*�-N�,O�Pr<c��|jtjj�t	�}|jtd�|j�}|j|�|jt�5|jd�ddd�|j|jdg�y#1swY�'xYw)NT�8<!DOCTYPE external SYSTEM "unsupported://non-existing">
)Nzunsupported://non-existing)r��urllib�request�
urlcleanuprrXrr��setEntityResolverr&rr�r-r��r9r[�resolvers   r:�test_expat_external_dtd_enabledz/ExpatReaderTest.test_expat_external_dtd_enabled�s���������1�1�2�������.��5��*�*�,��� � ��*�
�
�
�x�
(��K�K�K�
�)�	
������ D�E�	
�	)�
(�s�B8�8Cc��t�}|j�}|j|�|jd�|jd�|j	�|j|jg�y)Nr�z<doc />)rr�r�r�r�r-r�r�s   r:�test_expat_external_dtd_defaultz/ExpatReaderTest.test_expat_external_dtd_default�sa������*�*�,��� � ��*����G�	
�	���I����������*�*�B�/r<c��eZdZd�Zy)�"ExpatReaderTest.TestEntityResolverc�N�t�}|jtd��|S)Ns	<entity/>)rrr)r9r�r��inpsrcs    r:r�z0ExpatReaderTest.TestEntityResolver.resolveEntity�s!�� �]�F�� � ���!6�7��Mr<N)rFrGrHr�rIr<r:�TestEntityResolverr��s��	r<r�c��t�}|jtd�|j|j	��t�}|j
t|��|jd�|jd�|jd�|jd�|j�|j|j�tdz�y)NTr��#  <!ENTITY test SYSTEM "whatever">
r��<doc>&test;</doc>s<doc><entity></entity></doc>)
rrXrr�r�rrYr	r�r�r-rgr��r9r[ris   r:�!test_expat_entityresolver_enabledz1ExpatReaderTest.test_expat_entityresolver_enableds���������.��5�� � ��!8�!8�!:�;����� � ��f�!5�6����'�(����:�;����F�����'�(�����������*�E�8�-9�	:r<c���t�}|j|jt�d�|j	|j��t
�}|jt|��|jd�|jd�|jd�|jd�|j�|j|j�tdz�y)NFr�r�r�r��<doc></doc>)
rr-�
getFeaturerr�r�rrYr	r�r�rgr�r�s   r:�!test_expat_entityresolver_defaultz1ExpatReaderTest.test_expat_entityresolver_defaults����������*�*�+?�@�%�H�� � ��!8�!8�!:�;����� � ��f�!5�6����'�(����:�;����F�����'�(�����������*�E�'�-(�	)r<c��eZdZd�Zd�Zy)�ExpatReaderTest.AttrGathererc��||_yr`��_attrs)r9r�r$s   r:rz)ExpatReaderTest.AttrGatherer.startElement%�	���D�Kr<c��||_yr`r�)r9r��qnamer$s    r:r;z+ExpatReaderTest.AttrGatherer.startElementNS(r�r<N)rFrGrHrr;rIr<r:�AttrGathererr�#s��	 �	 r<rc���t�}|j�}|j|�|jd�|j	�|j|j�y)Nr)rrrYr�r�r;r��r9r[�gathers   r:�test_expat_attrs_emptyz&ExpatReaderTest.test_expat_attrs_empty+sL������"�"�$��� � ��(����H����������
�
�.r<c���t�}|j�}|j|�|jd�|j	�|j|j�y)Nz<doc attr='val'/>)rrrYr�r�rEr�rs   r:�test_expat_attrs_wattrz&ExpatReaderTest.test_expat_attrs_wattr5sM������"�"�$��� � ��(����'�(���������
�
�.r<c���td�}|j�}|j|�|jd�|j	�|j|j�y)NrBr)rrrYr�r�r@r�rs   r:�test_expat_nsattrs_emptyz(ExpatReaderTest.test_expat_nsattrs_empty?sO���q�!���"�"�$��� � ��(����H�������!�!�&�-�-�0r<c��td�}|j�}|j|�|jdtz�|j�|j}|j|j�d�|j|j�tdfg�|j|j�gk(xs|j�dgk(�|jt|�d�|jtdf|�|j|jtdf�d�|j|jtdfd�d�|jt|j!��tdfdfg�|jt|j#��dg�|j|j%tdf�d�|j|tdfd�y)NrBz"<doc xmlns:ns='%s' ns:attr='val'/>r#r>rCr%)rrrYr�r?r�r�r-r.r/r�r0r1rDr5r3r6r7r()r9r[rr$s    r:�test_expat_nsattrs_wattrz(ExpatReaderTest.test_expat_nsattrs_wattrIs����q�!���"�"�$��� � ��(����8�6�A�B������
�
��������*�A�.�������)�V�V�,<�+=�>�������*�b�0�:����*�y�k�9�	<�����U��Q�'��
�
�v�v�&��.�������F�F�#3�4�e�<�������F�F�#3�R�8�%�@�����e�k�k�m�,���0@�%�/H�.I�J�����e�l�l�n�-��w�7���������(8�9�5�A�������/�0�%�8r<c���t�}t�}t|�}|j|�|j	t
�|j
|j�t�yr`)	rrr	rYrer�r-rgr��r9r[rir�s    r:�test_expat_inpsource_filenamez-ExpatReaderTest.test_expat_inpsource_filenamebsK���������f�%��� � ��(����\�"�������*�L�9r<c���t�}t�}t|�}|j|�|j	tt��|j|j�t�yr`)
rrr	rYrerr�r-rgr�r
s    r:�test_expat_inpsource_sysidz*ExpatReaderTest.test_expat_inpsource_sysidlsP���������f�%��� � ��(����[��.�/�������*�L�9r<c�t�tj}tjt|�|jtj|�t�}t�}t|�}|j|�|jt|��|j|j�t�yr`)rr�r�r�r�r�rarrr	rYrerr-rgr�r�s     r:�#test_expat_inpsource_sysid_nonasciiz3ExpatReaderTest.test_expat_inpsource_sysid_nonasciivs}���(�(������e�,����	�(�(�%�0��������f�%��� � ��(����[��'�(�������*�L�9r<c�N�t�}t�}t|�}|j|�t	�}ttd�5}|j|�|j|�ddd�|j|j�t�y#1swY�.xYwr�)rrr	rYrrYr�rrer-rgr��r9r[rir�r�r[s      r:� test_expat_inpsource_byte_streamz0ExpatReaderTest.test_expat_inpsource_byte_stream�s|���������f�%��� � ��(����
�,��
%��� � ��#��L�L�� �&�	
������*�L�9�	&�
%�s�#B�B$c�R�t�}t�}t|�}|j|�t	�}ttdd��5}|j|�|j|�ddd�|j|j�t�y#1swY�.xYwr�)rrr	rYrrYr�r�rer-rgr�rs      r:�%test_expat_inpsource_character_streamz5ExpatReaderTest.test_expat_inpsource_character_stream�s~���������f�%��� � ��(����
�,��|�
<���%�%�a�(��L�L�� �=�	
������*�L�9�	=�
<�s�
#B�B&c��t�}t|�}t�}|j|�|j	d�|j	d�|j�|j
|j�tdz�y)N�<doc>�</doc>r�)	rr	rrYr�r�r-rgr��r9rir�r[s    r:�test_expat_incrementalz&ExpatReaderTest.test_expat_incremental�se������f�%������ � ��(����G�����H������������*�E�N�,B�Cr<c���t�}t|�}t�}|j|�|j	d�|j	d�t�}t|�}|j|�|j�|j	d�|j	d�|j	d�|j
�|j|j�tdz�y)Nr�textrs<doc>text</doc>)
rr	rrYr��resetr�r-rgr�rs    r:�test_expat_incremental_resetz,ExpatReaderTest.test_expat_incremental_reset�s�������f�%������ � ��(����G�����F������f�%��� � ��(��������G�����F�����H������������*�E�4F�,F�Gr<���rzExpat z" does not support reparse deferralc�~�t�}t|�}t�}|j|�dD]}|j	|��|j|j
�t�|j|jj��|j�|j|jj��|j|j
�tdz�|j	d�|j�|j|j
�tdz�y)N�z<doc�>�<doc>rr�)
rr	rrYr�r-rgr�r��_parser�GetReparseDeferralEnabled�flushr��r9rir�r[�chunks     r:�#test_flush_reparse_deferral_enabledz3ExpatReaderTest.test_flush_reparse_deferral_enabled�s�������f�%������ � ��(�"�E��K�K���#�	
������*�E�2�������@�@�B�C�����������@�@�B�C�������*�E�H�,<�=����H������������*�E�N�,B�Cr<c���t�}t|�}t�}|j|�dD]}|j	|��t
jdk\r?|jjd�|j|j�t�|j|jj��|j�|j|jj��|j|j�tdz�|j	d�|j�|j|j�tdz�y)Nr%r!Fr'rr�)rr	rrYr��pyexpat�version_infor(�SetReparseDeferralEnabledr-rgr�rjr)r*r�r+s     r:�$test_flush_reparse_deferral_disabledz4ExpatReaderTest.test_flush_reparse_deferral_disabled�s������f�%������ � ��(�"�E��K�K���#����9�,��N�N�4�4�U�;����V�_�_�.��6�������A�A�C�D�����������A�A�C�D�������*�E�H�,<�=����H������������*�E�N�,B�Cr<c��t�}t|�}t�}|j|�|j	d�|j	d�|j�|j
|j�d�|j
|j�d�|j
|j�d�y)NrrrB)
rr	rrYr�r�r-�getSystemId�getPublicId�
getLineNumberrs    r:�test_expat_locator_noinfoz)ExpatReaderTest.test_expat_locator_noinfo�s�������f�%������ � ��(����G�����H����������+�+�-�t�4�����+�+�-�t�4�����-�-�/��3r<c��t�}t|�}t�}|j|�|j	t
�|j
|j�t
�|j
|j�d�yr`)	rr	rrYrer�r-r4r5rs    r:�test_expat_locator_withinfoz+ExpatReaderTest.test_expat_locator_withinfosf������f�%������ � ��(����\�"�����+�+�-�|�<�����+�+�-�t�4r<c��tj}tjt|�|jtj|�t�}t|�}t�}|j|�|j|�|j|j�|�|j|j�d�yr`)rr�r�r�r�r�rarr	rrYrer-r4r5)r9r�rir�r[s     r:�$test_expat_locator_withinfo_nonasciiz4ExpatReaderTest.test_expat_locator_withinfo_nonasciis����(�(������e�,����	�(�(�%�0�����f�%������ � ��(����U������+�+�-�u�5�����+�+�-�t�4r<N)'rFrGrHr�r��requires_nonascii_filenamesr�r�r�r�r�r�r�r�r�r�r�rrrrr	rrrrrrrr �unittest�skipIfr/r0r-r2r7r9r;rIr<r:r�r�ps"��	:�	:�!�:�!�:�
:�
:�
E�
E�	�	�Q� 
�"
0���:� )�$ �~� �/�/�1�9�2:�:�!�:�!�:�:�:�
D�H�*�X�_�_�W�)�)�I�5��g�2�2�3�40�0�1�D�1�D�,D�64�5�!�5�!�5r<r�c�2�eZdZd�Zd�Zd�ZGd�d�Zy)�ErrorReportingTestc�h�t�}|jt��t�}|j	td��d}|j
|�	|j|�|j�y#t$r*}|j|j�|�Yd}~yd}~wwxYw)Ns<foo bar foobar>za file name)rrYrrrrr�re�failrr-r4)r9r[r�r�rs     r:�test_expat_inpsource_locationz0ErrorReportingTest.test_expat_inpsource_location%s������� � ��!1�2�������W�%8�9�:������4� �	4��L�L�� ��I�I�K���	4����Q�]�]�_�d�3�3��	4�s�!A>�>	B1� B,�,B1c��t�}|jt��|jt|j
t
d��|j|j�d�|j|j�d�y)Nz<foo>�rB)
rrYrr&rrerr-�getColumnNumberr6)r9r[s  r:�test_expat_incompletez(ErrorReportingTest.test_expat_incomplete2sh������ � ��!1�2����+�V�\�\�8�G�;L�M�����/�/�1�1�5�����-�-�/��3r<c
�4�ttdd|jdd���ttdd|jdd���ttdd|jdd���ttdd|jdd���y)N�messagerB)�strr�DummyLocatorrbs r:�test_sax_parse_exception_strz/ErrorReportingTest.test_sax_parse_exception_str9s���	��i��"�/�/��1�5�
7�	8�	��i��"�/�/��a�8�
:�	;�	��i��"�/�/��4�8�
:�	;�	��i��"�/�/��d�;�
=�	>r<c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�ErrorReportingTest.DummyLocatorc� �||_||_yr`)�_lineno�_colno)r9�lineno�colnos   r:r�z(ErrorReportingTest.DummyLocator.__init__Ls��!�D�L��D�Kr<c��y)N�pubidrIrbs r:r5z+ErrorReportingTest.DummyLocator.getPublicIdP���r<c��y)N�sysidrIrbs r:r4z+ErrorReportingTest.DummyLocator.getSystemIdSrVr<c��|jSr`)rPrbs r:r6z-ErrorReportingTest.DummyLocator.getLineNumberVs���<�<�r<c��|jSr`)rQrbs r:rFz/ErrorReportingTest.DummyLocator.getColumnNumberYs���;�;�r<N)rFrGrHr�r5r4r6rFrIr<r:rKrNKs��	 �	�	�	 �	r<rKN)rFrGrHrCrGrLrKrIr<r:r@r@$s��4�4�>�$�r<r@c�$�eZdZd�Zd�Zd�Zd�Zy)�
XmlReaderTestc�8�|jti��yr`)r;rrbs r:�test_attrs_emptyzXmlReaderTest.test_attrs_emptyes������r� 2�3r<c�<�|jtddi��y)Nr#rC)rErrbs r:�test_attrs_wattrzXmlReaderTest.test_attrs_wattrhs��������/?� @�Ar<c�:�|jtii��yr`)r@rrbs r:�test_nsattrs_emptyz XmlReaderTest.test_nsattrs_emptyks���!�!�"2�2�r�":�;r<c��ttdfditdfdi�}|j|j�d�|j|j	�tdfg�|j|j�dg�|jt
|�d�|jtdf|�|jt|j��tdfg�|j|jtdf�d�|j|jtdfd�d�|jt|j��tdfdfg�|jt|j��dg�|j|jtdf�d�|j|jd�d�|j|jd�tdf�|j|tdfd�|j|j!tdf�d�y)Nr#rCr>rBr%)rr?r-r.r/r0r1rDr3r4r5r6r7r(r)r*r+r8s  r:�test_nsattrs_wattrz XmlReaderTest.test_nsattrs_wattrns��� �6�6�"2�U�!;�#)�6�"2�Y�!?�A��	
������*�A�.�������)�V�V�,<�+=�>�������*�Y�K�8�����U��Q�'��
�
�v�v�&��.�����e�j�j�l�+�v�v�.>�-?�@�������F�F�#3�4�e�<�������F�F�#3�R�8�%�@�����e�k�k�m�,���0@�%�/H�.I�J�����e�l�l�n�-��w�7���������(8�9�5�A�����.�.�y�9�5�A�����-�-�i�8�6�6�:J�K�������/�0�%�8�����-�-�v�v�.>�?��Kr<N)rFrGrHr^r`rbrdrIr<r:r\r\bs��4�B�<�Lr<r\c��eZdZd�Zd�Zy)�LexicalHandlerTestc�"�d|_d|_d|_d|_d|_d|_t
�|_|jjdj|j|j��|jjdj|j��|jjdj|j
d	��|jjd
j|j��|jjd�|jjd�|jjd
�|jjd�|jjd�|jjdj|jd	��|jjdj|jd��|jjdj|jd��|jjd�|jjdj|j��|jjd�|jjd�|jjd�|jjd�|jjdj|jd|jd	|jd��|jjdj|j
d��|jjdj|j��|jjd	�d|_d|_d|_
d|_d|_d|_d|_g|_y)NrnzUTF-8�wish)�nbspr��target)zComment in a DTDzReally! You think so?z#<?xml version="{}" encoding="{}"?>
z<!DOCTYPE {} [
z<!-- {} -->
rz,<!ELEMENT {} (to,from,heading,body,footer)>
z<!ELEMENT to (#PCDATA)>
z<!ELEMENT from (#PCDATA)>
z<!ELEMENT heading (#PCDATA)>
z<!ELEMENT body (#PCDATA)>
z<!ELEMENT footer (#PCDATA)>
z<!ENTITY {} "&#xA0;">
z&<!ENTITY {} "Written by: Alexander.">
rBz+<!ENTITY {} "Hope it gets to: Aristotle.">
r"r�z<{}>z<to>Aristotle</to>
z<from>Alexander</from>
z <heading>Supplication</heading>
z <body>Teach me patience!</body>
z<footer>&{};&{};&{};</footer>
z</{}>
F)r[�specified_version�specified_encoding�specified_doctype�specified_entity_names�specified_commentr�	test_datarZ�format�seek�versionrO�
standalone�doctype�publicID�systemID�
end_of_dtd�commentsrbs r:r�zLexicalHandlerTest.setUp�s$�����!&���")���!'���&B��#�";���!���������C�#�V�D�$:�$:�$(�$;�$;�=�	>�	
�����/�#�V�D�$:�$:�;�	=������_�#�V�D�$:�$:�1�$=�>�	@������L�#�V�D�$:�$:�;�	=������8�9������:�;������=�>������:�;������<�=������6�#�V�D�$?�$?��$B�C�	E������F�#�V�D�$?�$?��$B�C�	E������K�#�V�D�$?�$?��$B�C�	E������V�$������V�]�]�4�+A�+A�B�C������3�4������7�8������@�A������@�A������>�#�V�D�$?�$?��$B�$(�$?�$?��$B�$(�$?�$?��$B�D�	E�	
�����_�3�3�D�4J�4J�1�4M�N�O������Y�-�-�d�.D�.D�E�F������A�������
���������
���
������
r<c��Gd�dt�}t�|_|jjt	��|jjd||��t
�}|j|j�|jj|�|j|j|j�|j|j�|j|j�|j!|j"�|jt%|j&�t%|j(��|jd|j(d�d�|j&d�y)Nc�0��eZdZ�fd�Zd�Zd�Zd�Z�xZS)�<LexicalHandlerTest.test_handlers.<locals>.TestLexicalHandlerc�2��t�|�|i|��||_yr`��superr��test_harness�r9r�r��kwargs�	__class__s    �r:r�zELexicalHandlerTest.test_handlers.<locals>.TestLexicalHandler.__init__������� �$�1�&�1�$0��!r<c�j�||j_||j_||j_yr`)r�rurvrw)r9rurvrws    r:�startDTDzELexicalHandlerTest.test_handlers.<locals>.TestLexicalHandler.startDTD�s,��,3��!�!�)�-5��!�!�*�-5��!�!�*r<c�&�d|j_yr�)r�rxrbs r:�endDTDzCLexicalHandlerTest.test_handlers.<locals>.TestLexicalHandler.endDTD�s��/3��!�!�,r<c�N�|jjj|�yr`)r�ryr�)r9rs  r:�commentzDLexicalHandlerTest.test_handlers.<locals>.TestLexicalHandler.comment�s���!�!�*�*�1�1�$�7r<)rFrGrHr�r�r�r��
__classcell__�r�s@r:�TestLexicalHandlerr|�s���
1�
6�

4�
8r<r��-http://xml.org/sax/properties/lexical-handlerr+r)rrr[rYr�setPropertyrr�rprer-rurmr�rvrwr�rxr1ryro)r9r�r�s   r:�
test_handlersz LexicalHandlerTest.test_handlers�s��	8��	8� $�o������%�%�n�&6�7������;��t�$�	&�����!�!�$�.�.�1������&�!�������t�'=�'=�>����$�-�-�(����$�-�-�(�������(�����T�]�]�+��T�3�3�4�	6����1�T�3�3�A�6�7�q�9�4�=�=��;K�Lr<N�rFrGrHr�r�rIr<r:rfrf�s��4�lMr<rfc��eZdZd�Zd�Zy)�CDATAHandlerTestc��d|_g|_|jjd�|jjd�d|_t	�|_|j
j
d�|j
j
d�|j
j
|jdd�d��|j
j
d�|j
j
d�|j
j
d	|jd
d�d��|j
j
d�|j
j
d
�|j
jd�g|_d|_	y)N)zParseable character dataF)z <> &% - assorted other XML junk.Trz<root_doc>
z<some_pcdata>
�
z</some_pcdata>
z
<some_cdata>
z	<![CDATA[rBz]]>
z</some_cdata>
z</root_doc>
F)
r[�specified_charsr��
char_indexrrprZrr�chardata�in_cdatarbs r:r�zCDATAHandlerTest.setUp�s3�����!������#�#�$G�H����#�#�$N�O����!���������^�,������.�/������� 4� 4�Q� 7�� :�;�2�>�?������/�0������-�.������y��)=�)=�a�)@��)C�(D�E�J�K������.�/������_�-������A����
���
r<c���Gd�dt�}Gd�dt�}t�|_|jj	||��|jjd||��t
�}|j|j�|jj|�|j|j�|j|jd�y)Nc�*��eZdZ�fd�Zd�Zd�Z�xZS)�:CDATAHandlerTest.test_handlers.<locals>.TestLexicalHandlerc�2��t�|�|i|��||_yr`r~r�s    �r:r�zCCDATAHandlerTest.test_handlers.<locals>.TestLexicalHandler.__init__�r�r<c�&�d|j_yr��r�r�rbs r:�
startCDATAzECDATAHandlerTest.test_handlers.<locals>.TestLexicalHandler.startCDATA�s��-1��!�!�*r<c�&�d|j_y)NFr�rbs r:�endCDATAzCCDATAHandlerTest.test_handlers.<locals>.TestLexicalHandler.endCDATA�s��-2��!�!�*r<)rFrGrHr�r�r�r�r�s@r:r�r��s���
1�
2�
3r<r�c�$��eZdZ�fd�Zd�Z�xZS)�7CDATAHandlerTest.test_handlers.<locals>.TestCharHandlerc�2��t�|�|i|��||_yr`r~r�s    �r:r�z@CDATAHandlerTest.test_handlers.<locals>.TestCharHandler.__init__�r�r<c���|dk7ro|j}|j|j}|j|d|�|j|d|j�|xjdz
c_yy)Nr�rrB)r�r�r�r-r�)r9r��h�ts    r:rzBCDATAHandlerTest.test_handlers.<locals>.TestCharHandler.characterssc���d�?��)�)�A��)�)�!�,�,�7�A��M�M�!�A�$��0��M�M�!�A�$��
�
�3��L�L�A�%�L�#r<)rFrGrHr�rr�r�s@r:�TestCharHandlerr��s
���
1�
&r<r�r�r")rrrr[rYr�rr�rprerjr�r-r�)r9r�r�r�s    r:r�zCDATAHandlerTest.test_handlers�s���		3��		3�	&�n�	&�$�o������%�%�o�d�&;�<������;��t�$�	&�����!�!�$�.�.�1������&�!�������'�������!�,r<Nr�rIr<r:r�r��s���*#-r<r��__main__r`).)Wrfrrrrrr=r�SkipTest�xml.sax.saxutilsr	r
rrr
r�xml.sax.expatreaderr�xml.sax.handlerrrr�xml.sax.xmlreaderrrr�iorrr��os.pathr�r/r��sys�urllib.errorr�urllib.requestr��test.supportrr�test.support.os_helperrrr��TEST_XMLFILE_OUTrS�UnicodeEncodeError�supports_nonascii_filenames�path�supports_unicode_filenamesr��getfilesystemencoding�UnicodeError�	TypeError�
skipUnlessr<r?�TestCaser!rPrUr\r^r�r�r�r�rsrxr|r�r�r�r�rYr[r�r�r�r@r\rfr�rF�mainrIr<r:�<module>r�s��K�K���8��M�A�A�-�-�-�K�K� �
���
�
�!��"�!�3��
�=�9���N�=�A��A����� ����G�$�#��	�w�w�)�)�,�� � �'�'�(A��(A�(A�(C�D�
2�h�1�1�#�.�0��
1��2?�(�#�#�2?�jG�
M�
-�zM��!�!�zM�x-2�X�&�&�-2�j18�8�$�$�18�hN9�X�.�.�N9�f_Y�_Y�B#�z�8�#4�#4�#�G�j�(�"3�"3�G�
"��
"�	F�Z��):�):�	F�F�:�x�/@�/@�F�,	9��L��)�)�L�,
�
�D�!�Q��6�6�8�L�"�k5�k�k5�h
6��*�*�6�|L�K�L�BVM��*�*�VM�r9-�x�(�(�9-�x�z���H�M�M�O���]0�8�
�(�
�
�6�
7�7�8��6�A�
�(�
�
�?�
@�@�A��
�)�$�,�',�#�,��B"�!�s5�J�"J7�*K�K"�J4�7K�	K�K�"K+

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists