AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/twisted/words/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/twisted/words/test/__pycache__/test_xpath.cpython-310.pyc
o

�be)�@sRddlmZddlmZddlmZddlmZddlm	Z	Gdd�dej
�ZdS)	�)�unittest)�xpath)�Element)�
XPathQuery)�SyntaxErrorc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7S)8�
XPathTestscCs�td�|_d|jd<d|jd<|j�d�|j�d�|_|j�d�|_|j�d	�|_|j�d
�|j�d�|j�d�|_d|jd
<|j�d�|_|j�d�|_	|j�d	�|_
|j
�d�|j�d�|_|j�d�|_d|jd<d|jd<|j�d�|_
|j�d	�|_|j�d�|j�d�|_d|jd<d|jd<|j�d�|_|j�d	�|_|j�d�|j�d�|_d|jd<d|jd<d|jd<|j�d�|_|j�d�dS)N)�testns�foo�value1�attrib1zuser@host/resource�attrib3�somecontent�barr	�gar�DEF�somemorecontent�value2�attrib2�ABC�value4�attrib4�value5�attrib5�JKL�MNO�value6�á�attrib6�quuxu☃)r�e�
addContent�
addElement�bar1�subfoo�gar1�bar2�bar3�subfoo2�gar2�bar4�bar5�subfoo3�gar3�bar6�subfoo4�gar4�bar7r��self�r3�?/usr/lib/python3/dist-packages/twisted/words/test/test_xpath.py�setUp
sD










zXPathTests.setUpc	Csx|�t�d|j�d�|�t�d|j�|j|j|j|j|j	|j
g�|�t�d|j�d�|�t�d|j�ddg�dS)z=
        Test basic operation of the static methods.
        �/foo/barT�/foor
rN)
�assertEqualr�matchesr�
queryForNodesr"r%r)r*r-r0�queryForString�queryForStringListr1r3r3r4�test_staticMethodsLs��zXPathTests.test_staticMethodscC� td�}|�|�|j�d�dS)z3
        Test matching foo with child bar.
        r6�N�rr8r9r�r2�xpr3r3r4�test_locationFooBarZ�zXPathTests.test_locationFooBarcC�@td�}|�|�|j�d�|�|�|j�|j|j|jg�dS)z8
        Test finding foos at the second level.
        z/foo/bar/foor?N)rr8r9rr:r#r+r.rAr3r3r4�test_locationFooBarFooas
�z!XPathTests.test_locationFooBarFoocCr>)z(
        Test not finding bar3.
        z	/foo/bar3rNr@rAr3r3r4�test_locationNoBar3krDzXPathTests.test_locationNoBar3c	CsLtd�}|�|�|j�d�|�|�|j�|j|j|j|j|j	|j
g�dS)z-
        Test finding childs of foo.
        z/foo/*TN)rr8r9rr:r"r%r)r*r-r0rAr3r3r4�test_locationAllChildsrs
�z!XPathTests.test_locationAllChildscCr>)z3
        Test matching foo with attribute.
        z/foo[@attrib1]TNr@rAr3r3r4�test_attribute}rDzXPathTests.test_attributecC�8td�}|�|�|j�d�|�|�|j�|jg�dS)z>
        Test find nodes with attribute having value.
        z/foo/*[@attrib2='value2']TN)rr8r9rr:r%rAr3r3r4�test_attributeWithValueAny��z%XPathTests.test_attributeWithValueAnycCrJ)zI
        Nodes' attributes can be matched with non-ASCII values.
        u/foo/*[@attrib6='á']TN)rr8r9rr:r0rAr3r3r4�test_locationWithValueUnicode�rLz(XPathTests.test_locationWithValueUnicodecCr>)z4
        Test matching node with namespace.
        z/foo[@xmlns='testns']/barr?Nr@rAr3r3r4�test_namespaceFound�rDzXPathTests.test_namespaceFoundcCr>)z>
        Test not matching node with wrong namespace.
        z/foo[@xmlns='badns']/bar2rNr@rAr3r3r4�test_namespaceNotFound�rDz!XPathTests.test_namespaceNotFoundcCr>)zA
        Test matching node with attribute having value.
        z/foo[@attrib1='value1']r?Nr@rAr3r3r4�test_attributeWithValue�rDz"XPathTests.test_attributeWithValuecCr>)zM
        queryforString on absolute paths returns their first CDATA.
        r7r
N)rr8r;rrAr3r3r4�test_queryForString�rDzXPathTests.test_queryForStringcC�$td�}|�|�|j�ddg�dS)zO
        queryforStringList on absolute paths returns all their CDATA.
        r7r
rN�rr8r<rrAr3r3r4�test_queryForStringList���z"XPathTests.test_queryForStringListcCrR)zO
        queryforStringList on relative paths returns all their CDATA.
        z//foor
rNrSrAr3r3r4�"test_queryForStringListAnyLocation�rUz-XPathTests.test_queryForStringListAnyLocationc	Cs8td�}|�|�|j�|j|j|j|j|j|j	g�dS)z%
        Test finding nodes.
        r6N)
rr8r:rr"r%r)r*r-r0rAr3r3r4�test_queryForNodes�s

�zXPathTests.test_queryForNodescCr>)z7
        Test matching a node with given text.
        z/foo[text() = 'somecontent']TNr@rAr3r3r4�test_textCondition�rDzXPathTests.test_textConditioncCrJ)zK
        A node can be matched by text with non-ascii code points.
        u//*[text()='☃']TN)rr8r9rr:rrAr3r3r4�test_textConditionUnicode�rLz$XPathTests.test_textConditionUnicodecCr>)z(
        Test for not operator.
        z/foo[not(@nosuchattrib)]TNr@rAr3r3r4�test_textNotOperator�rDzXPathTests.test_textNotOperatorcCs\td�}|�|�|j�d�|�|�|j�|j|j|j|jg�|�|�	|j�gd��dS)zS
        Test finding any nodes named gar and getting their text contents.
        z//garT)rrrrN)
rr8r9rr:r$r(r,r/r<rAr3r3r4�test_anyLocationAndText�s�z"XPathTests.test_anyLocationAndTextc
CsPtd�}|�|�|j�d�|�|�|j�|j|j|j|j|j	|j
|jg�dS)z3
        Test finding any nodes named bar.
        �//barTN)rr8r9rr:r"r%r&r)r*r-r0rAr3r3r4�test_anyLocation�s
��zXPathTests.test_anyLocationcCstd�}|�t|jd�dS)zn
        L{XPathQuery.queryForString} should raise a L{NotImplementedError}
        for any location.
        r\N)r�assertRaises�NotImplementedErrorr;rAr3r3r4�test_anyLocationQueryForStringsz)XPathTests.test_anyLocationQueryForStringcCrJ)z9
        Test boolean and operator in condition.
        z.//bar[@attrib4='value4' and @attrib5='value5']TN)rr8r9rr:r*rAr3r3r4�test_andOperatorrLzXPathTests.test_andOperatorcC�<td�}|�|�|j�d�|�|�|j�|j|jg�dS)z8
        Test boolean or operator in condition.
        z-//bar[@attrib5='value4' or @attrib5='value5']TN)rr8r9rr:r*r-rAr3r3r4�test_orOperators zXPathTests.test_orOperatorcCrb)zK
        Test multiple boolean operators in condition with parens.
        zf//bar[@attrib4='value4' and
                                 (@attrib5='value4' or @attrib5='value6')]TN)rr8r9rr:r-r0rAr3r3r4�test_booleanOperatorsParenss
� z&XPathTests.test_booleanOperatorsParenscCrE)zN
        Test multiple boolean operators in condition without parens.
        z�//bar[@attrib5='value4' or
                                 @attrib5='value5' or
                                 @attrib5='value6']TN)rr8r9rr:r*r-r0rAr3r3r4�test_booleanOperatorsNoParens#s
�$z(XPathTests.test_booleanOperatorsNoParenscCs,|�ttd�}|�|j�d�d|j�dS)z}
        A missing closing bracket raises a SyntaxError.

        This test excercises the most common failure mode.
        z//bar[@attrib1zTrying to find one ofzCSyntaxError message '%s' doesn't start with 'Trying to find one of'N)r^rr�
assertTrue�msg�
startswith)r2�excr3r3r4�test_badXPathNoClosingBracket/s
��z(XPathTests.test_badXPathNoClosingBracketN)�__name__�
__module__�__qualname__r5r=rCrFrGrHrIrKrMrNrOrPrQrTrVrWrXrYrZr[r]r`rarcrdrerjr3r3r3r4rs8?
		
rN)�
twisted.trialr�twisted.words.xishr�twisted.words.xish.domishr�twisted.words.xish.xpathr�twisted.words.xish.xpathparserr�TestCaserr3r3r3r4�<module>s

Anon7 - 2022
AnonSec Team