HEX
Server: Apache
System: Linux vps.rockyroadprinting.net 4.18.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User: rockyroadprintin (1011)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python2.7/site-packages/bs4/tests/test_tree.pyo
�
�_[c@s�dZddlmZddlZddlZddlZddlZddlmZddl	m
Z
mZddlm
Z
mZmZmZmZmZmZmZddlmZmZe
jd�ek	Ze
jd	�ek	Zd
efd��YZdefd
��YZdefd��YZdefd��YZdefd��YZ defd��YZ!defd��YZ"defd��YZ#defd��YZ$de$fd��YZ%de$fd��YZ&d efd!��YZ'd"e'fd#��YZ(d$e'fd%��YZ)d&efd'��YZ*d(efd)��YZ+d*efd+��YZ,d,efd-��YZ-d.efd/��YZ.d0efd1��YZ/d2efd3��YZ0d4efd5��YZ1d6efd7��YZ2dS(8s8Tests for Beautiful Soup's tree traversal methods.

The tree traversal methods are the main advantage of using Beautiful
Soup over just using a parser.

Different parsers will build different Beautiful Soup trees given the
same markup, but all Beautiful Soup trees can be traversed with the
methods tested here.
i����(t	set_traceN(t
BeautifulSoup(tbuilder_registrytHTMLParserTreeBuilder(tPY3KtCDatatCommenttDeclarationtDoctypetNavigableStringtSoupStrainertTag(tSoupTesttskipIftxmltlxmltTreeTestcBseZd�Zd�ZRS(cCs*|jg|D]}|j^q
|�dS(s�Make sure that the given tags have the correct text.

        This is used in tests that define a bunch of tags, each
        containing a single string, and then select certain strings by
        some mechanism.
        N(tassertEqualtstring(tselfttagstshould_matchttag((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt
assertSelects+scCs+|jg|D]}|d^q
|�dS(s�Make sure that the given tags have the correct IDs.

        This is used in tests that define a bunch of tags, each
        containing a single string, and then select certain strings by
        some mechanism.
        tidN(R(RRRR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pytassertSelectsIDs4s(t__name__t
__module__RR(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR)s		tTestFindcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s�Basic tests of the find() method.

    find() just calls find_all() with limit=1, so it's not tested all
    that thouroughly here.
    cCs/|jd�}|j|jd�jd�dS(Ns <a>1</a><b>2</b><a>3</a><b>4</b>tbt2(tsoupRtfindR(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt
test_find_tagEscCs/|jd�}|j|jdd�d�dS(Nu<h1>Räksmörgås</h1>Ru
Räksmörgås(RRR (RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_unicode_text_findIscCs<|jd�}t|�|jd|jdd�j�dS(Nu&<h1 id="Räksmörgås">here it is</h1>s
here it isRu
Räksmörgås(RtstrRR ttext(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_unicode_attribute_findMs
cCs/|jd�}|jdt|j���dS(s)Test an optimization that finds all tags.s<a>foo</a><b>bar</b>iN(RRtlentfind_all(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_everythingSscCs2|jd�}|jdt|jd���dS(s;Test an optimization that finds all tags with a given name.s<a>foo</a><b>bar</b><a>baz</a>itaN(RRR&R'(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_everything_with_nameXs(RRt__doc__R!R"R%R(R*(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR>s				tTestFindAllcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s%Basic tests of the find_all() method.cCs�|jd�}|j|jdd�dg�|j|jdd�dg�|j|jdddg�ddg�|j|jdtjd��ddd	g�|j|jdt�ddd	g�d
S(s'You can search the tree for text nodes.s<html>Foo<b>bar</b>�</html>RtbarubarR$tFoouFoos.*u»N(RRR'tretcompiletTrue(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_text_nodes`s"cCs�|jd�}|j|jddd�dddg�|j|jddd�dg�|j|jddd	�dddd
dg�|j|jddd�dddd
dg�d
S(s7You can limit the number of items returned by find_all.s(<a>1</a><a>2</a><a>3</a><a>4</a><a>5</a>R)tlimitit1Rt3ii
t4t5iN(RRR'(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_limitps("(cCsQ|jd�}|j|ddd�dg�|j|jdd�dg�dS(	Ns!<a>1</a><b>2<a id='foo'>3</a></b>R)R3iR4RtfooR5(RRR(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt%test_calling_a_tag_is_calling_findall|scCs?|jd�}g}|j|�|jg|j|��dS(Ns<a></a>(RtappendRR'(RRtl((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pytTtest_find_all_with_self_referential_data_structure_does_not_cause_infinite_recursion�s
cCs�|jd�}|jd�}|jt|d��|jt�}|jt|d��|jdd�}|jt|d��dS(s%All find_all calls return a ResultSets<a></a>R)tsourceR$R9N(RR't
assertTruethasattrR1(RRtresult((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_resultset�s(RRR+R2R8R:R=RB(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR,]s				
tTestFindAllBasicNamespacescBseZd�ZRS(cCsU|jd�}|jd|jd�j�|jd|jdidd6�j�dS(Ns0<mathml:msqrt>4</mathml:msqrt><a svg:fill="red">R6smathml:msqrtR)tattrstredssvg:fill(RRR Rtname(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_by_namespaced_name�s(RRRG(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRC�stTestFindAllByNamecBsqeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
RS(s&Test ways of finding tags by tag name.cCs)tt|�j�|jd�|_dS(Ns�<a>First tag.</a>
                                  <b>Second tag.</b>
                                  <c>Third <a>Nested tag.</a> tag.</c>(tsuperRtsetUpRttree(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRJ�scCs&|j|jjd�ddg�dS(NR)s
First tag.sNested tag.(RRKR'(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_by_tag_name�scCs�|j|jjddd�dg�|j|jjddt�ddg�|j|jjddtjd��ddg�dS(NR)R$s
First tag.sNested tag.R(RRKR'R1R/R0(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_by_name_and_text�s"cCs&|j|jjjd�dg�dS(NR)sNested tag.(RRKtcR'(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt!test_find_all_on_non_root_element�scCs#|j|jd�ddg�dS(NR)s
First tag.sNested tag.(RRK(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt%test_calling_element_invokes_find_all�scCs,|j|jjtd��ddg�dS(NR)s
First tag.sNested tag.(RRKR'R
(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_by_tag_strainer�scCs/|j|jjddg�dddg�dS(NR)Rs
First tag.sSecond tag.sNested tag.(RRKR'(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_by_tag_names�scCs7|j|jjitd6td6�dddg�dS(NR)Rs
First tag.sSecond tag.sNested tag.(RRKR'R1(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_by_tag_dict�scCs2|j|jjtjd��dddg�dS(Ns^[ab]$s
First tag.sSecond tag.sNested tag.(RRKR'R/R0(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_by_tag_re�scCs;d�}|jd�}|j|j|�ddg�dS(NcSs|j|jd�kS(NR(RFtget(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pytid_matches_name�ss�<a id="a">Match 1.</a>
                            <a id="1">Does not match.</a>
                            <b id="b">Match 2.</a>sMatch 1.sMatch 2.(RRR'(RRVRK((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt'test_find_all_with_tags_matching_method�s
		cCs�|jd�}|jdd�}|jdtjd��}|jdddg�\}}|jd|j�|jd|j�|jd|j�|jd|j�dS(NsH<div class='a b'>1</div><div class='a c'>2</div><div class='a d'>3</div>tdivsa dsa bR5R4(RR R/R0R'RR(RRtr1tr2tr3tr4((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt%test_find_with_multi_valued_attribute�s	(RRR+RJRLRMRORPRQRRRSRTRWR](((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRH�s										
tTestFindAllByAttributecBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(cCs5|jd�}|j|jdd�ddg�dS(Ns�
                         <a id="first">Matching a.</a>
                         <a id="second">
                          Non-matching <b id="first">Matching b.</b>a.
                         </a>RtfirstsMatching a.sMatching b.(RRR'(RRK((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_by_attribute_name�s	cCs�djd�}djd�}|j|�}|j|jg|jd|��|j|jg|jd|jd���|j|jg|jd|dg��dS(Nuםולשtutf8u<a title="םולש"></a>ttitlessomething else(tencodeRRR)R'tdecode(RtpeacetdataR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt%test_find_all_by_utf8_attribute_value�s"+cCs~|jd�}|j|jdd�dg�|j|jdidd6�dg�|j|jdidd6�d	g�dS(
Ns0
                         <a name="name1" class="class1">Name match.</a>
                         <a name="name2" class="class2">Class match.</a>
                         <a name="name3" class="class3">Non-match.</a>
                         <name1>A tag called 'name1'.</name1>
                         RFtname1sA tag called 'name1'.RDsName match.tclass2tclasssClass match.(RRR'(RRK((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_by_attribute_dicts	

cCs�|jd�}|j|jddd�dg�|j|jddd�dg�|j|jddd	�dg�|j|jdd�dg�|j|jd
d�ddg�|j|jdd�dg�|j|jdd	�dg�dS(Ns�
                         <a class="1">Class 1.</a>
                         <a class="2">Class 2.</a>
                         <b class="1">Class 1.</b>
                         <c class="3 4">Class 3 and 4.</c>
                         R)tclass_R4sClass 1.RNR5sClass 3 and 4.R6RD(RRR'(RRK((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_by_classs	""""cCs�|jd�}|jddtjd��}|j|dg�|jddtjd��}|j|dg�|jddtjd��}|j|dg�dS(Ns#<gar class='foo bar'>Found it</gar>tgarRltosFound itR)so b(RR'R/R0R(RRKtf((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt0test_find_by_class_when_multiple_classes_present-scCs�|jd�}|j|jdtjd��dg�d�}|j|jd|�g�d�}|j|jd|�dg�dS(Ns<a class='bar'>Found it</a>R)tbasFound itcSst|�dkS(Ni(R&(tvalue((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pytbig_attribute_value@scSst|�dkS(Ni(R&(Rs((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pytsmall_attribute_valueEs(RRR'R/R0(RRRtRu((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt:test_find_all_with_non_dictionary_for_attrs_finds_by_class;s(		cCs�|jd�}|jd�\}}|j||g|jdd��|j|g|jdd��|j|g|jddd��|j|g|jdd��|jg|jdd��dS(Ns*<a class="foo bar"></a><a class="foo"></a>R)R9R-Rlsfoo barsbar foo(RR'R(RRR)ta2((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt:test_find_all_with_string_for_attrs_finds_multiple_classesKs""cCsE|jd�}tdidd6�}|j|j|�dg�dS(Nsi
                         <a id="first">Match.</a>
                         <a id="second">Non-match.</a>RDR_RsMatch.(RR
RR'(RRKtstrainer((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt'test_find_all_by_attribute_soupstrainerWs	cCs5|jd�}|j|jddd�dg�dS(Ns�<a id="1">ID present.</a>
                            <a>No ID present.</a>
                            <a id="">ID is empty.</a>R)RsNo ID present.(RRR'tNone(RRK((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt$test_find_all_with_missing_attribute_s	cCs5|jd�}|j|jdt�ddg�dS(Ns�<a id="1">ID present.</a>
                            <a>No ID present.</a>
                            <a id="">ID is empty.</a>RsID present.sID is empty.(RRR'R1(RRK((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt$test_find_all_with_defined_attributegs	cCsW|jd�}ddg}|j|jdd�|�|j|jdd�|�dS(Ns[<a id=1>Unquoted attribute.</a>
                            <a id="1">Quoted attribute.</a>sUnquoted attribute.sQuoted attribute.RiR4(RRR'(RRKtexpected((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt$test_find_all_with_numeric_attributeps
	cCs>|jd�}|j|jddddg�ddg�dS(Ns�<a id="1">1</a>
                            <a id="2">2</a>
                            <a id="3">3</a>
                            <a>No ID.</a>RR4R5R6(RRR'(RRK((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt(test_find_all_with_list_attribute_valuesys	cCs>|jd�}|j|jdtjd��ddg�dS(Ns�<a id="a">One a.</a>
                            <a id="aa">Two as.</a>
                            <a id="ab">Mixed as and bs.</a>
                            <a id="b">One b.</a>
                            <a>No ID.</a>Rs^a+$sOne a.sTwo as.(RRR'R/R0(RRK((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt5test_find_all_with_regular_expression_attribute_value�s	cCs||jd�}|j}|j|g|jddd��|jg|jddd��|jg|jddd��dS(Ns<b>foo</b><b>bar</b><a>foo</a>R)R$R9R-(RR)RR'(RRR)((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt'test_find_by_name_and_containing_string�s
	"cCs;|jd�}|j|jd�|jddd��dS(Ns"<a>foo</a><a><b><c>foo</c></b></a>R)R$R9(RRR'(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt=test_find_by_name_and_containing_string_when_string_is_buried�scCsc|jd�}|j}|j|g|jdddd��|jg|jdddd��dS(Ns"<b id="1">foo</b><a id="2">foo</a>RiR$R9iR-(RR)RR'(RRR)((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt,test_find_by_attribute_and_containing_string�s	%(RRR`RgRkRmRqRvRxRzR|R}RR�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR^�s 														
	
		t	TestIndexcBseZdZd�ZRS(sTest Tag.indexcCsk|jd�}|j}x6t|j�D]%\}}|j||j|��q(W|jt|jd�dS(Nsh<div>
                            <a>Identical</a>
                            <b>Not identical</b>
                            <a>Identical</a>

                            <c><d>Identical with child</d></c>
                            <b>Also not identical</b>
                            <c><d>Identical with child</d></c>
                            </div>i(RRXt	enumeratetcontentsRtindextassertRaisest
ValueError(RRKRXtitelement((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt
test_index�s		(RRR+R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��stTestParentOperationscBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s;Test navigation and searching through an element's parents.cCs8tt|�j�|jd�|_|jj|_dS(Ns1<ul id="empty"></ul>
                                 <ul id="top">
                                  <ul id="middle">
                                   <ul id="bottom">
                                    <b>Start here</b>
                                   </ul>
                                  </ul>(RIR�RJRRKRtstart(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRJ�scCs[|j|jjdd�|j|jjjdd�|j|jjjjdd�dS(NRtbottomtmiddlettop(RR�tparent(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_parent�scCs*|jjd}|j|j|j�dS(Ni(RKR�RR�(Rttop_tag((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt%test_parent_of_top_tag_is_soup_object�scCs|jd|jj�dS(N(RR{RKR�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_soup_object_has_no_parent�scCsN|j|jjd�dddg�|j|jjddd�dg�dS(NtulR�R�R�R(RR�tfind_parents(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_parents�scCsJ|j|jjd�dd�|j|jjddd�dd�dS(NR�RR�R�(RR�tfind_parent(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_parent�s cCs/|jjdd�}|j|jjd�dS(NR$s
Start hereR(RKR RR�RF(RR$((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_parent_of_text_element�scCs6|jjdd�}|j|jd�dd�dS(NR$s
Start hereR�RR�(RKR RR�(RR$((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_text_element_find_parent�scCs[g|jjD]+}|dk	r
d|jkr
|d^q
}|j|dddg�dS(NRR�R�R�(R�tparentsR{RDR(RR�R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_parent_generator�s+(RRR+RJR�R�R�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��s								t
ProximityTestcBseZd�ZRS(cCs)tt|�j�|jd�|_dS(Nsg<html id="start"><head></head><body><b id="1">One</b><b id="2">Two</b><b id="3">Three</b></body></html>(RIRRJRRK(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRJ�s(RRRJ(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��stTestNextOperationscBsPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cCs&tt|�j�|jj|_dS(N(RIR�RJRKRR�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRJ�scCs7|j|jjd�|j|jjjdd�dS(NtOneRR(RR�tnext_element(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt	test_next�scCs,|jjdd�}|j|jd�dS(NR$tThree(RKR RR�R{(Rtlast((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_next_of_last_item_is_none�scCs|j|jjd�dS(N(RRKR�R{(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_next_of_root_is_nonescCs[|j|jjd�ddg�|jjdd�|j|jjdd�dg�dS(NRtTwoR�Ri(RR�t
find_all_next(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_nexts"cCsC|j|jjd�dd�|j|jjdd�d�dS(NRRRR$R�(RR�t	find_next(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_next
s cCsT|jjdd�}|j|jd�jd�|j|jd�ddg�dS(NR$R�RR�R�(RKR RR�RRR�(RR$((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_next_for_text_elementscCse|jjdd�}g|jD]}|^q}|\}}|j|dd�|j|d�dS(NR$R�RR5R�(RKR t
next_elementsR(RR�tnodet
successorsRR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_next_generators
(
RRRJR�R�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��s							tTestPreviousOperationscBsPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cCs/tt|�j�|jjdd�|_dS(NR$R�(RIR�RJRKR tend(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRJscCs7|j|jjdd�|j|jjjd�dS(NRR5R�(RR�tprevious_element(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt
test_previous!scCs)|jjd�}|j|jd�dS(Nthtml(RKR RR�R{(RR_((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt#test_previous_of_first_item_is_none%scCsdS(N((R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_previous_of_root_is_none)scCsK|j|jjd�dddg�|j|jjdd�dg�dS(NRR�R�R�Ri(RR�tfind_all_previous(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_all_previous/scCsC|j|jjd�dd�|j|jjdd�d�dS(NRRR5R$R�(RR�t
find_previous(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_previous7s cCsW|jjdd�}|j|jd�jd�|j|jd�dddg�dS(NR$R�RR�R�(RKR RR�RRR�(RR$((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt#test_find_previous_for_text_element;scCs�|jjdd�}g|jD]}|^q}|\}}}}|j|dd�|j|jd�|j|jd�|j|jd�dS(NR$R�RR4tbodytheadR�(RKR tprevious_elementsRRF(RR�R�tpredecessorsRR�R�R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_previous_generatorAs(
RRRJR�R�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR�s							tSiblingTestcBseZd�ZRS(cCsJtt|�j�d}tjd�jd|�}|j|�|_dS(Ns�<html>
                    <span id="1">
                     <span id="1.1"></span>
                    </span>
                    <span id="2">
                     <span id="2.1"></span>
                    </span>
                    <span id="3">
                     <span id="3.1"></span>
                    </span>
                    <span id="4"></span>
                    </html>s\n\s*t(RIR�RJR/R0tsubRRK(Rtmarkup((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRJPs(RRRJ(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR�NstTestNextSiblingcBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs/tt|�j�|jjdd�|_dS(NRR4(RIR�RJRKR R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRJfscCs|j|jjd�dS(N(RRKtnext_siblingR{(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt!test_next_sibling_of_root_is_nonejscCsU|j|jjdd�|j|jjjdd�|j|jjdd�dS(NRRR5s1.1(RR�R�R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_next_siblingmscCsm|j|jjjd�|jjdd�}|j|jd�|jjdd�}|j|jd�dS(NRs1.1R6(RRKR�R�R{R (Rtnested_spant	last_span((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_next_sibling_may_not_existts
cCs$|j|jjd�dd�dS(NtspanRR(RR�tfind_next_sibling(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_next_sibling}scCsK|j|jjd�dddg�|j|jjdd�dg�dS(NR�RR5R6R(RR�tfind_next_siblings(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_next_siblings�scCs�|jd�}|jdd�}|j|jjd�|j|jjd�|j|jd�dg�|j|jdd�d�|j|jdd�d�dS(NsFoo<b>bar</b>bazR$R.RtbazR-tnonesuch(	RR RR�RFRR�R�R{(RRR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt"test_next_sibling_for_text_element�s(	RRRJR�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR�ds							tTestPreviousSiblingcBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs/tt|�j�|jjdd�|_dS(NRR6(RIR�RJRKR R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRJ�scCs|j|jjd�dS(N(RRKtprevious_siblingR{(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt%test_previous_sibling_of_root_is_none�scCsU|j|jjdd�|j|jjjdd�|j|jjdd�dS(NRR5Rs3.1(RR�R�R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_previous_sibling�scCsm|j|jjjd�|jjdd�}|j|jd�|jjdd�}|j|jd�dS(NRs1.1R4(RRKR�R�R{R (RR�t
first_span((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt#test_previous_sibling_may_not_exist�s
cCs$|j|jjd�dd�dS(NR�RR5(RR�tfind_previous_sibling(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_find_previous_sibling�scCsK|j|jjd�dddg�|j|jjdd�dg�dS(NR�R5RR4R(RR�tfind_previous_siblings(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_previous_siblings�scCs�|jd�}|jdd�}|j|jjd�|j|jjd�|j|jd�dg�|j|jdd�d�|j|jdd�d�dS(NsFoo<b>bar</b>bazR$R�RR.R-R�(	RR RR�RFRR�R�R{(RRR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt&test_previous_sibling_for_text_element�s(	RRRJR�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��s							tTestTagCreationcBs2eZdZd�Zd�Zd�Zd�ZRS(s$Test the ability to create new tags.cCs�|jd�}|jddddidd6�}|jt|t��|jd|j�|jtdddd�|j�|jd|j
�dS(NR�R9R-R�RDsa nameRF(Rtnew_tagR?t
isinstanceRRRFtdictRDR{R�(RRR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_new_tag�s""cCs�trbtdd�}|jd�}|jd�}|jd|j��|jd|j��ntdd�}|jd�}|jd�}|jd|j��|jd|j��dS(	NR�slxml-xmltbrtps<br/>s<p/>shtml.parsers<p></p>(tXML_BUILDER_PRESENTRR�RRc(Rtxml_souptxml_brtxml_pt	html_soupthtml_brthtml_p((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt1test_tag_inherits_self_closing_rules_from_builder�scCsH|jd�}|jd�}|jd|�|jt|t��dS(NR�R9(Rt
new_stringRR?R�R	(RRts((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt'test_new_string_creates_navigablestring�scCsK|jd�}|jdt�}|jd|�|jt|t��dS(NR�R9(RR�RRR?R�(RRR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt3test_new_string_can_create_navigablestring_subclass�s(RRR+R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��s
			tTestTreeModificationcBs^eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'RS(&cCs�|jd�}d|jd<|j|j�|jd��|jd=|j|j�|jd��d|jd<|j|j�|jd��dS(	Ns<a id="1"></a>iRs<a id="2"></a>s<a></a>R9tid2s<a id2="foo"></a>(RR)RRdtdocument_for(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_attribute_modification�s


cCs�tjd��}|jdd|�}t||d�}t||d�}d|d<|jjd|�|jjd	|�|j|jj�d
�dS(NR�s
<body></body>tbuilderR)tolshttp://foo.com/threfiis4<body><a href="http://foo.com/"></a><ol></ol></body>(RtlookupRRR�tinsertRRc(RR�RR)R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_new_tag_creation�s
cCs�d}|j|�}|jdd�}|j}|jdd�j|j�|j|j|�|j|j�|jd��dS(NsT<p id="1">Don't leave me <b>here</b>.</p>
                <p id="2">Don't leave!</p>RRsD<p id="1">Don't leave me .</p>
<p id="2">Don't leave!<b>here</b></p>(RR RR;RR�RdR�(RtdocRtsecond_paratbold((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt!test_append_to_contents_moves_tag�s	cCsDd}|j|�}|j}|j|j�}|j||�dS(Ns<a></a><b><c></c></b>(RR)treplace_withRNR(RR$RR)tnew_a((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt1test_replace_with_returns_thing_that_was_replaceds
	cCs>d}|j|�}|j}|j�}|j||�dS(Ns<a><b></b><c></c></a>(RR)tunwrapR(RR$RR)R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt+test_unwrap_returns_thing_that_was_replaceds
	cCse|jd�}|j}|j�|jd|j�|jt|j�|jt|j	|j
�dS(Ns<a><b>Foo</b></a><c>Bar</c>(RR)textractRR{R�R�R�RRRN(RRR)((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pytItest_replace_with_and_unwrap_give_useful_exception_when_tag_has_no_parents	
cCsQd}|j|�}|j}|jj|�|j|j�|j|��dS(Ns-<a><b></b><c>Foo<d></d></c></a><a><e></e></a>(RRNRRRdR�(RR$RRN((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_replace_tag_with_itself's
	cCs5d}|j|�}|jt|jj|j�dS(Ns<a><b></b></a>(RR�R�RRR)(RR$R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt1test_replace_tag_with_its_parent_raises_exception.scCs8d}|j|�}|jt|jjd|j�dS(Ns<a><b></b></a>i(RR�R�R)R�(RR$R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt,test_insert_tag_into_itself_raises_exception3sc	Cs�|jd�}d}|j|�}|jd|�x|jD]}q>Wt|j�\}}}}|jd|j�|jd|j�|jd|j�|jd|j�dS(	s�Inserting one BeautifulSoup object into another actually inserts all
        of its children -- you'll never combine BeautifulSoup objects.
        s-<p>And now, a word:</p><p>And we're back.</p>s<p>p2</p><p>p3</p>isAnd now, a word:tp2tp3sAnd we're back.N(RR�tdescendantstlisttchildrentassertEqualsR(	RRR$t	to_insertR�tp1RRtp4((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt1test_insert_beautifulsoup_object_inserts_children8scCsx|jd�}|j}|jd}|jdd�|j\}}|jd�|jd�|jd|jj�dS(Ns<p><a>one</a><b>three</b></p>iittwoR�tthree(RR)R�R�treplaceWithRRR(RRR)Rtlefttright((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt3test_replace_with_maintains_next_element_throughoutLs	


cCs�|jd�}|jdd�jd�|jdd�}|j}|j|j|�|j|j|�|j|jj|�|j|jd�dS(Ns<b>Argh!</b>R$sArgh!sHooray!(	RR RRRR�R�R�R{(RRtnew_textR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_replace_final_node[s	cCs�|jd�}|jjdd�|j|j�|jd��|jdd�}|j|jd�|j|jj|�|j|j	d�|j|j	j
|�|j|j
d�|j|j|j�dS(Ns<a><b>Argh!</b><c></c></a>isHooray!s!<a><b>Argh!Hooray!</b><c></c></a>R$sArgh!(
RRR�RRdR�R R�R�R�R�R{RN(RRR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_consecutive_text_nodeses
cCsr|jd�}|jjdd�|jjdd�|jddg|jj�|j|jjdjd�dS(Ns<a></a>iR-R9(RR)R�RR�R�(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_insert_stringzs
cCsW|j}|jdd|�}t||d�}|jdd�|jjd|�|j|j�|jd��|j}|j|j	|�|j|j
|�|jdd	�}|j|j|�|j|j
|�|j}|j|j	|�|j|j
|�|jdd�}|j|j|�|j|j|�|j|j
|�dS(
Ns%<a><b>Find</b><c>lady!</c><d></d></a>R�tmagictagittheis=<a><b>Find</b><magictag>the</magictag><c>lady!</c><d></d></a>R$tFind(tdefault_builderRRR�R)RRdR�RR�R�R R�R�RNR�(RR�Rt	magic_tagtb_tagR tc_tagR#((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_insert_tag�s,	
		cCsBd}|j|�}|jj|j�|j||j��dS(Ns<a><b></b></a>(RR)R;RRRd(RRfR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt*test_append_child_thats_already_at_the_end�scCsEd}|j|�}|jjd|j�|jd|j��dS(Ns<a><b></b><c></c><d></d></a>is<a><d></d><b></b><c></c></a>(RR)R�tdRRd(RRfR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt$test_move_tag_to_beginning_of_parent�scCs?|jd�}|jjdd�|jt|j�d�dS(Ns<br/>itContentss<br>Contents</br>(RR�R�RR#(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt&test_insert_works_on_empty_element_tag�scCs�|jd�}|jjd�|jjd�|j|j�|jd��|jj|j�|j|j�|jd��dS(Ns<a>foo</a><b>bar</b>tBAZtQUUXsQUUX<a>foo</a>BAZ<b>bar</b>sQUUX<b>bar</b><a>foo</a>BAZ(RRt
insert_beforeR)RRdR�(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_insert_before�scCs�|jd�}|jjd�|jjd�|j|j�|jd��|jj|j�|j|j�|jd��dS(Ns<a>foo</a><b>bar</b>R/R0s<a>foo</a>QUUX<b>bar</b>BAZsQUUX<b>bar</b><a>foo</a>BAZ(RRtinsert_afterR)RRdR�(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_insert_after�scCss|jd�}|jd�}|jd�}|jt|j|�|jt|j|�|jt|j|�dS(NR�R)(RR�R�R�R�R3tNotImplementedError(RRRR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt:test_insert_after_raises_exception_if_after_has_no_meaning�scCss|jd�}|jd�}|jd�}|jt|j|�|jt|j|�|jt|j|�dS(NR�R)(RR�R�R�R�R1R5(RRRR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pytFtest_insert_before_raises_notimplementederror_if_before_has_no_meaning�scCs�|jd�}|jd�\}}|j|�|j|j�|jd��|j|jd�|j|j|j�|j|j	d�|j|j
d�dS(Ns;<p>There's <b>no</b> business like <b>show</b> business</p>Rs0<p>There's  business like <b>no</b> business</p>tnos	 business(RR'RRRdR�R�R{R�R�R�(RRR8tshow((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_replace_with�s	
	
cCsBd}|j|�}|jj|j�|jd|j��dS(Ns<a><b></b><c></c></a>s<a><c></c></a>(RRRRNRRd(RRfR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_replace_first_child�scCsBd}|j|�}|jj|j�|jd|j��dS(Ns<a><b></b><c></c></a>s<a><b></b></a>(RRNRRRRd(RRfR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_replace_last_child�scCsx|jd�}|j}|j}|j|�|j|j�|jd��|j|jd�|j|j	dd�j
d�|j|jd�|j|jd�|j|j
d�|j|j|j�|j|jd�|j|j
j
|j�|j|jd�|j	dd�}|j}|j|j
|�|j|j|�|j|j|�|j|j
|�dS(NsQ<a>We<b>reserve<c>the</c><d>right</d></b></a><e>to<f>refuse</f><g>service</g></e>s-<a>We<f>refuse</f></a><e>to<g>service</g></e>R$RtWetto(RRRpRRRdR�R�R{R R�R�R�R�R)tetg(RRt
remove_tagtmove_tagtto_texttg_tag((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_nested_tag_replace_with�s.			

	cCsI|jd�}|jj�|j|jd�|j|jjd�dS(NsI
            <p>Unneeded <em>formatting</em> is unneeded</p>
            sUnneeded formatting is unneeded(RtemRRR{R�R$(RRK((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_unwraps
	
cCsc|jd�}|jj|jd��}|j|j�d�|j|j�|jd��dS(NsI wish I was bold.Rs<b>I wish I was bold.</b>(RRtwrapR�RRdR�(RRRs((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt	test_wrap"s
cCsH|jd�}|jjj|j�|j|j�|jd��dS(Ns<b></b>I wish I was bold.s<b>I wish I was bold.</b>(RRR�RHRRdR�(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt%test_wrap_extracts_tag_from_elsewhere)scCsd|jd�}|jjj|j�|jdt|jj��|j|j�|jd��dS(Ns+<b>I like being bold.</b>I wish I was bold.is+<b>I like being bold.I wish I was bold.</b>(	RRR�RHRR&R�RdR�(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt&test_wrap_puts_new_contents_at_the_end/scCs;|jd�}|jt|jj�d�|jdd�j�}|j|j�d�|j|j�d�|jt|jj�d�|j|jd�|j|j
d�|j|jjd�|jdd	�}|jdd
�}|j|j|�|j|j|�|j|j
|�|j|j
|�dS(NsR<html><body>Some content. <div id="nav">Nav crap</div> More content.</body></html>iRtnavs6<html><body>Some content.  More content.</body></html>s<div id="nav">Nav crap</div>iR$sSome content. s More content.(RRR&R�R�R R	RdR�R{R�R�R�R�(RRt	extractedt	content_1t	content_2((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_extract7s"	cCs�|jd�}|jj}|jj}|jd�}|jd�}|jj|�|jj|�|j�|j�|j||jj�|j||jj�dS(Ns<a>foo</a><b>bar</b>R9R-(RR)RRR�R;R	R(RRtfoo_1tbar_1tfoo_2tbar_2((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt4test_extract_distinguishes_between_identical_stringsPs

cCsU|jd�}g|jd�D]}|jj�^q|jdt|j��dS(Nsv
<html>
<head>
<script>foo</script>
</head>
<body>
 <script>bar</script>
 <a></a>
</body>
<script>baz</script>
</html>tscripts<body>

<a></a>
</body>(RR'RVR	RtunicodeR�(RRR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt"test_extract_multiples_of_same_tagas
	)cCs?|jd�}|jd�j�|jd|jd��dS(Ns<html>
<body>hi</body>
</html>R�(RR R	RR{(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pytBtest_extract_works_when_element_is_surrounded_by_identical_stringsqs	cCs�|jd�}|j}|jj�|jt|jj�d�|jt|d��|j	}|jdt
�|jdt|j��dS(sTag.clear()s4<p><a>String <em>Italicized</em></a> and another</p>iR�t	decomposeN(RR)R�tclearRR&R�R?R@RFR1(RRR)RF((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt
test_clearzs	
	cCs]|jd�}d|j_|j|jjdg�d|j_|j|jjdg�dS(sTag.string = 'string's<a></a> <b><c></c></b>R9R-N(RR)RRR�R(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_string_set�s
cCs>|jd�}|jj|j_|j|jj�d�dS(Ns<a><b>foo</b><c>bar</c>s<a><b>bar</b><c>bar</c></a>(RRNRRRR)Rc(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt/test_string_set_does_not_affect_original_string�scCsG|jd�}td�}||j_|jt|jjt��dS(Ns<a></a>R9(RRR)RR?R�(RRtcdata((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt)test_set_string_preserves_class_of_string�s((RRR�R�RRRR
RRR
RRRR R!R)R*R,R.R2R4R6R7R:R;R<RERGRIRJRKRPRURXRYR\R]R^R`(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��sL													
										
						$												tTestElementObjectscBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�ZRS(s)Test various features of element objects.cCsw|jd�}|jt|j�d�|jt|�d�|jt|j�d�|jt|jj�d�dS(s3The length of an element is its number of children.s<top>1<b>2</b>3</top>iiN(RRR&R�R�(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_len�s
cCsj|jd�}|j|j|jd��|j|jj|jd�jd��|j|jd�dS(s2Accessing a Python member .foo invokes find('foo')s<b><i></i></b>RR�N(RRRR R�R)R{(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_member_access_invokes_find�s(cCsg|jd�}tjdt��}|j}WdQX|j|j|�|jdt|dj��dS(Ns<b><i></i></b>trecordsp.bTag is deprecated, use .find("b") instead. If you really were looking for a tag called bTag, use .find("bTag")i(	Rtwarningstcatch_warningsR1tbTagRRR#tmessage(RRtwR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_deprecated_member_access�scCsE|jd�}|j|jjd��|j|jjd��dS(s�has_attr() checks for the presence of an attribute.

        Please note note: has_attr() is different from
        __in__. has_attr() checks the tag's attributes and __in__
        checks the tag's chidlren.
        s<foo attr='bar'>tattrtattr2N(RR?R9thas_attrtassertFalse(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt
test_has_attr�scCsd}|j|d�dS(Ns%<b a="1" z="5" m="3" f="2" y="4"></b>s%<b a="1" f="2" m="3" y="4" z="5"></b>(tassertSoupEquals(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt.test_attributes_come_out_in_alphabetical_order�scCs)|jd�}|j|jjd�dS(Ns
<b>foo</b>R9(RRRR(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_string�scCs)|jd�}|j|jjd�dS(Ns<b></b>(RRRRR{(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_empty_tag_has_no_string�scCs�|jd�}|j|jjd�|jd�}|j|jjd�|jd�}|jjdd�|j|jjd�dS(Ns<a>foo<b></b><b></b></b>s<a>foo<b></b>bar</b>s
<a>foo</b>iR-(RRRRR{R)R�(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt-test_tag_with_multiple_children_has_no_string�scCs<|jd�}|j|jjd�|j|jd�dS(Ns<a><b>foo</b></a>R9(RRR)R(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt)test_tag_with_recursive_string_has_string�scCsH|jd�}|j|jj�|jd�}|j|jj�dS(s7Only a tag containing a single text node has a .string.s<b>f<i>e</i>o</b>s<b></b>N(RRnRR(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_lack_of_string�scCs�|jd�}|j|jjd�|j|jjdt�d�|j|jjd�d�|j|jjddt�d�dS(	sBTag.text and Tag.get_text(sep=u"") -> all child text, concatenateds<a>a<b>r</b>   <r> t </r></a>sar  t tstriptartt,s	a,r, , t sa,r,tN(RRR)R$tget_textR1(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt
test_all_text�s
cCsg|jd�}|j|j�d�|j|jdttf�d�|j|jdd�d�dS(Nsfoo<!--IGNORE-->bartfoobarttypestfooIGNOREbar(RRRzR	RR{(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_get_text_ignores_comments�scCs2|jd�}|jddgt|j��dS(Nsfoo<!--IGNORE-->barR9R-(RRRtstrings(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt!test_all_strings_ignores_commentss(RRR+RbRcRjRoRqRrRsRtRuRvR{RR�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRa�s														tTestCDAtaListAttributescBsVeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	s0Testing cdata-list attributes like 'class'.
    cCs-|jd�}|jdg|jd�dS(Ns<a class='foo'>R9Rj(RRR)(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_single_value_becomes_list
scCs0|jd�}|jddg|jd�dS(Ns<a class='foo bar'>R9R-Rj(RRR)(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt!test_multiple_values_becomes_listscCs3|jd�}|jdddg|jd�dS(Ns<a class='foo	bar
baz'>R9R-R�Rj(RRR)(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt2test_multiple_values_separated_by_weird_whitespacescCs,|jd�}|jd|jj��dS(Ns<a class='foo	bar'>s<a class="foo bar"></a>(RRR)Rc(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt,test_attributes_joined_into_string_on_outputscCs2|jd�}|jdg|jjd��dS(Ns<a id='abc def'>sabc defR(RRR)tget_attribute_list(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_get_attribute_listscCs0|jd�}|jddg|jd�dS(Ns(<form accept-charset="ISO-8859-1 UTF-8">s
ISO-8859-1sUTF-8saccept-charset(RRtform(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_accept_charset!scCs0d}|j|�}|jd|jd�dS(Ns)<a accept-charset="ISO-8859-1 UTF-8"></a>sISO-8859-1 UTF-8saccept-charset(RRR)(RRfR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt-test_cdata_attribute_applying_only_to_one_tag%scsH|jd�j�|jd�j��fd�}|jt|�dS(NR�cs
d�_dS(NR9(RF((R(s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pytt0s(RRRR{RFR�tAttributeError(RR�((Rs7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt'test_string_has_immutable_name_property-s(RRR+R�R�R�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR�	s							tTestPersistencecBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s*Testing features like pickle and deepcopy.cCs5tt|�j�d|_|j|j�|_dS(Nsy<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Beautiful Soup: We called him Tortoise because he taught us.</title>
<link rev="made" href="mailto:leonardr@segfault.org">
<meta name="Description" content="Beautiful Soup: an HTML parser optimized for screen-scraping.">
<meta name="generator" content="Markov Approximation 1.4 (module: leonardr)">
<meta name="author" content="Leonard Richardson">
</head>
<body>
<a href="foo">foo</a>
<a href="foo"><b>bar</b></a>
</body>
</html>(RIR�RJtpageRRK(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRJ7s	cCsZtj|jd�}tj|�}|j|jt�|j|j�|jj��dS(Ni(tpickletdumpsRKtloadsRt	__class__RRd(Rtdumpedtloaded((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt!test_pickle_and_unpickle_identityKscCs5tj|j�}|j|j�|jj��dS(N(tcopytdeepcopyRKRRd(Rtcopied((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_deepcopy_identitySscCsQtdd�}|j}|j�}|jdt|��|j||j�dS(Ns
<p>&nbsp;</p>shtml.parseru	<p> </p>(Rtoriginal_encodingt__copy__RRW(RRtencodingR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_copy_preserves_encodingXs
	cCsYd}|j|�}tj|tj�}tj|�}|j|j�|j��dS(Nu
<b>☃</b>(RR�R�tHIGHEST_PROTOCOLR�RRd(RR�RR�R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_unicode_pickle_s
cCs�d}|j|�}|jdd�}tj|�}|j||�|jd|j�|jd|j�|jd|j�|jd|j�|jd|j	�dS(Nu<b>Foo<a></a></b><b>Bar</b>RR.(
RR R�RR{R�R�tassertNotEqualR�R�(RR�Rts1ts2((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt1test_copy_navigablestring_is_not_attached_to_treegscCsWd}|j|�}|j}tj|�}|j||�|jt|t��dS(Nu<b><!--Foo--></b>(RRR�RR?R�R(RR�RR�R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt0test_copy_navigablestring_subclass_has_same_typess	cCs8d}|j|�}tj|�}|j||�dS(Nu)<div><b>Foo<a></a></b><b>Bar</b></div>end(RR�R(RR�Rt	soup_copy((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_copy_entire_soup{scCs�d}|j|�}|j}tj|�}|jt|�t|��|j||�|j||k�|jd|j�|jd|j�|jd|j	dd�j
�|jd|j	dd�j
�dS(Nu)<div><b>Foo<a></a></b><b>Bar</b></div>endRtBar(RRXR�RRWRnR{R�R�R R�R�(RR�RRXtdiv_copy((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_copy_tag_copies_contents�s	(RRR+RJR�R�R�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR�4s								tTestSubstitutionscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(cCsDd}|j|�}|jdd�}|j||jd��dS(Nu#<b>&lt;&lt;Sacré bleu!&gt;&gt;</b>t	formattertminimal(RRdRR�(RR�Rtdecoded((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt!test_default_formatter_is_minimal�scCsDd}|j|�}|jdd�}|j||jd��dS(Nu'<br><b>&lt;&lt;Sacré bleu!&gt;&gt;</b>R�R�s.<br/><b>&lt;&lt;Sacr&eacute; bleu!&gt;&gt;</b>(RRdRR�(RR�RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_formatter_html�scCsDd}|j|�}|jdd�}|j||jd��dS(Nu'<br><b>&lt;&lt;Sacré bleu!&gt;&gt;</b>R�thtml5s-<br><b>&lt;&lt;Sacr&eacute; bleu!&gt;&gt;</b>(RRdRR�(RR�RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_formatter_html5�scCsDd}|j|�}|jdd�}|j||jd��dS(Nu#<b>&lt;&lt;Sacré bleu!&gt;&gt;</b>R�R�(RRdRR�(RR�RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_formatter_minimal�scCsDd}|j|�}|jdd�}|j||jd��dS(Nu#<b>&lt;&lt;Sacré bleu!&gt;&gt;</b>R�u<b><<Sacré bleu!>></b>(RRdR{RR�(RR�RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_formatter_null�s
	cCsGd}|j|�}|jdd��}|j||jd��dS(Nu!<b>&lt;foo&gt;</b><b>bar</b><br/>R�cSs
|j�S(N(tupper(tx((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt<lambda>�su<b><FOO></b><b>BAR</b><br>(RRdRR�(RR�RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_formatter_custom�scCs�d}|j|�}|j}d}|j||j��|j||jdd��d}|j||jdd��|j||jdd��d}|j||jdd���dS(	Nu%<a href="http://a.com?a=b&c=é">e</a>u)<a href="http://a.com?a=b&amp;c=é">e</a>R�R�u/<a href="http://a.com?a=b&amp;c=&eacute;">e</a>R�u%<a href="HTTP://A.COM?A=B&C=É">E</a>cSs
|j�S(N(R�(R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��s(RR)RRdR{(RR�RR)texpect_minimaltexpect_htmltexpect_upper((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt)test_formatter_is_run_on_attribute_values�s	cCs2d}t|d�j�}|jd|k�dS(NsO
  <script type="text/javascript">
   console.log("< < hey > > ");
  </script>
shtml.parsers< < hey > >(RRcR?(RRtencoded((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt2test_formatter_skips_script_tag_for_html_documents�scCs2d}t|d�j�}|jd|k�dS(NsF
  <style type="text/css">
   console.log("< < hey > > ");
  </style>
shtml.parsers< < hey > >(RRcR?(RRR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt1test_formatter_skips_style_tag_for_html_documents�scCs,|jd�}|jd|jj��dS(Ns*<div>  foo  <pre>  	bar
  
  </pre>  baz  u/<div>
 foo
 <pre>  	bar
  
  </pre>
 baz
</div>(RRRXtprettify(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt,test_prettify_leaves_preformatted_text_alone�scCs;tdd�}|jdd��}|jd|k�dS(Ns<html><body>foo</body></html>shtml.parserR�cSs
|j�S(N(R�(R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��stFOO(RR�R?(RRtpretty((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt(test_prettify_accepts_formatter_function�scCs/|jd�}|jtt|j���dS(Ns<a></a>(RRRWttypeR�(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt(test_prettify_outputs_unicode_by_default�scCs2|jd�}|jtt|jd���dS(Ns<a></a>sutf-8(RRtbytesR�R�(RR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_prettify_can_encode_datascCsDd}|j|�}|jjd�}|j||jd��dS(Nu<b>Sacré bleu!</b>sutf-8(RRRcR(RR�RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt,test_html_entity_substitution_off_by_defaultscCs�d}|j|�}|j|jdd�|jd�}|jd|k�|jd�}|jd|k�|jd�}|jd	|k�|jd
�jd
�}|jd|k�dS(NsE<meta content="text/html; charset=x-sjis" http-equiv="Content-type"/>tcontentstext/html; charset=x-sjissutf-8s
charset=utf-8teuc_jpscharset=euc_jps	shift-jisscharset=shift-jissutf-16scharset=utf-16(RRtmetaRcR?Rd(Rtmeta_tagRtutf_8R�t	shift_jistutf_16_u((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_encoding_substitutionscCsEd}td�}|j|d|�}|j|jdjd�dS(Ns`<head><meta content="text/html; charset=x-sjis" http-equiv="Content-type"/></head><pre>foo</pre>tpret
parse_onlyi(R
RRR�RF(RR�RyR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt;test_encoding_substitution_doesnt_happen_if_tag_is_strained$s(RRR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��s 	
			
			
											tTestEncodingcBsVeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	s0Test the ability to encode objects into strings.cCsAd}|j|�}|j|jjjd�djd��dS(Nu
<b>☃</b>sutf-8u☃(RRRRRc(RR�R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt"test_unicode_string_can_be_encoded2scCs>d}|j|�}|j|jjd�|jd��dS(Nu
<b>☃</b>sutf-8(RRRRc(RR�R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt1test_tag_containing_unicode_string_can_be_encoded8scCs5d}|j|�}|j|jjd�d�dS(Nu
<b>☃</b>tasciis<b>&#9731;</b>(RRRRc(RR�R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt<test_encoding_substitutes_unrecognized_characters_by_default>scCs5d}|j|�}|jt|jddd�dS(Nu
<b>☃</b>R�terrorststrict(RR�tUnicodeEncodeErrorRc(RR�R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt test_encoding_can_be_made_strictCscCs2d}|j|�}|jd|jj��dS(Nu
<b>☃</b>u☃(RRRtdecode_contents(RR�R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_decode_contentsIscCsAd}|j|�}|jdjd�|jjdd��dS(Nu
<b>☃</b>u☃RaR�(RRRcRtencode_contents(RR�R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_encode_contentsNs
cCs;d}|j|�}|jdjd�|jj��dS(Nu
<b>☃</b>u☃Ra(RRRcRtrenderContents(RR�R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_deprecated_renderContentsUscCsNd}|j|�}tr4|j|t|��n|jdt|��dS(Nu
<b>☃</b>s
<b>\u2603</b>(RRRtrepr(RR�R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt	test_repr[s
(RRR+R�R�R�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR�/s							tTestNavigableStringSubclassescBs,eZd�Zd�Zd�Zd�ZRS(cCsx|jd�}td�}|jd|�|jt|�d�|j|jdd�d�|j|jdd�dS(NR�R9is<![CDATA[foo]]>R$i(RRR�RR#R R�(RRR_((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt
test_cdataescsvd�_�fd�}�jd�}td�}|jd|��jd|jd|���jd�j�dS(	skText inside a CData object is passed into the formatter.

        But the return value is ignored.
        ics�jd7_dS(NisBITTER FAILURE(tcount(targs(R(s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt	incrementvsR�s<><><>is<![CDATA[<><><>]]>R�N(R�RRR�RRc(RR�RR_((Rs7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_cdata_is_never_formattedos	cCsEtd�}|jd�}|jd|�|j|j�d�dS(NR9R�is<!DOCTYPE foo>
(RRR�RRc(RtdoctypeR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_doctype_ends_in_newline�scCs&td�}|jd|j��dS(NR9s<?foo?>(RRtoutput_ready(RR+((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_declaration�s(RRR�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR�cs	
		tTestSoupSelectorcBseZdZd�Zd�ZeZd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�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/�Z2d0�Z3d1�Z4d2�Z5d3�Z6d4�Z7d5�Z8d6�Z9d7�Z:d8�Z;d9�Z<RS(:s�
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>The title</title>
<link rel="stylesheet" href="blah.css" type="text/css" id="l1">
</head>
<body>
<custom-dashed-tag class="dashed" id="dash1">Hello there.</custom-dashed-tag>
<div id="main" class="fancy">
<div id="inner">
<h1 id="header1">An H1</h1>
<p>Some text</p>
<p class="onep" id="p1">Some more text</p>
<h2 id="header2">An H2</h2>
<p class="class1 class2 class3" id="pmulti">Another</p>
<a href="http://bob.example.org/" rel="friend met" id="bob">Bob</a>
<h2 id="header3">Another H2</h2>
<a id="me" href="http://simonwillison.net/" rel="me">me</a>
<span class="s1">
<a href="#" id="s1a1">span1a1</a>
<a href="#" id="s1a2">span1a2 <span id="s1a2s1">test</span></a>
<span class="span2">
<a href="#" id="s2a1">span2a1</a>
</span>
<span class="span3"></span>
<custom-dashed-tag class="dashed" id="dash2"/>
<div data-tag="dashedvalue" id="data1"/>
</span>
</div>
<x id="xid">
<z id="zida"/>
<z id="zidab"/>
<z id="zidac"/>
</x>
<y id="yid">
<z id="zidb"/>
</y>
<p lang="en" id="lang-en">English</p>
<p lang="en-gb" id="lang-en-gb">English UK</p>
<p lang="en-us" id="lang-en-us">English US</p>
<p lang="fr" id="lang-fr">French</p>
</div>

<div id="footer">
</div>
cCst|jd�|_dS(Nshtml.parser(RtHTMLR(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyRJ�scKsvg|jj||�D]}|d^q}|j�|j�|j||d|dj|�dj|�f�dS(NRs$Selector %s, expected [%s], got [%s]s, (RtselecttsortRtjoin(Rtselectortexpected_idstkwargsteltel_ids((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR�s,

cGs+x$|D]\}}|j||�qWdS(N(tassertSelect(RttestsR�R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pytassertSelectMultiple�scCs]|jjd�}|jt|�d�|j|djd�|j|djdg�dS(NRbiiu	The title(RR�RR&RFR�(Rtels((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_one_tag_one�scCsv|jjd�}|jt|�d�x!|D]}|j|jd�q/W|jjd�}|jd|d�dS(NRXitmainR(RR�RR&RFt
select_one(RR�RXR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_one_tag_many�s
cCs&|jjd�}|jd|�dS(Ntnonexistenttag(RRRR{(Rtmatch((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt(test_select_one_returns_none_if_no_match�scCs,|jjd�}|jdddg�dS(Nsdiv divtinnertdata1(RR�R(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_tag_in_tag_one�scCs1x*dD]"}|j|ddddg�qWdS(	Nshtml divs
html body divsbody divRRRtfooter(shtml divs
html body divsbody div(R(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_tag_in_tag_many�s
cCs[|jddgdd�|jdddgdd�|jdd	ddd
gdd�dS(Nshtml divRR3is
html body divRisbody divRR	i
(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt
test_limit�scCs&|jt|jjd��d�dS(Ntdeli(RR&RR�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_tag_no_match�scCs|jt|jjd�dS(Nstag%t(R�R�RR�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_invalid_tag�scCs|jdddg�dS(Nscustom-dashed-tagtdash1tdash2(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_select_dashed_tag_ids�scCsE|jjd�}|j|djd�|j|ddd�dS(Nscustom-dashed-tag[id="dash2"]iscustom-dashed-tagRR(RR�RRF(Rtdashed((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_select_dashed_by_id�scCs'|j|jjd�djd�dS(Nsbody > custom-dashed-tagiuHello there.(RRR�R$(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_dashed_tag_textscCs,|j|jjd�|jjd��dS(Nscustom-dashed-tag(RRR�R'(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt#test_select_dashed_matches_find_allscCs)|jddgfdddgf�dS(Nth1theader1th2theader2theader3(R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_header_tags
scCsoxhd	D]`}|jj|�}|jt|�d�|j|djd�|j|dddg�qWdS(
Ns.onepsp.onepshtml p.onepiiR�Rjtonep(s.onepsp.onepshtml p.onep(RR�RR&RF(RR�R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_class_ones

cCs,|jjd�}|jt|�d�dS(Nsdiv.onepi(RR�RR&(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_class_mismatched_tagscCs(x!dD]}|j|dg�qWdS(Ns	div#inners#inners
div div#innerR(s	div#inners#inners
div div#inner(R(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_one_ids
cCs,|jjd�}|jt|�d�dS(Ns
#doesnotexisti(RR�RR&(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_bad_idscCs�|jjd�}|jt|�d�x!|D]}|j|jd�q/W|j|dddg�|j|djd��dS(Nsdiv#inner piR�iRjRi(RR�RR&RFRnRm(RR�R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_items_in_id#s
cCs7x0dD](}|jt|jj|��d�qWdS(Nsdiv#main delsdiv#main div.oopssdiv div#maini(sdiv#main delsdiv#main div.oopssdiv div#main(RR&RR�(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_a_bunch_of_emptys+s
cCs(x!d
D]}|j|d	g�qWdS(Ns.class1sp.class1s.class2sp.class2s.class3sp.class3s
html p.class2sdiv#inner .class2tpmulti(s.class1sp.class1s.class2sp.class2s.class3sp.class3s
html p.class2sdiv#inner .class2(R(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_multi_class_support/s
cCs(x!dD]}|j|dg�qWdS(Ns.class1.class3s.class3.class2s.class1.class2.class3R#(s.class1.class3s.class3.class2s.class1.class2.class3(R(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_multi_class_selection4s
cCs-|jdddg�|jddg�dS(Ns.s1 > ats1a1ts1a2s.s1 > a spants1a2s1(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_child_selector9scCs|jddg�dS(Ns.s1 > a#s1a2 spanR((R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_child_selector_id=scCs�|jddgfddgfddgfddgfddgfddgfd	dgfd
gfddgfddgfd
dgfdgfdgfdgf�dS(Nsp[class="onep"]Rs
p[id="p1"]s[class="onep"]s	[id="p1"]slink[rel="stylesheet"]tl1slink[type="text/css"]slink[href="blah.css"]slink[href="no-blah.css"]s[rel="stylesheet"]s[type="text/css"]s[href="blah.css"]s[href="no-blah.css"]sp[href="no-blah.css"](R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_attribute_equals@s			cCs�|jddgfddgfddgfddgfddgfddgfdd	gfd
d	gfdd	gfdd	gf�
dS(
Nsp[class~="class1"]R#sp[class~="class2"]sp[class~="class3"]s[class~="class1"]s[class~="class2"]s[class~="class3"]sa[rel~="friend"]tbobs
a[rel~="met"]s[rel~="friend"]s[rel~="met"](R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_attribute_tildeRscCs�|jddgfddgfdgfdgfdgfddgfdd	d
gfdd	d
gfdd
dgfdd
dgfddgfdd
gfddgf�
dS(Ns[rel^="style"]R+slink[rel^="style"]snotlink[rel^="notstyle"]s[rel^="notstyle"]slink[rel^="notstyle"]slink[href^="bla"]sa[href^="http://"]R-tmes[href^="http://"]s	[id^="p"]R#Rs	[id^="m"]Rsdiv[id^="m"]s
a[id^="m"]sdiv[data-tag^="dashed"]R(R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_attribute_startswith`s			c
Csh|jddgfddgfddgfdddddd	d
ddgfd
dgfdgf�dS(Ns[href$=".css"]R+slink[href$=".css"]s
link[id$="1"]s	[id$="1"]RRRR&ts2a1R(Rsdiv[id$="1"]s[id$="noending"](R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_attribute_endswithqs!cCs4|jddgfddgfdgfdgfdgfddgfdd	d
gfddd
gfddgfdd
gfddgfddgfddgfdddd
ddddddg	fddgfdgfdd	d
dgfdd	d
gfd dgfd!dd"gfd#d"gfd$dgf�dS(%Ns[rel*="style"]R+slink[rel*="style"]snotlink[rel*="notstyle"]s[rel*="notstyle"]slink[rel*="notstyle"]slink[href*="bla"]s[href*="http://"]R-R/s	[id*="p"]R#Rsdiv[id*="m"]Rs
a[id*="m"]s[href*=".css"]slink[href*=".css"]s
link[id*="1"]s	[id*="1"]RRR&R'R1R(Rsdiv[id*="1"]s[id*="noending"]s[href*="."]sa[href*="."]slink[href*="."]sdiv[id*="n"]Rs
div[id*="nn"]sdiv[data-tag*="edval"](R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_attribute_contains{s.			$	cCsG|jddddgfddddgfddgfdgf�dS(	Ns
p[lang|="en"]slang-ens
lang-en-gbs
lang-en-uss[lang|="en"]s
p[lang|="fr"]slang-frs
p[lang|="gb"](R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_attribute_exact_or_hypen�s
c
Cs}|jddddgfddgfdddgfddd	d
dgfdd
dgfdgfdgfddgf�dS(Ns[rel]R+R-R/s	link[rel]sa[rel]s[lang]slang-ens
lang-en-gbs
lang-en-usslang-frsp[class]RR#s[blah]sp[blah]s
div[data-tag]R(R�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_attribute_exists�s		cCs>d}t|d�}|jd�\}|jd|j�dS(Ns]<div style="display: wrong">nope</div>
        <div style="display: right">yes</div>
        shtml.parsersdiv[style="display: right"]tyes(RR�RR(RR�Rtchosen((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt"test_quoted_space_in_selector_name�scCs6|jt|jjd�|jt|jjd�dS(Nsa:no-such-pseudoclasssa:nth-of-type(a)(R�R5RR�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_unsupported_pseudoclass�scCs�|jjd�}|jt|�d�|j|djd�|jjd�}|jt|�d�|j|djd�|jjd�}|jt|�d�|jt|jjd�dS(	Nsdiv#inner p:nth-of-type(1)iiu	Some textsdiv#inner p:nth-of-type(3)uAnothersdiv#inner p:nth-of-type(4)sdiv p:nth-of-type(0)(RR�RR&RR�R�(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_nth_of_type�scCsC|jjd�}|jt|�d�|j|djd�dS(Nsdiv#inner > p:nth-of-type(1)iiu	Some text(RR�RR&R(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt"test_nth_of_type_direct_descendant�scCs|jddg�dS(Ns#inner > p:nth-of-type(2)R(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt"test_id_child_selector_nth_of_type�scCsA|jjddd�}|jd�}|j|ddg�dS(NRXRRRR(RR R�R(RRtselected((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_select_on_element�scCs'|jddg�|jdg�dS(Ns
.fancy #innerRs.normal #inner(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_overspecified_child_id�scCsY|jddg�|jddg�|jddg�|jg|jjd��dS(Ns#p1 + h2Rs#p1 + h2 + pR#s#p1 + #header2 + .class1s#p1 + p(RRRR�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_adjacent_sibling_selector�scCso|jdddg�|jddg�|jddg�|jddg�|jg|jjd��dS(	Ns#p1 ~ h2RRs#p1 ~ #header2s#p1 ~ h2 + aR/s#p1 ~ h2 + [rel="me"]s#inner ~ h2(RRRR�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_general_sibling_selector�s
cCs|jt|jjd�dS(Nsh1 >(R�R�RR�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_dangling_combinator�scCs|jddddg�dS(Nsp[lang] ~ ps
lang-en-gbs
lang-en-usslang-fr(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt2test_sibling_combinator_wont_select_same_tag_twice�scCs|jdddg�dS(Nsx, ytxidtyid(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_multiple_select�scCs|jdddg�dS(Nsx,yRDRE(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt"test_multiple_select_with_no_space�scCs|jdddg�dS(Nsx,    yRDRE(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt$test_multiple_select_with_more_space�scCs|jddg�dS(Nsx, xRD(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_multiple_select_duplicatedscCs|jdddg�dS(Nsx, y ~ p[lang=fr]RDslang-fr(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_multiple_select_siblingscCs|jdddg�dS(Nsx, y > zRDtzidb(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt.test_multiple_select_tag_and_direct_descendantscCs&|jdddddddg�dS(Ns
div > x, y, zRDREtzidaRKtzidabtzidac(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt/test_multiple_select_direct_descendant_and_tags
scCs&|jdddddddg�dS(Nsdiv x,y,  zRDRERMRKRNRO(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt(test_multiple_select_indirect_descendant
scCs6|jt|jjd�|jt|jjd�dS(Ns,x, ysx,,y(R�R�RR�(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_invalid_multiple_selectscCs|jdddg�dS(Nsp[lang=en], p[lang=en-gb]slang-ens
lang-en-gb(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_multiple_select_attrsscCs|jddddg�dS(Ns*x, y > z[id=zida], z[id=zidab], z[id=zidb]RDRKRN(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_multiple_select_idsscCs|jdddg�dS(Nsbody > div > x, y > zRDRK(R(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_multiple_select_nestedscCsad}t|d�}|jd�}|jdt|��x |jdddg�D]}qSWdS(Ns3<div class="c1"/><div class="c2"/><div class="c1"/>shtml.parsers.c1, .c2iRltc1tc2(RR�RR&R'(RR�RR=R�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyttest_select_duplicate_elementss(=RRR�RJRR�R�R�RRRR
RR
RRRRRRRRRR R!R"R$R%R)R*R,R.R0R2R3R4R5R8R9R:R;R<R>R?R@RARBRCRFRGRHRIRJRLRPRQRRRSRTRURX(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyR��sv1		
																													
																											(3R+tpdbRR�R�R/Retbs4Rtbs4.builderRRtbs4.elementRRRRRR	R
Rtbs4.testingRR
R�R{R�tLXML_PRESENTRRR,RCRHR^R�R�R�R�R�R�R�R�R�R�RaR�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_tree.pyt<module>sF:
;O�3(3--*��n+a�4*