• File: test_tree.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/bs4/tests/__pycache__/test_tree.cpython-37.pyc
  • Date Modified: 07/07/2021 10:44 PM
  • File size: 84.08 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

G.`0@sdZddlmZddlZddlZddlZddlZddlmZddl	m
Z
mZddlm
Z
mZmZmZmZmZmZmZddlmZmZe
ddk	Ze
d	dk	ZGd
ddeZGdd
d
eZGdddeZGdddeZGdddeZGdddeZ GdddeZ!GdddeZ"GdddeZ#Gddde#Z$Gddde#Z%Gd d!d!eZ&Gd"d#d#e&Z'Gd$d%d%e&Z(Gd&d'd'eZ)Gd(d)d)eZ*Gd*d+d+eZ+Gd,d-d-eZ,Gd.d/d/eZ-Gd0d1d1eZ.Gd2d3d3eZ/Gd4d5d5eZ0Gd6d7d7eZ1dS)8a8Tests 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.
)	set_traceN)
BeautifulSoup)builder_registryHTMLParserTreeBuilder)PY3KCDataCommentDeclarationDoctypeNavigableStringSoupStrainerTag)SoupTestskipIfZxmlZlxmlc@seZdZddZddZdS)TreeTestcCs|dd|D|dS)zMake 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.
        cSsg|]
}|jqS)string).0tagrrD/opt/alt/python37/lib/python3.7/site-packages/bs4/tests/test_tree.py
<listcomp>1sz*TreeTest.assertSelects.<locals>.<listcomp>N)assertEqual)selftagsshould_matchrrr
assertSelects*szTreeTest.assertSelectscCs|dd|D|dS)zMake 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.
        cSsg|]}|dqS)idr)rrrrrr:sz-TreeTest.assertSelectsIDs.<locals>.<listcomp>N)r)rrrrrrassertSelectsIDs3szTreeTest.assertSelectsIDsN)__name__
__module____qualname__rrrrrrr(s	rc@s8eZdZdZddZddZddZdd	Zd
dZdS)
TestFindzBasic tests of the find() method.

    find() just calls find_all() with limit=1, so it's not tested all
    that thouroughly here.
    cCs"|d}||djddS)Nz <a>1</a><b>2</b><a>3</a><b>4</b>b2)souprfindr)rr$rrr
test_find_tagDs
zTestFind.test_find_tagcCs"|d}||jddddS)Nu<h1>Räksmörgås</h1>u
Räksmörgås)r)r$rr%)rr$rrrtest_unicode_text_findHs
zTestFind.test_unicode_text_findcCs,|d}t||d|jddjdS)Nu&<h1 id="Räksmörgås">here it is</h1>z
here it isu
Räksmörgås)r)r$strrr%text)rr$rrrtest_unicode_attribute_findLs
z$TestFind.test_unicode_attribute_findcCs"|d}|dt|dS)z)Test an optimization that finds all tags.z<a>foo</a><b>bar</b>N)r$rlenfind_all)rr$rrrtest_find_everythingRs
zTestFind.test_find_everythingcCs$|d}|dt|ddS)z;Test an optimization that finds all tags with a given name.z<a>foo</a><b>bar</b><a>baz</a>r+aN)r$rr,r-)rr$rrrtest_find_everything_with_nameWs
z'TestFind.test_find_everything_with_nameN)	rrr __doc__r&r'r*r.r0rrrrr!=sr!c@s8eZdZdZddZddZddZdd	Zd
dZdS)
TestFindAllz%Basic tests of the find_all() method.cCs|d}||jdddg||jdddg||jddgdddg||jtdddddg||jdddddgd	S)
z'You can search the tree for text nodes.u<html>Foo<b>bar</b>»</html>bar)r)r)Fooz.*»TN)r$rr-recompile)rr$rrrtest_find_all_text_nodes_s
z$TestFindAll.test_find_all_text_nodescCs|d}||jddddddg||jddddg||jdd	ddddd
dg||jddddddd
dgd
S)z7You can limit the number of items returned by find_all.z(<a>1</a><a>2</a><a>3</a><a>4</a><a>5</a>r/)limit1r#3
45rN)r$rr-)rr$rrrtest_find_all_limitos
zTestFindAll.test_find_all_limitcCs:|d}||ddddg||jdddgdS)	Nz!<a>1</a><b>2<a id='foo'>3</a></b>r/r=)r:r;foo)rr<)r$rr")rr$rrr%test_calling_a_tag_is_calling_findall{s
z1TestFindAll.test_calling_a_tag_is_calling_findallcCs.|d}g}|||g||dS)Nz<a></a>)r$appendrr-)rr$lrrrTtest_find_all_with_self_referential_data_structure_does_not_cause_infinite_recursions

z`TestFindAll.test_find_all_with_self_referential_data_structure_does_not_cause_infinite_recursioncCs^|d}|d}|t|d|d}|t|d|jdd}|t|ddS)z%All find_all calls return a ResultSetz<a></a>r/sourceTrB)r)N)r$r-
assertTruehasattr)rr$resultrrrtest_find_all_resultsets


z#TestFindAll.test_find_all_resultsetN)	rrr r1r8rArCrFrKrrrrr2\s
r2c@seZdZddZdS)TestFindAllBasicNamespacescCs<|d}|d|dj|d|jddidjdS)Nz0<mathml:msqrt>4</mathml:msqrt><a svg:fill="red">r?zmathml:msqrtr/zsvg:fillZred)attrs)r$rr%rname)rr$rrrtest_find_by_namespaced_names
z7TestFindAllBasicNamespaces.test_find_by_namespaced_nameN)rrr rOrrrrrLsrLcspeZdZdZfddZddZddZdd	Zd
dZdd
Z	ddZ
ddZddZddZ
ddZZS)TestFindAllByNamez&Test ways of finding tags by tag name.cstt||d|_dS)Nz<a>First tag.</a>
                                  <b>Second tag.</b>
                                  <c>Third <a>Nested tag.</a> tag.</c>)superrsetUpr$tree)r)	__class__rrrRszTestFindAllByName.setUpcCs||jdddgdS)Nr/z
First tag.zNested tag.)rrSr-)rrrrtest_find_all_by_tag_namesz+TestFindAllByName.test_find_all_by_tag_namecCs\||jjddddg||jjdddddg||jjdtddddgdS)Nr/z
First tag.)r)TzNested tag.r)rrSr-r6r7)rrrrtest_find_all_by_name_and_textsz0TestFindAllByName.test_find_all_by_name_and_textcCs||jjddgdS)Nr/zNested tag.)rrScr-)rrrr!test_find_all_on_non_root_elementsz3TestFindAllByName.test_find_all_on_non_root_elementcCs||dddgdS)Nr/z
First tag.zNested tag.)rrS)rrrr%test_calling_element_invokes_find_allsz7TestFindAllByName.test_calling_element_invokes_find_allcCs ||jtdddgdS)Nr/z
First tag.zNested tag.)rrSr-r)rrrrtest_find_all_by_tag_strainersz/TestFindAllByName.test_find_all_by_tag_strainercCs"||jddgdddgdS)Nr/r"z
First tag.zSecond tag.zNested tag.)rrSr-)rrrrtest_find_all_by_tag_namessz,TestFindAllByName.test_find_all_by_tag_namescCs$||jddddddgdS)NT)r/r"z
First tag.zSecond tag.zNested tag.)rrSr-)rrrrtest_find_all_by_tag_dictsz+TestFindAllByName.test_find_all_by_tag_dictcCs$||jtddddgdS)Nz^[ab]$z
First tag.zSecond tag.zNested tag.)rrSr-r6r7)rrrrtest_find_all_by_tag_resz)TestFindAllByName.test_find_all_by_tag_recCs,dd}|d}|||ddgdS)NcSs|j|dkS)Nr)rNget)rrrrid_matches_nameszRTestFindAllByName.test_find_all_with_tags_matching_method.<locals>.id_matches_namez<a id="a">Match 1.</a>
                            <a id="1">Does not match.</a>
                            <b id="b">Match 2.</a>zMatch 1.zMatch 2.)r$rr-)rr_rSrrr'test_find_all_with_tags_matching_methods
z9TestFindAllByName.test_find_all_with_tags_matching_methodcCsx|d}|dd}|dtd}|dddg\}}|d|j|d|j|d|j|d|jdS)NzH<div class='a b'>1</div><div class='a c'>2</div><div class='a d'>3</div>divza dza br<r;)r$r%r6r7r-rr)rr$Zr1Zr2Zr3Zr4rrr%test_find_with_multi_valued_attributesz7TestFindAllByName.test_find_with_multi_valued_attribute)rrr r1rRrUrVrXrYrZr[r\r]r`rb
__classcell__rr)rTrrPs
rPc@seZdZddZddZddZddZd	d
ZddZd
dZ	ddZ
ddZddZddZ
ddZddZddZddZdd Zd!S)"TestFindAllByAttributecCs&|d}||jddddgdS)Nz
                         <a id="first">Matching a.</a>
                         <a id="second">
                          Non-matching <b id="first">Matching b.</b>a.
                         </a>first)rzMatching a.zMatching b.)r$rr-)rrSrrrtest_find_all_by_attribute_namesz6TestFindAllByAttribute.test_find_all_by_attribute_namecCstdd}dd}||}||jg|j|d||jg|j|dd||jg|j|dgddS)Nuםולשutf8u<a title="םולש"></a>)titlezsomething else)encoder$rr/r-decode)rZpeacedatar$rrr%test_find_all_by_utf8_attribute_values


z<TestFindAllByAttribute.test_find_all_by_utf8_attribute_valuecCsX|d}||jdddg||jddiddg||jdd	idd
gdS)Na0
                         <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>
                         Zname1)rNzA tag called 'name1'.rN)rMzName match.classZclass2zClass match.)r$rr-)rrSrrrtest_find_all_by_attribute_dictsz6TestFindAllByAttribute.test_find_all_by_attribute_dictcCs|d}||jddddg||jddddg||jdd	ddg||dddg||jdd
ddg||dddg||dd	dgdS)Nz
                         <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/r;)class_zClass 1.rWr<zClass 3 and 4.r?)rM)r$rr-)rrSrrrtest_find_all_by_classsz-TestFindAllByAttribute.test_find_all_by_classcCst|d}|jdtdd}||dg|jdtdd}||dg|jdtdd}||dgdS)Nz#<gar class='foo bar'>Found it</gar>Zgaro)rozFound itr/zo b)r$r-r6r7r)rrSfrrr0test_find_by_class_when_multiple_classes_present+s
zGTestFindAllByAttribute.test_find_by_class_when_multiple_classes_presentcCsd|d}||dtddgdd}||d|gdd}||d|dgdS)	Nz<a class='bar'>Found it</a>r/ZbazFound itcSst|dkS)Nr9)r,)valuerrrbig_attribute_value>sznTestFindAllByAttribute.test_find_all_with_non_dictionary_for_attrs_finds_by_class.<locals>.big_attribute_valuecSst|dkS)Nr9)r,)rtrrrsmall_attribute_valueCszpTestFindAllByAttribute.test_find_all_with_non_dictionary_for_attrs_finds_by_class.<locals>.small_attribute_value)r$rr-r6r7)rr$rurvrrr:test_find_all_with_non_dictionary_for_attrs_finds_by_class9s
zQTestFindAllByAttribute.test_find_all_with_non_dictionary_for_attrs_finds_by_classcCs|d}|d\}}|||g|dd||g|dd||g|jddd||g|dd|g|dddS)Nz*<a class="foo bar"></a><a class="foo"></a>r/rBr3zfoo bar)rozbar foo)r$r-r)rr$r/Za2rrr:test_find_all_with_string_for_attrs_finds_multiple_classesIs
zQTestFindAllByAttribute.test_find_all_with_string_for_attrs_finds_multiple_classescCs0|d}tddid}|||dgdS)Nzi
                         <a id="first">Match.</a>
                         <a id="second">Non-match.</a>rre)rMzMatch.)r$rrr-)rrSstrainerrrr'test_find_all_by_attribute_soupstrainerUsz>TestFindAllByAttribute.test_find_all_by_attribute_soupstrainercCs&|d}||jddddgdS)Nz<a id="1">ID present.</a>
                            <a>No ID present.</a>
                            <a id="">ID is empty.</a>r/)rzNo ID present.)r$rr-)rrSrrr$test_find_all_with_missing_attribute]sz;TestFindAllByAttribute.test_find_all_with_missing_attributecCs&|d}||jddddgdS)Nz<a id="1">ID present.</a>
                            <a>No ID present.</a>
                            <a id="">ID is empty.</a>T)rzID present.zID is empty.)r$rr-)rrSrrr$test_find_all_with_defined_attributeesz;TestFindAllByAttribute.test_find_all_with_defined_attributecCs>|d}ddg}||jdd|||jdd|dS)Nz[<a id=1>Unquoted attribute.</a>
                            <a id="1">Quoted attribute.</a>zUnquoted attribute.zQuoted attribute.r=)rr;)r$rr-)rrSZexpectedrrr$test_find_all_with_numeric_attributens
z;TestFindAllByAttribute.test_find_all_with_numeric_attributecCs,|d}||jdddgdddgdS)Nz<a id="1">1</a>
                            <a id="2">2</a>
                            <a id="3">3</a>
                            <a>No ID.</a>r;r<r?)r)r$rr-)rrSrrr(test_find_all_with_list_attribute_valueswsz?TestFindAllByAttribute.test_find_all_with_list_attribute_valuescCs,|d}||jtddddgdS)Nz<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>z^a+$)rzOne a.zTwo as.)r$rr-r6r7)rrSrrr5test_find_all_with_regular_expression_attribute_valueszLTestFindAllByAttribute.test_find_all_with_regular_expression_attribute_valuecCsX|d}|j}||g|jddd|g|jddd|g|jddddS)Nz<b>foo</b><b>bar</b><a>foo</a>r/rB)r)r3)r$r/rr-)rr$r/rrr'test_find_by_name_and_containing_strings

z>TestFindAllByAttribute.test_find_by_name_and_containing_stringcCs*|d}||d|jddddS)Nz"<a>foo</a><a><b><c>foo</c></b></a>r/rB)r))r$rr-)rr$rrr=test_find_by_name_and_containing_string_when_string_is_burieds
zTTestFindAllByAttribute.test_find_by_name_and_containing_string_when_string_is_buriedcCsB|d}|j}||g|jddd|g|jddddS)Nz"<b id="1">foo</b><a id="2">foo</a>r+rB)rr)r=r3)r$r/rr-)rr$r/rrr,test_find_by_attribute_and_containing_strings
zCTestFindAllByAttribute.test_find_by_attribute_and_containing_stringN)rrr rfrlrnrprsrwrxrzr{r|r}r~rrrrrrrrrds 		

rdc@seZdZdZddZdS)	TestIndexzTest Tag.indexcCsN|d}|j}x(t|jD]\}}||||qW|t|jddS)Nah<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>r=)r$ra	enumeratecontentsrindexassertRaises
ValueError)rrSraiZelementrrr
test_indexszTestIndex.test_indexN)rrr r1rrrrrrsrcs`eZdZdZfddZddZddZdd	Zd
dZdd
Z	ddZ
ddZddZZ
S)TestParentOperationsz;Test navigation and searching through an element's parents.cs(tt||d|_|jj|_dS)Na1<ul id="empty"></ul>
                                 <ul id="top">
                                  <ul id="middle">
                                   <ul id="bottom">
                                    <b>Start here</b>
                                   </ul>
                                  </ul>)rQrrRr$rSr"start)r)rTrrrRszTestParentOperations.setUpcCsF||jjdd||jjjdd||jjjjdddS)Nrbottommiddletop)rrparent)rrrrtest_parentsz TestParentOperations.test_parentcCs |jjd}||j|jdS)Nr)rSrrr)rZtop_tagrrr%test_parent_of_top_tag_is_soup_objectsz:TestParentOperations.test_parent_of_top_tag_is_soup_objectcCs|d|jjdS)N)rrSr)rrrrtest_soup_object_has_no_parentsz3TestParentOperations.test_soup_object_has_no_parentcCs8||jddddg||jjddddgdS)Nulrrr)r)rrZfind_parents)rrrrtest_find_parentssz&TestParentOperations.test_find_parentscCs8||jddd||jjddddddS)Nrrrr)r)rrfind_parent)rrrrtest_find_parentsz%TestParentOperations.test_find_parentcCs"|jjdd}||jjddS)Nz
Start here)r)r")rSr%rrrN)rr)rrrtest_parent_of_text_elementsz0TestParentOperations.test_parent_of_text_elementcCs(|jjdd}||ddddS)Nz
Start here)r)rrr)rSr%rr)rr)rrrtest_text_element_find_parentsz2TestParentOperations.test_text_element_find_parentcCs(dd|jjD}||dddgdS)NcSs&g|]}|dk	rd|jkr|dqS)Nr)rM)rrrrrrsz>TestParentOperations.test_parent_generator.<locals>.<listcomp>rrr)rparentsr)rrrrrtest_parent_generatorsz*TestParentOperations.test_parent_generator)rrr r1rRrrrrrrrrrcrr)rTrrsrcseZdZfddZZS)
ProximityTestcstt||d|_dS)Nzg<html id="start"><head></head><body><b id="1">One</b><b id="2">Two</b><b id="3">Three</b></body></html>)rQrrRr$rS)r)rTrrrRszProximityTest.setUp)rrr rRrcrr)rTrrsrcsTeZdZfddZddZddZddZd	d
ZddZd
dZ	ddZ
ZS)TestNextOperationscstt||jj|_dS)N)rQrrRrSr"r)r)rTrrrRszTestNextOperations.setUpcCs*||jjd||jjjdddS)NOnerr#)rrnext_element)rrrr	test_nextszTestNextOperations.test_nextcCs |jjdd}||jddS)NThree)r))rSr%rr)rZlastrrrtest_next_of_last_item_is_nonesz1TestNextOperations.test_next_of_last_item_is_nonecCs||jjddS)N)rrSr)rrrrtest_next_of_root_is_nonesz,TestNextOperations.test_next_of_root_is_nonecCsB||jdddg|jjdd||jjdddgdS)Nr"Tworr9)r)rr
find_all_next)rrrrtest_find_all_nextsz%TestNextOperations.test_find_all_nextcCs2||jddd||jjddddS)Nr"rr#r)r))rr	find_next)rrrrtest_find_nextsz!TestNextOperations.test_find_nextcCs<|jjdd}||djd||dddgdS)Nr)r)r"rr)rSr%rrrrr)rr)rrrtest_find_next_for_text_elementsz2TestNextOperations.test_find_next_for_text_elementcCsF|jjdd}dd|jD}|\}}||dd||ddS)Nr)r)cSsg|]}|qSrr)rnoderrrrsz:TestNextOperations.test_next_generator.<locals>.<listcomp>rr<r)rSr%Z
next_elementsr)rrZ
successorsrrrrrtest_next_generators
z&TestNextOperations.test_next_generator)rrr rRrrrrrrrrcrr)rTrrsrcsTeZdZfddZddZddZddZd	d
ZddZd
dZ	ddZ
ZS)TestPreviousOperationscs"tt||jjdd|_dS)Nr)r))rQrrRrSr%end)r)rTrrrRszTestPreviousOperations.setUpcCs*||jjdd||jjjddS)Nrr<r)rrprevious_element)rrrr
test_previoussz$TestPreviousOperations.test_previouscCs|jd}||jddS)Nhtml)rSr%rr)rrerrr#test_previous_of_first_item_is_none#sz:TestPreviousOperations.test_previous_of_first_item_is_nonecCsdS)Nr)rrrrtest_previous_of_root_is_none'sz4TestPreviousOperations.test_previous_of_root_is_nonecCs6||jddddg||jjdddgdS)Nr"rrrr=)r)rrfind_all_previous)rrrrtest_find_all_previous-sz-TestPreviousOperations.test_find_all_previouscCs2||jddd||jjddddS)Nr"rr<r)r))rr
find_previous)rrrrtest_find_previous5sz)TestPreviousOperations.test_find_previouscCs>|jjdd}||djd||ddddgdS)Nr)r)r"rr)rSr%rrrrr)rr)rrr#test_find_previous_for_text_element9sz:TestPreviousOperations.test_find_previous_for_text_elementcCsh|jjdd}dd|jD}|\}}}}||dd||jd||jd||jd	dS)
Nr)r)cSsg|]}|qSrr)rrrrrrAszBTestPreviousOperations.test_previous_generator.<locals>.<listcomp>rr;bodyheadr)rSr%Zprevious_elementsrrN)rrZpredecessorsr"rrrrrrtest_previous_generator?sz.TestPreviousOperations.test_previous_generator)rrr rRrrrrrrrrcrr)rTrrsrcseZdZfddZZS)SiblingTestcs4tt|d}tdd|}|||_dS)Na<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>z
\s*)rQrrRr6r7subr$rS)rmarkup)rTrrrRNszSiblingTest.setUp)rrr rRrcrr)rTrrLsrcsLeZdZfddZddZddZddZd	d
ZddZd
dZ	Z
S)TestNextSiblingcs"tt||jjdd|_dS)Nr;)r)rQrrRrSr%r)r)rTrrrRdszTestNextSibling.setUpcCs||jjddS)N)rrSnext_sibling)rrrr!test_next_sibling_of_root_is_nonehsz1TestNextSibling.test_next_sibling_of_root_is_nonecCsB||jjdd||jjjdd||jjdddS)Nrr#r<z1.1)rrrr)rrrrtest_next_siblingksz!TestNextSibling.test_next_siblingcCsN||jjjd|jjdd}||jd|jjdd}||jddS)Nz1.1)rr?)rrSrrr%)rnested_spanZ	last_spanrrrtest_next_sibling_may_not_existrs
z/TestNextSibling.test_next_sibling_may_not_existcCs||jddddS)Nspanrr#)rrfind_next_sibling)rrrrtest_find_next_sibling{sz&TestNextSibling.test_find_next_siblingcCs6||jddddg||jjdddgdS)Nrr#r<r?)r)rrfind_next_siblings)rrrrtest_next_siblings~sz"TestNextSibling.test_next_siblingscCsv|d}|jdd}||jjd||jjd||ddg||jddd||jddddS)NzFoo<b>bar</b>bazr4)r)r"bazr3nonesuch)r$r%rrrNrrr)rr$rrrr"test_next_sibling_for_text_elements
z2TestNextSibling.test_next_sibling_for_text_element)rrr rRrrrrrrrcrr)rTrrbs	rcsLeZdZfddZddZddZddZd	d
ZddZd
dZ	Z
S)TestPreviousSiblingcs"tt||jjdd|_dS)Nr?)r)rQrrRrSr%r)r)rTrrrRszTestPreviousSibling.setUpcCs||jjddS)N)rrSprevious_sibling)rrrr%test_previous_sibling_of_root_is_nonesz9TestPreviousSibling.test_previous_sibling_of_root_is_nonecCsB||jjdd||jjjdd||jjdddS)Nrr<r#z3.1)rrrr)rrrrtest_previous_siblingsz)TestPreviousSibling.test_previous_siblingcCsN||jjjd|jjdd}||jd|jjdd}||jddS)Nz1.1)rr;)rrSrrr%)rrZ
first_spanrrr#test_previous_sibling_may_not_exists
z7TestPreviousSibling.test_previous_sibling_may_not_existcCs||jddddS)Nrrr<)rrfind_previous_sibling)rrrrtest_find_previous_siblingsz.TestPreviousSibling.test_find_previous_siblingcCs6||jddddg||jjdddgdS)Nrr<r#r;)r)rrfind_previous_siblings)rrrrtest_previous_siblingssz*TestPreviousSibling.test_previous_siblingscCsv|d}|jdd}||jjd||jjd||ddg||jddd||jddddS)NzFoo<b>bar</b>bazr)r)r"r4r3r)r$r%rrrNrrr)rr$rrrr&test_previous_sibling_for_text_elements
z:TestPreviousSibling.test_previous_sibling_for_text_element)rrr rRrrrrrrrcrr)rTrrs	rc@s0eZdZdZddZddZddZdd	Zd
S)TestTagCreationz$Test the ability to create new tags.cCs\|d}|jddd}|t|t|d|j|tdd|j|d|j	dS)NrrBr)r3)
r$new_tagrH
isinstancer
rrNdictrMr)rr$rrrrtest_new_tags
zTestTagCreation.test_new_tagcCstrBtdd}|d}|d}|d||d|tdd}|d}|d}|d||d|dS)	Nrzlxml-xmlbrps<br/>s<p/>zhtml.parsers<p></p>)XML_BUILDER_PRESENTrrrri)rZxml_soupZxml_brZxml_pZ	html_soupZhtml_brZhtml_prrr1test_tag_inherits_self_closing_rules_from_builders





zATestTagCreation.test_tag_inherits_self_closing_rules_from_buildercCs4|d}|d}|d||t|tdS)NrrB)r$
new_stringrrHrr)rr$srrr'test_new_string_creates_navigablestrings

z7TestTagCreation.test_new_string_creates_navigablestringcCs6|d}|dt}|d||t|tdS)NrrB)r$rrrrHr)rr$rrrr3test_new_string_can_create_navigablestring_subclasss
zCTestTagCreation.test_new_string_can_create_navigablestring_subclassN)rrr r1rrrrrrrrrs
rc@s4eZdZddZddZddZddZd	d
ZddZd
dZ	ddZ
ddZddZddZ
ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKS)LTestTreeModificationcCsl|d}d|jd<|||d|jd=|||dd|jd<|||ddS)	Nz<a id="1"></a>r+rz<a id="2"></a>z<a></a>rBZid2z<a id2="foo"></a>)r$r/rrjdocument_for)rr$rrrtest_attribute_modifications


z0TestTreeModification.test_attribute_modificationcCsltd}|jd|d}t||d}t||d}d|d<|jd||jd	|||jd
dS)Nrz
<body></body>)builderr/olzhttp://foo.com/Zhrefrr=s4<body><a href="http://foo.com/"></a><ol></ol></body>)rlookupr$r
rinsertrri)rrr$r/rrrrtest_new_tag_creationsz*TestTreeModification.test_new_tag_creationcCs\d}||}|jdd}|j}|jdd|j||j||||ddS)NzT<p id="1">Don't leave me <b>here</b>.</p>
                <p id="2">Don't leave!</p>r#)rzD<p id="1">Don't leave me .</p>
<p id="2">Don't leave!<b>here</b></p>)r$r%r"rDrrrjr)rdocr$Zsecond_paraZboldrrr!test_append_to_contents_moves_tags

z6TestTreeModification.test_append_to_contents_moves_tagcCs0d}||}|j}||j}|||dS)Nz<a></a><b><c></c></b>)r$r/replace_withrWr)rr)r$r/new_arrr1test_replace_with_returns_thing_that_was_replaceds

zFTestTreeModification.test_replace_with_returns_thing_that_was_replacedcCs,d}||}|j}|}|||dS)Nz<a><b></b><c></c></a>)r$r/unwrapr)rr)r$r/rrrr+test_unwrap_returns_thing_that_was_replaceds

z@TestTreeModification.test_unwrap_returns_thing_that_was_replacedcCsJ|d}|j}||d|j|t|j|t|j|j	dS)Nz<a><b>Foo</b></a><c>Bar</c>)
r$r/extractrrrrrrrW)rr$r/rrrItest_replace_with_and_unwrap_give_useful_exception_when_tag_has_no_parents
z^TestTreeModification.test_replace_with_and_unwrap_give_useful_exception_when_tag_has_no_parentcCs:d}||}|j}|j|||||dS)Nz-<a><b></b><c>Foo<d></d></c></a><a><e></e></a>)r$rWrrrjr)rr)r$rWrrrtest_replace_tag_with_itself%s

z1TestTreeModification.test_replace_tag_with_itselfcCs&d}||}|t|jj|jdS)Nz<a><b></b></a>)r$rrr"rr/)rr)r$rrr1test_replace_tag_with_its_parent_raises_exception,s
zFTestTreeModification.test_replace_tag_with_its_parent_raises_exceptioncCs(d}||}|t|jjd|jdS)Nz<a><b></b></a>r)r$rrr/r)rr)r$rrr,test_insert_tag_into_itself_raises_exception1s
zATestTreeModification.test_insert_tag_into_itself_raises_exceptioncCsX|d}|j}|jd}|dd|j\}}|d|d|d|jjdS)Nz<p><a>one</a><b>three</b></p>rr=ZtworZthree)r$r/rrZreplaceWithrr"r)rr$r/r"leftrightrrr3test_replace_with_maintains_next_element_throughout6s




zHTestTreeModification.test_replace_with_maintains_next_element_throughoutcCsl|d}|jddd|jdd}|j}||j|||j|||jj|||jddS)Nz<b>Argh!</b>zArgh!)r)zHooray!)r$r%rr"rrrr)rr$new_textr"rrrtest_replace_final_nodeEs
z,TestTreeModification.test_replace_final_nodecCs|d}|jdd|||d|jdd}||jd||jj|||j	d||j	j
|||j
d||j|jdS)Nz<a><b>Argh!</b><c></c></a>r=zHooray!z!<a><b>Argh!Hooray!</b><c></c></a>)r)zArgh!)r$r"rrrjrr%rrrrrW)rr$rrrrtest_consecutive_text_nodesOs

z0TestTreeModification.test_consecutive_text_nodescCsT|d}|jdd|jdd|ddg|jj||jjdjddS)Nz<a></a>rr3rB)r$r/rrrr)rr$rrrtest_insert_stringds

z'TestTreeModification.test_insert_stringcCs|j}|jd|d}t||d}|dd|jd||||d|j}||j	|||j
||jdd	}||j|||j
||j}||j	|||j
||jdd	}||j|||j|||j
|dS)
Nz%<a><b>Find</b><c>lady!</c><d></d></a>)rZmagictagrther=z=<a><b>Find</b><magictag>the</magictag><c>lady!</c><d></d></a>ZFind)r))Zdefault_builderr$r
rr/rrjrr"rrr%rrrWr)rrr$Z	magic_tagZb_tagr%Zc_tagrrrrtest_insert_tagms,

z$TestTreeModification.test_insert_tagcCs0d}||}|j|j|||dS)Nz<a><b></b></a>)r$r/rDr"rrj)rrkr$rrr*test_append_child_thats_already_at_the_ends
z?TestTreeModification.test_append_child_thats_already_at_the_endcCs2d}||}|jd|j|d|dS)Nz<a><b></b><c></c><d></d></a>rz<a><d></d><b></b><c></c></a>)r$r/rdrrj)rrkr$rrr$test_move_tag_to_beginning_of_parents
z9TestTreeModification.test_move_tag_to_beginning_of_parentcCs.|d}|jdd|t|jddS)Nz<br/>r=ZContentsz<br>Contents</br>)r$rrrr()rr$rrr&test_insert_works_on_empty_element_tags
z;TestTreeModification.test_insert_works_on_empty_element_tagcCs`|d}|jd|jd|||d|j|j|||ddS)Nz<a>foo</a><b>bar</b>BAZQUUXzQUUX<a>foo</a>BAZ<b>bar</b>zQUUX<b>bar</b><a>foo</a>BAZ)r$r"
insert_beforer/rrjr)rr$rrrtest_insert_befores
z'TestTreeModification.test_insert_beforecCs`|d}|jd|jd|||d|j|j|||ddS)Nz<a>foo</a><b>bar</b>rrz<a>foo</a>QUUX<b>bar</b>BAZzQUUX<b>bar</b><a>foo</a>BAZ)r$r"insert_afterr/rrjr)rr$rrrtest_insert_afters
z&TestTreeModification.test_insert_aftercCsR|d}|d}|d}|t|j||t|j||t|j|dS)Nrr/)r$rrrrr	NotImplementedError)rr$rrrrr:test_insert_after_raises_exception_if_after_has_no_meanings


zOTestTreeModification.test_insert_after_raises_exception_if_after_has_no_meaningcCsR|d}|d}|d}|t|j||t|j||t|j|dS)Nrr/)r$rrrrrr)rr$rrrrrFtest_insert_before_raises_notimplementederror_if_before_has_no_meanings


z[TestTreeModification.test_insert_before_raises_notimplementederror_if_before_has_no_meaningcCsv|d}|d\}}|||||d||jd||j|j||jd||j	ddS)Nz;<p>There's <b>no</b> business like <b>show</b> business</p>r"z0<p>There's  business like <b>no</b> business</p>noz	 business)
r$r-rrrjrrrrr)rr$rZshowrrrtest_replace_withs
z&TestTreeModification.test_replace_withcCs0d}||}|j|j|d|dS)Nz<a><b></b><c></c></a>z<a><c></c></a>)r$r"rrWrrj)rrkr$rrrtest_replace_first_childs
z-TestTreeModification.test_replace_first_childcCs0d}||}|j|j|d|dS)Nz<a><b></b><c></c></a>z<a><b></b></a>)r$rWrr"rrj)rrkr$rrrtest_replace_last_childs
z,TestTreeModification.test_replace_last_childcCs|d}|j}|j}|||||d||jd||jddj	d||j
d||jd||jd||j|j
||j
d||j	j	|j||jd|jdd}|j}||j	|||j|||j
|||j|dS)NzQ<a>We<b>reserve<c>the</c><d>right</d></b></a><e>to<f>refuse</f><g>service</g></e>z-<a>We<f>refuse</f></a><e>to<g>service</g></e>r)r)ZWeto)r$r"rrrrrjrrr%rrrrr/eg)rr$Z
remove_tagZmove_tagZto_textZg_tagrrrtest_nested_tag_replace_withs.

z1TestTreeModification.test_nested_tag_replace_withcCs6|d}|j||jd||jjddS)NzI
            <p>Unneeded <em>formatting</em> is unneeded</p>
            zUnneeded formatting is unneeded)r$emrrrr))rrSrrrtest_unwraps

z TestTreeModification.test_unwrapcCsF|d}|j|d}||d|||ddS)NzI wish I was bold.r"z<b>I wish I was bold.</b>)r$rwraprrrjr)rr$rtrrr	test_wraps

zTestTreeModification.test_wrapcCs4|d}|jj|j|||ddS)Nz<b></b>I wish I was bold.z<b>I wish I was bold.</b>)r$r"rrrrjr)rr$rrr%test_wrap_extracts_tag_from_elsewheres
z:TestTreeModification.test_wrap_extracts_tag_from_elsewherecCsH|d}|jj|j|dt|jj|||ddS)Nz+<b>I like being bold.</b>I wish I was bold.r+z+<b>I like being bold.I wish I was bold.</b>)	r$r"rrrr,rrjr)rr$rrr&test_wrap_puts_new_contents_at_the_ends

z;TestTreeModification.test_wrap_puts_new_contents_at_the_endcCs|d}|t|jjd|jdd}||d||d|t|jjd||jd||j	d||j
j
d|jdd	}|jd
d	}||j
|||j|||j	|||j|dS)NzR<html><body>Some content. <div id="nav">Nav crap</div> More content.</body></html>r9Znav)rz6<html><body>Some content.  More content.</body></html>z<div id="nav">Nav crap</div>r+zSome content. )r)z More content.)
r$rr,rrr%rrjrrrrr)rr$Z	extractedZ	content_1Z	content_2rrrtest_extract!s"z!TestTreeModification.test_extractcCsz|d}|jj}|jj}|d}|d}|j||j||||||jj|||jjdS)Nz<a>foo</a><b>bar</b>rBr3)r$r/rr"rrDrr)rr$Zfoo_1Zbar_1Zfoo_2Zbar_2rrr4test_extract_distinguishes_between_identical_strings:s


zITestTreeModification.test_extract_distinguishes_between_identical_stringscs8|dfdddD|dtjdS)Nzv
<html>
<head>
<script>foo</script>
</head>
<body>
 <script>bar</script>
 <a></a>
</body>
<script>baz</script>
</html>csg|]}jqSr)scriptr)rr)r$rrrWszKTestTreeModification.test_extract_multiples_of_same_tag.<locals>.<listcomp>rz<body>

<a></a>
</body>)r$r-rr(r)rr)r$r"test_extract_multiples_of_same_tagKs
z7TestTreeModification.test_extract_multiples_of_same_tagcCs.|d}|d|d|ddS)Nz<html>
<body>hi</body>
</html>r)r$r%rr)rr$rrrBtest_extract_works_when_element_is_surrounded_by_identical_strings[szWTestTreeModification.test_extract_works_when_element_is_surrounded_by_identical_stringscCsf|d}|j}|j|t|jjd|t|d|j	}|jdd|dt|jdS)zTag.clear()z4<p><a>String <em>Italicized</em></a> and another</p>rrT)Z	decomposeN)
r$r/rclearrr,rrHrIr)rr$r/rrrr
test_cleards

zTestTreeModification.test_clearcCsB|d}d|j_||jjdgd|j_||jjdgdS)zTag.string = 'string'z<a></a> <b><c></c></b>rBr3N)r$r/rrrr")rr$rrrtest_string_setrs

z$TestTreeModification.test_string_setcCs,|d}|jj|j_||jddS)Nz<a><b>foo</b><c>bar</c>s<a><b>bar</b><c>bar</c></a>)r$rWrr"rr/ri)rr$rrr/test_string_set_does_not_affect_original_stringzs
zDTestTreeModification.test_string_set_does_not_affect_original_stringcCs2|d}td}||j_|t|jjtdS)Nz<a></a>rB)r$rr/rrHr)rr$cdatarrr)test_set_string_preserves_class_of_strings
z>TestTreeModification.test_set_string_preserves_class_of_stringN)(rrr rrrrrrrrrrrrrrrrrrr
rr
rrrrrrrrrrrr r"r#r$r&rrrrrsJ	
		
$	rc@sxeZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZddZddZ
ddZddZddZdS)TestElementObjectsz)Test various features of element objects.cCsV|d}|t|jd|t|d|t|jd|t|jjddS)z3The length of an element is its number of children.z<top>1<b>2</b>3</top>r=r9N)r$rr,rr)rr$rrrtest_lens

zTestElementObjects.test_lencCsL|d}||j|d||jj|dd||jddS)z2Accessing a Python member .foo invokes find('foo')z<b><i></i></b>r"rN)r$rr"r%rr/)rr$rrrtest_member_access_invokes_finds
z2TestElementObjects.test_member_access_invokes_findc	CsP|d}tjdd}|j}WdQRX||j||dt|djdS)Nz<b><i></i></b>T)recordz,.bTag is deprecated, use .find("b") instead.r)r$warningscatch_warningsZbTagrr"r(message)rr$wrrrrtest_deprecated_member_accesss
z0TestElementObjects.test_deprecated_member_accesscCs2|d}||jd||jddS)zhas_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.
        z<foo attr='bar'>attrZattr2N)r$rHrBhas_attrassertFalse)rr$rrr
test_has_attrs
z TestElementObjects.test_has_attrcCsd}||ddS)Nz%<b a="1" z="5" m="3" f="2" y="4"></b>z%<b a="1" f="2" m="3" y="4" z="5"></b>)ZassertSoupEquals)rrrrr.test_attributes_come_out_in_alphabetical_orderszATestElementObjects.test_attributes_come_out_in_alphabetical_ordercCs|d}||jjddS)Nz
<b>foo</b>rB)r$rr"r)rr$rrrtest_strings
zTestElementObjects.test_stringcCs|d}||jjddS)Nz<b></b>)r$rr"r)rr$rrrtest_empty_tag_has_no_strings
z/TestElementObjects.test_empty_tag_has_no_stringcCs`|d}||jjd|d}||jjd|d}|jdd||jjddS)Nz<a>foo<b></b><b></b></b>z<a>foo<b></b>bar</b>z
<a>foo</b>r=r3)r$rr"rr/r)rr$rrr-test_tag_with_multiple_children_has_no_strings


z@TestElementObjects.test_tag_with_multiple_children_has_no_stringcCs,|d}||jjd||jddS)Nz<a><b>foo</b></a>rB)r$rr/r)rr$rrr)test_tag_with_recursive_string_has_strings
z<TestElementObjects.test_tag_with_recursive_string_has_stringcCs4|d}||jj|d}||jjdS)z7Only a tag containing a single text node has a .string.z<b>f<i>e</i>o</b>z<b></b>N)r$r2r"r)rr$rrrtest_lack_of_strings

z&TestElementObjects.test_lack_of_stringcCs`|d}||jjd||jjddd||jdd||jjddddd	S)
zBTag.text and Tag.get_text(sep=u"") -> all child text, concatenatedz<a>a<b>r</b>   <r> t </r></a>zar  t T)stripZart,z	a,r, , t za,r,tN)r$rr/r)get_text)rr$rrr
test_all_texts

z TestElementObjects.test_all_textcCsJ|d}||d||jttfdd||jddddS)Nzfoo<!--IGNORE-->barZfoobar)typesZfooIGNOREbar)r$rr<rr)rr$rrrtest_get_text_ignores_commentss
z1TestElementObjects.test_get_text_ignores_commentscCs$|d}|ddgt|jdS)Nzfoo<!--IGNORE-->barrBr3)r$rlistZstrings)rr$rrr!test_all_strings_ignores_commentss
z4TestElementObjects.test_all_strings_ignores_commentsN)rrr r1r(r)r/r3r4r5r6r7r8r9r=r?rArrrrr's		r'c@sHeZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
dS)TestCDAtaListAttributesz0Testing cdata-list attributes like 'class'.
    cCs"|d}|dg|jddS)Nz<a class='foo'>rBrm)r$rr/)rr$rrrtest_single_value_becomes_lists
z6TestCDAtaListAttributes.test_single_value_becomes_listcCs$|d}|ddg|jddS)Nz<a class='foo bar'>rBr3rm)r$rr/)rr$rrr!test_multiple_values_becomes_lists
z9TestCDAtaListAttributes.test_multiple_values_becomes_listcCs&|d}|dddg|jddS)Nz<a class='foo	bar
baz'>rBr3rrm)r$rr/)rr$rrr2test_multiple_values_separated_by_weird_whitespaces
zJTestCDAtaListAttributes.test_multiple_values_separated_by_weird_whitespacecCs |d}|d|jdS)Nz<a class='foo	bar'>s<a class="foo bar"></a>)r$rr/ri)rr$rrr,test_attributes_joined_into_string_on_outputs
zDTestCDAtaListAttributes.test_attributes_joined_into_string_on_outputcCs$|d}|ddg|jddS)Nz(<form accept-charset="ISO-8859-1 UTF-8">z
ISO-8859-1zUTF-8zaccept-charset)r$rZform)rr$rrrtest_accept_charsets
z+TestCDAtaListAttributes.test_accept_charsetcCs$d}||}|d|jddS)Nz)<a accept-charset="ISO-8859-1 UTF-8"></a>zISO-8859-1 UTF-8zaccept-charset)r$rr/)rrkr$rrr-test_cdata_attribute_applying_only_to_one_tags
zETestCDAtaListAttributes.test_cdata_attribute_applying_only_to_one_tagcs6|dj|djfdd}|t|dS)Nrcs
d_dS)NrB)rNr)rrrtszJTestCDAtaListAttributes.test_string_has_immutable_name_property.<locals>.t)r$rrrNrAttributeError)rrIr)rr'test_string_has_immutable_name_propertysz?TestCDAtaListAttributes.test_string_has_immutable_name_propertyN)rrr r1rCrDrErFrGrHrKrrrrrBsrBcs`eZdZdZfddZddZddZdd	Zd
dZdd
Z	ddZ
ddZddZZ
S)TestPersistencez*Testing features like pickle and deepcopy.cs&tt|d|_||j|_dS)Nay<!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>)rQrLrRZpager$rS)r)rTrrrRszTestPersistence.setUpcCs@t|jd}t|}||jt|||jdS)Nr+)pickledumpsrSloadsrrTrrj)rdumpedloadedrrr!test_pickle_and_unpickle_identity1s
z1TestPersistence.test_pickle_and_unpickle_identitycCs&t|j}|||jdS)N)copyZdeepcopyrSrrj)rZcopiedrrrtest_deepcopy_identity9sz&TestPersistence.test_deepcopy_identitycCs:tdd}|j}|}|dt||||jdS)Ns
<p>&nbsp;</p>zhtml.parseru	<p> </p>)rZoriginal_encoding__copy__rr()rr$encodingrSrrrtest_copy_preserves_encoding>s

z,TestPersistence.test_copy_preserves_encodingcCs>d}||}t|tj}t|}|||dS)Nu
<b>☃</b>)r$rMrNZHIGHEST_PROTOCOLrOrrj)rrr$rPrQrrrtest_unicode_pickleEs


z#TestPersistence.test_unicode_picklecCszd}||}|jdd}t|}||||d|j|d|j|d|j|d|j|d|jdS)Nz<b>Foo<a></a></b><b>Bar</b>r4)r)	r$r%rSrrrassertNotEqualrr)rrr$s1s2rrr1test_copy_navigablestring_is_not_attached_to_treeMs

zATestPersistence.test_copy_navigablestring_is_not_attached_to_treecCs>d}||}|j}t|}||||t|tdS)Nz<b><!--Foo--></b>)r$rrSrrHrr)rrr$rZr[rrr0test_copy_navigablestring_subclass_has_same_typeYs

z@TestPersistence.test_copy_navigablestring_subclass_has_same_typecCs(d}||}t|}|||dS)Nz)<div><b>Foo<a></a></b><b>Bar</b></div>end)r$rSr)rrr$Z	soup_copyrrrtest_copy_entire_soupas

z%TestPersistence.test_copy_entire_soupcCsd}||}|j}t|}|t|t|||||||k|d|j|d|j|d|jddj	|
d|jddj	dS)Nz)<div><b>Foo<a></a></b><b>Bar</b></div>endZBar)r)r$rarSrr(r2rrr%rrY)rrr$raZdiv_copyrrrtest_copy_tag_copies_contentsgs

z-TestPersistence.test_copy_tag_copies_contents)rrr r1rRrRrTrWrXr\r]r^r_rcrr)rTrrLsrLc@seZdZddZddZddZddZd	d
ZddZd
dZ	ddZ
ddZddZddZ
ddZddZddZddZdS) TestSubstitutionscCs0d}||}|jdd}|||ddS)Nu#<b>&lt;&lt;Sacré bleu!&gt;&gt;</b>minimal)	formatter)r$rjrr)rrr$decodedrrr!test_default_formatter_is_minimal}s
z3TestSubstitutions.test_default_formatter_is_minimalcCs0d}||}|jdd}|||ddS)Nu#<b>&lt;&lt;Sacré bleu!&gt;&gt;</b>r)rbz)<b>&lt;&lt;Sacr&eacute; bleu!&gt;&gt;</b>)r$rjrr)rrr$rcrrrtest_formatter_htmls
z%TestSubstitutions.test_formatter_htmlcCs0d}||}|jdd}|||ddS)Nu#<b>&lt;&lt;Sacré bleu!&gt;&gt;</b>ra)rb)r$rjrr)rrr$rcrrrtest_formatter_minimals
z(TestSubstitutions.test_formatter_minimalcCs0d}||}|jdd}|||ddS)Nu#<b>&lt;&lt;Sacré bleu!&gt;&gt;</b>)rbu<b><<Sacré bleu!>></b>)r$rjrr)rrr$rcrrrtest_formatter_nulls

z%TestSubstitutions.test_formatter_nullcCs4d}||}|jddd}|||ddS)Nz<b>&lt;foo&gt;</b><b>bar</b>cSs|S)N)upper)xrrr<lambda>z9TestSubstitutions.test_formatter_custom.<locals>.<lambda>)rbz<b><FOO></b><b>BAR</b>)r$rjrr)rrr$rcrrrtest_formatter_customs
z'TestSubstitutions.test_formatter_customcCsd}||}|j}d}||||||jddd}|||jdd|||jddd}|||jdd	ddS)
Nu%<a href="http://a.com?a=b&c=é">e</a>u)<a href="http://a.com?a=b&amp;c=é">e</a>ra)rbz/<a href="http://a.com?a=b&amp;c=&eacute;">e</a>ru%<a href="HTTP://A.COM?A=B&C=É">E</a>cSs|S)N)rh)rirrrrjrkzMTestSubstitutions.test_formatter_is_run_on_attribute_values.<locals>.<lambda>)r$r/rrj)rrr$r/Zexpect_minimalZexpect_htmlZexpect_upperrrr)test_formatter_is_run_on_attribute_valuess
z;TestSubstitutions.test_formatter_is_run_on_attribute_valuescCs$d}t|d}|d|kdS)NzO
  <script type="text/javascript">
   console.log("< < hey > > ");
  </script>
zhtml.parsers< < hey > >)rrirH)rrencodedrrr2test_formatter_skips_script_tag_for_html_documentsszDTestSubstitutions.test_formatter_skips_script_tag_for_html_documentscCs$d}t|d}|d|kdS)NzF
  <style type="text/css">
   console.log("< < hey > > ");
  </style>
zhtml.parsers< < hey > >)rrirH)rrrnrrr1test_formatter_skips_style_tag_for_html_documentsszCTestSubstitutions.test_formatter_skips_style_tag_for_html_documentscCs |d}|d|jdS)Nz*<div>  foo  <pre>  	bar
  
  </pre>  baz  z/<div>
 foo
 <pre>  	bar
  
  </pre>
 baz
</div>)r$rraprettify)rr$rrr,test_prettify_leaves_preformatted_text_alones
z>TestSubstitutions.test_prettify_leaves_preformatted_text_alonecCs,tdd}|jddd}|d|kdS)Nz<html><body>foo</body></html>zhtml.parsercSs|S)N)rh)rirrrrjrkzCTestSubstitutions.test_prettify_accepts_formatter.<locals>.<lambda>)rbZFOO)rrqrH)rr$Zprettyrrrtest_prettify_accepts_formatters
z1TestSubstitutions.test_prettify_accepts_formattercCs"|d}|tt|dS)Nz<a></a>)r$rr(typerq)rr$rrr(test_prettify_outputs_unicode_by_defaults
z:TestSubstitutions.test_prettify_outputs_unicode_by_defaultcCs$|d}|tt|ddS)Nz<a></a>zutf-8)r$rbytesrtrq)rr$rrrtest_prettify_can_encode_datas
z/TestSubstitutions.test_prettify_can_encode_datacCs0d}||}|jd}|||ddS)Nu<b>Sacré bleu!</b>zutf-8)r$r"rir)rrr$rnrrr,test_html_entity_substitution_off_by_defaults
z>TestSubstitutions.test_html_entity_substitution_off_by_defaultcCsd}||}||jdd|d}|d|k|d}|d|k|d}|d	|k|d
d
}|d|kdS)NzE<meta content="text/html; charset=x-sjis" http-equiv="Content-type"/>Zcontentztext/html; charset=x-sjiszutf-8s
charset=utf-8euc_jpscharset=euc_jpz	shift-jisscharset=shift-jiszutf-16zcharset=utf-16)r$rmetarirHrj)rZmeta_tagr$utf_8ry	shift_jisZutf_16_urrrtest_encoding_substitutions



z,TestSubstitutions.test_encoding_substitutioncCs2d}td}|j||d}||jdjddS)Nz`<head><meta content="text/html; charset=x-sjis" http-equiv="Content-type"/></head><pre>foo</pre>Zpre)Z
parse_onlyr)rr$rrrN)rrryr$rrr;test_encoding_substitution_doesnt_happen_if_tag_is_strainedszMTestSubstitutions.test_encoding_substitution_doesnt_happen_if_tag_is_strainedN)rrr rdrerfrgrlrmrorprrrsrurwrxr}r~rrrrr`{s

	
		r`c@sPeZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZdS)TestEncodingz0Test the ability to encode objects into strings.cCs.d}||}||jjddddS)Nu
<b>☃</b>zutf-8u☃)r$rr"rri)rrr$rrr"test_unicode_string_can_be_encodeds
z/TestEncoding.test_unicode_string_can_be_encodedcCs,d}||}||jd|ddS)Nu
<b>☃</b>zutf-8)r$rr"ri)rrr$rrr1test_tag_containing_unicode_string_can_be_encodeds
z>TestEncoding.test_tag_containing_unicode_string_can_be_encodedcCs&d}||}||jdddS)Nu
<b>☃</b>asciis<b>&#9731;</b>)r$rr"ri)rrr$rrr<test_encoding_substitutes_unrecognized_characters_by_defaults
zITestEncoding.test_encoding_substitutes_unrecognized_characters_by_defaultcCs&d}||}|jt|jddddS)Nu
<b>☃</b>rstrict)errors)r$rUnicodeEncodeErrorri)rrr$rrr test_encoding_can_be_made_strict!s
z-TestEncoding.test_encoding_can_be_made_strictcCs$d}||}|d|jdS)Nu
<b>☃</b>u☃)r$rr"Zdecode_contents)rrr$rrrtest_decode_contents's
z!TestEncoding.test_decode_contentscCs.d}||}|dd|jjdddS)Nu
<b>☃</b>u☃rg)rV)r$rrir"Zencode_contents)rrr$rrrtest_encode_contents,s

z!TestEncoding.test_encode_contentscCs*d}||}|dd|jdS)Nu
<b>☃</b>u☃rg)r$rrir"ZrenderContents)rrr$rrrtest_deprecated_renderContents3s
z+TestEncoding.test_deprecated_renderContentscCs8d}||}tr$||t|n|dt|dS)Nu
<b>☃</b>s
<b>\u2603</b>)r$rrrepr)rrr$rrr	test_repr9s

zTestEncoding.test_reprN)rrr r1rrrrrrrrrrrrr
src@s,eZdZddZddZddZddZd	S)
TestNavigableStringSubclassescCsX|d}td}|d||t|d||jddd||jdddS)NrrBr=z<![CDATA[foo]]>)r)r)r$rrrr(r%r)rr$r%rrr
test_cdataCs
z(TestNavigableStringSubclasses.test_cdatacsVd_fdd}d}td}|d|d|j|ddjd	S)
zkText inside a CData object is passed into the formatter.

        But the return value is ignored.
        rcsjd7_dS)Nr=zBITTER FAILURE)count)args)rrr	incrementTszNTestNavigableStringSubclasses.test_cdata_is_never_formatted.<locals>.incrementrz<><><>r=s<![CDATA[<><><>]]>)rbN)rr$rrrri)rrr$r%r)rrtest_cdata_is_never_formattedMs
z;TestNavigableStringSubclasses.test_cdata_is_never_formattedcCs2td}|d}|d|||ddS)NrBrr=s<!DOCTYPE foo>
)r
r$rrri)rZdoctyper$rrrtest_doctype_ends_in_newline_s
z:TestNavigableStringSubclasses.test_doctype_ends_in_newlinecCstd}|d|dS)NrBz<?foo?>)r	rZoutput_ready)rrrrrtest_declarationgsz.TestNavigableStringSubclasses.test_declarationN)rrr rrrrrrrrrAs
rc@seZdZdZddZddZeZddZdd	Zd
dZ	dd
Z
ddZddZddZ
ddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Z d:d;Z!d<d=Z"d>d?Z#d@dAZ$dBdCZ%dDdEZ&dFdGZ'dHdIZ(dJdKZ)dLdMZ*dNdOZ+dPdQZ,dRdSZ-dTdUZ.dVdWZ/dXdYZ0dZd[Z1d\d]Z2d^d_Z3d`daZ4dbdcZ5dddeZ6dfdgZ7dhdiZ8djdkZ9dldmZ:dndoZ;dpdqZ<drS)sTestSoupSelectora
<!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)Nzhtml.parser)rHTMLr$)rrrrrRszTestSoupSelector.setUpc
KsRdd|jj|f|D}|||||d|d|d|fdS)NcSsg|]}|dqS)rr)relrrrrsz2TestSoupSelector.assertSelects.<locals>.<listcomp>z$Selector %s, expected [%s], got [%s]z, )r$selectsortrjoin)rselectorexpected_idskwargsZel_idsrrrrszTestSoupSelector.assertSelectscGs"x|D]\}}|||qWdS)N)assertSelect)rZtestsrrrrrassertSelectMultiplesz%TestSoupSelector.assertSelectMultiplecCsF|jd}|t|d||djd||djdgdS)Nrhr=rz	The title)r$rrr,rNr)relsrrrtest_one_tag_onesz!TestSoupSelector.test_one_tag_onecCsX|jd}|t|dx|D]}||jdq"W|jd}|d|ddS)Nramainr)r$rrr,rN
select_one)rrrarrrrtest_one_tag_manys
z"TestSoupSelector.test_one_tag_manycCs|jd}|d|dS)NZnonexistenttag)r$rr)rmatchrrr(test_select_one_returns_none_if_no_matchsz9TestSoupSelector.test_select_one_returns_none_if_no_matchcCs |jd}|dddgdS)Nzdiv divinnerdata1)r$rr)rrrrrtest_tag_in_tag_onesz$TestSoupSelector.test_tag_in_tag_onecCs&x dD]}||ddddgqWdS)N)zhtml divz
html body divzbody divrrrfooter)r)rrrrrtest_tag_in_tag_manys
z%TestSoupSelector.test_tag_in_tag_manycCsB|jddgdd|jdddgdd|jdd	ddd
gdddS)Nzhtml divrr=)r:z
html body divrr+zbody divrrr>)r)rrrr
test_limitszTestSoupSelector.test_limitcCs|t|jdddS)Ndelr)rr,r$r)rrrrtest_tag_no_matchsz"TestSoupSelector.test_tag_no_matchcCs|t|jjddS)Nztag%t)rrr$r)rrrrtest_invalid_tagsz!TestSoupSelector.test_invalid_tagcCs|dddgdS)Nzcustom-dashed-tagdash1dash2)r)rrrrtest_select_dashed_tag_idssz+TestSoupSelector.test_select_dashed_tag_idscCs6|jd}||djd||ddddS)Nzcustom-dashed-tag[id="dash2"]rzcustom-dashed-tagrr)r$rrrN)rZdashedrrrtest_select_dashed_by_idsz)TestSoupSelector.test_select_dashed_by_idcCs||jddjddS)Nzbody > custom-dashed-tagrzHello there.)rr$rr))rrrrtest_dashed_tag_textsz%TestSoupSelector.test_dashed_tag_textcCs ||jd|jddS)Nzcustom-dashed-tag)rr$rr-)rrrr#test_select_dashed_matches_find_allsz4TestSoupSelector.test_select_dashed_matches_find_allcCs|ddgfdddgfdS)NZh1header1Zh2header2header3)r)rrrrtest_header_tagssz!TestSoupSelector.test_header_tagscCsVxPdD]H}|j|}|t|d||djd||dddgqWdS)N)z.onepzp.onepzhtml p.onepr=rrrmonep)r$rrr,rN)rrrrrrtest_class_ones

zTestSoupSelector.test_class_onecCs |jd}|t|ddS)Nzdiv.onepr)r$rrr,)rrrrrtest_class_mismatched_tagsz*TestSoupSelector.test_class_mismatched_tagcCs xdD]}||dgqWdS)N)z	div#innerz#innerz
div div#innerr)r)rrrrrtest_one_ids
zTestSoupSelector.test_one_idcCs |jd}|t|ddS)Nz
#doesnotexistr)r$rrr,)rrrrrtest_bad_idszTestSoupSelector.test_bad_idcCsf|jd}|t|dx|D]}||jdq"W||dddg||dddS)Nzdiv#inner pr9rr=rmrr)r$rrr,rNr2r1)rrrrrrtest_items_in_ids
z!TestSoupSelector.test_items_in_idcCs*x$dD]}|t|j|dqWdS)N)zdiv#main delzdiv#main div.oopszdiv div#mainr)rr,r$r)rrrrrtest_a_bunch_of_emptys	s
z'TestSoupSelector.test_a_bunch_of_emptyscCs xdD]}||dgqWdS)N)z.class1zp.class1z.class2zp.class2z.class3zp.class3z
html p.class2zdiv#inner .class2pmulti)r)rrrrrtest_multi_class_support
s
z)TestSoupSelector.test_multi_class_supportcCs xdD]}||dgqWdS)N)z.class1.class3z.class3.class2z.class1.class2.class3r)r)rrrrrtest_multi_class_selections
z+TestSoupSelector.test_multi_class_selectioncCs"|dddg|ddgdS)Nz.s1 > as1a1s1a2z.s1 > a spans1a2s1)r)rrrrtest_child_selectorsz$TestSoupSelector.test_child_selectorcCs|ddgdS)Nz.s1 > a#s1a2 spanr)r)rrrrtest_child_selector_idsz'TestSoupSelector.test_child_selector_idcCst|ddgfddgfddgfddgfddgfddgfd	dgfd
gfddgfddgfd
dgfdgfdgfdgfdS)Nzp[class="onep"]p1z
p[id="p1"]z[class="onep"]z	[id="p1"]zlink[rel="stylesheet"]l1zlink[type="text/css"]zlink[href="blah.css"]zlink[href="no-blah.css"]z[rel="stylesheet"]z[type="text/css"]z[href="blah.css"]z[href="no-blah.css"]zp[href="no-blah.css"])r)rrrrtest_attribute_equalssz&TestSoupSelector.test_attribute_equalsc
Cs\|ddgfddgfddgfddgfddgfddgfdd	gfd
d	gfdd	gfdd	gf
dS)
Nzp[class~="class1"]rzp[class~="class2"]zp[class~="class3"]z[class~="class1"]z[class~="class2"]z[class~="class3"]za[rel~="friend"]bobz
a[rel~="met"]z[rel~="friend"]z[rel~="met"])r)rrrrtest_attribute_tilde0sz%TestSoupSelector.test_attribute_tildecCsv|ddgfddgfdgfdgfdgfddgfdd	d
gfdd	d
gfdd
dgfdd
dgfddgfdd
gfddgf
dS)Nz[rel^="style"]rzlink[rel^="style"]znotlink[rel^="notstyle"]z[rel^="notstyle"]zlink[rel^="notstyle"]zlink[href^="bla"]za[href^="http://"]rmez[href^="http://"]z	[id^="p"]rrz	[id^="m"]rzdiv[id^="m"]z
a[id^="m"]zdiv[data-tag^="dashed"]r)r)rrrrtest_attribute_startswith>s



z*TestSoupSelector.test_attribute_startswithcCsH|ddgfddgfddgfdddddd	d
ddgfd
dgfdgfdS)Nz[href$=".css"]rzlink[href$=".css"]z
link[id$="1"]z	[id$="1"]rrrrs2a1rrzdiv[id$="1"]z[id$="noending"])r)rrrrtest_attribute_endswithOsz(TestSoupSelector.test_attribute_endswithcCs|ddgfddgfdgfdgfdgfddgfdd	d
gfddd
gfddgfdd
gfddgfddgfddgfdddd
ddddddg	fddgfdgfdd	d
dgfdd	d
gfd dgfd!dd"gfd#d"gfd$dgfdS)%Nz[rel*="style"]rzlink[rel*="style"]znotlink[rel*="notstyle"]z[rel*="notstyle"]zlink[rel*="notstyle"]zlink[href*="bla"]z[href*="http://"]rrz	[id*="p"]rrzdiv[id*="m"]rz
a[id*="m"]z[href*=".css"]zlink[href*=".css"]z
link[id*="1"]z	[id*="1"]rrrrrrrzdiv[id*="1"]z[id*="noending"]z[href*="."]za[href*="."]zlink[href*="."]zdiv[id*="n"]rz
div[id*="nn"]zdiv[data-tag*="edval"])r)rrrrtest_attribute_containsYs.



z(TestSoupSelector.test_attribute_containscCs2|ddddgfddddgfddgfdgfdS)	Nz
p[lang|="en"]zlang-enz
lang-en-gbz
lang-en-usz[lang|="en"]z
p[lang|="fr"]zlang-frz
p[lang|="gb"])r)rrrrtest_attribute_exact_or_hypenvs
z.TestSoupSelector.test_attribute_exact_or_hypencCsV|ddddgfddgfdddgfddd	d
dgfdd
dgfdgfdgfddgfdS)Nz[rel]rrrz	link[rel]za[rel]z[lang]zlang-enz
lang-en-gbz
lang-en-uszlang-frzp[class]rrz[blah]zp[blah]z
div[data-tag]r)r)rrrrtest_attribute_exists~s

z&TestSoupSelector.test_attribute_existscCs,d}t|d}|d\}|d|jdS)Nz]<div style="display: wrong">nope</div>
        <div style="display: right">yes</div>
        zhtml.parserzdiv[style="display: right"]Zyes)rrrr)rrr$Zchosenrrr"test_quoted_space_in_selector_names
z3TestSoupSelector.test_quoted_space_in_selector_namecCs(|t|jjd|t|jjddS)Nza:no-such-pseudoclassza:nth-of-type(a))rrr$r)rrrrtest_unsupported_pseudoclasssz-TestSoupSelector.test_unsupported_pseudoclasscCs|jd}|t|d||djd|jd}|t|d||djd|jd}|t|d|t|jjddS)	Nzdiv#inner p:nth-of-type(1)r=rz	Some textzdiv#inner p:nth-of-type(3)ZAnotherzdiv#inner p:nth-of-type(4)zdiv p:nth-of-type(0))r$rrr,rrr)rrrrrtest_nth_of_typesz!TestSoupSelector.test_nth_of_typecCs2|jd}|t|d||djddS)Nzdiv#inner > p:nth-of-type(1)r=rz	Some text)r$rrr,r)rrrrr"test_nth_of_type_direct_descendantsz3TestSoupSelector.test_nth_of_type_direct_descendantcCs|ddgdS)Nz#inner > p:nth-of-type(2)r)r)rrrr"test_id_child_selector_nth_of_typesz3TestSoupSelector.test_id_child_selector_nth_of_typecCs.|jjddd}|d}||ddgdS)Nrar)rrr)r$r%rr)rrZselectedrrrtest_select_on_elements
z'TestSoupSelector.test_select_on_elementcCs|ddg|dgdS)Nz
.fancy #innerrz.normal #inner)r)rrrrtest_overspecified_child_idsz,TestSoupSelector.test_overspecified_child_idcCsB|ddg|ddg|ddg|g|jddS)Nz#p1 + h2rz#p1 + h2 + prz#p1 + #header2 + .class1z#p1 + p)rrr$r)rrrrtest_adjacent_sibling_selectorsz/TestSoupSelector.test_adjacent_sibling_selectorcCsR|dddg|ddg|ddg|ddg|g|jddS)	Nz#p1 ~ h2rrz#p1 ~ #header2z#p1 ~ h2 + arz#p1 ~ h2 + [rel="me"]z#inner ~ h2)rrr$r)rrrrtest_general_sibling_selectors
z.TestSoupSelector.test_general_sibling_selectorcCs|t|jjddS)Nzh1 >)rrr$r)rrrrtest_dangling_combinatorsz)TestSoupSelector.test_dangling_combinatorcCs|ddddgdS)Nzp[lang] ~ pz
lang-en-gbz
lang-en-uszlang-fr)r)rrrr2test_sibling_combinator_wont_select_same_tag_twiceszCTestSoupSelector.test_sibling_combinator_wont_select_same_tag_twicecCs|dddgdS)Nzx, yxidyid)r)rrrrtest_multiple_selectsz%TestSoupSelector.test_multiple_selectcCs|dddgdS)Nzx,yrr)r)rrrr"test_multiple_select_with_no_spacesz3TestSoupSelector.test_multiple_select_with_no_spacecCs|dddgdS)Nzx,    yrr)r)rrrr$test_multiple_select_with_more_spacesz5TestSoupSelector.test_multiple_select_with_more_spacecCs|ddgdS)Nzx, xr)r)rrrrtest_multiple_select_duplicatedsz0TestSoupSelector.test_multiple_select_duplicatedcCs|dddgdS)Nzx, y ~ p[lang=fr]rzlang-fr)r)rrrrtest_multiple_select_siblingsz-TestSoupSelector.test_multiple_select_siblingcCs|dddgdS)Nzx, y > zrzidb)r)rrrr.test_multiple_select_tag_and_direct_descendantsz?TestSoupSelector.test_multiple_select_tag_and_direct_descendantc	Cs|dddddddgdS)Nz
div > x, y, zrrzidarzidabzidac)r)rrrr/test_multiple_select_direct_descendant_and_tagssz@TestSoupSelector.test_multiple_select_direct_descendant_and_tagsc	Cs|dddddddgdS)Nzdiv x,y,  zrrrrrr)r)rrrr(test_multiple_select_indirect_descendantsz9TestSoupSelector.test_multiple_select_indirect_descendantcCs(|t|jjd|t|jjddS)Nz,x, yzx,,y)rrr$r)rrrrtest_invalid_multiple_selectsz-TestSoupSelector.test_invalid_multiple_selectcCs|dddgdS)Nzp[lang=en], p[lang=en-gb]zlang-enz
lang-en-gb)r)rrrrtest_multiple_select_attrssz+TestSoupSelector.test_multiple_select_attrscCs|ddddgdS)Nz*x, y > z[id=zida], z[id=zidab], z[id=zidb]rrr)r)rrrrtest_multiple_select_idssz)TestSoupSelector.test_multiple_select_idscCs|dddgdS)Nzbody > div > x, y > zrr)r)rrrrtest_multiple_select_nestedsz,TestSoupSelector.test_multiple_select_nestedN)=rrr rrRrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrkst1
	
	r)2r1ZpdbrrSrMr6r+Zbs4rZbs4.builderrrZbs4.elementrrrr	r
rrr
Zbs4.testingrrrrZLXML_PRESENTrr!r2rLrPrdrrrrrrrrrrr'rBrLr`rrrrrrr<module>
sN(
;N83(3--*"n'a4*