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_pulldom.cpython-312.opt-1.pyc

�

'ΜgT1��f�ddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZedd��Zd	Z
Gd
�dej�ZGd�d
ej�ZGd�de�ZGd�de�ZGd�de	j(�ZGd�dej�Zedk(rej0�yy)�N)�AttributesImpl)�feature_external_ges)�pulldom)�findfileztest.xml�xmltestdata)�subdira
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xdc="http://www.xml.com/books">
<!-- A comment -->
<title>Introduction to XSL</title>
<hr/>
<p><xdc:author xdc:attrib="prefixed attribute" attrib="other attrib">A. Namespace</xdc:author></p>
</html>c�l�eZdZd�Zd�Zd�Zejd��Zejd��Z	d�Z
y)�PullDOMTestCasec��tjt�}|j|jj
�t
|�ttd�5}t
tj|��ddd�y#1swYyxYw)z&Minimal test of DOMEventStream.parse()�rbN)r�parse�tstfile�
addCleanup�stream�close�list�open)�self�handler�fins   �./usr/local/lib/python3.12/test/test_pulldom.py�
test_parsezPullDOMTestCase.test_parsesZ���-�-��(��������,�,�-��W�
��'�4�
 �C�����s�#�$�!�
 �
 �s�B�Bc�z	�tjt�}t|�\}}|j	t|d��|j
tj|�t|�\}}|j
tj|�|j
d|j�|j
dt|j��|j
|jjd�jd�t|�\}}|j
tj|�t|�\}}|j
tj|�t|�\}}|j
d|j�|}t|�\}}|j
tj|�|j
d|j�t|�\}}|j
tj |�|j
d|j�|j	||u�t|�\}}|j
tj|�t|�\}}|j
tj|�|j
d|j�t|�\}}|j
tj |�|j
d|j�t|�\}}|j
tj|�t|�\}}|j
tj|�|j
d	|j�t|�\}}|j
tj|�|j
d
|j�t|�\}}|j
tj|�t|�\}}|j
tj |�|j
d
|j�t|�\}}|j
tj |�t|�\}}|j
tj|�t|�\}}|j
tj |�y)z&Test DOMEventStream parsing semantics.�
createElement�html�z	xmlns:xdczhttp://www.xml.com/books�titlezIntroduction to XSL�hr�pz
xdc:authorN)r�parseString�SMALL_SAMPLE�next�
assertTrue�hasattr�assertEqual�START_DOCUMENT�
START_ELEMENT�tagName�len�
attributes�getNamedItem�value�
CHARACTERS�data�END_ELEMENT)r�items�evt�node�
title_nodes     r�test_parse_semanticsz$PullDOMTestCase.test_parse_semantics+s����#�#�L�1����K�	��T������o�6�7�����/�/��5���K�	��T�����.�.��4��������.�����C����0�1�������5�5�k�B�H�H�(�	*���K�	��T�����+�+�S�1���K�	��T�	
����+�+�S�1���K�	��T�����$�,�,�/��
���K�	��T�����+�+�S�1����.��	�	�:���K�	��T�����,�,�c�2�����$�,�,�/����
�d�*�+���K�	��T�����+�+�S�1���K�	��T�����.�.��4�����t�|�|�,���K�	��T�����,�,�c�2�����t�|�|�,���K�	��T�����+�+�S�1���K�	��T�����.�.��4�����d�l�l�+���K�	��T�����.�.��4�����t�|�|�4���K�	��T�����+�+�S�1���K�	��T�����,�,�c�2�����t�|�|�4���K�	��T�����,�,�c�2���K�	��T�����+�+�S�1���K�	��T�����,�,�c�2�c���tjt�}|D]`\}}|tjk(s�|jdk(s�*|j|�|j
dt|j��n|jd�|D]\}}|tjk(s�n|j
djd�|j|�|j
t|�dtj�t|�\}}|j
|jd�|j|�t|�t|�\}}|j
|jd�|jt�5t|�d	d	d	�|j�|j|j �|j|j"�y	#1swY�PxYw)
z$Ensure expandItem works as expected.r�z,No "title" element detected in SMALL_SAMPLE!rz=expandNode did not leave DOMEventStream in the correct state.rrrN)rr r!r'r(�
expandNoder%r)�
childNodes�failr"r-�assertRaises�
StopIteration�clear�assertIsNone�parserr)rr0r1�itemr2s     r�test_expandItemzPullDOMTestCase.test_expandItemis����#�#�L�1���I�C���g�+�+�+�����0G�� � ��&�� � ��C����$8�9��	�
�I�I�F�G��I�C���g�+�+�+���	
����t�|�|�K�	M�	���������e��Q���);�);�<���K�	��T�������s�+�
������U����K�	��T�������v�.�
�
�
�}�
-���K�.�
���
����%�,�,�'����%�,�,�'�	.�
-�s�G)�)G2c��tjt�}|D]\}}|tjk(s�y|j	d�y)z*PullDOM does not receive "comment" events.zNo comment was encounteredN)rr r!�COMMENTr:)rr0r1�_s    r�test_commentzPullDOMTestCase.test_comment�s@���#�#�L�1���F�C���g�o�o�%���
�I�I�2�3r5c�2�tjt�}|D]*\}}|tjk(s�|jdk(s�*n	t|�\}}|j
tj|�y#t$r|jd�YywxYw)z/PullDOM does not receive "end-document" events.rz8Ran out of events, but should have received END_DOCUMENTN)
rr r!r/r(r"r%�END_DOCUMENTr<r:)rr0r1r2s    r�test_end_documentz!PullDOMTestCase.test_end_document�s����#�#�L�1���I�C���g�)�)�)�d�l�l�f�.D���	L��U��I�C�����W�1�1�3�7���	L��I�I�J�
L�	L�s�
.A9�9B�Bc��tjt�}|j}|j	t
�}|j
|d�y)NF)rr r!r?�
getFeaturerr%)rr?�	saxparser�gess    r�test_external_ges_defaultz)PullDOMTestCase.test_external_ges_default�s<���$�$�\�2���M�M�	��"�"�#7�8������e�$r5N)�__name__�
__module__�__qualname__rr4rA�unittest�expectedFailurerErHrM�r5rr
r
sN��%� 93�|(�@���4��4����
L��
L�%r5r
c�H�eZdZdZd�Zejd��Zd�Zdd�Z	y)�ThoroughTestCasez(Test the hard-to-reach parts of pulldom.c�`�|jtjdt����y)z0Test some of the hard-to-reach parts of PullDOM.N)r?)�_test_thoroughrr
�SAXExerciser�rs r�test_thorough_parsez$ThoroughTestCase.test_thorough_parse�s�����G�M�M�$�|�~�F�Gr5c�P�tdt�d�}|j|�y)z2SAX2DOM can"t handle a PI before the root element.N�)�SAX2DOMTestHelperrXrW�r�pds  r�test_sax2dom_failz"ThoroughTestCase.test_sax2dom_fail�s"���t�\�^�R�
8�����B�r5c�R�tdt�d�}|j|d�y)z0Test some of the hard-to-reach parts of SAX2DOM.Nr\F)r]�SAX2DOMExerciserrWr^s  r�test_thorough_sax2domz&ThoroughTestCase.test_thorough_sax2dom�s$��
�t�%5�%7��
<�����B��&r5c��t|�\}}|jtj|�|j	t|d��|r�t|�\}}|jtj|�|jd|j�t|�\}}|jtj|�|jd|j�|jd|j�t|�\}}|jtj|�|jd|j�t|�\}}|jtj|�|jd|j�t|�\}}|jtj|�|jd|j�|jd|j�t|�\}}|jtj|�|jd|j�t|�\}}|jtj|�|jd|j�t|�\}}|jtj|�|jd|j�t|�\}}|jtj|�|jd|j�t|�\}}|jtj|�y)	zPTest some of the hard-to-reach parts of the parser, using a mock
        parser.r�	a comment�targetr.rr�textN)r"r%rr&r#r$rCr.�PROCESSING_INSTRUCTIONrfr'r(r-r/rG)rr_�before_rootr1r2s     rrWzThoroughTestCase._test_thorough�ss����H�	��T�����/�/��5������o�6�7���R��I�C�����W�_�_�c�2����[�$�)�)�4��R��I�C�����W�;�;�S�A����X�t�{�{�3����V�T�Y�Y�/���H�	��T�����.�.��4��������.���H�	��T�������#�.�����d�i�i�0���H�	��T�����7�7��=�����4�;�;�/��������+���H�	��T�����.�.��4�����d�l�l�+���H�	��T�����+�+�S�1��������+���H�	��T�����,�,�c�2�����d�l�l�+���H�	��T�����,�,�c�2��������.���H�	��T�����-�-�s�3r5N)T)
rNrOrP�__doc__rZrQrRr`rcrWrSr5rrUrU�s/��2�H���� �� �
'�
,4r5rUc�*�eZdZdZd�Zd�Zd�ZeZeZy)rXznA fake sax parser that calls some of the harder-to-reach sax methods to
    ensure it emits the correct eventsc��||_y�N)�_handler)rrs  r�setContentHandlerzSAXExerciser.setContentHandler�s	����
r5c��|j}|j�|jd�|jdd�|j	dti��|jd�|jdd�|j	dtddi��|j
d�|jd�|jd�|j�y)	Nrerfr.rr�class�	paraclassrg)	rn�
startDocument�comment�processingInstruction�startElementr�
characters�
endElement�endDocument�rrD�hs   rr
zSAXExerciser.parse�s����M�M��	����	
�	�	�+��	����&�1�	���v�~�b�1�2�	�	�	�+��	����&�1�	���s�N�G�[�+A�B�C�	���V��	���S��	���V��	�
�
�r5c��y)zStub method. Does nothing.NrS)r�args�kwargss   r�stubzSAXExerciser.stubs��r5N)	rNrOrPrjror
r�setProperty�
setFeaturerSr5rrXrX�s"��*� ��(
��K��Jr5rXc��eZdZdZd�Zy)rbz�The same as SAXExerciser, but without the processing instruction and
    comment before the root element, because S2D can"t handle itc�x�|j}|j�|jdti��|j	d�|jdd�|jdtddi��|j
d�|jd�|jd�|j�y)	Nrrerfr.rrqrrrg)	rnrsrvrrtrurwrxryrzs   rr
zSAX2DOMExerciser.parses����M�M��	����	���v�~�b�1�2�	�	�	�+��	����&�1�	���s�N�G�[�+A�B�C�	���V��	���S��	���V��	�
�
�r5N)rNrOrPrjr
rSr5rrbrb
s
��D�
r5rbc��eZdZdZd�Zy)r]z1Allows us to drive SAX2DOM from a DOMEventStream.c��tj�|_|jjtj
jjd�|jj|j�y)Nr7)	r�SAX2DOMr?r��xml�saxr�feature_namespacesrorYs r�resetzSAX2DOMTestHelper.reset!sH�����(��������s�w�w���A�A�1�E����%�%�d�l�l�3r5N)rNrOrPrjr�rSr5rr]r]s
��;�4r5r]c� �eZdZdd�Zd�Zd�Zy)�SAX2DOMTestCasec�(�|j||�yrm)r#)r�test�testnames   r�confirmzSAX2DOMTestCase.confirm*s������h�'r5c�t�tjt�5}t|tj
j
�tt��}|D]*\}}|tjk(s�|jdk(s�*n|jtj�d�ddd�y#1swYyxYw)z'Ensure SAX2DOM can parse from a stream.rrN)
�io�StringIOr!r]r�r��make_parserr)rr'r(�
assertGreaterr9)rr�sdr1r2s     r�
test_basiczSAX2DOMTestCase.test_basic-s���
�[�[��
&�#�"�3����(;�(;�(=�#&�|�#4�6�B��	��T��'�/�/�/�D�L�L�F�4J�� �

���s�4�?�?�3�Q�7�'�
&�
&�s�AB.�-B.�=(B.�.B7c��tj�}|j�|jdi�|j	d�|jdi�|j	d�|jd�|j	d�|jd�|j
�|j}|j}|j\}}}|jd}|j|j�|j|j|�|j|j|�|j|j|�|j|j|�|j|j�|j|j�|j|j�|j|j|�|j|j|�|j|j|�|j|j|�|j|j|�|j�y)z)Ensure SAX2DOM expands nodes as expected.�docrg�subelmrN)rr�rsrvrwrxry�document�documentElementr9r>�previousSibling�assertIs�nextSibling�
parentNode�unlink)r�sax2domr��root�text1�elm1�text2�text3s        r�testSAX2DOMzSAX2DOMTestCase.testSAX2DOM9s����/�/�#���������U�B�'����6�"����X�r�*����6�"����8�$����6�"����5�!����������"�"��#������e�����"�����%�/�/�0��
�
�e�'�'��.��
�
�d�*�*�E�2��
�
�d�&�&��.��
�
�e�+�+�T�2����%�+�+�,����%�/�/�0����%�+�+�,��
�
�d�o�o�s�+��
�
�e�&�&��-��
�
�d�o�o�t�,��
�
�e�&�&��-��
�
�e�&�&��-��
�
�r5N)�Test)rNrOrPr�r�r�rSr5rr�r�(s��(�
8� r5r��__main__)r�rQ�xml.saxr��xml.sax.xmlreaderr�xml.sax.handlerr�xml.domr�test.supportrrr!�TestCaser
rU�objectrXrb�DOMEventStreamr]r�rN�mainrSr5r�<module>r�s���	���,�0��!��:�m�
4����N%�h�'�'�N%�b>4�x�(�(�>4�B�6��D�|��"4��.�.�4�1�h�'�'�1�h�z���H�M�M�O�r5

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