HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_pulldom.cpython-310.opt-2.pyc
o

�i�2�@s�ddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZeddd�Zd	Z
Gd
d�dej�ZGdd
�d
ej�ZGdd�de�ZGdd�de�ZGdd�de	j�ZGdd�dej�Zedkrje��dSdS)�N)�AttributesImpl)�feature_external_ges)�pulldom)�findfileztest.xmlZxmltestdata)Zsubdira
<?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@sPeZdZdd�Zdd�Zdd�Zejdd��Zejd	d
��Z	dd�Z
d
d�ZdS)�PullDOMTestCasecCs`	t�t�}|�|jj�t|�ttd��}tt�|��Wd�dS1s)wYdS)N�rb)r�parse�tstfileZ
addCleanup�stream�close�list�open)�self�handler�fin�r�./usr/local/lib/python3.10/test/test_pulldom.py�
test_parses
"�zPullDOMTestCase.test_parsecCs�	t�t�}t|�\}}|�t|d��|�tj|�t|�\}}|�tj|�|�d|j	�|�dt
|j��|�|j�d�j
d�t|�\}}|�tj|�t|�\}}|�tj|�t|�\}}|�d|j	�|}t|�\}}|�tj|�|�d|j�t|�\}}|�tj|�|�d|j	�|�||u�t|�\}}|�tj|�t|�\}}|�tj|�|�d|j	�t|�\}}|�tj|�|�d|j	�t|�\}}|�tj|�t|�\}}|�tj|�|�d	|j	�t|�\}}|�tj|�|�d
|j	�t|�\}}|�tj|�t|�\}}|�tj|�|�d
|j	�t|�\}}|�tj|�t|�\}}|�tj|�t|�\}}|�tj|�dS)N�
createElement�html�z	xmlns:xdczhttp://www.xml.com/books�titlezIntroduction to XSL�hr�pz
xdc:author)r�parseString�SMALL_SAMPLE�next�
assertTrue�hasattr�assertEqual�START_DOCUMENT�
START_ELEMENT�tagName�lenZ
attributesZgetNamedItem�value�
CHARACTERS�data�END_ELEMENT)r�items�evt�nodeZ
title_noderrr�test_parse_semantics+sj
�z$PullDOMTestCase.test_parse_semanticscCs@	t�t�}|D]\}}|tjkr&|jdkr&|�|�|�dt|j��nq|�	d�|D]\}}|tjkr9nq.|�d|jd�|�|�|�t
|�dtj�t
|�\}}|�|jd�|�|�t
|�t
|�\}}|�|jd�|�t
��t
|�Wd�n1s�wY|��|�|j�|�|j�dS)	Nr�z,No "title" element detected in SMALL_SAMPLE!rz=expandNode did not leave DOMEventStream in the correct state.rrr)rrrr!r"Z
expandNoderr#�
childNodes�failrr%ZassertRaises�
StopIteration�clear�assertIsNone�parserr
)rr(r)�itemr*rrr�test_expandItemis<

�

�
�


�zPullDOMTestCase.test_expandItemcCs8	t�t�}|D]\}}|tjkrdSq|�d�dS)NzNo comment was encountered)rrr�COMMENTr.)rr(r)�_rrr�test_comment�s

�zPullDOMTestCase.test_commentcCsr	t�t�}|D]\}}|tjkr|jdkrnqzt|�\}}|�tj|�WdSty8|�	d�YdSw)Nrz8Ran out of events, but should have received END_DOCUMENT)
rrrr'r"rr�END_DOCUMENTr/r.)rr(r)r*rrr�test_end_document�s
�
��z!PullDOMTestCase.test_end_documentcCsRt�t�}|�td��|�|ddtj�Wd�dS1s"wYdS)NzUse iterator protocol instead���r)rrrZassertWarnsRegex�DeprecationWarningrr )rr2rrr�test_getitem_deprecation�s
�"�z(PullDOMTestCase.test_getitem_deprecationcCs*t�t�}|j}|�t�}|�|d�dS)NF)rrrr2Z
getFeaturerr)rr2Z	saxparserZgesrrr�test_external_ges_default�s

z)PullDOMTestCase.test_external_ges_defaultN)�__name__�
__module__�__qualname__rr+r4�unittest�expectedFailurer7r9r<r=rrrrrs> 
	
rc@s6eZdZ	dd�Zejdd��Zdd�Zddd	�Zd
S)�ThoroughTestCasecCs	|�tjdt�d��dS)N)r2)�_test_thoroughrr�SAXExerciser�rrrr�test_thorough_parse�sz$ThoroughTestCase.test_thorough_parsecCs	tdt�d�}|�|�dS)N�)�SAX2DOMTestHelperrErD�r�pdrrr�test_sax2dom_fail�sz"ThoroughTestCase.test_sax2dom_failcCs 	tdt�d�}|�|d�dS)NrHF)rI�SAX2DOMExerciserrDrJrrr�test_thorough_sax2dom�sz&ThoroughTestCase.test_thorough_sax2domTcCs�	t|�\}}|�tj|�|�t|d��|rGt|�\}}|�tj|�|�d|j�t|�\}}|�tj|�|�d|j	�|�d|j�t|�\}}|�tj
|�|�d|j�t|�\}}|�tj|�|�d|j�t|�\}}|�tj|�|�d|j	�|�d|j�t|�\}}|�tj
|�|�d|j�t|�\}}|�tj|�|�d|j�t|�\}}|�tj
|�|�d|j�t|�\}}|�tj
|�|�d|j�t|�\}}|�tj|�dS)Nr�	a comment�targetr&rr�text)rrrr rrr5r&ZPROCESSING_INSTRUCTIONrPr!r"r%r'r8)rrKZbefore_rootr)r*rrrrD�sHzThoroughTestCase._test_thoroughN)T)	r>r?r@rGrArBrLrNrDrrrrrC�s
rCc@s.eZdZ	dd�Zdd�Zdd�ZeZeZdS)rEcCs
||_dS�N)�_handler)rrrrr�setContentHandler�s
zSAXExerciser.setContentHandlercCs�|j}|��|�d�|�dd�|�dti��|�d�|�dd�|�dtddi��|�d�|�d�|�d�|��dS)	NrOrPr&rr�class�	paraclassrQ)	rS�
startDocument�comment�processingInstruction�startElementr�
characters�
endElement�endDocument�rr6�hrrrr�s




zSAXExerciser.parsecOs	dSrRr)r�args�kwargsrrr�stub
szSAXExerciser.stubN)r>r?r@rTrrbZsetProperty�
setFeaturerrrrrE�srEc@�eZdZ	dd�ZdS)rMcCsr|j}|��|�dti��|�d�|�dd�|�dtddi��|�d�|�d�|�d�|��dS)	NrrOrPr&rrUrVrQ)	rSrWrZrrXrYr[r\r]r^rrrrs



zSAX2DOMExerciser.parseN)r>r?r@rrrrrrMsrMc@rd)rIcCs0t��|_|j�tjjjd�|j�|j�dS)Nr,)	r�SAX2DOMr2rc�xml�saxrZfeature_namespacesrTrFrrr�reset(s
zSAX2DOMTestHelper.resetN)r>r?r@rhrrrrrI%srIc@s&eZdZd	dd�Zdd�Zdd�ZdS)
�SAX2DOMTestCase�TestcCs|�||�dSrR)r)r�testZtestnamerrr�confirm1szSAX2DOMTestCase.confirmcCs�	t�t��0}t|tj��tt��}|D]\}}|tj	kr$|j
dkr$nq|�t|j�d�Wd�dS1s9wYdS)Nrr)
�io�StringIOrrIrfrgZmake_parserr#rr!r"Z
assertGreaterr-)rr�sdr)r*rrr�
test_basic4s��"�zSAX2DOMTestCase.test_basiccCs@	t��}|��|�di�|�d�|�di�|�d�|�d�|�d�|�d�|��|j}|j}|j	\}}}|j	d}|�
|j�|�|j
|�|�|j|�|�|j
|�|�|j|�|�
|j
�|�
|j�|�
|j
�|�|j|�|�|j|�|�|j|�|�|j|�|�|j|�|��dS)N�docrQZsubelmr)rrerWrZr[r\r]ZdocumentZdocumentElementr-r1ZpreviousSiblingZassertIsZnextSiblingZ
parentNode�unlink)rZsax2domrq�rootZtext1Zelm1Ztext2Ztext3rrr�testSAX2DOM@s:





zSAX2DOMTestCase.testSAX2DOMN)rj)r>r?r@rlrprtrrrrri/s
ri�__main__)rmrAZxml.saxrfZxml.sax.xmlreaderrZxml.sax.handlerrZxml.domrZtest.supportrr	rZTestCaserrC�objectrErMZDOMEventStreamrIrir>�mainrrrr�<module>s&	A"
4�