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/testing.pyc
�
��\[c@sdZdZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZddlmZeZdejfd	��YZd
efd��YZdefd
��YZdefd��YZd�ZdS(sHelper classes for tests.tMITi����N(tTestCase(t
BeautifulSoup(tCharsetMetaAttributeValuetCommenttContentMetaAttributeValuetDoctypetSoupStrainer(tHTMLParserTreeBuildertSoupTestcBs>eZed��Zd�Zd�Zdd�Zd�ZRS(cCst�S(N(tdefault_builder(tself((s//usr/lib/python2.7/site-packages/bs4/testing.pyR
scKs(|jd|j�}t|d||�S(s*Build a Beautiful Soup object from markup.tbuilder(tpopR
R(RtmarkuptkwargsR((s//usr/lib/python2.7/site-packages/bs4/testing.pytsoup scCs|jj|�S(s[Turn an HTML fragment into a document.

        The details depend on the builder.
        (R
ttest_fragment_to_document(RR((s//usr/lib/python2.7/site-packages/bs4/testing.pytdocument_for%scCsS|j}t|d|�}|dkr0|}n|j|j�|j|��dS(NR(R
RtNonetassertEqualtdecodeR(Rtto_parsetcompare_parsed_toRtobj((s//usr/lib/python2.7/site-packages/bs4/testing.pytassertSoupEquals,s
		cCsSd}xF|jD];}|rE|j||j�|j||j�n|}qWdS(syEnsure that next_element and previous_element are properly
        set for all descendants of the given element.
        N(RtdescendantsRtnext_elementtprevious_element(Rtelementtearlierte((s//usr/lib/python2.7/site-packages/bs4/testing.pytassertConnectedness4sN(	t__name__t
__module__tpropertyR
RRRRR (((s//usr/lib/python2.7/site-packages/bs4/testing.pyR	s
		tHTMLTreeBuilderSmokeTestcBseZdZd�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#�Zd$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d,�Z-d-�Z.d.�Z/d/�Z0d0�Z1d1�Z2d2�Z3d3�Z4d4�Z5d5�Z6d6�Z7d7�Z8d8�Z9RS(9sCA basic test of a treebuilder's competence.

    Any HTML treebuilder, present or future, should be able to pass
    these tests. With invalid markup, there's room for interpretation,
    and different parsers can handle it differently. But with the
    markup in these tests, there's not much room for interpretation.
    cCs|xuddddddddd	d
ddd
dddddgD]7}|jd�}|j|�}|jt|j�q=WdS(smVerify that all HTML4 and HTML5 empty element (aka void element) tags
        are handled correctly.
        tareatbasetbrtcoltembedthrtimgtinputtkeygentlinktmenuitemtmetatparamtsourcettracktwbrtspacertframetN(Rtnew_tagRtTruetis_empty_element(RtnameRR8((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_empty_element_tagsIs0cCsc|jd�}tj|d�}tj|�}|j|jt�|j|j�|j��dS(Ns
<a><b>foo</a>i(RtpickletdumpstloadsRt	__class__RR(Rttreetdumpedtloaded((s//usr/lib/python2.7/site-packages/bs4/testing.pyt!test_pickle_and_unpickle_identityUs
cCs�|j|�\}}|jd}|j|jt�|j||�|jt|�t|� |�|j|jjdd�dS(s8Assert that a given doctype string is handled correctly.itfooN(t_document_with_doctypetcontentsRR@Rtstrtlentp(Rtdoctype_fragmenttdoctype_strRtdoctype((s//usr/lib/python2.7/site-packages/bs4/testing.pytassertDoctypeHandled^s
 cCs-d|}|d}|j|�}||fS(s5Generate and parse a document with the given doctype.s
<!DOCTYPE %s>s
<p>foo</p>(R(RRKRMRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyRFls

cCs|jd�|jd�dS(s?Make sure normal, everyday HTML doctypes are handled correctly.thtmls4html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"N(RN(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_normal_doctypesss
cCs6|jd�}|jd}|jd|j��dS(Ns
<!DOCTYPE>iR7(RRGRtstrip(RRRM((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_empty_doctypeys
cCsd}|j|�dS(Nsnhtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"(RN(RRM((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_public_doctype_with_url~scCs|jd�dS(Ns$foo SYSTEM "http://www.example.com/"(RN(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_system_doctype�scCs|jd�dS(Ns#xsl:stylesheet SYSTEM "htmlent.dtd"(RN(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_namespaced_system_doctype�scCs|jd�dS(Ns#xsl:stylesheet PUBLIC "htmlent.dtd"(RN(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_namespaced_public_doctype�scCsJd}|j|�}|j|jd�jdd�|jdd��dS(sJA real XHTML document should come out more or less the same as it went in.s�<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Hello.</title></head>
<body>Goodbye.</body>
</html>sutf-8s
R7N(RRtencodetreplace(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_real_xhtml_document�s
cCs8d}|j|�}|jdt|jd���dS(stWhen a namespaced XML document is parsed as HTML it should
        be treated as HTML with weird tag names.
        s.<ns1:foo>content</ns1:foo><ns1:foo/><ns2:foo/>isns1:fooN(RRRItfind_all(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_namespaced_html�scCs]d}|j|�}|j||j��d}|j|�}|j||jd��dS(Nu<?PITarget PIContent?>s<?PITarget PIContent?>tutf8(RRRRW(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_processing_instruction�scCstj|j�dS(s�Make sure you can copy the tree builder.

        This is important because the builder is part of a
        BeautifulSoup object, and we want to be able to copy that.
        N(tcopytdeepcopyR
(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyt
test_deepcopy�scCs?|jd�}|j|jj�|jt|j�d�dS(s�A <p> tag is never designated as an empty-element tag.

        Even if the markup shows it as an empty-element tag, it
        shouldn't be presented that way.
        s<p/>s<p></p>N(RtassertFalseRJR:RRH(RR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt!test_p_tag_is_never_empty_element�scCs4|jdd�|jdd�|jdd�dS(s�A tag that's not closed by the end of the document should be closed.

        This applies to all tags except empty-element tags.
        s<p>s<p></p>s<b>s<b></b>s<br>s<br/>N(R(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_unclosed_tags_get_closed�scCs?|jd�}|j|jj�|jt|j�d�dS(s�A <br> tag is designated as an empty-element tag.

        Some parsers treat <br></br> as one <br/> tag, some parsers as
        two tags, but it should always be an empty-element tag.
        s	<br></br>s<br/>N(Rt
assertTrueR'R:RRH(RR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt#test_br_is_always_empty_element_tag�scCs|jd�dS(Ns<em><em></em></em>(R(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_nested_formatting_elements�scCs6d}|j|�}|jd|jd�d�dS(Ns�<!DOCTYPE html>
<html>
<head>
<title>Ordinary HEAD element test</title>
</head>
<script type="text/javascript">
alert("Help!");
</script>
<body>
Hello, world!
</body>
</html>
stext/javascripttscriptttype(RRtfind(RROR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_double_head�s
cCs�d}|j|�|j|�}|jdd�}|j|jt�|jdd�}|j||j�|jdd�}|j||j�dS(Ns<p>foo<!--foobar-->baz</p>ttexttfoobarREtbaz(RRRiRR@RRR(RRRtcommentRERm((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_comment�s
cCs�d}d}|j|�|j|�|j|�}|j|jj�|�|j|�}|j|jj�|�|jd�}|j|jj�d�dS(sWhitespace must be preserved in <pre> and <textarea> tags,
        even if that would mean not prettifying the markup.
        s<pre>   </pre>s<textarea> woo
woo  </textarea>s<textarea></textarea>N(RRRtpretprettifyttextarea(Rt
pre_markupttextarea_markupR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt-test_preserved_whitespace_in_pre_and_textarea�s

cCs=d}|j|�d}|j|�d}|j|�dS(s+Inline elements can be nested indefinitely.s<b>Inside a B tag</b>s!<p>A <i>nested <b>tag</b></i></p>s/<p>A <a>doubly <i>nested <b>tag</b></i></a></p>N(R(Rtb_tagtnested_b_tagtdouble_nested_b_tag((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_nested_inline_elements
s

cCsK|jd�}|j}|j|jjjd�|j|jjd�dS(sBlock elements can be nested.s*<blockquote><p><b>Foo</b></p></blockquote>tFooN(Rt
blockquoteRRJtbtstring(RRR{((s//usr/lib/python2.7/site-packages/bs4/testing.pyt test_nested_block_level_elementss	cCs'd}|j|d�|jd�dS(s$One table can go inside another one.s[<table id="1"><tr><td>Here's another table:<table id="2"><tr><td>foo</td></tr></table></td>sh<table id="1"><tr><td>Here's another table:<table id="2"><tr><td>foo</td></tr></table></td></tr></table>s{<table><thead><tr><td>Foo</td></tr></thead><tbody><tr><td>Bar</td></tr></tbody><tfoot><tr><td>Baz</td></tr></tfoot></table>N(R(RR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_correctly_nested_tablesscCs6d}|j|�}|jdg|jjd�dS(Ns1<table><div><div class="css"></div></div></table>tcsstclass(RRtdiv(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt(test_deeply_nested_multivalued_attribute0scCs6d}|j|�}|jddg|jd�dS(Ns<html class="a b"></html>taR|R�(RRRO(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt"test_multivalued_attribute_on_html8scCs|jdd�dS(Ns<a b="<a>"></a>s<a b="&lt;a&gt;"></a>(R(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyt3test_angle_brackets_in_attribute_values_are_escaped@scCs|jdd�dS(Nu$<p>&bull; AT&T is in the s&p 500</p>u)<p>• AT&amp;T is in the s&amp;p 500</p>(R(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyt3test_strings_resembling_character_entity_referencesCscCs/d}|j|�}|jd|jj�dS(Ns%<p>&#147;Hello&#148; &#45;&#9731;</p>u“Hello” -☃(RtassertEqualsRJR}(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt*test_entities_in_foreign_document_encodingKscCsJd}|jd|�|jd|�|jd|�|jd|�dS(Nu<p id="piñata"></p>s<p id="pi&#241;ata"></p>s<p id="pi&#xf1;ata"></p>s<p id="pi&#Xf1;ata"></p>s<p id="pi&ntilde;ata"></p>(R(Rtexpect((s//usr/lib/python2.7/site-packages/bs4/testing.pyt0test_entities_in_attributes_converted_to_unicodeWs
cCsJd}|jd|�|jd|�|jd|�|jd|�dS(Nu<p>piñata</p>s<p>pi&#241;ata</p>s<p>pi&#xf1;ata</p>s<p>pi&#Xf1;ata</p>s<p>pi&ntilde;ata</p>(R(RR�((s//usr/lib/python2.7/site-packages/bs4/testing.pyt*test_entities_in_text_converted_to_unicode^s
cCs|jdd�dS(Ns#<p>I said &quot;good day!&quot;</p>s<p>I said "good day!"</p>(R(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyt,test_quot_entity_converted_to_quotation_markes	cCs:d}|jd|�|jd|�|jd|�dS(Nu�s&#10000000000000;s&#x10000000000000;s
&#1000000000;(R(RR�((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_out_of_range_entityiscCsR|jd�}|jd|jjjj�|jd|jj�|j|�dS(sDMostly to prevent a recurrence of a bug in the html5lib treebuilder.s!<html><h2>
foo</h2><p></p></html>RJN(RRth2R}RR;RJR (RR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_multipart_stringsoscCs$|jdd�|jdd�dS(sqVerify consistent handling of empty-element tags,
        no matter how they come in through the markup.
        s<br/><br/><br/>s<br /><br /><br />N(R(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyR<vscCs<d}|j|�}|jd|jj�|j|�dS(s8Prevent recurrence of a bug in the html5lib treebuilder.s?<html><head></head>
  <link></link>
  <body>foo</body>
</html>
N(RtassertNotEqualRROtbodyR (RtcontentR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt#test_head_tag_between_head_and_body}scCs)d}|j|�}|j|j�dS(s8Prevent recurrence of a bug in the html5lib treebuilder.s�<!DOCTYPE html>
<html>
 <body>
   <article id="a" >
   <div><a href="1"></div>
   <footer>
     <a href="2"></a>
   </footer>
  </article>
  </body>
</html>
N(RR tarticle(RR�R((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_multiple_copies_of_a_tag�s
cCs}d}|j|�}|j||j��|j}|jd|jd�|jd|jd�|jd|jd�dS(	s�Parsers don't need to *understand* namespaces, but at the
        very least they should not choke on namespaces or lose
        data.s�<html xmlns="http://www.w3.org/1999/xhtml" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:svg="http://www.w3.org/2000/svg"><head></head><body><mathml:msqrt>4</mathml:msqrt><b svg:fill="red"></b></body></html>shttp://www.w3.org/1999/xhtmltxmlnss"http://www.w3.org/1998/Math/MathMLsxmlns:mathmlshttp://www.w3.org/2000/svgs	xmlns:svgN(RRRWRO(RRRRO((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_basic_namespaces�s	cCs6d}|j|�}|jddg|jd�dS(Ns<a class="foo bar">REtbarR�(RRR�(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt-test_multivalued_attribute_value_becomes_list�scCs/d}|j|�}|jd|jj�dS(NuD<html><head><meta encoding="euc-jp"></head><body>Sacré bleu!</body>uSacré bleu!(RRR�R}(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_can_parse_unicode_document�scCs;td�}|jdd|�}|j|j�d�dS(s2Parsers should be able to work with SoupStrainers.R|s&A <b>bold</b> <meta/> <i>statement</i>t
parse_onlys<b>bold</b>N(RRRR(RtstrainerR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_soupstrainer�s	cCs|jdd�dS(Ns<foo attr='bar'></foo>s<foo attr="bar"></foo>(R(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyt7test_single_quote_attribute_values_become_double_quotes�s	cCsd}|j|�dS(Ns'<foo attr='bar "brawls" happen'>a</foo>(R(RRk((s//usr/lib/python2.7/site-packages/bs4/testing.pyt7test_attribute_values_with_nested_quotes_are_left_alone�scCs?d}|j|�}d|jd<|j|jj�d�dS(Ns'<foo attr='bar "brawls" happen'>a</foo>sBrawls happen at "Bob's Bar"tattrs:<foo attr="Brawls happen at &quot;Bob's Bar&quot;">a</foo>(RRERR(RRkR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt:test_attribute_values_with_double_nested_quotes_get_quoted�s
cCs$|jdd�|jdd�dS(Ns+<this is="really messed up & stuff"></this>s/<this is="really messed up &amp; stuff"></this>s.<a href="http://example.org?a=1&b=2;3">foo</a>s2<a href="http://example.org?a=1&amp;b=2;3">foo</a>(R(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyt.test_ampersand_in_attribute_value_gets_escaped�s
	cCs|jd�dS(Ns/<a href="http://example.org?a=1&amp;b=2;3"></a>(R(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyt7test_escaped_ampersand_in_attribute_value_is_left_alone�scCs d}d}|j||�dS(Ns-<p>&lt;&lt;sacr&eacute;&#32;bleu!&gt;&gt;</p>u#<p>&lt;&lt;sacré bleu!&gt;&gt;</p>(R(RRktexpected((s//usr/lib/python2.7/site-packages/bs4/testing.pyt1test_entities_in_strings_converted_during_parsing�scCs/d}|j|�}|j|jjd�dS(Ns<p>�Foo�</p>u	‘Foo’(RRRJR}(RtquoteR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt)test_smart_quotes_converted_on_the_way_in�s
	cCs)|jd�}|j|jjd�dS(Ns<a>&nbsp;&nbsp;</a>u iu  (RRR�R}(RR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt0test_non_breaking_spaces_converted_on_the_way_in�scCsDd}djd�}|j|�}|j|jjd�|�dS(Ns-<p>&lt;&lt;sacr&eacute;&#32;bleu!&gt;&gt;</p>u#<p>&lt;&lt;sacré bleu!&gt;&gt;</p>sutf-8(RWRRRJ(RRkR�R((s//usr/lib/python2.7/site-packages/bs4/testing.pyt&test_entities_converted_on_the_way_out�scCshd}|jd�}|j|�}|jd�}|jdd�}|jd�}|j||�dS(Nu�<html><head><meta content="text/html; charset=ISO-Latin-1" http-equiv="Content-type"/></head><body><p>Sacré bleu!</p></body></html>s
iso-8859-1sutf-8sISO-Latin-1(RWRRXR(Rtunicode_htmltiso_latin_htmlRtresultR�((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_real_iso_latin_document�scCsld}|jd�}|j|�}|j|jd�|jd��|j|jd�|jd��dS(Nsk<html><head></head><body><pre>�����Shift-JIS�ŃR�[�f�B���O���ꂽ���{��̃t�@�C���ł��B</pre></body></html>s	shift-jissutf-8teuc_jp(RRRRW(Rtshift_jis_htmlR�R((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_real_shift_jis_documents
"cCs_d}|j|dd�}|jdks0t�|j|jd�|jd�jd��dS(Ns�<html><head><title>Hebrew (ISO 8859-8) in Visual Directionality</title></head><body><h1>Hebrew (ISO 8859-8) in Visual Directionality</h1>���</body></html>t
from_encodings	iso8859-8s
iso-8859-8sutf-8(s	iso8859-8s
iso-8859-8(Rtoriginal_encodingtAssertionErrorRRWR(Rthebrew_documentR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_real_hebrew_document$scCs�d}d|}|j|�}|jdidd6�}|d}|jd|�|jt|t��|jd|jd	��dS(
NsE<meta content="text/html; charset=x-sjis" http-equiv="Content-type"/>sj<html><head>
%s
<meta http-equiv="Content-language" content="ja"/></head><body>Shift-JIS markup goes here.R0sContent-types
http-equivR�stext/html; charset=x-sjisstext/html; charset=utf8R\(RRiRRdt
isinstanceRRW(Rtmeta_tagR�Rtparsed_metaR�((s//usr/lib/python2.7/site-packages/bs4/testing.pyt'test_meta_tag_reflects_current_encoding1s
cCs�d}d|}|j|�}|jddd�}|d}|jd|�|jt|t��|jd|jd��dS(	Ns'<meta id="encoding" charset="x-sjis" />sj<html><head>
%s
<meta http-equiv="Content-language" content="ja"/></head><body>Shift-JIS markup goes here.R0tidtencodingtcharsetsx-sjisR\(RRiRRdR�RRW(RR�R�RR�R�((s//usr/lib/python2.7/site-packages/bs4/testing.pyt3test_html5_style_meta_tag_reflects_current_encodingMs
cCs9|jd�}d|jd<|jd|jj��dS(Ns<a>text</a>R�REs<a foo="bar">text</a>(RR�RR(Rtdata((s//usr/lib/python2.7/site-packages/bs4/testing.pyt5test_tag_with_no_attributes_can_have_attributes_addedes
(:R!R"t__doc__R<RDRNRFRPRRRSRTRURVRYR[R]R`RbRcReRfRjRoRuRyR~RR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s//usr/lib/python2.7/site-packages/bs4/testing.pyR$?sr												
		
		
	
	
																																					
		tXMLTreeBuilderSmokeTestcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�ZRS(cCsc|jd�}tj|d�}tj|�}|j|jt�|j|j�|j��dS(Ns
<a><b>foo</a>i(RR=R>R?RR@RR(RRARBRC((s//usr/lib/python2.7/site-packages/bs4/testing.pyRDls
cCs)|jd�}|j|j�d�dS(Ns<root/>s.<?xml version="1.0" encoding="utf-8"?>
<root/>(RRRW(RR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_docstring_generateduscCs2d}|j|�}|j||jd��dS(Ns,<?xml version="1.0" encoding="utf8"?>
<foo/>R\(RRRW(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_xml_declarationzscCs2d}|j|�}|j||jd��dS(Ns<<?xml version="1.0" encoding="utf8"?>
<?PITarget PIContent?>R\(RRRW(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyR]scCs2d}|j|�}|j|jd�|�dS(sGA real XHTML document should come out *exactly* the same as it went in.s�<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Hello.</title></head>
<body>Goodbye.</body>
</html>sutf-8N(RRRW(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyRY�scCs/d}|j|�}|j||j��dS(Ns<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<parent xmlns="http://ns1/">
<child xmlns="http://ns2/" xmlns:ns3="http://ns3/">
<grandchild ns3:attr="value" xmlns="http://ns4/"/>
</child>
</parent>(RRRW(RtdocR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_nested_namespaces�scCsDd}t|d�}d|j_|j�}|jd|k�dS(Ns/
  <script type="text/javascript">
  </script>
slxml-xmlsconsole.log("< < hey > > ");s&lt; &lt; hey &gt; &gt;(RRgR}RWRd(RR�Rtencoded((s//usr/lib/python2.7/site-packages/bs4/testing.pyt5test_formatter_processes_script_tag_for_xml_documents�s
cCs/d}|j|�}|jd|jj�dS(Nu?<?xml version="1.0" encoding="euc-jp"><root>Sacré bleu!</root>uSacré bleu!(RRtrootR}(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyR��scCs2d}|j|�}|jt|j�|�dS(Ns�<rss xmlns:dc="foo"><dc:creator>b</dc:creator><dc:date>2012-07-02T20:33:42Z</dc:date><dc:rights>c</dc:rights><image>d</image></rss>(RRtunicodetrss(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_popping_namespaced_tag�scCs,|jd�}|j|jd�d�dS(Ns<root/>tlatin1s/<?xml version="1.0" encoding="latin1"?>
<root/>(RRRW(RR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt(test_docstring_includes_correct_encoding�scCs>dddd}|j|�}|j|jd�|�dS(	s<A large XML document should come out the same as it went in.s-<?xml version="1.0" encoding="utf-8"?>
<root>t0iis</root>sutf-8Ni(RRRW(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_large_xml_document�scCs!|jdd�|jd�dS(Ns<p>s<p/>s
<p>foo</p>(R(R((s//usr/lib/python2.7/site-packages/bs4/testing.pyt9test_tags_are_empty_element_if_and_only_if_they_are_empty�scCsJd}|j|�}|j}|jd|d�|jd|d�dS(Ns�<root xmlns:a="http://example.com/" xmlns:b="http://example.net/"><a:foo>This tag is in the a namespace</a:foo><b:foo>This tag is in the b namespace</b:foo></root>shttp://example.com/sxmlns:ashttp://example.net/sxmlns:b(RR�R(RRRR�((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_namespaces_are_preserved�s
	cCs2d}|j|�}|jt|j�|�dS(NsN<p xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:date>20010504</dc:date></p>(RRR�RJ(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_closing_namespaced_tag�scCs2d}|j|�}|jt|j�|�dS(Nss<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><bar xsi:schemaLocation="http://www.example.com"/></foo>(RRR�RE(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_namespaced_attributes�scCs2d}|j|�}|jt|j�|�dS(Ns<foo xml:lang="fr">bar</foo>(RRR�RE(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt(test_namespaced_attributes_xml_namespace�scCs�d}|j|�}|jdt|jd���|jdt|jd���|jdt|jd���|jdt|jddd	���|jdt|jddg���dS(
Ns<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="http://example.com/ns0"
    xmlns:ns1="http://example.com/ns1"
    xmlns:ns2="http://example.com/ns2"
    <ns1:tag>foo</ns1:tag>
    <ns1:tag>bar</ns1:tag>
    <ns2:tag key="value">baz</ns2:tag>
</Document>
ittagisns1:tagisns2:tagtkeytvalue(RRRIRZ(RR�R((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_find_by_prefixed_name�s	%cCsGd}|j|�}|j}tj|�}|j|j|j�dS(Nsf<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://example.com/ns0"/>(RtdocumentR^Rtprefix(RtxmlRR�t	duplicate((s//usr/lib/python2.7/site-packages/bs4/testing.pyt!test_copy_tag_preserves_namespace�s
	(R!R"RDR�R�R]RYR�R�R�R�R�R�R�R�R�R�R�R�R�(((s//usr/lib/python2.7/site-packages/bs4/testing.pyR�js$																			tHTML5TreeBuilderSmokeTestcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s2Smoke test for a tree builder that supports HTML5.cCsdS(N((R((s//usr/lib/python2.7/site-packages/bs4/testing.pyRYscCs/d}|j|�}|jd|jj�dS(Ns<a>shttp://www.w3.org/1999/xhtml(RRR�t	namespace(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_html_tags_have_namespacescCsKd}|j|�}d}|j||jj�|j||jj�dS(Ns<svg><circle/></svg>shttp://www.w3.org/2000/svg(RRtsvgR�tcircle(RRRR�((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_svg_tags_have_namespace
s
cCsKd}|j|�}d}|j||jj�|j||jj�dS(Ns<math><msqrt>5</msqrt></math>s"http://www.w3.org/1998/Math/MathML(RRtmathR�tmsqrt(RRRR�((s//usr/lib/python2.7/site-packages/bs4/testing.pyttest_mathml_tags_have_namespaces
cCsjd}|j|�}|jt|jdt��|j|jdd�|jd|jdjj�dS(Ns3<?xml version="1.0" encoding="utf-8"?><html></html>is$?xml version="1.0" encoding="utf-8"?RO(RRdR�RGRRRR;(RRR((s//usr/lib/python2.7/site-packages/bs4/testing.pyt$test_xml_declaration_becomes_comments
(R!R"R�RYR�R�R�R�(((s//usr/lib/python2.7/site-packages/bs4/testing.pyR��s				csd����fd�}|S(Nc_sdS(N(R(ttesttargsR((s//usr/lib/python2.7/site-packages/bs4/testing.pytnothing!scs�r
�S|SdS(N((t	test_item(t	conditionR�(s//usr/lib/python2.7/site-packages/bs4/testing.pyt	decorator$s((R�treasonR�((R�R�s//usr/lib/python2.7/site-packages/bs4/testing.pytskipIf s	(R�t__license__R=R^t	functoolstunittestRtbs4Rtbs4.elementRRRRRtbs4.builderRR
R	tobjectR$R�R�R�(((s//usr/lib/python2.7/site-packages/bs4/testing.pyt<module>s"(%��-�#