B
    j9C\YO  ã            
   @   s~  d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	 ddl
mZmZmZmZ ddlZddlmZmZmZ ddlmZmZ ddlZyddlmZmZ d	ZW n& ek
rÊ Z zd
ZW ddZ[X Y nX ejd dkoâejdk ZG dd„ deƒZG dd„ deƒZ G dd„ deƒZ G dd„ deƒZ!G dd„ dej"ƒZ#G dd„ deƒZ$G dd„ dej"ƒZ%G dd„ deƒZ&G dd„ dej"ƒZ'dS )z#Tests of Beautiful Soup as a whole.é    )Ú	set_traceN)ÚBeautifulSoupÚBeautifulStoneSoup)ÚCharsetMetaAttributeValueÚContentMetaAttributeValueÚSoupStrainerÚNamespacedAttribute)ÚEntitySubstitutionÚUnicodeDammitÚEncodingDetector)ÚSoupTestÚskipIf)ÚLXMLTreeBuilderÚLXMLTreeBuilderForXMLTFé   )r   é   c               @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚTestConstructorc             C   s"   d}|   |¡}|  d|jj¡ d S )Nu   <h1>Ã©Ã©</h1>u   Ã©Ã©)ÚsoupÚassertEqualÚh1Ústring)ÚselfÚdatar   © r   ú2lib/python3.7/site-packages/bs4/tests/test_soup.pyÚtest_short_unicode_input*   s    
z(TestConstructor.test_short_unicode_inputc             C   s"   d}|   |¡}|  d|jj¡ d S )Nz<h1>foo bar</h1>zfoo bar)r   r   r   r   )r   r   r   r   r   r   Útest_embedded_null/   s    
z"TestConstructor.test_embedded_nullc             C   s,   d  d¡}| j|dgd}|  d|j¡ d S )Nu   RÃ¤ksmÃ¶rgÃ¥szutf-8)Úexclude_encodingszwindows-1252)Úencoder   r   Úoriginal_encoding)r   Ú	utf8_datar   r   r   r   Útest_exclude_encodings4   s    
z&TestConstructor.test_exclude_encodingsN)Ú__name__Ú
__module__Ú__qualname__r   r   r!   r   r   r   r   r   (   s   r   c               @   sF   e Zd Zddd„Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Z	dS )ÚTestWarningsTc             C   s"   |  tjd d… ¡}|  |¡ d S )NéP   )Ú
startswithr   ZNO_PARSER_SPECIFIED_WARNINGÚ
assertTrue)r   ÚsZis_thereÚvr   r   r   Ú_no_parser_specified<   s    z!TestWarnings._no_parser_specifiedc          	   C   s>   t jdd}|  d¡}W d Q R X t|d jƒ}|  |¡ d S )NT)Úrecordz<a><b></b></a>r   )ÚwarningsÚcatch_warningsr   ÚstrÚmessageÚ_assert_no_parser_specified)r   Úwr   Úmsgr   r   r   Ú#test_warning_if_no_parser_specified@   s    z0TestWarnings.test_warning_if_no_parser_specifiedc          	   C   s@   t jdd}|  dd¡}W d Q R X t|d jƒ}|  |¡ d S )NT)r,   z<a><b></b></a>Úhtmlr   )r-   r.   r   r/   r0   r1   )r   r2   r   r3   r   r   r   Ú*test_warning_if_parser_specified_too_vagueF   s    z7TestWarnings.test_warning_if_parser_specified_too_vaguec          	   C   s4   t jdd}|  dd¡}W d Q R X |  g |¡ d S )NT)r,   z<a><b></b></a>zhtml.parser)r-   r.   r   r   )r   r2   r   r   r   r   Ú,test_no_warning_if_explicit_parser_specifiedL   s    z9TestWarnings.test_no_warning_if_explicit_parser_specifiedc          	   C   sh   t jdd}| jdtdƒd}W d Q R X t|d jƒ}|  d|k¡ |  d|k¡ |  d	| ¡ ¡ d S )
NT)r,   z<a><b></b></a>Úb)ÚparseOnlyTheser   r9   Ú
parse_onlys   <b></b>)	r-   r.   r   r   r/   r0   r(   r   r   )r   r2   r   r3   r   r   r   Ú)test_parseOnlyThese_renamed_to_parse_onlyQ   s    z6TestWarnings.test_parseOnlyThese_renamed_to_parse_onlyc          	   C   sf   t jdd}d}| j|dd}W d Q R X t|d jƒ}|  d|k¡ |  d|k¡ |  d|j¡ d S )	NT)r,   s   Ã©Úutf8)ÚfromEncodingr   r=   Zfrom_encoding)r-   r.   r   r/   r0   r(   r   r   )r   r2   r<   r   r3   r   r   r   Ú*test_fromEncoding_renamed_to_from_encodingY   s    z7TestWarnings.test_fromEncoding_renamed_to_from_encodingc             C   s   | j t| jddd d S )Nz<a>T)Zno_such_argument)ÚassertRaisesÚ	TypeErrorr   )r   r   r   r   Ú"test_unrecognized_keyword_argumentb   s    z/TestWarnings.test_unrecognized_keyword_argumentN)T)
r"   r#   r$   r+   r4   r6   r7   r;   r>   rA   r   r   r   r   r%   :   s   
	r%   c               @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )r%   c          	   C   s’   t  ¡ }|j}zBtjdd}|  |¡}W d Q R X t|d jƒ}|  d|k¡ W d | 	¡  X tjdd}|  |¡}W d Q R X |  
dt|ƒ¡ d S )NT)r,   r   zlooks like a filename)ÚtempfileZNamedTemporaryFileÚnamer-   r.   r   r/   r0   r(   Úcloser   Úlen)r   Z
filehandleÚfilenamer2   r   r3   r   r   r   Útest_disk_file_warningh   s    
z#TestWarnings.test_disk_file_warningc          	   C   s>   t jdd}|  d¡}W d Q R X |  tdd„ |D ƒƒ¡ d S )NT)r,   s   http://www.crummybytes.com/c             s   s   | ]}d t |jƒkV  qdS )zlooks like a URLN)r/   r0   )Ú.0r2   r   r   r   ú	<genexpr>}   s   z?TestWarnings.test_url_warning_with_bytes_url.<locals>.<genexpr>)r-   r.   r   r(   Úany)r   Úwarning_listr   r   r   r   Útest_url_warning_with_bytes_urlx   s    z,TestWarnings.test_url_warning_with_bytes_urlc          	   C   s>   t jdd}|  d¡}W d Q R X |  tdd„ |D ƒƒ¡ d S )NT)r,   zhttp://www.crummyunicode.com/c             s   s   | ]}d t |jƒkV  qdS )zlooks like a URLN)r/   r0   )rH   r2   r   r   r   rI   …   s   zATestWarnings.test_url_warning_with_unicode_url.<locals>.<genexpr>)r-   r.   r   r(   rJ   )r   rK   r   r   r   r   Ú!test_url_warning_with_unicode_url€   s    z.TestWarnings.test_url_warning_with_unicode_urlc          	   C   s>   t jdd}|  d¡}W d Q R X |  tdd„ |D ƒƒ¡ d S )NT)r,   s$   http://www.crummybytes.com/ is greatc             s   s   | ]}d t |jƒkV  qdS )zlooks like a URLN)r/   r0   )rH   r2   r   r   r   rI   ‹   s   zETestWarnings.test_url_warning_with_bytes_and_space.<locals>.<genexpr>)r-   r.   r   ÚassertFalserJ   )r   rK   r   r   r   r   Ú%test_url_warning_with_bytes_and_spaceˆ   s    z2TestWarnings.test_url_warning_with_bytes_and_spacec          	   C   s>   t jdd}|  d¡}W d Q R X |  tdd„ |D ƒƒ¡ d S )NT)r,   z%http://www.crummyuncode.com/ is greatc             s   s   | ]}d t |jƒkV  qdS )zlooks like a URLN)r/   r0   )rH   r2   r   r   r   rI   ‘   s   zGTestWarnings.test_url_warning_with_unicode_and_space.<locals>.<genexpr>)r-   r.   r   rN   rJ   )r   rK   r   r   r   r   Ú'test_url_warning_with_unicode_and_spaceŽ   s    z4TestWarnings.test_url_warning_with_unicode_and_spaceN)r"   r#   r$   rG   rL   rM   rO   rP   r   r   r   r   r%   f   s
   c               @   s   e Zd Zdd„ ZdS )ÚTestSelectiveParsingc             C   s.   d}t dƒ}| j||d}|  | ¡ d¡ d S )Nz&No<b>Yes</b><a>No<b>Yes <c>Yes</c></b>r8   )r:   s   <b>Yes</b><b>Yes <c>Yes</c></b>)r   r   r   r   )r   ÚmarkupZstrainerr   r   r   r   Útest_parse_with_soupstrainer—   s    z1TestSelectiveParsing.test_parse_with_soupstrainerN)r"   r#   r$   rS   r   r   r   r   rQ   •   s   rQ   c               @   sx   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚTestEntitySubstitutionz1Standalone tests of the EntitySubstitution class.c             C   s
   t | _d S )N)r	   Úsub)r   r   r   r   ÚsetUp    s    zTestEntitySubstitution.setUpc             C   s   d}|   | j |¡d¡ d S )Nu   fooâˆ€â˜ƒÃµbaru   foo&forall;â˜ƒ&otilde;bar)r   rU   Úsubstitute_html)r   r)   r   r   r   Útest_simple_html_substitution£   s    z4TestEntitySubstitution.test_simple_html_substitutionc             C   s&   d}t |ƒ}|  | j |j¡d¡ d S )Ns   ‘’foo“”z&lsquo;&rsquo;foo&ldquo;&rdquo;)r
   r   rU   rW   rR   )r   ZquotesÚdammitr   r   r   Útest_smart_quote_substitutionª   s    z4TestEntitySubstitution.test_smart_quote_substitutionc             C   s   d}|   | j |d¡|¡ d S )NzWelcome to "my bar"F)r   rU   Úsubstitute_xml)r   r)   r   r   r   ÚItest_xml_converstion_includes_no_quotes_if_make_quoted_attribute_is_false²   s    z`TestEntitySubstitution.test_xml_converstion_includes_no_quotes_if_make_quoted_attribute_is_falsec             C   s0   |   | j dd¡d¡ |   | j dd¡d¡ d S )NZWelcomeTz	"Welcome"z	Bob's Barz"Bob's Bar")r   rU   r[   )r   r   r   r   Ú6test_xml_attribute_quoting_normally_uses_double_quotes¶   s    zMTestEntitySubstitution.test_xml_attribute_quoting_normally_uses_double_quotesc             C   s   d}|   | j |d¡d¡ d S )NzWelcome to "my bar"Tz'Welcome to "my bar"')r   rU   r[   )r   r)   r   r   r   ÚOtest_xml_attribute_quoting_uses_single_quotes_when_value_contains_double_quotes¼   s    zfTestEntitySubstitution.test_xml_attribute_quoting_uses_single_quotes_when_value_contains_double_quotesc             C   s   d}|   | j |d¡d¡ d S )NzWelcome to "Bob's Bar"Tz""Welcome to &quot;Bob's Bar&quot;")r   rU   r[   )r   r)   r   r   r   Úbtest_xml_attribute_quoting_escapes_single_quotes_when_value_contains_both_single_and_double_quotesÁ   s    zyTestEntitySubstitution.test_xml_attribute_quoting_escapes_single_quotes_when_value_contains_both_single_and_double_quotesc             C   s   d}|   | j |¡|¡ d S )NzWelcome to "Bob's Bar")r   rU   r[   )r   Zquotedr   r   r   Ú<test_xml_quotes_arent_escaped_when_value_is_not_being_quotedÇ   s    zSTestEntitySubstitution.test_xml_quotes_arent_escaped_when_value_is_not_being_quotedc             C   s   |   | j d¡d¡ d S )Nzfoo<bar>zfoo&lt;bar&gt;)r   rU   r[   )r   r   r   r   Ú'test_xml_quoting_handles_angle_bracketsË   s    
z>TestEntitySubstitution.test_xml_quoting_handles_angle_bracketsc             C   s   |   | j d¡d¡ d S )NzAT&TzAT&amp;T)r   rU   r[   )r   r   r   r   Ú#test_xml_quoting_handles_ampersandsÐ   s    z:TestEntitySubstitution.test_xml_quoting_handles_ampersandsc             C   s   |   | j d¡d¡ d S )Nz&Aacute;T&Tz&amp;Aacute;T&amp;T)r   rU   r[   )r   r   r   r   ÚEtest_xml_quoting_including_ampersands_when_they_are_part_of_an_entityÓ   s    
z\TestEntitySubstitution.test_xml_quoting_including_ampersands_when_they_are_part_of_an_entityc             C   s   |   | j d¡d¡ d S )Nz&Aacute;T&Tz&Aacute;T&amp;T)r   rU   Z"substitute_xml_containing_entities)r   r   r   r   ÚDtest_xml_quoting_ignoring_ampersands_when_they_are_part_of_an_entityØ   s    
z[TestEntitySubstitution.test_xml_quoting_ignoring_ampersands_when_they_are_part_of_an_entityc             C   s   d}|   | j |¡|¡ dS )z:There's no need to do this except inside attribute values.zBob's "bar"N)r   rU   rW   )r   Útextr   r   r   Ú test_quotes_not_html_substitutedÝ   s    z7TestEntitySubstitution.test_quotes_not_html_substitutedN)r"   r#   r$   Ú__doc__rV   rX   rZ   r\   r]   r^   r_   r`   ra   rb   rc   rd   rf   r   r   r   r   rT   ž   s   rT   c                   sN   e Zd Z‡ fdd„Zdd„ Zdd„ Zdd„ Zd	d
„ Zee	dƒdd„ ƒZ
‡  ZS )ÚTestEncodingConversionc                s4   t t| ƒ ¡  d| _| j d¡| _|  | jd¡ d S )NuU   <html><head><meta charset="utf-8"/></head><body><foo>SacrÃ© bleu!</foo></body></html>zutf-8sU   <html><head><meta charset="utf-8"/></head><body><foo>SacrÃ© bleu!</foo></body></html>)Úsuperrh   rV   Úunicode_datar   r    r   )r   )Ú	__class__r   r   rV   ç   s    zTestEncodingConversion.setUpc          	   C   s’   t jj}t tj¡ zbdd„ }|t j_d}|  |¡}| ¡ }|  t	|t
ƒ¡ |  ||  | ¡ ¡¡ |  |j ¡ d¡ W d t tj¡ |t j_X d S )Nc             S   s   d S )Nr   )r/   r   r   r   Únoopö   s    z>TestEncodingConversion.test_ascii_in_unicode_out.<locals>.noops   <foo>a</foo>zutf-8)Úbs4rY   Úchardet_dammitÚloggingÚdisableÚWARNINGr   Údecoder(   Ú
isinstancer/   r   Zdocument_forr   ÚlowerÚNOTSET)r   Úchardetrl   ÚasciiZsoup_from_asciiZunicode_outputr   r   r   Útest_ascii_in_unicode_outð   s    
z0TestEncodingConversion.test_ascii_in_unicode_outc             C   s@   |   | j¡}|  | ¡ | j¡ |  |jjd¡ |  |jd ¡ d S )Nu   SacrÃ© bleu!)r   rj   r   rr   Úfoor   r   )r   Úsoup_from_unicoder   r   r   Útest_unicode_in_unicode_out  s    z2TestEncodingConversion.test_unicode_in_unicode_outc             C   s2   |   | j¡}|  | ¡ | j¡ |  |jjd¡ d S )Nu   SacrÃ© bleu!)r   r    r   rr   rj   ry   r   )r   Zsoup_from_utf8r   r   r   Útest_utf8_in_unicode_out  s    z/TestEncodingConversion.test_utf8_in_unicode_outc             C   s$   |   | j¡}|  | d¡| j¡ d S )Nzutf-8)r   rj   r   r   r    )r   rz   r   r   r   Útest_utf8_out  s    z$TestEncodingConversion.test_utf8_outzQBad HTMLParser detected; skipping test of non-ASCII characters in attribute name.c             C   s(   d}|   |  |¡j d¡| d¡¡ d S )Nu    <div><a â˜ƒ="snowman"></a></div>r<   )r   r   Zdivr   )r   rR   r   r   r   Ú1test_attribute_name_containing_unicode_characters  s    zHTestEncodingConversion.test_attribute_name_containing_unicode_characters)r"   r#   r$   rV   rx   r{   r|   r}   r   ÚPYTHON_3_PRE_3_2r~   Ú__classcell__r   r   )rk   r   rh   ã   s   	rh   c               @   s˜   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$S )%ÚTestUnicodeDammitz"Standalone tests of UnicodeDammit.c             C   s   d}t |ƒ}|  |j|¡ d S )Nu   I'm already Unicode! â˜ƒ)r
   r   Úunicode_markup)r   rR   rY   r   r   r   Útest_unicode_input"  s    z$TestUnicodeDammit.test_unicode_inputc             C   s   d}t |ƒ}|  |jd¡ d S )Ns   <foo>‘’“”</foo>u   <foo>â€˜â€™â€œâ€</foo>)r
   r   r‚   )r   rR   rY   r   r   r   Útest_smart_quotes_to_unicode'  s    z.TestUnicodeDammit.test_smart_quotes_to_unicodec             C   s"   d}t |dd}|  |jd¡ d S )Ns   <foo>‘’“”</foo>Zxml)Úsmart_quotes_toz+<foo>&#x2018;&#x2019;&#x201C;&#x201D;</foo>)r
   r   r‚   )r   rR   rY   r   r   r   Ú!test_smart_quotes_to_xml_entities-  s    z3TestUnicodeDammit.test_smart_quotes_to_xml_entitiesc             C   s"   d}t |dd}|  |jd¡ d S )Ns   <foo>‘’“”</foo>r5   )r…   z'<foo>&lsquo;&rsquo;&ldquo;&rdquo;</foo>)r
   r   r‚   )r   rR   rY   r   r   r   Ú"test_smart_quotes_to_html_entities3  s    z4TestUnicodeDammit.test_smart_quotes_to_html_entitiesc             C   s"   d}t |dd}|  |jd¡ d S )Ns   <foo>‘’“”</foo>rw   )r…   z<foo>''""</foo>)r
   r   r‚   )r   rR   rY   r   r   r   Útest_smart_quotes_to_ascii9  s    z,TestUnicodeDammit.test_smart_quotes_to_asciic             C   s0   d}t |ƒ}|  |j ¡ d¡ |  |jd¡ d S )Ns   SacrÃ© bleu! â˜ƒzutf-8u   SacrÃ© bleu! â˜ƒ)r
   r   r   rt   r‚   )r   r<   rY   r   r   r   Útest_detect_utf8?  s    z"TestUnicodeDammit.test_detect_utf8c             C   s4   d}t |dgƒ}|  |j ¡ d¡ |  |jd¡ d S )Ns   íåìùz
iso-8859-8u   ××•×œ×©)r
   r   r   rt   r‚   )r   ÚhebrewrY   r   r   r   Útest_convert_hebrewF  s    z%TestUnicodeDammit.test_convert_hebrewc             C   s6   d}t |ƒ}|  |j ¡ d¡ |  |j d¡|¡ d S )Ns   ã‚±ãƒ¼ã‚¿ã‚¤ Watchzutf-8)r
   r   r   rt   r‚   r   )r   Úutf_8rY   r   r   r   Ú/test_dont_see_smart_quotes_where_there_are_noneL  s    zATestUnicodeDammit.test_dont_see_smart_quotes_where_there_are_nonec             C   s,   d  d¡}t|dgƒ}|  |j ¡ d¡ d S )Nu   RÃ¤ksmÃ¶rgÃ¥szutf-8z
iso-8859-8)r   r
   r   r   rt   )r   r    rY   r   r   r   Ú test_ignore_inappropriate_codecsR  s    
z2TestUnicodeDammit.test_ignore_inappropriate_codecsc             C   s:   d  d¡}x*dD ]"}t||gƒ}|  |j ¡ d¡ qW d S )Nu   RÃ¤ksmÃ¶rgÃ¥szutf-8)z.utf8z...z
utF---16.!)r   r
   r   r   rt   )r   r    Zbad_encodingrY   r   r   r   Útest_ignore_invalid_codecsW  s    

z,TestUnicodeDammit.test_ignore_invalid_codecsc             C   sL   d  d¡}t|dgd}|  |j ¡ d¡ t|ddgd}|  |jd ¡ d S )Nu   RÃ¤ksmÃ¶rgÃ¥szutf-8)r   zwindows-1252)r   r
   r   r   rt   )r   r    rY   r   r   r   r!   ]  s    
z(TestUnicodeDammit.test_exclude_encodingsc             C   s"   t dƒ}t|jƒ}d|kst‚d S )Ns'   <?xml version="1.0" encoding="UTF-Û" ?>u   utf-ï¿½)r   ÚlistÚ	encodingsÚAssertionError)r   Zdetectedr‘   r   r   r   ÚPtest_encoding_detector_replaces_junk_in_encoding_name_with_replacement_characterk  s    
zbTestUnicodeDammit.test_encoding_detector_replaces_junk_in_encoding_name_with_replacement_characterc             C   s,   x&dD ]}t |dd}|  d|j¡ qW d S )N)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>T)Zis_htmlzeuc-jp)r
   r   r   )r   r   rY   r   r   r   Ú test_detect_html5_style_meta_tagq  s
    z2TestUnicodeDammit.test_detect_html5_style_meta_tagc          	   C   s„   d}t jj}t tj¡ zPdd„ }|t j_t|ƒ}|  d|j¡ |  	d|j
k¡ t|dƒ}|  	|j¡ W d t tj¡ |t j_X d S )NsT   ï»¿<?xml version="1.0" encoding="UTF-8"?>
<html><b>Ø¨ØªØ±</b>
<i>ÈÒÑÊÑíä</i></html>c             S   s   d S )Nr   )r/   r   r   r   rl   ’  s    zBTestUnicodeDammit.test_last_ditch_entity_replacement.<locals>.noopTu   ï¿½zhtml.parser)rm   rY   rn   ro   rp   rq   r
   r   Zcontains_replacement_charactersr(   r‚   r   ru   )r   Údocrv   rl   rY   r   r   r   r   Ú"test_last_ditch_entity_replacement|  s    
z4TestUnicodeDammit.test_last_ditch_entity_replacementc             C   s,   d}t |ƒ}|  d|j¡ |  d|j¡ d S )Ns   ÿþ< a > á é < / a > u   <a>Ã¡Ã©</a>zutf-16le)r
   r   r‚   r   )r   r   rY   r   r   r   Útest_byte_order_mark_removedŸ  s    z.TestUnicodeDammit.test_byte_order_mark_removedc             C   sP   d  d¡}d  d¡}|| | }|  t|jd¡ t |¡}|  d| d¡¡ d S )Nu	   â˜ƒâ˜ƒâ˜ƒr<   u   â€œHi, I like Windows!â€Úwindows_1252u+   â˜ƒâ˜ƒâ˜ƒâ€œHi, I like Windows!â€â˜ƒâ˜ƒâ˜ƒ)r   r?   ÚUnicodeDecodeErrorrr   r
   Ú	detwingler   )r   r<   r˜   r•   Zfixedr   r   r   Útest_detwingle¦  s    

z TestUnicodeDammit.test_detwinglec             C   sB   x<dD ]4}|  d¡}|  | d¡¡ t |¡}|  ||¡ qW d S )N)u   Å“u   â‚“u   Ã°ÂÂÂ“r<   ó   “)r   r(   Úendswithr
   rš   r   )r   Ztricky_unicode_charÚinputÚoutputr   r   r   Ú+test_detwingle_ignores_multibyte_characters¾  s    

z=TestUnicodeDammit.test_detwingle_ignores_multibyte_charactersN)r"   r#   r$   rg   rƒ   r„   r†   r‡   rˆ   r‰   r‹   r   rŽ   r   r!   r“   r”   r–   r—   r›   r    r   r   r   r   r     s$   #r   c               @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚTestNamedspacedAttributec             C   s   t dd ƒ}|  |d¡ d S )NZxmlns)r   r   )r   Úar   r   r   Útest_name_may_be_noneÏ  s    
z.TestNamedspacedAttribute.test_name_may_be_nonec             C   s   t ddƒ}|  d|¡ d S )Nr¢   r8   za:b)r   r   )r   r¢   r   r   r   Ú6test_attribute_is_equivalent_to_colon_separated_stringÓ  s    
zOTestNamedspacedAttribute.test_attribute_is_equivalent_to_colon_separated_stringc             C   sp   t dddƒ}t dddƒ}|  ||¡ t ddd ƒ}|  ||¡ t dddƒ}|  ||¡ t dddƒ}|  ||¡ d S )Nr¢   r8   ÚcÚz)r   r   ZassertNotEqual)r   r¢   r8   r¥   ÚdÚer   r   r   Ú;test_attributes_are_equivalent_if_prefix_and_name_identical×  s    zTTestNamedspacedAttribute.test_attributes_are_equivalent_if_prefix_and_name_identicalN)r"   r#   r$   r£   r¤   r©   r   r   r   r   r¡   Í  s   r¡   c               @   s   e Zd Zdd„ Zdd„ ZdS )Ú)TestAttributeValueWithCharsetSubstitutionc             C   s8   t dƒ}|  d|¡ |  d|j¡ |  d| d¡¡ d S )Nzeuc-jpr<   )r   r   Úoriginal_valuer   )r   Úvaluer   r   r   Ú!test_content_meta_attribute_valueê  s    zKTestAttributeValueWithCharsetSubstitution.test_content_meta_attribute_valuec             C   s8   t dƒ}|  d|¡ |  d|j¡ |  d| d¡¡ d S )Nztext/html; charset=euc-jpztext/html; charset=utf8r<   )r   r   r«   r   )r   r¬   r   r   r   r­   ñ  s    N)r"   r#   r$   r­   r   r   r   r   rª   è  s   rª   )(rg   Zpdbr   ro   ZunittestÚsysrB   rm   r   r   Zbs4.elementr   r   r   r   Z
bs4.dammitr	   r
   r   Zbs4.testingr   r   r-   Zbs4.builderr   r   ZLXML_PRESENTÚImportErrorr¨   Úversion_infor   r   r%   rQ   ZTestCaserT   rh   r   r¡   rª   r   r   r   r   Ú<module>   s6   ,/	E< /