
    w:ik                         d dl Z d dlmZmZ d dlmZ d dlmZmZm	Z	m
Z
mZmZ d dlmZ  G d de          Z G d d	e j                  Zd
 Zedk    r e j        d           dS dS )    N)AttrsQName)XML)Path
PathParserPathSyntaxErrorGenericStrategySingleStepStrategySimplePathStrategy)doctest_suitec                       e Zd Zd ZddZdS )FakePathc                     || _         d S N)strategy)selfr   s     N/var/www/html/trac/venv/lib/python3.11/site-packages/genshi/tests/test_path.py__init__zFakePath.__init__   s         Fc                 6    | j                             |          S r   )r   test)r   ignore_contexts     r   r   zFakePath.test   s    }!!.111r   N)F)__name__
__module____qualname__r   r    r   r   r   r      s7        ! ! !2 2 2 2 2 2r   r   c                      e Zd ZeeegZd Zd Zd Z	d Z
d Zd Zd Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d Z#d Z$d Z%d  Z&d! Z'd" Z(d# Z)d$ Z*d% Z+d& Z,d' Z-d( Z.d) Z/d* Z0d+ Z1d, Z2d- Z3d. Z4d/ Z5d0 Z6d1 Z7d2 Z8d3 Z9d4 Z:d5 Z;d6 Z<d7 Z=d8 Z>d9 Z?d: Z@d; ZAd< ZBd= ZCd> ZDd? ZE	 dDdAZF	 	 dEdCZGd@S )FPathTestCasec                 H    |                      t          t          d           d S )Nz/rootassertRaisesr   r   r   s    r   test_error_no_absolute_pathz(PathTestCase.test_error_no_absolute_path"   s     /499999r   c                     |                      t          t          d           |                      t          t          d           d S )Nz..z
parent::mar    r"   s    r   test_error_unsupported_axisz(PathTestCase.test_error_unsupported_axis%   s8    /4666/4>>>>>r   c                    t          d          }|                     dd|d           |                     dd|d           |                     dd|d           |                     dd|d           |                     d	d
|d           d S )N<root><elem/></root>elemz<Path "child::elem"><elem/>pathequivinputoutputzchild::elemz//elemz!<Path "descendant-or-self::elem">zdescendant::elemz<Path "descendant::elem">r   
_test_evalr   xmls     r   
test_1stepzPathTestCase.test_1step)   s    ())*	 	 	
 	
 	
 	*	 	 	
 	
 	
 	 *	 	 	
 	
 	
 	7	 	 	
 	
 	
 	%/	 	 	
 	
 	
 	
 	
r   c                     t          d          }|                     dd|d           |                     dd|d           d S )Nr'   .z<Path "self::node()">r*   zself::node()r/   r1   s     r   test_1step_selfzPathTestCase.test_1step_selfJ   sj    ())++	 	 	
 	
 	
 	!++	 	 	
 	
 	
 	
 	
r   c                     t          d          }|                     dd|d           |                     dd|d           |                     dd|d           |                     d	d
|d           d S )Nr'   *z<Path "child::*">r)   r*   zchild::*zchild::node()<Path "child::node()">z//*z<Path "descendant-or-self::*">r/   r1   s     r   test_1step_wildcardz PathTestCase.test_1step_wildcardY   s    ())'	 	 	
 	
 	
 	'	 	 	
 	
 	
 	",	 	 	
 	
 	
 	4+	 	 	
 	
 	
 	
 	
r   c                     |                      ddt          d          d           t          d          }|                      dd|d           |                      dd	|d           d S )
Nz@fooz<Path "attribute::foo">z<root/> r*   z<root foo="bar"/>barz./@fooz$<Path "self::node()/attribute::foo">r0   r   r1   s     r   test_1step_attributez!PathTestCase.test_1step_attributet   s    -	NN	 	 	
 	
 	
 %&&-	 	 	
 	
 	
 	:	 	 	
 	
 	
 	
 	
r   c                     t          d          }|                     dd|d           |                     dd|d           |                     dd	|d           |                     d
d|d           d S )Nz<root>Hey</root>text()<Path "child::text()">Heyr*   ./text()#<Path "self::node()/child::text()">//text()#<Path "descendant-or-self::text()">z	.//text()z><Path "self::node()/descendant-or-self::node()/child::text()">r/   r1   s     r   test_1step_textzPathTestCase.test_1step_text   s    $%%,	 	 	
 	
 	
 	9	 	 	
 	
 	
 	9	 	 	
 	
 	
 	T	 	 	
 	
 	
 	
 	
r   c                     t          d          }|                     d|d           |                     d|d           |                     d|d           d S )	N<root><foo/><bar/></root>r8   z<foo/><bar/>r-   r.   r=   <bar/>bazr<   r/   r1   s     r   
test_2stepzPathTestCase.test_2step   s^    -..3~>>>S:::S44444r   c                 b   t          d          }|                     d|d           |                     d|d           |                     d|d           |                     d|d	           t          d
          }|                     d|d           |                     d|d           d S )Nz4<elem class="x"><span id="joe">Hey Joe</span></elem>z@*xrK   z./@*z.//@*xjoez*/@*joez'<elem><foo id="1"/><foo id="2"/></elem>r<   zfoo/@*12r/   r1   s     r   test_2step_attributez!PathTestCase.test_2step_attribute   s    HIIC444c#666s6:::c%888;<<C333D99999r   c                    t          d          }|                     dd|d           |                     dd|d           |                     d	d
|d           t          d          }|                     dd|d           t          d          }|                     d|d           t          d          }|                     d|d           d S )N<root><foo><bar/></foo></root>zfoo/barz<Path "child::foo/child::bar">rL   r*   z./barz <Path "self::node()/child::bar">r<   foo/*<Path "child::foo/child::*">2<root><foo><bar id="1"/></foo><bar id="2"/></root>z<bar id="2"/>zp<table>
            <tr><td>1</td><td>One</td></tr>
            <tr><td>2</td><td>Two</td></tr>
        </table>ztr/td[1]z<td>1</td><td>2</td>)r+   r-   r.   z<ul>
            <li>item1
                <ul><li>subitem11</li></ul>
            </li>
            <li>item2
                <ul><li>subitem21</li></ul>
            </li>
        </ul>zli[2]/ulz<ul><li>subitem21</li></ul>r/   r1   s     r   test_2step_complexzPathTestCase.test_2step_complex   sB   2334	 	 	
 	
 	
 	6	 	 	
 	
 	
 	2	 	 	
 	
 	
 FGG6$	 	 	
 	
 	
     	+ 	 	
 	
 	

     	2 	 	
 	
 	
 	
 	
r   c                    t          d          }|                     dd|d           |                     dd|d           |                     dd	|d           |                     d
d|d           t          d          }|                     dd|d           t          d          }|                     dd|d           d S )Nz<root><item>Foo</item></root>zitem/text()z"<Path "child::item/child::text()">Foor*   z*/text()z<Path "child::*/child::text()">rF   rG   rD   rE   r<   z-<root><item>Foo</item><item>Bar</item></root>FooBarzE<root><item><name>Foo</name><sub><name>Bar</name></sub></item></root>zitem/name/text()z.<Path "child::item/child::name/child::text()">r/   r1   s     r   test_2step_textzPathTestCase.test_2step_text   s*   122 8	 	 	
 	
 	
 	5	 	 	
 	
 	
 	9	 	 	
 	
 	
 	9	 	 	
 	
 	
 ABB 8	 	 	
 	
 	
 YZZ%D	 	 	
 	
 	
 	
 	
r   c                 V    t          d          }|                     dd|d           d S )NrV   rW   rX   rL   r*   r/   r1   s     r   
test_3stepzPathTestCase.test_3step  sA    2332	 	 	
 	
 	
 	
 	
r   c                     |                      ddt          d          d           |                      ddt          d          d	           d S )
Nz*/barz<Path "child::*/child::bar">rV   rL   r*   z//barz <Path "descendant-or-self::bar">rY   z<bar id="1"/><bar id="2"/>r>   r"   s    r   test_3step_complexzPathTestCase.test_3step_complex  sn    2899	 	 	
 	
 	
 	6LMM1	 	 	
 	
 	
 	
 	
r   c                     t          d          }|                     dd|d           |                     dd|d           d S )	NzM<root><item><bar>Some text </bar><baz><bar>in here.</bar></baz></item></root>zitem/bar/text()z-<Path "child::item/child::bar/child::text()">z
Some text r*   zitem//bar/text()zH<Path "child::item/descendant-or-self::node()/child::bar/child::text()">Some text in here.r/   r1   s     r   test_3step_complex_textz$PathTestCase.test_3step_complex_text'  sj    abb$C!	 	 	
 	
 	
 	%^)	 	 	
 	
 	
 	
 	
r   c                 V    t          d          }|                     dd|d           d S )Nz<root><!-- commented --></root>z	comment()z<Path "child::comment()">z<!-- commented -->r*   r/   r1   s     r   test_node_type_commentz#PathTestCase.test_node_type_comment6  sA    344/)	 	 	
 	
 	
 	
 	
r   c                 V    t          d          }|                     dd|d           d S )N$<root>Some text <br/>in here.</root>rA   rB   rd   r*   r/   r1   s     r   test_node_type_textz PathTestCase.test_node_type_text?  sA    899,)	 	 	
 	
 	
 	
 	
r   c                 V    t          d          }|                     dd|d           d S )Nri   znode()r9   zSome text <br/>in here.r*   r/   r1   s     r   test_node_type_nodez PathTestCase.test_node_type_nodeH  sA    899,.	 	 	
 	
 	
 	
 	
r   c                     t          d          }|                     dd|d           |                     dd|d           |                     d	d
|d           d S )Nz4<?python x = 2 * 3 ?><root><?php echo("x") ?></root>z//processing-instruction()z5<Path "descendant-or-self::processing-instruction()">z'<?python x = 2 * 3 ?><?php echo("x") ?>r*   zprocessing-instruction()z(<Path "child::processing-instruction()">z<?php echo("x") ?>zprocessing-instruction("php")z-<Path "child::processing-instruction("php")">r/   r1   s     r   %test_node_type_processing_instructionz2PathTestCase.test_node_type_processing_instructionQ  s    HII/K>	 	 	
 	
 	
 	->)	 	 	
 	
 	
 	2E)	 	 	
 	
 	
 	
 	
r   c                 V    t          d          }|                     dd|d           d S )Nz"<body>1<br />2<br />3<br /></body>z*|text()z<Path "child::*|child::text()">z1<br/>2<br/>3<br/>r*   r/   r1   s     r   test_simple_unionzPathTestCase.test_simple_unionf  sA    :;;5)	 	 	
 	
 	
 	
 	
r   c                 T    t          d          }|                     d|d           d S )NrJ   z*[name()="foo"]<foo/>rK   r/   r1   s     r   test_predicate_namez PathTestCase.test_predicate_nameo  s/    -..)XFFFFFr   c                 T    t          d          }|                     d|d           d S )N$<root><foo xmlns="NS"/><bar/></root>z*[local-name()="foo"]<foo xmlns="NS"/>rK   r/   r1   s     r   test_predicate_localnamez%PathTestCase.test_predicate_localnames  s=    899/s%8 	 	: 	: 	: 	: 	:r   c                 T    t          d          }|                     d|d           d S )Nru   z*[namespace-uri()="NS"]rv   rK   r/   r1   s     r   test_predicate_namespacez%PathTestCase.test_predicate_namespacex  s=    8991': 	 	< 	< 	< 	< 	<r   c                 T    t          d          }|                     d|d           d S )NrJ   z*[not(name()="foo")]rL   rK   r/   r1   s     r   test_predicate_not_namez$PathTestCase.test_predicate_not_name}  s=    -...c%- 	 	/ 	/ 	/ 	/ 	/r   c                     t          d          }|                     d|d           |                     d|d           d S )N,<root><item/><item important="very"/></root>zitem[@important]<item important="very"/>rK   item[@important="very"]r/   r1   s     r   test_predicate_attrz PathTestCase.test_predicate_attr  sh    @AA*#%? 	 	A 	A 	A1%? 	 	A 	A 	A 	A 	Ar   c                     t          d          }|                     d|d           |                     d|d           d S )Nz-<root><item/><item important="notso"/></root>r   r<   rK   zitem[@important!="very"]z <item/><item important="notso"/>r/   r1   s     r   test_predicate_attr_equalityz)PathTestCase.test_predicate_attr_equality  s[    ABB1RHHH2#%G 	 	I 	I 	I 	I 	Ir   c                     t          d          }|                     d|d           |                     d|d           d S )N!<root><item priority="3"/></root>zitem[@priority>3]r<   rK   zitem[@priority>2]<item priority="3"/>r/   r1   s     r    test_predicate_attr_greater_thanz-PathTestCase.test_predicate_attr_greater_than  V    566+3rBBB+3%; 	 	= 	= 	= 	= 	=r   c                     t          d          }|                     d|d           |                     d|d           d S )Nr   zitem[@priority<3]r<   rK   zitem[@priority<4]r   r/   r1   s     r   test_predicate_attr_less_thanz*PathTestCase.test_predicate_attr_less_than  r   r   c                     t          d          }|                     d|d           |                     d|d           d S )Nr}   z&item[@important and @important="very"]r~   rK   z'item[@important and @important="notso"]r<   r/   r1   s     r   test_predicate_attr_andz$PathTestCase.test_predicate_attr_and  sd    @AA@&)2L 	 	N 	N 	NA&)" 	 	6 	6 	6 	6 	6r   c                     t          d          }|                     d|d           |                     d|d           d S )Nr}   zitem[@urgent or @important]r~   rK   zitem[@urgent or @notso]r<   r/   r1   s     r   test_predicate_attr_orz#PathTestCase.test_predicate_attr_or  sU    @AA5S%? 	 	A 	A 	A1RHHHHHr   c                 D   t          d          }|                     d|d           |                     d|d           |                     d|d           |                     d|d           |                     d	|d           |                     d
|d           d S )N<root><foo>bar</foo></root>z*[boolean("")]r<   rK   z*[boolean("yo")]<foo>bar</foo>z*[boolean(0)]z*[boolean(42)]z*[boolean(false())]z*[boolean(true())]r/   r1   s     r   test_predicate_boolean_functionz,PathTestCase.test_predicate_boolean_function  s    /00(B???*#%5 	 	7 	7 	7s2>>>(%5 	 	7 	7 	7-SDDD,C%5 	 	7 	7 	7 	7 	7r   c                 T    t          d          }|                     d|d           d S )Nr   z*[ceiling("4.5")=5]r   rK   r/   r1   s     r   test_predicate_ceil_functionz)PathTestCase.test_predicate_ceil_function  s=    /00-S%5 	 	7 	7 	7 	7 	7r   c                 T    t          d          }|                     d|d           d S )Nr   z*[name()=concat("f", "oo")]r   rK   r/   r1   s     r   test_predicate_concat_functionz+PathTestCase.test_predicate_concat_function  s=    /005S%5 	 	7 	7 	7 	7 	7r   c                 T    t          d          }|                     d|d           d S )Nr   z*[contains(name(), "oo")]r   rK   r/   r1   s     r    test_predicate_contains_functionz-PathTestCase.test_predicate_contains_function  s=    /0033%5 	 	7 	7 	7 	7 	7r   c                 T    t          d          }|                     d|d           d S )Nz)<root><foo>bar</foo><bar>foo</bar></root>z*[matches(name(), "foo|bar")]z<foo>bar</foo><bar>foo</bar>rK   r/   r1   s     r   test_predicate_matches_functionz,PathTestCase.test_predicate_matches_function  sB    =>>7s%C 	 	E 	E 	E 	E 	Er   c                 T    t          d          }|                     d|d           d S )Nr   z
*[false()]r<   rK   r/   r1   s     r   test_predicate_false_functionz*PathTestCase.test_predicate_false_function  s.    /00C;;;;;r   c                 T    t          d          }|                     d|d           d S )Nr   z*[floor("4.5")=4]r   rK   r/   r1   s     r   test_predicate_floor_functionz*PathTestCase.test_predicate_floor_function  s=    /00+3%5 	 	7 	7 	7 	7 	7r   c                 T    t          d          }|                     d|d           d S )Nr   z,*[normalize-space(" foo   bar  ")="foo bar"]r   rK   r/   r1   s     r   'test_predicate_normalize_space_functionz4PathTestCase.test_predicate_normalize_space_function  sC    /00F&)2B 	 	D 	D 	D 	D 	Dr   c                     t          d          }|                     d|d           |                     d|d           |                     d|d           d S )Nr   z*[number("3.0")=3]r   rK   z*[number("3.0")=3.0]z*[number("0.1")=.1]r/   r1   s     r   test_predicate_number_functionz+PathTestCase.test_predicate_number_function  s    /00,C%5 	 	7 	7 	7.c%5 	 	7 	7 	7-S%5 	 	7 	7 	7 	7 	7r   c                     t          d          }|                     d|d           |                     d|d           d S )Nr   z*[round("4.4")=4]r   rK   z*[round("4.6")=5]r/   r1   s     r   test_predicate_round_functionz*PathTestCase.test_predicate_round_function  s`    /00+3%5 	 	7 	7 	7+3%5 	 	7 	7 	7 	7 	7r   c                     t          d          }|                     d|d           |                     d|d           d S )Nr   z*[starts-with(name(), "f")]r   rK   z*[starts-with(name(), "b")]r<   r/   r1   s     r   #test_predicate_starts_with_functionz0PathTestCase.test_predicate_starts_with_function  s`    /005S%5 	 	7 	7 	75S%' 	 	) 	) 	) 	) 	)r   c                 T    t          d          }|                     d|d           d S )Nr   z*[string-length(name())=3]r   rK   r/   r1   s     r   %test_predicate_string_length_functionz2PathTestCase.test_predicate_string_length_function  s=    /004C%5 	 	7 	7 	7 	7 	7r   c                     t          d          }|                     d|d           |                     d|d           d S )Nr   z*[substring(name(), 1)="oo"]r   rK   z*[substring(name(), 1, 1)="o"]r/   r1   s     r   !test_predicate_substring_functionz.PathTestCase.test_predicate_substring_function  s`    /006c%5 	 	7 	7 	78%5 	 	7 	7 	7 	7 	7r   c                 T    t          d          }|                     d|d           d S )Nr   z$*[substring-after(name(), "f")="oo"]r   rK   r/   r1   s     r   'test_predicate_substring_after_functionz4PathTestCase.test_predicate_substring_after_function  s=    /00>c'7 	 	9 	9 	9 	9 	9r   c                 T    t          d          }|                     d|d           d S )Nr   z%*[substring-before(name(), "oo")="f"]r   rK   r/   r1   s     r   (test_predicate_substring_before_functionz5PathTestCase.test_predicate_substring_before_function  sC    /00?&)2B 	 	D 	D 	D 	D 	Dr   c                 T    t          d          }|                     d|d           d S )Nr   z&*[translate(name(), "fo", "ba")="baa"]r   rK   r/   r1   s     r   !test_predicate_translate_functionz.PathTestCase.test_predicate_translate_function  sC    /00@&)2B 	 	D 	D 	D 	D 	Dr   c                 T    t          d          }|                     d|d           d S )Nr   z	*[true()]r   rK   r/   r1   s     r   test_predicate_true_functionz)PathTestCase.test_predicate_true_function  s/    /0037GHHHHHr   c                 Z    t          d          }|                     d|dddi           d S )Nr   z*[name()=$bar]r   r=   foo)r+   r-   r.   	variablesr/   r1   s     r   test_predicate_variablez$PathTestCase.test_predicate_variable  sE    /00#%	 	 	
 	
 	
 	
 	
r   c                 T    t          d          }|                     d|d           d S )Nz7<root><foo id="a1"/><foo id="a2"/><foo id="a3"/></root>z*[2]<foo id="a2"/>rK   r/   r1   s     r   test_predicate_positionz$PathTestCase.test_predicate_position  s/    KLLc2BCCCCCr   c                 T    t          d          }|                     d|d           d S )N/<root><foo/><foo id="a1"/><foo id="a2"/></root>z	*[@id][2]r   rK   r/   r1   s     r    test_predicate_attr_and_positionz-PathTestCase.test_predicate_attr_and_position  s/    CDD37GHHHHHr   c                     t          d          }|                     d|d           |                     d|d           d S )Nr   z	*[1][@id]r<   rK   z	*[2][@id]z<foo id="a1"/>r/   r1   s     r    test_predicate_position_and_attrz-PathTestCase.test_predicate_position_and_attr  sG    CDD3r:::37GHHHHHr   c                 T    t          d          }|                     d|d           d S )Nz-<root><a><b><c><d><e/></d></c></b></a></root>z]descendant-or-self::*/descendant-or-self::*/descendant-or-self::*[2]/self::*/descendant::*[3]z<d><e/></d>rK   r/   r1   s     r    test_predicate_advanced_positionz-PathTestCase.test_predicate_advanced_position"  sD    ABB ; CF'4	 	 	6 	6 	6 	6 	6r   c                     t          d          }|                     d|d           |                     d|d           d S )NzC<root><a><b>1</b><b>2</b><b>3</b></a><a><b>4</b><b>5</b></a></root>z//a/b[2]z<b>2</b><b>5</b>rK   z//a/b[3]z<b>3</b>r/   r1   s     r   test_predicate_child_positionz*PathTestCase.test_predicate_child_position*  sP     E F F
#6HIII
#jAAAAAr   c                 \    t          d          }|                     dd|dddi           d S )N-<root xmlns:f="FOO"><f:foo>bar</f:foo></root>zf:fooz<Path "child::f:foo"><foo xmlns="FOO">bar</foo>fFOOr+   r,   r-   r.   
namespacesr/   r1   s     r   test_name_with_namespacez%PathTestCase.test_name_with_namespace0  sH    ABB+1u 	 	
 	
 	
 	
 	
r   c                 \    t          d          }|                     dd|dddi           d S )Nr   zf:*z<Path "child::f:*">r   r   r   r   r/   r1   s     r   test_wildcard_with_namespacez)PathTestCase.test_wildcard_with_namespace:  sH    ABB)1u 	 	
 	
 	
 	
 	
r   c                     t          d          }|                     d|d           t          d          }|                     d|d           dS )z
        Verify that a patch matching the self axis with a predicate doesn't
        cause an infinite loop. See <http://genshi.edgewall.org/ticket/82>.
        z&<ul flag="1"><li>a</li><li>b</li></ul>z.[@flag="1"]/*z<li>a</li><li>b</li>rK   z.[@flag="0"]/*r<   Nr/   r1   s     r   test_predicate_terminationz'PathTestCase.test_predicate_terminationD  sd    
 :;;(%; 	 	= 	= 	= :;;(B?????r   c                 Z    t          d          }|                     d|dddi           d S )N-<root xmlns:f="FOO"><foo f:bar="baz"/></root>zfoo[@f:bar]$<foo xmlns:ns1="FOO" ns1:bar="baz"/>r   r   r-   r.   r   r/   r1   s     r   test_attrname_with_namespacez)PathTestCase.test_attrname_with_namespaceP  sC    ABBS%K*-u 	 	7 	7 	7 	7 	7r   c                 Z    t          d          }|                     d|dddi           d S )Nr   z	foo[@f:*]r   r   r   r   r/   r1   s     r    test_attrwildcard_with_namespacez-PathTestCase.test_attrwildcard_with_namespaceV  sC    ABB3%K*-u 	 	7 	7 	7 	7 	7r   c                 D   t          d          }|                     d|d           |                     d|d           |                     d|d           |                     d|d           |                     d	|d           |                     d
|d           d S )Nz<root><foo/></root>z
self::rootrK   z	self::foor<   zdescendant::rootzdescendant::foorr   zdescendant-or-self::rootzdescendant-or-self::foor/   r1   s     r   test_self_and_descendantz%PathTestCase.test_self_and_descendant\  s    '((C8MNNN3r:::*#bAAA)XFFF2#'< 	 	> 	> 	>1XNNNNNr   c                    t          d          }|                     d|d           |                     d|d           |                     d|d           |                     d|d           |                     d|d           |                     d	|d           |                     d
|d           |                     d|d           |                     d|d           d S )Nzb<root><a><b><a><d><a><b><a><b><a><b><a><c>!</c></a></b></a></b></a></b></a></d></a></b></a></root>z//a/b/a/b/a/cz<c>!</c>rK   z	//a/b/a/cz//a/cz//cza/b/descendant::a/cz#a/b/descendant::a/d/descendant::a/cza/b/descendant::a/d/a/cr<   z;//d/descendant::b/descendant::b/descendant::b/descendant::czI//d/descendant::b/descendant::b/descendant::b/descendant::b/descendant::cr/   r1   s     r   test_long_simple_pathsz#PathTestCase.test_long_simple_pathsf  s(    N O Os:FFF3zBBBs:>>>S<<< 	-SLLL=$'
 	 	< 	< 	<1RHHH /69* 	 	N 	N 	N =DG%' 	 	) 	) 	) 	) 	)r   c                     t          d          }t          d          }|                    |          }|                     t	          |          t          t          d          dfg          g           d S )Nz"<root><foo bar="abc"></foo></root>zfoo/@barr=   abcr   r   selectassertEquallistr   r   r   r2   r+   results       r   test_attr_selectionz PathTestCase.test_attr_selectionz  sv    677JS!!fE%LL&)*++(
 	 	 	 	 	r   c                     t          d          }t          d          }|                    |ddi          }|                     t	          |          t          t          d          dfg          g           d S )NzE<root xmlns:ns1="http://example.com"><foo ns1:bar="abc"></foo></root>zfoo/@ns1:barns1zhttp://example.com)r   zhttp://example.com}barr   r   r   s       r   "test_attr_selection_with_namespacez/PathTestCase.test_attr_selection_with_namespace  s      N##Se5I-JKKfE233V<=>>(
 	 	 	 	 	r   c                 ~    t          |d d                                          d         }|                    |          S )Nr   )r   parsesupports)r   strategy_classtextr+   s       r   _test_supportzPathTestCase._test_support  s8    $b))//11!4&&t,,,r   c                 `   |                      |                     t          d                     |                      |                     t          d                     |                      |                     t          d                     |                      |                     t          d                     |                      |                     t          d                     |                      |                     t          d                     |                      |                     t          d                     |                      |                     t          d                      |                      |                     t          d	                      |                      |                     t          d
                      |                      |                     t          d                      |                      |                     t          d                      d S )Nza/bz	self::a/bzdescendant::a/bzdescendant-or-self::a/bz//a/bza/@bza/text()za//bz	node()/@az@azfoo:barz
a/@foo:bar)
assertTruer   r   r"   s    r   test_simple_strategy_supportz)PathTestCase.test_simple_strategy_support  s   **+=uEEFFF**+={KKLLL**+=?PQQRRR**+=24 4 	5 	5 	5**+=wGGHHH**+=vFFGGG**+=zJJKKK 	D../A6JJJKKKD../A;OOOPPPD../A4HHHIIID../A9MMMNNND../A<PPPQQQQQr   Nc                 @   | j         D ]}|                    |          s ||          }t          |                              |||                              d           }dt          |          z  }	|	d|z  z  }	|	d|z  z  }	|                     |||	           d S )Nr   r   encodingzBad render using %s strategy
Expected:	%r
Rendered:	%r)
strategiesr   r   r   renderstrr   )
r   r-   r+   r.   r   r   r   srenderedmsgs
             r   _test_strategieszPathTestCase._test_strategies  s     
	4 
	4H$$T** A{{))%J4= * ? ?#)646#8#8  13x==@C$v--C$x//CVXs3333
	4 
	4r   r<   c                    t          |          }|#|                     |t          |                     |d S |                    |||                              d           }d}|d|z  z  }|d|z  z  }|                     |||           t          |j                  dk    r'|                     ||j        d         |||           d S d S )Nr   r   zBad output using whole pathr   r      r   )r   r   reprr   r   lenpathsr   )	r   r+   r,   r-   r.   r   r   r   r   s	            r   r0   zPathTestCase._test_eval  s    DzzUDJJ///=F;;u)2  4 44:FDF4I4I 	+ 6)) 8++3///tz??a!!%A-79 " N N N N N  r   )NN)NNr<   NN)Hr   r   r   r	   r
   r   r   r#   r%   r3   r6   r:   r?   rH   rN   rT   rZ   r^   r`   rb   re   rg   rj   rl   rn   rp   rs   rw   ry   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r0   r   r   r   r   r      sB       !#57IJJ: : :? ? ?
 
 
B
 
 

 
 
6
 
 
*
 
 
65 5 5	: 	: 	:0
 0
 0
d'
 '
 '
R
 
 

 
 

 
 

 
 

 
 

 
 

 
 
*
 
 
G G G: : :
< < <
/ / /
A A AI I I= = == = =6 6 6I I I
7 
7 
77 7 7
7 7 7
7 7 7
E E E
< < <7 7 7
D D D
7 7 77 7 7) ) )7 7 7
7 7 79 9 9
D D D
D D D
I I I
 
 
D D DI I II I I
6 6 6B B B
 
 

 
 

@ 
@ 
@7 7 77 7 7O O O) ) )(  	 	 	- - -R R R$ 594 4 4 4 ?A48N N N N N Nr   r   c                      t          j                    } |                     t          t          j                             |                     t           j                            t                               | S r   )	unittest	TestSuiteaddTestr   r   r   defaultTestLoaderloadTestsFromTestCaser   )suites    r   r  r    sT      E	MM-00111	MM(,BB<PPQQQLr   __main__r  )defaultTest)r  genshi.corer   r   genshi.inputr   genshi.pathr   r   r   r	   r
   r   genshi.tests.utilsr   r   TestCaser   r  r   mainr   r   r   <module>r     sC    $ $ $ $ $ $ $ $      ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? , , , , , ,2 2 2 2 2t 2 2 2d
N d
N d
N d
N d
N8$ d
N d
N d
NN   zHMg&&&&&& r   