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_soup.pyo
�
�Wc@s�dZddlmZddlZddlZddlZddlZddlmZm	Z	ddl
mZmZm
Z
mZddlZddlmZmZmZddlmZmZddlZy ddlmZmZeZWnek
rZeZnXejd	d
ko#ejdkZ defd
��YZ!defd��YZ"defd��YZ"defd��YZ#dej$fd��YZ%defd��YZ&dej$fd��YZ'defd��YZ(dej$fd��YZ)dS(s#Tests of Beautiful Soup as a whole.i����(t	set_traceN(t
BeautifulSouptBeautifulStoneSoup(tCharsetMetaAttributeValuetContentMetaAttributeValuetSoupStrainertNamespacedAttribute(tEntitySubstitutiont
UnicodeDammittEncodingDetector(tSoupTesttskipIf(tLXMLTreeBuildertLXMLTreeBuilderForXMLiiitTestConstructorcBs#eZd�Zd�Zd�ZRS(cCs/d}|j|�}|jd|jj�dS(Nu
<h1>éé</h1>uéé(tsouptassertEqualth1tstring(tselftdataR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_short_unicode_input*scCs/d}|j|�}|jd|jj�dS(Nu<h1>foobar</h1>ufoobar(RRRR(RRR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_embedded_null/scCs>djd�}|j|ddg�}|jd|j�dS(Nu
Räksmörgåssutf-8texclude_encodingsswindows-1252(tencodeRRtoriginal_encoding(Rt	utf8_dataR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_exclude_encodings4s(t__name__t
__module__RRR(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyR(s		tTestWarningscBsJeZed�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cCs'|jtjd �}|j|�dS(NiP(t
startswithRtNO_PARSER_SPECIFIED_WARNINGt
assertTrue(Rtstis_theretv((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt_no_parser_specified<scCsNtjdt��}|jd�}WdQXt|dj�}|j|�dS(Ntrecords<a><b></b></a>i(twarningstcatch_warningstTrueRtstrtmessaget_assert_no_parser_specified(RtwRtmsg((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt#test_warning_if_no_parser_specified@scCsQtjdt��}|jdd�}WdQXt|dj�}|j|�dS(NR&s<a><b></b></a>thtmli(R'R(R)RR*R+R,(RR-RR.((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt*test_warning_if_parser_specified_too_vagueFscCsAtjdt��}|jdd�}WdQX|jg|�dS(NR&s<a><b></b></a>shtml.parser(R'R(R)RR(RR-R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt,test_no_warning_if_explicit_parser_specifiedLsc	Cs�tjdt��"}|jddtd��}WdQXt|dj�}|jd|k�|jd|k�|jd|j	��dS(NR&s<a><b></b></a>tparseOnlyThesetbit
parse_onlys<b></b>(
R'R(R)RRR*R+R!RR(RR-RR.((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt)test_parseOnlyThese_renamed_to_parse_onlyQs!cCs�tjdt��"}d}|j|dd�}WdQXt|dj�}|jd|k�|jd|k�|jd|j�dS(NR&sétfromEncodingtutf8it
from_encoding(	R'R(R)RR*R+R!RR(RR-R8RR.((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt*test_fromEncoding_renamed_to_from_encodingYscCs |jt|jddt�dS(Ns<a>tno_such_argument(tassertRaisest	TypeErrorRR)(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt"test_unrecognized_keyword_argumentbs(
RRR)R%R/R1R2R6R:R>(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyR:s						cBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs�tj�}|j}zTtjdt��}|j|�}WdQXt|dj�}|j	d|k�Wd|j
�Xtjdt��}|j|�}WdQX|jdt|��dS(NR&islooks like a filename(
ttempfiletNamedTemporaryFiletnameR'R(R)RR*R+R!tcloseRtlen(Rt
filehandletfilenameR-RR.((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_disk_file_warninghs	cCsKtjdt��}|jd�}WdQX|jtd�|D���dS(NR&shttp://www.crummybytes.com/css$|]}dt|j�kVqdS(slooks like a URLN(R*R+(t.0R-((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pys	<genexpr>}s(R'R(R)RR!tany(Rtwarning_listR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_url_warning_with_bytes_urlxscCsKtjdt��}|jd�}WdQX|jtd�|D���dS(NR&uhttp://www.crummyunicode.com/css$|]}dt|j�kVqdS(slooks like a URLN(R*R+(RGR-((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pys	<genexpr>�s(R'R(R)RR!RH(RRIR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt!test_url_warning_with_unicode_url�scCsKtjdt��}|jd�}WdQX|jtd�|D���dS(NR&s$http://www.crummybytes.com/ is greatcss$|]}dt|j�kVqdS(slooks like a URLN(R*R+(RGR-((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pys	<genexpr>�s(R'R(R)RtassertFalseRH(RRIR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt%test_url_warning_with_bytes_and_space�scCsKtjdt��}|jd�}WdQX|jtd�|D���dS(NR&u%http://www.crummyuncode.com/ is greatcss$|]}dt|j�kVqdS(slooks like a URLN(R*R+(RGR-((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pys	<genexpr>�s(R'R(R)RRLRH(RRIR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt'test_url_warning_with_unicode_and_space�s(RRRFRJRKRMRN(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyRfs
				tTestSelectiveParsingcBseZd�ZRS(cCsAd}td�}|j|d|�}|j|j�d�dS(Ns&No<b>Yes</b><a>No<b>Yes <c>Yes</c></b>R4R5s<b>Yes</b><b>Yes <c>Yes</c></b>(RRRR(RtmarkuptstrainerR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_parse_with_soupstrainer�s(RRRR(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyRO�stTestEntitySubstitutioncBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�ZRS(s1Standalone tests of the EntitySubstitution class.cCs
t|_dS(N(Rtsub(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pytsetUp�scCs&d}|j|jj|�d�dS(Nufoo∀☃õbarufoo&forall;☃&otilde;bar(RRTtsubstitute_html(RR"((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_simple_html_substitution�scCs5d}t|�}|j|jj|j�d�dS(Ns��foo��s&lsquo;&rsquo;foo&ldquo;&rdquo;(RRRTRVRP(Rtquotestdammit((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_smart_quote_substitution�scCs)d}|j|jj|t�|�dS(NsWelcome to "my bar"(RRTtsubstitute_xmltFalse(RR"((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pytItest_xml_converstion_includes_no_quotes_if_make_quoted_attribute_is_false�scCsB|j|jjdt�d�|j|jjdt�d�dS(NtWelcomes	"Welcome"s	Bob's Bars"Bob's Bar"(RRTR[R)(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt6test_xml_attribute_quoting_normally_uses_double_quotes�scCs)d}|j|jj|t�d�dS(NsWelcome to "my bar"s'Welcome to "my bar"'(RRTR[R)(RR"((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pytOtest_xml_attribute_quoting_uses_single_quotes_when_value_contains_double_quotes�scCs)d}|j|jj|t�d�dS(NsWelcome to "Bob's Bar"s""Welcome to &quot;Bob's Bar&quot;"(RRTR[R)(RR"((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pytbtest_xml_attribute_quoting_escapes_single_quotes_when_value_contains_both_single_and_double_quotes�scCs&d}|j|jj|�|�dS(NsWelcome to "Bob's Bar"(RRTR[(Rtquoted((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt<test_xml_quotes_arent_escaped_when_value_is_not_being_quoted�scCs |j|jjd�d�dS(Nsfoo<bar>sfoo&lt;bar&gt;(RRTR[(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt'test_xml_quoting_handles_angle_brackets�scCs |j|jjd�d�dS(NsAT&TsAT&amp;T(RRTR[(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt#test_xml_quoting_handles_ampersands�scCs |j|jjd�d�dS(Ns&Aacute;T&Ts&amp;Aacute;T&amp;T(RRTR[(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pytEtest_xml_quoting_including_ampersands_when_they_are_part_of_an_entity�scCs |j|jjd�d�dS(Ns&Aacute;T&Ts&Aacute;T&amp;T(RRTt"substitute_xml_containing_entities(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pytDtest_xml_quoting_ignoring_ampersands_when_they_are_part_of_an_entity�scCs&d}|j|jj|�|�dS(s:There's no need to do this except inside attribute values.sBob's "bar"N(RRTRV(Rttext((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt test_quotes_not_html_substituted�s(RRt__doc__RURWRZR]R_R`RaRcRdReRfRhRj(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyRS�s												tTestEncodingConversioncBsMeZd�Zd�Zd�Zd�Zd�Zeed�d��Z	RS(cCsHtt|�j�d|_|jjd�|_|j|jd�dS(NuU<html><head><meta charset="utf-8"/></head><body><foo>Sacré bleu!</foo></body></html>sutf-8sU<html><head><meta charset="utf-8"/></head><body><foo>Sacré bleu!</foo></body></html>(tsuperRlRUtunicode_dataRRR(R((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyRU�s	cCs�tjj}tjtj�z�d�}|tj_d}|j|�}|j�}|jt	|t
��|j||j|j���|j|j
j�d�Wdtjtj�|tj_XdS(NcSsdS(N(tNone(R*((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pytnoop�ss<foo>a</foo>sutf-8(tbs4RYtchardet_dammittloggingtdisabletWARNINGRtdecodeR!t
isinstancetunicodeRtdocument_forRtlowertNOTSET(RtchardetRptasciitsoup_from_asciitunicode_output((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_ascii_in_unicode_out�s	cCsX|j|j�}|j|j�|j�|j|jjd�|j|jd�dS(NuSacré bleu!(RRnRRvtfooRRRo(Rtsoup_from_unicode((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_unicode_in_unicode_outscCsE|j|j�}|j|j�|j�|j|jjd�dS(NuSacré bleu!(RRRRvRnR�R(Rtsoup_from_utf8((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_utf8_in_unicode_outscCs2|j|j�}|j|jd�|j�dS(Nsutf-8(RRnRRR(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt
test_utf8_outssQBad HTMLParser detected; skipping test of non-ASCII characters in attribute name.cCs8d}|j|j|�jjd�|jd��dS(Nu <div><a ☃="snowman"></a></div>R8(RRtdivR(RRP((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt1test_attribute_name_containing_unicode_characterss(
RRRUR�R�R�R�RtPYTHON_3_PRE_3_2R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyRl�s						tTestUnicodeDammitcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�ZRS(s"Standalone tests of UnicodeDammit.cCs)d}t|�}|j|j|�dS(NuI'm already Unicode! ☃(RRtunicode_markup(RRPRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_unicode_input"scCs)d}t|�}|j|jd�dS(Ns<foo>����</foo>u<foo>‘’“”</foo>(RRR�(RRPRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_smart_quotes_to_unicode'scCs/d}t|dd�}|j|jd�dS(Ns<foo>����</foo>tsmart_quotes_totxmls+<foo>&#x2018;&#x2019;&#x201C;&#x201D;</foo>(RRR�(RRPRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt!test_smart_quotes_to_xml_entities-scCs/d}t|dd�}|j|jd�dS(Ns<foo>����</foo>R�R0s'<foo>&lsquo;&rsquo;&ldquo;&rdquo;</foo>(RRR�(RRPRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt"test_smart_quotes_to_html_entities3scCs/d}t|dd�}|j|jd�dS(Ns<foo>����</foo>R�R}s<foo>''""</foo>(RRR�(RRPRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_smart_quotes_to_ascii9scCsBd}t|�}|j|jj�d�|j|jd�dS(NsSacré bleu! ☃sutf-8uSacré bleu! ☃(RRRRzR�(RR8RY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_detect_utf8?scCsHd}t|dg�}|j|jj�d�|j|jd�dS(Ns���s
iso-8859-8uםולש(RRRRzR�(RthebrewRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_convert_hebrewFscCsKd}t|�}|j|jj�d�|j|jjd�|�dS(Nsケータイ Watchsutf-8(RRRRzR�R(Rtutf_8RY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt/test_dont_see_smart_quotes_where_there_are_noneLscCs>djd�}t|dg�}|j|jj�d�dS(Nu
Räksmörgåssutf-8s
iso-8859-8(RRRRRz(RRRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt test_ignore_inappropriate_codecsRscCsXdjd�}xBdddgD]1}t||g�}|j|jj�d�qWdS(Nu
Räksmörgåssutf-8s.utf8s...s
utF---16.!(RRRRRz(RRtbad_encodingRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_ignore_invalid_codecsWscCsldjd�}t|ddg�}|j|jj�d�t|dddg�}|j|jd�dS(Nu
Räksmörgåssutf-8Rswindows-1252(RRRRRzRo(RRRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyR]scCstd�}t|j�}dS(Ns'<?xml version="1.0" encoding="UTF-�" ?>(R	tlistt	encodings(RtdetectedR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pytPtest_encoding_detector_replaces_junk_in_encoding_name_with_replacement_characterks	cCs:x3dD]+}t|dt�}|jd|j�qWdS(Ns&<html><meta charset="euc-jp" /></html>s&<html><meta charset='euc-jp' /></html>s$<html><meta charset=euc-jp /></html>s#<html><meta charset=euc-jp/></html>tis_htmlseuc-jp(s&<html><meta charset="euc-jp" /></html>s&<html><meta charset='euc-jp' /></html>s$<html><meta charset=euc-jp /></html>s#<html><meta charset=euc-jp/></html>(RR)RR(RRRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt test_detect_html5_style_meta_tagqs
cCs�d}tjj}tjtj�zmd�}|tj_t|�}|jt|j	�|j
d|jk�t|d�}|j
|j	�Wdtjtj
�|tj_XdS(NsT<?xml version="1.0" encoding="UTF-8"?>
<html><b>بتر</b>
<i>��ѐ����</i></html>cSsdS(N(Ro(R*((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyRp�su�shtml.parser(RqRYRrRsRtRuRRR)tcontains_replacement_charactersR!R�RR{(RtdocR|RpRYR((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt"test_last_ditch_entity_replacement|s	cCs<d}t|�}|jd|j�|jd|j�dS(Ns��<a>��</a>u<a>áé</a>sutf-16le(RRR�R(RRRY((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_byte_order_mark_removed�scCsndjd�}djd�}|||}|jt|jd�tj|�}|jd|jd��dS(Nu☃iR8u“Hi, I like Windows!”twindows_1252u+☃☃☃“Hi, I like Windows!”☃☃☃u	☃☃☃(RR<tUnicodeDecodeErrorRvRt	detwingleR(RR8R�R�tfixed((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_detwingle�s	cCsYxRdD]J}|jd�}|j|jd��tj|�}|j||�qWdS(Nuœuₓu𐐓R8s�(uœuₓu𐐓(RR!tendswithRR�R(Rttricky_unicode_chartinputtoutput((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt+test_detwingle_ignores_multibyte_characters�s
(RRRkR�R�R�R�R�R�R�R�R�R�RR�R�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyR�s$														#		tTestNamedspacedAttributecBs#eZd�Zd�Zd�ZRS(cCs#tdd�}|j|d�dS(Ntxmlns(RRoR(Rta((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyttest_name_may_be_none�scCs#tdd�}|jd|�dS(NR�R4sa:b(RR(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt6test_attribute_is_equivalent_to_colon_separated_string�scCs�tddd�}tddd�}|j||�tddd�}|j||�tddd�}|j||�tddd�}|j||�dS(NR�R4tctz(RRRotassertNotEqual(RR�R4R�tdte((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt;test_attributes_are_equivalent_if_prefix_and_name_identical�s(RRR�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyR��s		t)TestAttributeValueWithCharsetSubstitutioncBseZd�Zd�ZRS(cCsLtd�}|jd|�|jd|j�|jd|jd��dS(Nseuc-jpR8(RRtoriginal_valueR(Rtvalue((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt!test_content_meta_attribute_value�scCsLtd�}|jd|�|jd|j�|jd|jd��dS(Nstext/html; charset=euc-jpstext/html; charset=utf8R8(RRR�R(RR�((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyR��s(RRR�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyR��s	(ii(*RktpdbRRstunittesttsysR?RqRRtbs4.elementRRRRt
bs4.dammitRRR	tbs4.testingR
RR'tbs4.builderRR
R)tLXML_PRESENTtImportErrorR�R\tversion_infoR�RRROtTestCaseRSRlR�R�R�(((s7/usr/lib/python2.7/site-packages/bs4/tests/test_soup.pyt<module>s4"

",/	E<�