3
(h                 @   s   d Z ddlZddlZddlmZmZ ddlmZmZm	Z	m
Z
mZ ddlmZmZmZmZ ddlmZmZ ejd dk rdd	 Znd
d	 ZG dd dejZdZdZdZedkrej  dS )a  
    Tests for cssselect
    ===================

    These tests can be run either by py.test or by the standard library's
    unittest. They use plain ``assert`` statements and do little reporting
    themselves in case of failure.

    Use py.test to get fancy error reporting and assert introspection.


    :copyright: (c) 2007-2012 Ian Bicking and contributors.
                See AUTHORS for more details.
    :license: BSD, see LICENSE for more details.

    N)etreehtml)parseGenericTranslatorHTMLTranslatorSelectorSyntaxErrorExpressionError)tokenizeparse_series_unicodeFunctionalPseudoElement)_unicode_safe_getattr	XPathExpr   c             C   s
   | j dS )Nutf8)decode)text r   6/tmp/pip-install-q3hcpn_q/cssselect/cssselect/tests.pyu!   s    r   c             C   s   | S )Nr   )r   r   r   r   r   %   s    c               @   s|   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd ZdS )TestCssselectc             C   sP   dd t tdD }|tddddtdd	d
ddddddddddgksLtd S )Nc             S   s   g | ]}t |qS r   )r   ).0itemr   r   r   
<listcomp>,   s    z0TestCssselect.test_tokenizer.<locals>.<listcomp>u,   E\ é > f [a~="y\"x"]:nth(/* fu /]* */-3.7)u   <IDENT 'E é' at 0>z<S ' ' at 4>z<DELIM '>' at 5>z<S ' ' at 6>u   <IDENT 'f ' at 7>z<DELIM '[' at 9>z<IDENT 'a' at 10>z<DELIM '~' at 11>z<DELIM '=' at 12>z<STRING 'y"x' at 13>z<DELIM ']' at 19>z<DELIM ':' at 20>z<IDENT 'nth' at 21>z<DELIM '(' at 24>z<NUMBER '-3.7' at 37>z<DELIM ')' at 41>z<EOF at 42>)r	   r   AssertionError)selftokensr   r   r   test_tokenizer*   s(    zTestCssselect.test_tokenizerc                sN  dd   fdd}|ddgks&t |ddgks8t |dd	gksJt |d
dgks\t |ddgksnt |ddgkst |ddddddddgkst |dddddgkst |ddddgkst |d d!gkst |d"d#gkst |d"d#gkst |d$d%gkst |d$d%gks,t |d&d'd(gksBt |d)d*gksVt |d+d,d-gkslt |d.d/d0gkst |d1d2gkst |d3d4gkst |d5d6gkst |d7d8gkst |d9d:gkst |d;d<gkst |d=d>gkst |d?d@gks"t |dAdBgks6t |dCdDgksJt d S )ENc             S   s2   t | }x|D ]}|jd kstqW dd |D S )Nc             S   s   g | ]}t |jjd dqS )z(u'z(')reprparsed_treereplace)r   selectorr   r   r   r   H   s   zATestCssselect.test_parser.<locals>.repr_parse.<locals>.<listcomp>)r   pseudo_elementr   )css	selectorsr!   r   r   r   
repr_parseD   s
    
z-TestCssselect.test_parser.<locals>.repr_parsec                s*    | }x|D ]} ||kst qW |S )N)r   )firstZothersresultother)r%   r   r   
parse_manyK   s    
z-TestCssselect.test_parser.<locals>.parse_many*z
Element[*]z*|*z*|foozElement[foo]zfoo|*zElement[foo|*]zfoo|barzElement[foo|bar]z#foo#barzHash[Hash[Element[*]#foo]#bar]zdiv>.fooz	div> .fooz	div >.fooz
div > .foozdiv 
>  	 	 .foozdiv>


.fooz
div>.fooz6CombinedSelector[Element[div] > Class[Element[*].foo]]ztd.foo,.barztd.foo, .barztd.foo	
 ,	
 .barzClass[Element[td].foo]zClass[Element[*].bar]zdiv, td.foo, div.bar spanzElement[div]zBCombinedSelector[Class[Element[div].bar] <followed> Element[span]]zdiv > pz+CombinedSelector[Element[div] > Element[p]]ztd:firstzPseudo[Element[td]:first]z	td :firstzACombinedSelector[Element[td] <followed> Pseudo[Element[*]:first]]za[name]z	a[ name	]zAttrib[Element[a][name]]za [name]z@CombinedSelector[Element[a] <followed> Attrib[Element[*][name]]]za[rel="include"]za[rel = include]z#Attrib[Element[a][rel = 'include']]za[hreflang |= 'en']za[hreflang|=en]z$Attrib[Element[a][hreflang |= 'en']]zdiv:nth-child(10)z(Function[Element[div]:nth-child(['10'])]z:nth-child(2n+2)z0Function[Element[*]:nth-child(['2', 'n', '+2'])]zdiv:nth-of-type(10)z*Function[Element[div]:nth-of-type(['10'])]zdiv div:nth-of-type(10) .aclasszCombinedSelector[CombinedSelector[Element[div] <followed> Function[Element[div]:nth-of-type(['10'])]] <followed> Class[Element[*].aclass]]z
label:onlyzPseudo[Element[label]:only]z
a:lang(fr)z!Function[Element[a]:lang(['fr'])]zdiv:contains("foo")z(Function[Element[div]:contains(['foo'])]z
div#foobarzHash[Element[div]#foobar]zdiv:not(div.foo)z3Negation[Element[div]:not(Class[Element[div].foo])]ztd ~ thz+CombinedSelector[Element[td] ~ Element[th]])r   )r   r)   r   )r%   r   test_parserC   s|    zTestCssselect.test_parserc                s  dd   fdd}|dd+ks$t |dd,ks4t |d	d-ksDt |dd.ksTt |dd/ksdt |dd0kstt |dd1kst |dd2kst |dd3kst |dd4kst |dd5kst |dd6k st |dd7k st |dd8k st |dd9kst |dd:kst |dd;ks0t  d!d<d=d>gk xFd?D ]>}td$| \}|j|ksjt t j|d%d&d'ksHt qHW t }td(\}|jdkst |j|d%d&d'kst | jt|j|d)d* d S )@Nc             S   sh   g }x^t | D ]R}|j}|r$t|n|}|d ks@t|tks@tt|jjdd}|j||f qW |S )Nz(u'z(')	r   r"   r   typer   r   r   r    append)r#   r'   r!   pseudor   r   r   parse_pseudo   s    z8TestCssselect.test_pseudo_elements.<locals>.parse_pseudoc                s     | }t |dkst|d S )N   r   )lenr   )r#   r'   )r/   r   r   	parse_one   s    z5TestCssselect.test_pseudo_elements.<locals>.parse_onefooElement[foo]r*   
Element[*]z:emptyPseudo[Element[*]:empty]z:BEforebeforez:aftERafterz:First-Line
first-linez:First-Letterfirst-letterz::befoREz::AFterz::firsT-linEz::firsT-letteRz::text-contenttext-contentz::attr(name))FunctionalPseudoElement[::attr(['name'])]z::Selection	selectionz	foo:afterzfoo::selectionz*lorem#ipsum ~ a#b.c[href]:empty::selectionfCombinedSelector[Hash[Element[lorem]#ipsum] ~ Pseudo[Attrib[Class[Hash[Element[a]#b].c][href]]:empty]]zfoo:before, bar, baz:afterElement[bar]Element[baz]ze:%s )prefixeze::fooT)Ztranslate_pseudo_elements)r4   N)r5   N)r6   N)r5   r7   )r5   r8   )r5   r9   )r5   r:   )r5   r7   )r5   r8   )r5   r9   )r5   r:   )r5   r;   )r5   r<   )r5   r=   )r4   r8   )r4   r=   )r>   r=   )r4   r7   )r?   N)r@   r8   )r8   r7   r9   r:   )r   r   r"   r   selector_to_xpathassertRaisesr   )r   r2   r.   r!   trr   )r/   r   test_pseudo_elements   sH     
 
z"TestCssselect.test_pseudo_elementsc             C   s  dd }|ddkst |ddks(t |ddks8t |dd ksHt |d	d!ksXt |d
d"ksht |dd#ksxt |dd$kst |dd%kst |dd&kst |dd'kst |dd(k st |dd)k st |dd*k st |dd+ks t |dd,kst |dd-ks$t |dd.ks6t |dd/ksHt |dd0ksZt |dd1kslt |dd2ks~t d S )3Nc             S   s$   t | }t|dkst|d j S )Nr0   r   )r   r1   r   specificity)r#   r$   r   r   r   rH      s    z3TestCssselect.test_specificity.<locals>.specificityr*   r   z foor0   z:empty z:beforez*:beforez:nth-child(2)z.barz[baz]z	[baz="4"]z
[baz^="4"]z#lipsumz:not(*)z	:not(foo)z
:not(.foo)z:not([foo])z:not(:empty)z
:not(#foo)z	foo:emptyz
foo:before   zfoo::beforezfoo:empty::beforez/#lorem + foo#ipsum:first-child > bar:first-liner   )r   r   r   )r   r   r0   )r   r0   r   )r   r   r0   )r   r   r0   )r   r0   r   )r   r0   r   )r   r0   r   )r   r0   r   )r   r0   r   )r0   r   r   )r   r   r   )r   r   r0   )r   r0   r   )r   r0   r   )r   r0   r   )r0   r   r   )r   r0   r0   )r   r   rI   )r   r   rI   )r   r0   rI   )rI   r0   r   )r   )r   rH   r   r   r   test_specificity   s0    zTestCssselect.test_specificityc             C   s  dd }|ddkst |ddks(t |ddks8t |dd	ksHt |d
dksXt |ddksht |ddksxt |ddkst |ddkst |ddkst |ddkst |ddkst |ddkst |ddkst |ddkst |dd ks
t |d!d"kst |d#d$ks.t |d%d ks@t |d&d'ksRt |d(d)ksdt |d*d ksvt |d+d,kst |d-d.kst |d/d0kst |d1d2kst |d3d2kst |d4d5kst |d6d7kst d S )8Nc             S   s:   yt |  W n( tk
r4   ttj d jddS X d S )Nr0   z(u'z(')r   r   strsysexc_infor    )r#   r   r   r   	get_error   s    z2TestCssselect.test_parse_errors.<locals>.get_errorzattributes(href)/html/body/az(Expected selector, got <DELIM '(' at 10>zattributes(href)zhtml/body/az'Expected selector, got <DELIM '/' at 4> z!Expected selector, got <EOF at 1>zdiv, z!Expected selector, got <EOF at 5>z , divz'Expected selector, got <DELIM ',' at 1>zp, , divz'Expected selector, got <DELIM ',' at 3>zdiv > z!Expected selector, got <EOF at 6>z  > divz'Expected selector, got <DELIM '>' at 2>zfoo|#barz,Expected ident or '*', got <HASH 'bar' at 4>z#.fooz'Expected selector, got <DELIM '#' at 0>z.#fooz%Expected ident, got <HASH 'foo' at 1>z:#fooz[*]z"Expected '|', got <DELIM ']' at 2>z[foo|]z$Expected ident, got <DELIM ']' at 5>z[#]z+Expected ident or '*', got <DELIM '#' at 1>z[foo=#]z.Expected string or ident, got <DELIM '#' at 5>z[href]az'Expected selector, got <IDENT 'a' at 6>z[rel=stylesheet]z[rel:stylesheet]z'Operator expected, got <DELIM ':' at 4>z[rel=stylesheetzExpected ']', got <EOF at 15>z	:lang(fr)z:lang(frz$Expected an argument, got <EOF at 8>z:contains("foozUnclosed string at 10zfoo!z'Expected selector, got <DELIM '!' at 3>za:before:emptyz8Got pseudo-element ::before not at the end of a selectorzli:before az:not(:before)z/Got pseudo-element ::before inside :not() at 12z:not(:not(a))zGot nested :not())r   )r   rN   r   r   r   test_parse_errors   sr    














zTestCssselect.test_parse_errorsc             C   s  dd }|ddkst |ddks(t |ddks8t |ddksHt |dd	ksXt |d
dksht |ddksxt |ddkst |ddkst |ddkst |ddkst |ddkst |ddkst |ddkst |ddkst |ddks
t |d d!kst |d d!ks.t |d"d#ks@t |d$dksRt |d%d&ksdt |d'dksvt |d(d)kst |d*d+kst |d,d-kst |d.d/kst |d0d/kst |d1d2kst |d3d4kst |d5d6kst |d7d6kst |d8d9ks*t |d:d;ks<t |d<d=ksNt |d>d4ks`t |d?d@ksrt |dAdBkst |dCdDkst |dEdFkst |dGdHkst |dItdJkst |dKdLkst |dMtdNkst |dOdPks
t | jt|tdQ | jt|dR | jt|dS | jt|dT | jt|dU | jt|dV | jt|dW | jt|dX | jt|dY | jt|dZ | jt|d[ | jtt jd\ | jtt jd] d S )^Nc             S   s   t t j| ddS )NrA   )rB   )r   r   css_to_xpath)r#   r   r   r   xpath;  s    z-TestCssselect.test_translation.<locals>.xpathr*   rC   z*|eze|fze:fze[foo]ze[@foo]z
e[foo|bar]ze[@foo:bar]ze[foo="bar"]ze[@foo = 'bar']ze[foo~="bar"]zFe[@foo and contains(concat(' ', normalize-space(@foo), ' '), ' bar ')]ze[foo^="bar"]z$e[@foo and starts-with(@foo, 'bar')]ze[foo$="bar"]z:e[@foo and substring(@foo, string-length(@foo)-2) = 'bar']ze[foo*="bar"]z!e[@foo and contains(@foo, 'bar')]ze[hreflang|="en"]zDe[@hreflang and (@hreflang = 'en' or starts-with(@hreflang, 'en-'))]ze:nth-child(1)z&*/*[name() = 'e' and (position() = 1)]ze:nth-last-child(1)z/*/*[name() = 'e' and (position() = last() - 1)]ze:nth-last-child(2n+2)zO*/*[name() = 'e' and ((position() +2) mod -2 = 0 and position() < (last() -2))]ze:nth-of-type(1)z*/e[position() = 1]ze:nth-last-of-type(1)z*/e[position() = last() - 1]z!div e:nth-last-of-type(1) .aclasszdiv/descendant-or-self::*/e[position() = last() - 1]/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' aclass ')]ze:first-childze:last-childz+*/*[name() = 'e' and (position() = last())]ze:first-of-typeze:last-of-typez*/e[position() = last()]ze:only-childz"*/*[name() = 'e' and (last() = 1)]ze:only-of-typeze[last() = 1]ze:emptyz"e[not(*) and not(string-length())]ze:EmPTYze:rootze[not(parent::*)]ze:hoverze[0]ze:contains("foo")ze[contains(., 'foo')]ze:ConTains(foo)z	e.warningzNe[@class and contains(concat(' ', normalize-space(@class), ' '), ' warning ')]ze#myidze[@id = 'myid']ze:not(:nth-child(odd))z5e[not((position() -1) mod 2 = 0 and position() >= 1)]ze:nOT(*)ze fze/descendant-or-self::*/fze > fze/fze + fz9e/following-sibling::*[name() = 'f' and (position() = 1)]ze ~ fze/following-sibling::fzdiv#container pz.div[@id = 'container']/descendant-or-self::*/pzdi\a0 vu   *[name() = 'di v']zdi\[vz*[name() = 'di[v']z
[h\a0 ref]u"   *[attribute::*[name() = 'h ref']]z[h\]ref]z!*[attribute::*[name() = 'h]ref']]u   :fİrst-childz:first-of-typez:only-of-typez:last-of-typez:nth-of-type(1)z:nth-last-of-type(1)z:nth-child(n-)z:afterz:lorem-ipsumz:lorem(ipsum)z::lorem-ipsum   r3   )r   r   rE   r   	TypeErrorr   rQ   rD   )r   rR   r   r   r   test_translation:  s    







zTestCssselect.test_translationc             C   s`   t jd dk rdjd}nd}t j|}|dd  |ks>t|jddjd}|d	ks\td S )
Nr   r   u   .aÁbz
ISO-8859-1r0   asciixmlcharrefreplaceASCIIzcdescendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' a&#193;b ')])rL   version_infor   r   rQ   r   encode)r   r#   rR   r   r   r   test_unicode  s    zTestCssselect.test_unicodec             C   sL   t  j}|ddkst|ddks(t|ddks8t|ddksHtd S )	Nz*[aval="'"]z"descendant-or-self::*[@aval = "'"]z*[aval="'''"]z$descendant-or-self::*[@aval = "'''"]z*[aval='"']z"descendant-or-self::*[@aval = '"']z*[aval='"""']z$descendant-or-self::*[@aval = '"""'])r   rQ   r   )r   rQ   r   r   r   test_quoting  s    


zTestCssselect.test_quotingc             C   sL   t  j}|ddkst|ddks(t|ddks8t|ddksHtd S )Nz*[aval="\'\22\'"]z2descendant-or-self::*[@aval = concat("'",'"',"'")]z*[aval="\'\22 2\'"]z3descendant-or-self::*[@aval = concat("'",'"2',"'")]z*[aval="\'\20  \'"]z%descendant-or-self::*[@aval = "'  '"]z*[aval="'\20
 '"])r   rQ   r   )r   rQ   r   r   r   test_unicode_escapes  s    


z"TestCssselect.test_unicode_escapesc                s   G dd dt   fdd}|ddks,t|ddks<t|d	d
ksLt|ddks\t|dd
kslt|ddks|td S )Nc               @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )zBTestCssselect.test_xpath_pseudo_elements.<locals>.CustomTranslatorc             S   s   t |trHd|jjdd }t| |d }|s:td|j |||j}n4d|jdd }t| |d }|sttd| ||}|S )Nz"xpath_%s_functional_pseudo_element-_z/The functional pseudo-element ::%s() is unknownzxpath_%s_simple_pseudo_elementz"The pseudo-element ::%s is unknown)
isinstancer   namer    r   r   	arguments)r   rR   r"   methodr   r   r   xpath_pseudo_element  s$    

zWTestCssselect.test_xpath_pseudo_elements.<locals>.CustomTranslator.xpath_pseudo_elementc             S   s   t |jd j}|jd| S )Nr   zcount(@*)=%d)intrb   valueadd_condition)r   rR   functionZnb_attributesr   r   r   xpath_nb_attr_function  s    zYTestCssselect.test_xpath_pseudo_elements.<locals>.CustomTranslator.xpath_nb_attr_functionc             S   s
   |j dS )Nzcount(@*)=5)rg   )r   rR   r   r   r   xpath_five_attributes_pseudo  s    z_TestCssselect.test_xpath_pseudo_elements.<locals>.CustomTranslator.xpath_five_attributes_pseudoc             S   s$   |d j }td| d}|jd|S )Nr   z@%srA   /)rf   r   join)r   rR   rb   Zattribute_namer(   r   r   r   $xpath_attr_functional_pseudo_element  s    
zgTestCssselect.test_xpath_pseudo_elements.<locals>.CustomTranslator.xpath_attr_functional_pseudo_elementc             S   s   t dd}|jd|S )Nztext()rA   rk   )r   rl   )r   rR   r(   r   r   r   %xpath_text_node_simple_pseudo_element  s    
zhTestCssselect.test_xpath_pseudo_elements.<locals>.CustomTranslator.xpath_text_node_simple_pseudo_elementc             S   s   t dd}|jd|S )Nz@hrefrA   rk   )r   rl   )r   rR   r(   r   r   r   %xpath_attr_href_simple_pseudo_element  s    
zhTestCssselect.test_xpath_pseudo_elements.<locals>.CustomTranslator.xpath_attr_href_simple_pseudo_elementN)	__name__
__module____qualname__rd   ri   rj   rm   rn   ro   r   r   r   r   CustomTranslator  s   rs   c                s   t   j| S )N)r   rQ   )r#   )rs   r   r   rR     s    z7TestCssselect.test_xpath_pseudo_elements.<locals>.xpathz:five-attributesz"descendant-or-self::*[count(@*)=5]z:nb-attr(3)z"descendant-or-self::*[count(@*)=3]z::attr(href)zdescendant-or-self::*/@hrefz::text-nodezdescendant-or-self::*/text()z::attr-hrefzp img::attr(src)z4descendant-or-self::p/descendant-or-self::*/img/@src)r   r   )r   rR   r   )rs   r   test_xpath_pseudo_elements  s    5z(TestCssselect.test_xpath_pseudo_elementsc             C   s:  dd }|ddkst |ddks(t |ddks8t |ddksHt |d	dksXt |d
d!ksht |dd#ksxt |dd%kst |dd'kst |dd(kst |dd)kst |dd*k st |dd+k st |dd,k st |dd.ks t |dd/kst |dd ks$t |dd ks6t d S )0Nc             S   s8   t d|  \}|jj}yt|S  tk
r2   d S X d S )Nz:nth-child(%s))r   r   rb   r
   
ValueError)r#   r!   argsr   r   r   series  s    z)TestCssselect.test_series.<locals>.seriesz1n+3r0   r   z1n +3z1n + 3z1n+ 3z1n-3z1n -3z1n - 3z1n- 3zn-5   ZoddrI   Zevenr   Z3nnz+nz-n5r3   zn+)r0   r   )r0   r   )r0   r   )r0   r   )r0   r{   r{   )r0   r{   r{   )r0   r{   r{   )r0   r{   )r0   r|   )rI   r0   )rI   r   )r   r   )r0   r   )r0   r   )r}   r   )r   rx   )r   )r   rw   r   r   r   test_series  s&    zTestCssselect.test_seriesc                s   t jttdd tj D jt j  fdd}|ddddd	gksVt	|d
dd	gksjt	|ddgks|t	|ddgkst	|ddgkst	|ddgkst	|ddgkst	|ddddd	dgkst	|dg kst	d S )Nc             s   s   | ]\}}||fV  qd S )Nr   )r   countelr   r   r   	<genexpr>+  s    z*TestCssselect.test_lang.<locals>.<genexpr>c                s,    | }j |}|jd dd |D S )N)keyc             S   s   g | ]}|j d dqS )idnil)get)r   elementr   r   r   r   3  s    z;TestCssselect.test_lang.<locals>.langid.<locals>.<listcomp>)rR   sort)r!   rR   items)rQ   documentsort_keyr   r   langid/  s    
z'TestCssselect.test_lang.<locals>.langidz:lang("EN")r&   secondZthirdZfourthz:lang("en-us")z:lang(en-nz)z	:lang(fr)Zfifthz	:lang(ru)Zsixthz:lang('ZH')Zeighthz:lang(de) :lang(zh)z:lang(en), :lang(zh)z	:lang(es))
r   
fromstringXMLLANG_IDSdict	enumerategetiterator__getitem__r   rQ   r   )r   r   r   )rQ   r   r   r   	test_lang(  s    
zTestCssselect.test_langc                s  t jttdd tj D jt j t	 j fddfdd}|d}|d d d	d
ddd
dgks|t
|dd  dgkst
|ddddgkst
|ddddddgkst
|ddgkst
|ddddgkst
|ddgkst
|ddddgkst
|dddgks*t
|ddgks>t
|ddgksRt
|d g ksdt
|d!ddgkszt
|d"dgkst
|d#g kst
|d$dgkst
|d%g kst
|d&d'dgkst
|d(d)d*g kst
|d+g kst
|d,d-d.gkst
|d/d0g ks.t
|d1g ks@t
|d2d3ddd.dgks\t
|d4ddg ksrt
|d5d6gkst
|d7g kst
|d8d9d:d.d;d<gkst
|d=d>d?d6d@dAgkst
|dBd;d<gkst
|dCd?d;dAgkst
|dDdAgkst
|dEdFd.d;d<gks,t
|dGd.d;gksBt
|dHdIgksVt
|dJg ksht
|dKdLgks|t
|dMdIgkst
|dNdgkst
|dOdgkst
|dPddgkst
| jt|dQ |dRdSgkst
|dTdUdgkst
|dVd6d;d@d<gks t
|dWdXd	gks6t
|dYdZg ksJt
|d[d\d	d
dddgksht
|d]g kszt
|d^d	d
ddId?dSd_gkst
|d`g kst
|dadbdcdddIgkst
|dedfdId6d;gkst
|dgdhdidjd6d;gkst
|dkdldmd?gkst
|dndoddgks,t
|dpg ks>t
|dqdrdIgksTt
|dsdgksht
|dtddgks~t
|dudgkst
|dvdAgkst
|dwddAgkst
|dxdgkst
|dydd?ddzd{d|gkst
|d}ddgkst
|d~g kst
|ddgks*t
|dd?d.dd@d<dAgksHt
|ddg ks\t
|ddg kspt
|ddddddd|gkst
|dddg kst
|dddddddddd|gkst
|ddddddd{gkst
|dddddgks t
d S )Nc             s   s   | ]\}}||fV  qd S )Nr   )r   r   r   r   r   r   r   C  s    z,TestCssselect.test_select.<locals>.<genexpr>c                sN    | }j |}|r4|g ks"t| }j |}|jd dd |D S )N)r   c             S   s   g | ]}|j d dqS )r   r   )r   )r   r   r   r   r   r   P  s    zATestCssselect.test_select.<locals>.select_ids.<locals>.<listcomp>)rR   r   r   )r!   	html_onlyrR   r   )rQ   r   html_css_to_xpathr   r   r   
select_idsH  s    

z-TestCssselect.test_select.<locals>.select_idsc                s:   |j dd} | |}x|D ]} |||kstqW |S )Nr   F)popr   )mainr$   kwargsr   r'   r!   )r   r   r   pcssR  s
    

z'TestCssselect.test_select.<locals>.pcssr*      r   r   z	link-hrefzlink-nohrefz	outer-divr0   zfoobar-spandivzli-divz
foobar-divZDIVT)r   zdiv divzdiv, div divza[name]zname-anchorza[NAme]za[rel]z
tag-anchorznofollow-anchorza[rel="tag"]za[href*="localhost"]za[href*=""]za[href^="http"]za[href^="http:"]za[href^=""]za[href$="org"]za[href$=""]zdiv[foobar~="bc"]zdiv[foobar~="cde"]z[foobar~="ab bc"]z[foobar~=""]z[foobar~=" 	"]zdiv[foobar~="cd"]z*[lang|="En"]z[lang|="En-us"]z	second-liz*[lang|="en"]z[lang|="en-US"]z*[lang|="e"]z:lang("EN")z*:lang(en-US)z
:lang("e")zli:nth-child(3)zthird-lizli:nth-child(10)zli:nth-child(2n)zli:nth-child(even)zli:nth-child(2n+0)z	fourth-lizsixth-lizli:nth-child(+2n+1)zli:nth-child(odd)zfirst-lizfifth-liz
seventh-lizli:nth-child(2n+4)zli:nth-child(3n+1)zli:nth-last-child(0)zli:nth-last-child(2n)zli:nth-last-child(even)zli:nth-last-child(2n+2)zol:first-of-typezfirst-olzol:nth-child(1)zol:nth-of-type(2)z	second-olzol:nth-last-of-type(1)zspan:only-childzli div:only-childzdiv *:only-childzp *:only-of-typezp:only-of-typeZ	paragraphza:emptyza:EMptyzli:emptyz:rootz	html:rootzli:rootz* :rootz*:contains("link")z:CONtains("link")z*:contains("LInk")z*:contains("e")zp-emz*:contains("E")z.az.bz*.azol.az.cz*.czol *.czol li.cz	li ~ li.cz	ol > li.cz	#first-lizli#first-liz
*#first-lizli divzli > divz	div > divzdiv>.czdiv > .cz	div + divza ~ aza[rel="tag"] ~ azol#first-ol li:last-childzol#first-ol *:last-childz#outer-div:first-childz#outer-div :first-childzp-bzcheckbox-fieldset-disabledz	area-hrefza[href]z:not(*)za:not([href])zol :Not(li[class])zdi\a0 vzdiv\[z
[h\a0 ref]z[h\]ref]z:linkz:visitedz:enabledzcheckbox-uncheckedztext-checkedzcheckbox-checkedz	:disabledzcheckbox-disabledzcheckbox-disabled-checkedfieldsetz:checkedr}   )r   r   HTML_IDSr   r   r   r   r   rQ   r   r   rE   r   )r   r   Zall_idsr   )rQ   r   r   r   r   r   test_select@  s    









zTestCssselect.test_selectc                s  t jt}|jdd t jyt W n tk
rD   tt	f Y nX  fdd}|ddksft
|ddksvt
|d	d
kst
|ddkst
|ddkst
|ddkst
|ddkst
|ddkst
|ddkst
|ddkst
|ddkst
|ddkst
|ddks,t
|ddks>t
|ddksPt
|ddksbt
|d dkstt
|d!d"kst
|d#dkst
|d$dkst
|d%dkst
|d&dkst
|d'dkst
|d(d)kst
|d*dkst
|d+dkst
|d,dks(t
|d-dks:t
|d.dksLt
|d/dks^t
|d0d1kspt
|d2d1kst
|d3dkst
|d4dkst
|d5dkst
|d6d7kst
|d8d9kst
|d:dkst
|d;d<ks t
|d=d>kst
|d?dks$t
|d@d>ks6t
|dAdksHt
|dBd>ksZt
|dCdkslt
|dDdks~t
d S )ENz//bodyr   c                sd   | }j |}t|  s"tt }x2|D ]*}||ks>t|j| t|  s.tq.W t|S )N)rR   r`   r   setaddr1   )r!   rR   resultsfoundr   )basestring_bodyrQ   r   r   r     s    


z4TestCssselect.test_select_shakespeare.<locals>.countr*      zdiv:contains(CELIA)   zdiv:only-child   zdiv:nth-child(even)j   zdiv:nth-child(2n)zdiv:nth-child(odd)   zdiv:nth-child(2n+1)zdiv:nth-child(n)   zdiv:last-child5   zdiv:first-child3   z	div > div   z	div + div   z	div ~ divr   r0   zbody divr   zdiv divzdiv div div   zdiv, div, divzdiv, a, spanz.dialogz
div.dialogzdiv .dialogzdiv.character, div.dialogc   zdiv.direction.dialogzdiv.dialog.directionzdiv.dialog.scenezdiv.scene.scenezdiv.scene .scenezdiv.direction .dialog zdiv .dialog .directionrS   zdiv.dialog .dialog .directionz#speech5zdiv#speech5zdiv #speech5zdiv.scene div.dialog1   zdiv#scene1 div.dialog div   z#scene1 #speech1z
div[class]g   zdiv[class=dialog]2   zdiv[class^=dia]zdiv[class$=log]zdiv[class*=sce]zdiv[class|=dialog]zdiv[class!=madeup]zdiv[class~=dialog])r   Zdocument_fromstringHTML_SHAKESPEARErR   r   rQ   
basestring	NameErrorrK   bytesr   )r   r   r   r   )r   r   rQ   r   test_select_shakespeare  sl    
z%TestCssselect.test_select_shakespeareN)rp   rq   rr   r   r+   rG   rJ   rP   rU   r[   r\   r]   rt   r~   r   r   r   r   r   r   r   r   )   s   S@!CmA r   a>  
<test>
  <a id="first" xml:lang="en">a</a>
  <b id="second" xml:lang="en-US">b</b>
  <c id="third" xml:lang="en-Nz">c</c>
  <d id="fourth" xml:lang="En-us">d</d>
  <e id="fifth" xml:lang="fr">e</e>
  <f id="sixth" xml:lang="ru">f</f>
  <g id="seventh" xml:lang="de">
    <h id="eighth" xml:lang="zh"/>
  </g>
</test>
a8  
<html id="html"><head>
  <link id="link-href" href="foo" />
  <link id="link-nohref" />
</head><body>
<div id="outer-div">
 <a id="name-anchor" name="foo"></a>
 <a id="tag-anchor" rel="tag" href="http://localhost/foo">link</a>
 <a id="nofollow-anchor" rel="nofollow" href="https://example.org">
    link</a>
 <ol id="first-ol" class="a b c">
   <li id="first-li">content</li>
   <li id="second-li" lang="En-us">
     <div id="li-div">
     </div>
   </li>
   <li id="third-li" class="ab c"></li>
   <li id="fourth-li" class="ab
c"></li>
   <li id="fifth-li"></li>
   <li id="sixth-li"></li>
   <li id="seventh-li">  </li>
 </ol>
 <p id="paragraph">
   <b id="p-b">hi</b> <em id="p-em">there</em>
   <b id="p-b2">guy</b>
   <input type="checkbox" id="checkbox-unchecked" />
   <input type="checkbox" id="checkbox-disabled" disabled="" />
   <input type="text" id="text-checked" checked="checked" />
   <input type="hidden" />
   <input type="hidden" disabled="disabled" />
   <input type="checkbox" id="checkbox-checked" checked="checked" />
   <input type="checkbox" id="checkbox-disabled-checked"
          disabled="disabled" checked="checked" />
   <fieldset id="fieldset" disabled="disabled">
     <input type="checkbox" id="checkbox-fieldset-disabled" />
     <input type="hidden" />
   </fieldset>
 </p>
 <ol id="second-ol">
 </ol>
 <map name="dummymap">
   <area shape="circle" coords="200,250,25" href="foo.html" id="area-href" />
   <area shape="default" id="area-nohref" />
 </map>
</div>
<div id="foobar-div" foobar="ab bc
cde"><span id="foobar-span"></span></div>
</body></html>
a:  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" debug="true">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
	<div id="test">
	<div class="dialog">
	<h2>As You Like It</h2>
	<div id="playwright">
	  by William Shakespeare
	</div>
	<div class="dialog scene thirdClass" id="scene1">
	  <h3>ACT I, SCENE III. A room in the palace.</h3>
	  <div class="dialog">
	  <div class="direction">Enter CELIA and ROSALIND</div>
	  </div>
	  <div id="speech1" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.1">Why, cousin! why, Rosalind! Cupid have mercy! not a word?</div>
	  </div>
	  <div id="speech2" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.2">Not one to throw at a dog.</div>
	  </div>
	  <div id="speech3" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.3">No, thy words are too precious to be cast away upon</div>
	  <div id="scene1.3.4">curs; throw some of them at me; come, lame me with reasons.</div>
	  </div>
	  <div id="speech4" class="character">ROSALIND</div>
	  <div id="speech5" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.8">But is all this for your father?</div>
	  </div>
	  <div class="dialog">
	  <div id="scene1.3.5">Then there were two cousins laid up; when the one</div>
	  <div id="scene1.3.6">should be lamed with reasons and the other mad</div>
	  <div id="scene1.3.7">without any.</div>
	  </div>
	  <div id="speech6" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.9">No, some of it is for my child's father. O, how</div>
	  <div id="scene1.3.10">full of briers is this working-day world!</div>
	  </div>
	  <div id="speech7" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.11">They are but burs, cousin, thrown upon thee in</div>
	  <div id="scene1.3.12">holiday foolery: if we walk not in the trodden</div>
	  <div id="scene1.3.13">paths our very petticoats will catch them.</div>
	  </div>
	  <div id="speech8" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.14">I could shake them off my coat: these burs are in my heart.</div>
	  </div>
	  <div id="speech9" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.15">Hem them away.</div>
	  </div>
	  <div id="speech10" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.16">I would try, if I could cry 'hem' and have him.</div>
	  </div>
	  <div id="speech11" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.17">Come, come, wrestle with thy affections.</div>
	  </div>
	  <div id="speech12" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.18">O, they take the part of a better wrestler than myself!</div>
	  </div>
	  <div id="speech13" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.19">O, a good wish upon you! you will try in time, in</div>
	  <div id="scene1.3.20">despite of a fall. But, turning these jests out of</div>
	  <div id="scene1.3.21">service, let us talk in good earnest: is it</div>
	  <div id="scene1.3.22">possible, on such a sudden, you should fall into so</div>
	  <div id="scene1.3.23">strong a liking with old Sir Rowland's youngest son?</div>
	  </div>
	  <div id="speech14" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.24">The duke my father loved his father dearly.</div>
	  </div>
	  <div id="speech15" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.25">Doth it therefore ensue that you should love his son</div>
	  <div id="scene1.3.26">dearly? By this kind of chase, I should hate him,</div>
	  <div id="scene1.3.27">for my father hated his father dearly; yet I hate</div>
	  <div id="scene1.3.28">not Orlando.</div>
	  </div>
	  <div id="speech16" class="character">ROSALIND</div>
	  <div title="wtf" class="dialog">
	  <div id="scene1.3.29">No, faith, hate him not, for my sake.</div>
	  </div>
	  <div id="speech17" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.30">Why should I not? doth he not deserve well?</div>
	  </div>
	  <div id="speech18" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.31">Let me love him for that, and do you love him</div>
	  <div id="scene1.3.32">because I do. Look, here comes the duke.</div>
	  </div>
	  <div id="speech19" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.33">With his eyes full of anger.</div>
	  <div class="direction">Enter DUKE FREDERICK, with Lords</div>
	  </div>
	  <div id="speech20" class="character">DUKE FREDERICK</div>
	  <div class="dialog">
	  <div id="scene1.3.34">Mistress, dispatch you with your safest haste</div>
	  <div id="scene1.3.35">And get you from our court.</div>
	  </div>
	  <div id="speech21" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.36">Me, uncle?</div>
	  </div>
	  <div id="speech22" class="character">DUKE FREDERICK</div>
	  <div class="dialog">
	  <div id="scene1.3.37">You, cousin</div>
	  <div id="scene1.3.38">Within these ten days if that thou be'st found</div>
	  <div id="scene1.3.39">So near our public court as twenty miles,</div>
	  <div id="scene1.3.40">Thou diest for it.</div>
	  </div>
	  <div id="speech23" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.41">                  I do beseech your grace,</div>
	  <div id="scene1.3.42">Let me the knowledge of my fault bear with me:</div>
	  <div id="scene1.3.43">If with myself I hold intelligence</div>
	  <div id="scene1.3.44">Or have acquaintance with mine own desires,</div>
	  <div id="scene1.3.45">If that I do not dream or be not frantic,--</div>
	  <div id="scene1.3.46">As I do trust I am not--then, dear uncle,</div>
	  <div id="scene1.3.47">Never so much as in a thought unborn</div>
	  <div id="scene1.3.48">Did I offend your highness.</div>
	  </div>
	  <div id="speech24" class="character">DUKE FREDERICK</div>
	  <div class="dialog">
	  <div id="scene1.3.49">Thus do all traitors:</div>
	  <div id="scene1.3.50">If their purgation did consist in words,</div>
	  <div id="scene1.3.51">They are as innocent as grace itself:</div>
	  <div id="scene1.3.52">Let it suffice thee that I trust thee not.</div>
	  </div>
	  <div id="speech25" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.53">Yet your mistrust cannot make me a traitor:</div>
	  <div id="scene1.3.54">Tell me whereon the likelihood depends.</div>
	  </div>
	  <div id="speech26" class="character">DUKE FREDERICK</div>
	  <div class="dialog">
	  <div id="scene1.3.55">Thou art thy father's daughter; there's enough.</div>
	  </div>
	  <div id="speech27" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.56">So was I when your highness took his dukedom;</div>
	  <div id="scene1.3.57">So was I when your highness banish'd him:</div>
	  <div id="scene1.3.58">Treason is not inherited, my lord;</div>
	  <div id="scene1.3.59">Or, if we did derive it from our friends,</div>
	  <div id="scene1.3.60">What's that to me? my father was no traitor:</div>
	  <div id="scene1.3.61">Then, good my liege, mistake me not so much</div>
	  <div id="scene1.3.62">To think my poverty is treacherous.</div>
	  </div>
	  <div id="speech28" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.63">Dear sovereign, hear me speak.</div>
	  </div>
	  <div id="speech29" class="character">DUKE FREDERICK</div>
	  <div class="dialog">
	  <div id="scene1.3.64">Ay, Celia; we stay'd her for your sake,</div>
	  <div id="scene1.3.65">Else had she with her father ranged along.</div>
	  </div>
	  <div id="speech30" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.66">I did not then entreat to have her stay;</div>
	  <div id="scene1.3.67">It was your pleasure and your own remorse:</div>
	  <div id="scene1.3.68">I was too young that time to value her;</div>
	  <div id="scene1.3.69">But now I know her: if she be a traitor,</div>
	  <div id="scene1.3.70">Why so am I; we still have slept together,</div>
	  <div id="scene1.3.71">Rose at an instant, learn'd, play'd, eat together,</div>
	  <div id="scene1.3.72">And wheresoever we went, like Juno's swans,</div>
	  <div id="scene1.3.73">Still we went coupled and inseparable.</div>
	  </div>
	  <div id="speech31" class="character">DUKE FREDERICK</div>
	  <div class="dialog">
	  <div id="scene1.3.74">She is too subtle for thee; and her smoothness,</div>
	  <div id="scene1.3.75">Her very silence and her patience</div>
	  <div id="scene1.3.76">Speak to the people, and they pity her.</div>
	  <div id="scene1.3.77">Thou art a fool: she robs thee of thy name;</div>
	  <div id="scene1.3.78">And thou wilt show more bright and seem more virtuous</div>
	  <div id="scene1.3.79">When she is gone. Then open not thy lips:</div>
	  <div id="scene1.3.80">Firm and irrevocable is my doom</div>
	  <div id="scene1.3.81">Which I have pass'd upon her; she is banish'd.</div>
	  </div>
	  <div id="speech32" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.82">Pronounce that sentence then on me, my liege:</div>
	  <div id="scene1.3.83">I cannot live out of her company.</div>
	  </div>
	  <div id="speech33" class="character">DUKE FREDERICK</div>
	  <div class="dialog">
	  <div id="scene1.3.84">You are a fool. You, niece, provide yourself:</div>
	  <div id="scene1.3.85">If you outstay the time, upon mine honour,</div>
	  <div id="scene1.3.86">And in the greatness of my word, you die.</div>
	  <div class="direction">Exeunt DUKE FREDERICK and Lords</div>
	  </div>
	  <div id="speech34" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.87">O my poor Rosalind, whither wilt thou go?</div>
	  <div id="scene1.3.88">Wilt thou change fathers? I will give thee mine.</div>
	  <div id="scene1.3.89">I charge thee, be not thou more grieved than I am.</div>
	  </div>
	  <div id="speech35" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.90">I have more cause.</div>
	  </div>
	  <div id="speech36" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.91">                  Thou hast not, cousin;</div>
	  <div id="scene1.3.92">Prithee be cheerful: know'st thou not, the duke</div>
	  <div id="scene1.3.93">Hath banish'd me, his daughter?</div>
	  </div>
	  <div id="speech37" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.94">That he hath not.</div>
	  </div>
	  <div id="speech38" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.95">No, hath not? Rosalind lacks then the love</div>
	  <div id="scene1.3.96">Which teacheth thee that thou and I am one:</div>
	  <div id="scene1.3.97">Shall we be sunder'd? shall we part, sweet girl?</div>
	  <div id="scene1.3.98">No: let my father seek another heir.</div>
	  <div id="scene1.3.99">Therefore devise with me how we may fly,</div>
	  <div id="scene1.3.100">Whither to go and what to bear with us;</div>
	  <div id="scene1.3.101">And do not seek to take your change upon you,</div>
	  <div id="scene1.3.102">To bear your griefs yourself and leave me out;</div>
	  <div id="scene1.3.103">For, by this heaven, now at our sorrows pale,</div>
	  <div id="scene1.3.104">Say what thou canst, I'll go along with thee.</div>
	  </div>
	  <div id="speech39" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.105">Why, whither shall we go?</div>
	  </div>
	  <div id="speech40" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.106">To seek my uncle in the forest of Arden.</div>
	  </div>
	  <div id="speech41" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.107">Alas, what danger will it be to us,</div>
	  <div id="scene1.3.108">Maids as we are, to travel forth so far!</div>
	  <div id="scene1.3.109">Beauty provoketh thieves sooner than gold.</div>
	  </div>
	  <div id="speech42" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.110">I'll put myself in poor and mean attire</div>
	  <div id="scene1.3.111">And with a kind of umber smirch my face;</div>
	  <div id="scene1.3.112">The like do you: so shall we pass along</div>
	  <div id="scene1.3.113">And never stir assailants.</div>
	  </div>
	  <div id="speech43" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.114">Were it not better,</div>
	  <div id="scene1.3.115">Because that I am more than common tall,</div>
	  <div id="scene1.3.116">That I did suit me all points like a man?</div>
	  <div id="scene1.3.117">A gallant curtle-axe upon my thigh,</div>
	  <div id="scene1.3.118">A boar-spear in my hand; and--in my heart</div>
	  <div id="scene1.3.119">Lie there what hidden woman's fear there will--</div>
	  <div id="scene1.3.120">We'll have a swashing and a martial outside,</div>
	  <div id="scene1.3.121">As many other mannish cowards have</div>
	  <div id="scene1.3.122">That do outface it with their semblances.</div>
	  </div>
	  <div id="speech44" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.123">What shall I call thee when thou art a man?</div>
	  </div>
	  <div id="speech45" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.124">I'll have no worse a name than Jove's own page;</div>
	  <div id="scene1.3.125">And therefore look you call me Ganymede.</div>
	  <div id="scene1.3.126">But what will you be call'd?</div>
	  </div>
	  <div id="speech46" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.127">Something that hath a reference to my state</div>
	  <div id="scene1.3.128">No longer Celia, but Aliena.</div>
	  </div>
	  <div id="speech47" class="character">ROSALIND</div>
	  <div class="dialog">
	  <div id="scene1.3.129">But, cousin, what if we assay'd to steal</div>
	  <div id="scene1.3.130">The clownish fool out of your father's court?</div>
	  <div id="scene1.3.131">Would he not be a comfort to our travel?</div>
	  </div>
	  <div id="speech48" class="character">CELIA</div>
	  <div class="dialog">
	  <div id="scene1.3.132">He'll go along o'er the wide world with me;</div>
	  <div id="scene1.3.133">Leave me alone to woo him. Let's away,</div>
	  <div id="scene1.3.134">And get our jewels and our wealth together,</div>
	  <div id="scene1.3.135">Devise the fittest time and safest way</div>
	  <div id="scene1.3.136">To hide us from pursuit that will be made</div>
	  <div id="scene1.3.137">After my flight. Now go we in content</div>
	  <div id="scene1.3.138">To liberty and not to banishment.</div>
	  <div class="direction">Exeunt</div>
	  </div>
	</div>
	</div>
</div>
</body>
</html>
__main__)__doc__rL   Zunittestlxmlr   r   Z	cssselectr   r   r   r   r   Zcssselect.parserr	   r
   r   r   Zcssselect.xpathr   r   rY   r   ZTestCaser   r   r   r   rp   r   r   r   r   r   <module>   s,   
     {3  :