Ë
    þ)f[<  ã                   ó~   — d dl Z d dlZd dlZd dlmZ d dlmZmZmZ  G d„ de«      Z	 G d„ de«      Z
 G d„ d	e«      Zy)
é    N)ÚBeautifulSoup)ÚEntitySubstitutionÚEncodingDetectorÚUnicodeDammitc                   ó‚   — e Zd ZdZd„ Zej                  j                  dg d¢«      d„ «       Zd„ Z	d„ Z
d„ Zd	„ Zd
„ Zd„ Zy)ÚTestUnicodeDammitz"Standalone tests of UnicodeDammit.c                 ó@   — d}t        |«      }|j                  |k(  sJ ‚y )Nu   I'm already Unicode! â˜ƒ)r   Úunicode_markup)ÚselfÚmarkupÚdammits      úR/var/www/html/flask-app/venv/lib/python3.12/site-packages/bs4/tests/test_dammit.pyÚtest_unicode_inputz$TestUnicodeDammit.test_unicode_input   s%   € Ø3ˆÜ˜vÓ&ˆØ×$Ñ$¨Ò.Ñ.Ð.ó    z smart_quotes_to,expect_converted))Nu   â€˜â€™â€œâ€�)Úxmlz &#x2018;&#x2019;&#x201C;&#x201D;)Úhtmlz&lsquo;&rsquo;&ldquo;&rdquo;)Úasciiz''""c                 óf   — d}t        |dg|¬«      j                  }|dj                  |«      k(  sJ ‚y)zbVerify the functionality of the smart_quotes_to argument
        to the UnicodeDammit constructor.s   <foo>‘’“”</foo>úwindows-1252)Úknown_definite_encodingsÚsmart_quotes_toz<foo>{}</foo>N)r   r
   Úformat)r   r   Úexpect_convertedr   Ú	converteds        r   Útest_smart_quotes_toz&TestUnicodeDammit.test_smart_quotes_to   sD   € ð 0ˆÜ!Ø¨nÐ-=Ø+ô
÷ ‰.ð 	ð ˜O×2Ñ2Ð3CÓDÒDÑDÐDr   c                 ó~   — d}t        |«      }|j                  j                  «       dk(  sJ ‚|j                  dk(  sJ ‚y )Ns   SacrÃ© bleu! â˜ƒúutf-8u   SacrÃ© bleu! â˜ƒ©r   Úoriginal_encodingÚlowerr
   )r   Úutf8r   s      r   Útest_detect_utf8z"TestUnicodeDammit.test_detect_utf8&   s@   € Ø1ˆÜ˜tÓ$ˆØ×'Ñ'×-Ñ-Ó/°7Ò:Ñ:Ø×$Ñ$Ð(DÒDÑDÐDr   c                 ó‚   — d}t        |dg«      }|j                  j                  «       dk(  sJ ‚|j                  dk(  sJ ‚y )Nó   íåìùú
iso-8859-8u   ×�×•×œ×©r   )r   Úhebrewr   s      r   Útest_convert_hebrewz%TestUnicodeDammit.test_convert_hebrew,   sD   € Ø$ˆÜ˜v¨ ~Ó6ˆØ×'Ñ'×-Ñ-Ó/°<Ò?Ñ?Ø×$Ñ$Ð(BÒBÑBÐBr   c                 óœ   — d}t        |«      }|j                  j                  «       dk(  sJ ‚|j                  j	                  d«      |k(  sJ ‚y )Ns   ã‚±ãƒ¼ã‚¿ã‚¤ Watchr   )r   r   r    r
   Úencode)r   Úutf_8r   s      r   Ú/test_dont_see_smart_quotes_where_there_are_nonezATestUnicodeDammit.test_dont_see_smart_quotes_where_there_are_none2   sJ   € ØIˆÜ˜uÓ%ˆØ×'Ñ'×-Ñ-Ó/°7Ò:Ñ:Ø×$Ñ$×+Ñ+¨GÓ4¸Ò=Ñ=Ð=r   c                 ó~   — dj                  d«      }t        |dg«      }|j                  j                  «       dk(  sJ ‚y )Nõ   RÃ¤ksmÃ¶rgÃ¥sr   r%   ©r)   r   r   r    ©r   Ú	utf8_datar   s      r   Ú test_ignore_inappropriate_codecsz2TestUnicodeDammit.test_ignore_inappropriate_codecs8   s=   € Ø#×*Ñ*¨7Ó3ˆ	Ü˜y¨<¨.Ó9ˆØ×'Ñ'×-Ñ-Ó/°7Ò:Ñ:Ð:r   c                 óŒ   — dj                  d«      }dD ].  }t        ||g«      }|j                  j                  «       dk(  rŒ.J ‚ y )Nr-   r   )z.utf8z...z
utF---16.!r.   )r   r0   Úbad_encodingr   s       r   Útest_ignore_invalid_codecsz,TestUnicodeDammit.test_ignore_invalid_codecs=   sI   € Ø#×*Ñ*¨7Ó3ˆ	Ø:ò 	?ˆLÜ" 9¨|¨nÓ=ˆFØ×+Ñ+×1Ñ1Ó3°wÓ>Ñ>ñ	?r   c                 óÀ   — dj                  d«      }t        |dg¬«      }|j                  j                  «       dk(  sJ ‚t        |ddg¬«      }|j                  d k(  sJ ‚y )Nr-   r   )Úexclude_encodingsr   r.   r/   s      r   Útest_exclude_encodingsz(TestUnicodeDammit.test_exclude_encodingsC   sg   € à#×*Ñ*¨7Ó3ˆ	ô ˜y¸W¸IÔFˆØ×'Ñ'×-Ñ-Ó/°>ÒAÑAô Ø¨'°>Ð)BôDˆà×'Ñ'¨4Ò/Ñ/Ð/r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚpytestÚmarkÚparametrizer   r"   r'   r+   r1   r4   r7   © r   r   r   r      sW   „ Ù,ò/ð
 ‡[�[×ÑØ*ò	
óñEóðEòEòCò>ò;ò
?ó0r   r   c                   óB   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zy
)ÚTestEncodingDetectorc                 óP   — t        d«      }t        |j                  «      }d|v sJ ‚y )Ns'   <?xml version="1.0" encoding="UTF-Û" ?>u   utf-ï¿½)r   ÚlistÚ	encodings)r   ÚdetectedrD   s      r   ÚPtest_encoding_detector_replaces_junk_in_encoding_name_with_replacement_characterzeTestEncodingDetector.test_encoding_detector_replaces_junk_in_encoding_name_with_replacement_characterS   s-   € Ü#Ø9ó;ˆä˜×+Ñ+Ó,ˆ	Ø.°)Ñ;Ñ;Ð;r   c                 óN   — dD ]   }t        |d¬«      }d|j                  k(  rŒ J ‚ y )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©Úis_htmlzeuc-jp)r   r   ©r   Údatar   s      r   Ú test_detect_html5_style_meta_tagz5TestEncodingDetector.test_detect_html5_style_meta_tagY   s2   € ð4ò 	8ˆDô
 # 4°Ô6ˆFØ˜v×7Ñ7Ó7Ñ7ñ	8r   c                 ó,  — d}t         j                  j                  }t        j                  t        j
                  «       	 d„ }|t         j                  _        t        |«      }d|j                  k(  sJ ‚d|j                  v sJ ‚t        |d«      }|j                  sJ ‚	 t        j                  t        j                  «       |t         j                  _        y # t        j                  t        j                  «       |t         j                  _        w xY w)NsT   ï»¿<?xml version="1.0" encoding="UTF-8"?>
<html><b>Ø¨ØªØ±</b>
<i>ÈÒÑ�ÊÑíä</i></html>c                  ó   — y ©Nr?   )Ústrs    r   ÚnoopzETestEncodingDetector.test_last_ditch_entity_replacement.<locals>.noopy   s   € Ør   Tu   ï¿½zhtml.parser)Úbs4r   Úchardet_dammitÚloggingÚdisableÚWARNINGr   Úcontains_replacement_charactersr
   r   ÚNOTSET)r   ÚdocÚchardetrQ   r   Úsoups         r   Ú"test_last_ditch_entity_replacementz7TestEncodingDetector.test_last_ditch_entity_replacementc   sÃ   € ð 2ˆô —*‘*×+Ñ+ˆÜ�‰œŸ™Ô(ð	0òà(,ŒC�J‰JÔ%Ü" 3Ó'ˆFØ˜6×AÑAÒAÑAØ˜v×4Ñ4Ñ4Ñ4ä   mÓ4ˆDØ×7Ò7Ñ7Ð7ä�O‰OœGŸN™NÔ+Ø(/ŒC�J‰JÕ%øô �O‰OœGŸN™NÔ+Ø(/ŒC�J‰JÕ%ús   ÁAC Ã:Dc                 ób   — d}t        |«      }d|j                  k(  sJ ‚d|j                  k(  sJ ‚y )Nó   ÿþ< a > á é < / a > u   <a>Ã¡Ã©</a>úutf-16le)r   r
   r   rJ   s      r   Útest_byte_order_mark_removedz1TestEncodingDetector.test_byte_order_mark_removed†   s6   € àMˆÜ˜tÓ$ˆØ × 5Ñ 5Ò5Ñ5Ø˜V×5Ñ5Ò5Ñ5Ð5r   c                 ó‚  — d}t        |«      }t        |dg¬«      }d|j                  k(  sJ ‚t        |dg¬«      }d|j                  k(  sJ ‚dg|j                  D �cg c]  }|d   ‘Œ	 c}k(  sJ ‚d}t        |dgd	g¬
«      }d	|j                  k(  sJ ‚dd	g|j                  D �cg c]  }|d   ‘Œ	 c}k(  sJ ‚y c c}w c c}w )Nr^   zutf-16)r   r   )Úuser_encodingsr_   r   r$   r%   )r   rb   ©r   r   Útried_encodings)r   rK   r   ÚbeforeÚafterÚxr&   s          r   Ú)test_known_definite_versus_user_encodingsz>TestEncodingDetector.test_known_definite_versus_user_encodings�   sÛ   € ð
 NˆÜ˜tÓ$ˆô ˜t¸x¸jÔIˆØ˜6×3Ñ3Ò3Ñ3ô
 ˜d°G°9Ô=ˆØ˜U×4Ñ4Ò4Ñ4Øˆ|¨f×.DÑ.DÖE¨  !£ÒEÒEÑEð %ˆÜ˜vÀÀ	Ø/;¨nô>ˆð ˜v×7Ñ7Ò7Ñ7Ø˜Ð&¸×9OÑ9OÖ*P°A¨1¨Q«4Ò*PÒPÑPÐPùò  Fùò +Qs   ÁB7Â#B<c                 ó    — d}t        |dgdgdg¬«      }d|j                  k(  sJ ‚g d¢|j                  D �cg c]  }|d   ‘Œ	 c}k(  sJ ‚y c c}w )Nr$   ú	shift-jisr   r%   )r   Úoverride_encodingsrb   )rj   r   r%   r   rc   )r   r&   r   rg   s       r   Ú"test_deprecated_override_encodingsz7TestEncodingDetector.test_deprecated_override_encodings¬   sg   € ð %ˆÜØØ&1 ]Ø '˜yØ(˜>ô	
ˆð ˜v×7Ñ7Ò7Ñ7ò 4Ø!×1Ñ1Ö2�aˆQˆq‹TÒ2ò
ñ 	
ð 
ùÚ2s   ·Ac                 ó,  — dj                  d«      }dj                  d«      }||z   |z   }t        j                  t        «      5  |j	                  d«       d d d «       t        j                  |«      }d|j	                  d«      k(  sJ ‚y # 1 sw Y   Œ5xY w)Nu	   â˜ƒâ˜ƒâ˜ƒr!   u   â€œHi, I like Windows!â€�Úwindows_1252u+   â˜ƒâ˜ƒâ˜ƒâ€œHi, I like Windows!â€�â˜ƒâ˜ƒâ˜ƒ)r)   r<   ÚraisesÚUnicodeDecodeErrorÚdecoder   Ú	detwingle)r   r!   rn   rY   Úfixeds        r   Útest_detwinglez#TestEncodingDetector.test_detwingle¾   s�   € à!×)Ñ)¨&Ó1ˆð.ß/5©v°nÓ/Eð 	ð
 �\Ñ! DÑ(ˆô �]‰]Ô-Ó.ñ 	Ø�J‰J�vÔ÷	ô ×'Ñ'¨Ó,ˆØ<ÀÇÁÈVÓ@TÒTÑTÐT÷	ð 	ús   ÁB
Â
Bc                 ó’   — dD ]B  }|j                  d«      }|j                  d«      sJ ‚t        j                  |«      }||k(  rŒBJ ‚ y )N)u   Å“u   â‚“u   Ã°Â�Â�Â“r!   ó   “)r)   Úendswithr   rr   )r   Útricky_unicode_charÚinputÚoutputs       r   Ú+test_detwingle_ignores_multibyte_charactersz@TestEncodingDetector.test_detwingle_ignores_multibyte_charactersÕ   sO   € ð
$ò 	#Ðð
 (×.Ñ.¨vÓ6ˆEØ—>‘> 'Ô*Ñ*Ü"×,Ñ,¨UÓ3ˆFØ˜U“?Ñ"ñ	#r   c                 ó¼  — d}|j                  d«      }d}|j                  d«      }t        j                  } ||d¬«      �J ‚d ||d¬«      k(  sJ ‚d ||d¬«      k(  sJ ‚d ||«      k(  sJ ‚d ||«      k(  sJ ‚d	d
z  } |||z   «      �J ‚ |||z   «      �J ‚ |||z   dd¬«      dk(  sJ ‚ ||d¬«      dk(  sJ ‚ |d	|z   d¬«      dk(  sJ ‚ |d|z   d¬«      �J ‚y )Nz0<html><head><meta charset="utf-8"></head></html>r   z,<?xml version="1.0" encoding="ISO-8859-1" ?>FrH   r   Tz
iso-8859-1ó    iˆ  )rI   Úsearch_entire_document)r~   ó   a)r)   r   Úfind_declared_encoding)r   Úhtml_unicodeÚ
html_bytesÚxml_unicodeÚ	xml_bytesÚmÚspacers          r   Útest_find_declared_encodingz0TestEncodingDetector.test_find_declared_encodingä   s   € ð JˆØ!×(Ñ(¨Ó1ˆ
àCˆØ×&Ñ& wÓ/ˆ	ä×3Ñ3ˆÙ� uÔ-Ð5Ñ5Ø™!˜L°$Ô7Ò7Ñ7Ø™!˜J°Ô5Ò5Ñ5à™q ›~Ò-Ñ-Ø™q ›|Ò+Ñ+ð ˜‘ˆÙ�˜*Ñ$Ó%Ð-Ñ-Ù�˜)Ñ#Ó$Ð,Ñ,ñ
 ˆf�zÑ!¨4ÈÔMØòñ	
ñ �°4Ô8¸LÒHÑHÙ�˜	Ñ!¸$Ô?À<ÒOÑOÙ�˜	Ñ!¸$Ô?ÐGÑGÐGr   N)r8   r9   r:   rF   rL   r\   r`   rh   rl   rt   r{   r‡   r?   r   r   rA   rA   Q   s3   „ ò<ò8ò!0òF6òQò>
ò$Uò.#ó(Hr   rA   c                   ó¦   — e Zd ZdZd„ Zej                  j                  dddg«      d„ «       Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚTestEntitySubstitutionz1Standalone tests of the EntitySubstitution class.c                 ó   — t         | _        y rO   )r   Úsub©r   s    r   Úsetup_methodz#TestEntitySubstitution.setup_method  s	   € Ü%ˆ�r   zoriginal,substituted)u   fooâˆ€â˜ƒÃµbaru   foo&forall;â˜ƒ&otilde;bar)u   â€˜â€™fooâ€œâ€�z&lsquo;&rsquo;foo&ldquo;&rdquo;c                 óD   — | j                   j                  |«      |k(  sJ ‚y rO   ©r‹   Úsubstitute_html)r   ÚoriginalÚsubstituteds      r   Útest_substitute_htmlz+TestEntitySubstitution.test_substitute_html  s!   € ð �x‰x×'Ñ'¨Ó1°[Ò@Ñ@Ð@r   c                 óp   — dD ]1  \  }}d}||z  }||z  }| j                   j                  |«      |k(  rŒ1J ‚ y )N)
)z&models;u   âŠ§)z&Nfr;u   ð�”‘)z&ngeqq;u   â‰§Ì¸)z&not;õ   Â¬)z&Not;u   â«¬z||)Úfjr–   )z&gt;ú>)z&lt;ú<)z&amp;ú&z3 %s 4r�   )r   ÚentityÚuÚtemplateÚrawÚwith_entitiess         r   Útest_html5_entityz(TestEntitySubstitution.test_html5_entity%  sM   € ð
ò 	B‰IˆF�Að0  ˆHØ˜Q‘,ˆCØ$ vÑ-ˆMØ—8‘8×+Ñ+¨CÓ0°MÓAÑAñ7	Br   c                 ó”   — d}d}| j                   j                  |«      |k(  sJ ‚d}d}| j                   j                  |«      |k(  sJ ‚y )Nu   fjords âŠ” penguinszfjords &sqcup; penguinsu   fjords âŠ”ï¸€ penguinszfjords &sqcups; penguinsr�   )r   rK   r   s      r   Ú)test_html5_entity_with_variation_selectorz@TestEntitySubstitution.test_html5_entity_with_variation_selectorC  sO   € ð (ˆØ*ˆØ�x‰x×'Ñ'¨Ó-°Ò7Ñ7à-ˆØ+ˆØ�x‰x×'Ñ'¨Ó-°Ò7Ñ7Ð7r   c                 óJ   — d}| j                   j                  |d«      |k(  sJ ‚y )NúWelcome to "my bar"F©r‹   Úsubstitute_xml©r   Úss     r   ÚItest_xml_converstion_includes_no_quotes_if_make_quoted_attribute_is_falsez`TestEntitySubstitution.test_xml_converstion_includes_no_quotes_if_make_quoted_attribute_is_falseO  s&   € Ø!ˆØ�x‰x×&Ñ& q¨%Ó0°AÒ5Ñ5Ð5r   c                 óˆ   — | j                   j                  dd«      dk(  sJ ‚| j                   j                  dd«      dk(  sJ ‚y )NÚWelcomeTz	"Welcome"z	Bob's Barz"Bob's Bar"r¤   rŒ   s    r   Ú6test_xml_attribute_quoting_normally_uses_double_quoteszMTestEntitySubstitution.test_xml_attribute_quoting_normally_uses_double_quotesS  s=   € Ø�x‰x×&Ñ& y°$Ó7¸;ÒFÑFØ�x‰x×&Ñ& {°DÓ9¸^ÒKÑKÐKr   c                 óJ   — d}| j                   j                  |d«      dk(  sJ ‚y )Nr£   Tz'Welcome to "my bar"'r¤   r¦   s     r   ÚOtest_xml_attribute_quoting_uses_single_quotes_when_value_contains_double_quoteszfTestEntitySubstitution.test_xml_attribute_quoting_uses_single_quotes_when_value_contains_double_quotesW  s'   € Ø!ˆØ�x‰x×&Ñ& q¨$Ó/Ð3LÒLÑLÐLr   c                 óJ   — d}| j                   j                  |d«      dk(  sJ ‚y )NúWelcome to "Bob's Bar"Tz""Welcome to &quot;Bob's Bar&quot;"r¤   r¦   s     r   Úbtest_xml_attribute_quoting_escapes_single_quotes_when_value_contains_both_single_and_double_quoteszyTestEntitySubstitution.test_xml_attribute_quoting_escapes_single_quotes_when_value_contains_both_single_and_double_quotes[  s'   € Ø%ˆØ�x‰x×&Ñ& q¨$Ó/Ð3XÒXÑXÐXr   c                 óH   — d}| j                   j                  |«      |k(  sJ ‚y )Nr¯   r¤   )r   Úquoteds     r   Ú<test_xml_quotes_arent_escaped_when_value_is_not_being_quotedzSTestEntitySubstitution.test_xml_quotes_arent_escaped_when_value_is_not_being_quoted_  s$   € Ø*ˆØ�x‰x×&Ñ& vÓ.°&Ò8Ñ8Ð8r   c                 óD   — | j                   j                  d«      dk(  sJ ‚y )Nzfoo<bar>zfoo&lt;bar&gt;r¤   rŒ   s    r   Ú'test_xml_quoting_handles_angle_bracketsz>TestEntitySubstitution.test_xml_quoting_handles_angle_bracketsc  s    € Ø�x‰x×&Ñ& zÓ2Ð6FÒFÑFÐFr   c                 óD   — | j                   j                  d«      dk(  sJ ‚y )NzAT&TzAT&amp;Tr¤   rŒ   s    r   Ú#test_xml_quoting_handles_ampersandsz:TestEntitySubstitution.test_xml_quoting_handles_ampersandsf  s   € Ø�x‰x×&Ñ& vÓ.°*Ò<Ñ<Ð<r   c                 óD   — | j                   j                  d«      dk(  sJ ‚y )Nú&Aacute;T&Tz&amp;Aacute;T&amp;Tr¤   rŒ   s    r   ÚEtest_xml_quoting_including_ampersands_when_they_are_part_of_an_entityz\TestEntitySubstitution.test_xml_quoting_including_ampersands_when_they_are_part_of_an_entityi  s    € Ø�x‰x×&Ñ& }Ó5Ð9NÒNÑNÐNr   c                 óD   — | j                   j                  d«      dk(  sJ ‚y )Nr¹   z&Aacute;T&amp;T)r‹   Ú"substitute_xml_containing_entitiesrŒ   s    r   ÚDtest_xml_quoting_ignoring_ampersands_when_they_are_part_of_an_entityz[TestEntitySubstitution.test_xml_quoting_ignoring_ampersands_when_they_are_part_of_an_entityl  s    € Ø�x‰x×:Ñ:¸=ÓIÐM^Ò^Ñ^Ð^r   c                 óH   — d}| j                   j                  |«      |k(  sJ ‚y)z:There's no need to do this except inside attribute values.zBob's "bar"Nr�   )r   Útexts     r   Ú test_quotes_not_html_substitutedz7TestEntitySubstitution.test_quotes_not_html_substitutedo  s$   € àˆØ�x‰x×'Ñ'¨Ó-°Ò5Ñ5Ð5r   N)r8   r9   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…   „ Ù;ò&ð ‡[�[×ÑØð2ð
 Cð		
óñAóðAòBò<
8ò6òLòMòYò9òGò=òOò_ó6r   r‰   )r<   rT   rR   r   Ú
bs4.dammitr   r   r   Úobjectr   rA   r‰   r?   r   r   ú<module>rÃ      sI   ðã Û Û 
Ý ÷ñ ôC0˜ô C0ôJ{H˜6ô {Hô|c6˜Võ c6r   