HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/site-packages/bs4/tests/__pycache__/test_dammit.cpython-311.pyc
�

��nc@=���ddlZddlZddlZddlmZddlmZmZmZGd�de��Z	Gd�de��Z
Gd�d	e��ZdS)
�N)�
BeautifulSoup)�EntitySubstitution�EncodingDetector�
UnicodeDammitc�T�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
S)�TestUnicodeDammitz"Standalone tests of UnicodeDammit.c�B�d}t|��}|j|ksJ�dS)NuI'm already Unicode! ☃�r�unicode_markup��self�markup�dammits   �7D:\Python311\Lib\site-packages\bs4/tests/test_dammit.py�test_unicode_inputz$TestUnicodeDammit.test_unicode_inputs.��3���v�&�&���$��.�.�.�.�.�.�c�B�d}t|��}|jdksJ�dS)N�<foo>����</foo>u<foo>‘’“”</foo>r
rs   r�test_smart_quotes_to_unicodez.TestUnicodeDammit.test_smart_quotes_to_unicodes/��/���v�&�&���$�(M�M�M�M�M�M�Mrc�F�d}t|d���}|jdksJ�dS)Nr�xml��smart_quotes_toz+<foo>&#x2018;&#x2019;&#x201C;&#x201D;</foo>r
rs   r�!test_smart_quotes_to_xml_entitiesz3TestUnicodeDammit.test_smart_quotes_to_xml_entitiess4��/���v�u�=�=�=���$�(U�U�U�U�U�U�Urc�F�d}t|d���}|jdksJ�dS)Nr�htmlrz'<foo>&lsquo;&rsquo;&ldquo;&rdquo;</foo>r
rs   r�"test_smart_quotes_to_html_entitiesz4TestUnicodeDammit.test_smart_quotes_to_html_entitiess4��/���v�v�>�>�>���$�(Q�Q�Q�Q�Q�Q�Qrc�F�d}t|d���}|jdksJ�dS)Nr�asciirz<foo>''""</foo>r
rs   r�test_smart_quotes_to_asciiz,TestUnicodeDammit.test_smart_quotes_to_ascii#s4��/���v�w�?�?�?���$�(=�=�=�=�=�=�=rc��d}t|��}|j���dksJ�|jdksJ�dS)NsSacré bleu! ☃�utf-8uSacré bleu! ☃�r�original_encoding�lowerr)r
�utf8rs   r�test_detect_utf8z"TestUnicodeDammit.test_detect_utf8(sO��1���t�$�$���'�-�-�/�/�7�:�:�:�:��$�(D�D�D�D�D�D�Drc��d}t|dg��}|j���dksJ�|jdksJ�dS)N����
iso-8859-8uםולשr#�r
�hebrewrs   r�test_convert_hebrewz%TestUnicodeDammit.test_convert_hebrew.sS��$���v��~�6�6���'�-�-�/�/�<�?�?�?�?��$�(B�B�B�B�B�B�Brc��d}t|��}|j���dksJ�|j�d��|ksJ�dS)Nsケータイ Watchr")rr$r%r�encode)r
�utf_8rs   r�/test_dont_see_smart_quotes_where_there_are_nonezATestUnicodeDammit.test_dont_see_smart_quotes_where_there_are_none4s\��I���u�%�%���'�-�-�/�/�7�:�:�:�:��$�+�+�G�4�4��=�=�=�=�=�=rc��d�d��}t|dg��}|j���dksJ�dS)N�
Räksmörgåsr"r*�r/rr$r%�r
�	utf8_datars   r� test_ignore_inappropriate_codecsz2TestUnicodeDammit.test_ignore_inappropriate_codecs:sL��#�*�*�7�3�3�	��y�<�.�9�9���'�-�-�/�/�7�:�:�:�:�:�:rc��d�d��}dD]2}t||g��}|j���dksJ��3dS)Nr3r")z.utf8z...z
utF---16.!r4)r
r6�bad_encodingrs    r�test_ignore_invalid_codecsz,TestUnicodeDammit.test_ignore_invalid_codecs?sb��#�*�*�7�3�3�	�:�	?�	?�L�"�9�|�n�=�=�F��+�1�1�3�3�w�>�>�>�>�>�	?�	?rc���d�d��}t|dg���}|j���dksJ�t|ddg���}|jdksJ�dS)Nr3r")�exclude_encodingszwindows-1252r4r5s   r�test_exclude_encodingsz(TestUnicodeDammit.test_exclude_encodingsEs���#�*�*�7�3�3�	��y�W�I�F�F�F���'�-�-�/�/�>�A�A�A�A���'�>�)B�D�D�D���'�4�/�/�/�/�/�/rN)�__name__�
__module__�__qualname__�__doc__rrrrr r'r-r1r7r:r=�rrrrs�������,�,�/�/�/�
N�N�N�
V�V�V�
R�R�R�
>�>�>�
E�E�E�C�C�C�>�>�>�;�;�;�
?�?�?�0�0�0�0�0rrc�D�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�TestEncodingDetectorc�X�td��}t|j��}d|vsJ�dS)Ns'<?xml version="1.0" encoding="UTF-�" ?>uutf-�)r�list�	encodings)r
�detectedrGs   r�Ptest_encoding_detector_replaces_junk_in_encoding_name_with_replacement_characterzeTestEncodingDetector.test_encoding_detector_replaces_junk_in_encoding_name_with_replacement_characterUs;��#�9�;�;����+�,�,�	�.�)�;�;�;�;�;�;rc�L�dD] }t|d���}d|jksJ��!dS)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_htmlzeuc-jp)rr$�r
�datars   r� test_detect_html5_style_meta_tagz5TestEncodingDetector.test_detect_html5_style_meta_tag[sH��4�	8�	8�D�
#�4��6�6�6�F��v�7�7�7�7�7�7�
	8�	8rc���d}tjj}tjtj��	d�}|tj_t
|��}d|jksJ�d|jvsJ�t|d��}|jsJ�	tjtj
��|tj_dS#tjtj
��|tj_wxYw)NsT<?xml version="1.0" encoding="UTF-8"?>
<html><b>بتر</b>
<i>��ѐ����</i></html>c��dS�NrB)�strs r�noopzETestEncodingDetector.test_last_ditch_entity_replacement.<locals>.noop{s���trTu�zhtml.parser)�bs4r�chardet_dammit�logging�disable�WARNINGr�contains_replacement_charactersrr�NOTSET)r
�doc�chardetrTr�soups      r�"test_last_ditch_entity_replacementz7TestEncodingDetector.test_last_ditch_entity_replacementes��� 2���*�+������(�(�(�	0�
�
�
�(,�C�J�%�"�3�'�'�F��6�A�A�A�A�A��v�4�4�4�4�4� ��m�4�4�D��7�7�7�7�7��O�G�N�+�+�+�(/�C�J�%�%�%��
�O�G�N�+�+�+�(/�C�J�%�/�/�/�/s�AB9�91C*c�\�d}t|��}d|jksJ�d|jksJ�dS)N���<a>��</a>u<a>áé</a>�utf-16le)rrr$rMs   r�test_byte_order_mark_removedz1TestEncodingDetector.test_byte_order_mark_removed�sB��M���t�$�$���� 5�5�5�5�5��V�5�5�5�5�5�5�5rc�L�d}t|��}t|dg���}d|jksJ�t|dg���}d|jksJ�dgd�|jD��ksJ�d}t|dgd	g�
��}d	|jksJ�dd	gd�|jD��ksJ�dS)Nrazutf-16)�known_definite_encodingsr")�user_encodingsrbc��g|]
}|d��S�rrB��.0�xs  r�
<listcomp>zRTestEncodingDetector.test_known_definite_versus_user_encodings.<locals>.<listcomp>�s��E�E�E���!��E�E�Err)r*)rerfc��g|]
}|d��SrhrBris  rrlzRTestEncodingDetector.test_known_definite_versus_user_encodings.<locals>.<listcomp>�s��*P�*P�*P�A�1�Q�4�*P�*P�*Pr�rr$�tried_encodings)r
rNr�before�afterr,s      r�)test_known_definite_versus_user_encodingsz>TestEncodingDetector.test_known_definite_versus_user_encodings�s���
N���t�$�$���t�x�j�I�I�I���6�3�3�3�3�3�
�d�G�9�=�=�=���U�4�4�4�4�4��|�E�E�f�.D�E�E�E�E�E�E�E�%���v��	�/;�n�>�>�>���v�7�7�7�7�7���&�*P�*P��9O�*P�*P�*P�P�P�P�P�P�Prc��d}t|dgdgdg���}d|jksJ�gd�d�|jD��ksJ�dS)Nr)�	shift-jisr"r*)re�override_encodingsrf)rtr"r*c��g|]
}|d��SrhrBris  rrlzKTestEncodingDetector.test_deprecated_override_encodings.<locals>.<listcomp>�s��2�2�2�a�Q�q�T�2�2�2rrnr+s   r�"test_deprecated_override_encodingsz7TestEncodingDetector.test_deprecated_override_encodings�s���%����&1�]� '�y�(�>�	
�
�
���v�7�7�7�7�7�4�3�3�2�2�6�1�2�2�2�
�	
�	
�	
�	
�	
rc�T�d�d��}d�d��}||z|z}tjt��5|�d��ddd��n#1swxYwYtj|��}d|�d��ksJ�dS)Nu	☃☃☃r&u“Hi, I like Windows!”�windows_1252u+☃☃☃“Hi, I like Windows!”☃☃☃)r/�pytest�raises�UnicodeDecodeError�decoder�	detwingle)r
r&ryr\�fixeds     r�test_detwinglez#TestEncodingDetector.test_detwingle�s���!�)�)�&�1�1��
.�/5�v�n�/E�/E�	�
�\�!�D�(���]�-�
.�
.�	�	��J�J�v����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��'��,�,��<����V�@T�@T�T�T�T�T�T�Ts�A.�.A2�5A2c��dD]J}|�d��}|�d��sJ�tj|��}||ksJ��KdS)N)uœuₓu𐐓r&��)r/�endswithrr~)r
�tricky_unicode_char�input�outputs    r�+test_detwingle_ignores_multibyte_charactersz@TestEncodingDetector.test_detwingle_ignores_multibyte_characters�sn��
$�	#�	#��
(�.�.�v�6�6�E��>�>�'�*�*�*�*�*�"�,�U�3�3�F��U�?�"�"�"�"�	#�	#rc��d}|�d��}d}|�d��}tj}||d����J�d||d���ksJ�d||d���ksJ�d||��ksJ�d||��ksJ�d	d
z}|||z���J�|||z���J�|||zdd���dksJ�||d���dksJ�|d	|zd���dksJ�|d
|zd����J�dS)Nz0<html><head><meta charset="utf-8"></head></html>rz,<?xml version="1.0" encoding="ISO-8859-1" ?>FrKr"Tz
iso-8859-1� i�)rL�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�1�
�C���&�&�w�/�/�	��3���q��u�-�-�-�5�5�5��!�!�L�$�7�7�7�7�7�7�7��!�!�J��5�5�5�5�5�5�5��q�q��~�~�-�-�-�-��q�q��|�|�+�+�+�+������q��*�$�%�%�-�-�-��q��)�#�$�$�,�,�,�

�A�f�z�!�4��M�M�M��
�	
�	
�	
��q��4�8�8�8�L�H�H�H�H��q��	�!�$�?�?�?�<�O�O�O�O��q��	�!�$�?�?�?�G�G�G�G�GrN)r>r?r@rIrOr_rcrrrwr�r�r�rBrrrDrDSs�������<�<�<�8�8�8�!0�!0�!0�F6�6�6�Q�Q�Q�>
�
�
�$U�U�U�.
#�
#�
#�(H�(H�(H�(H�(HrrDc�l�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�ZdS)�TestEntitySubstitutionz1Standalone tests of the EntitySubstitution class.c��t|_dSrR)r�sub�r
s r�setup_methodz#TestEntitySubstitution.setup_methods
��%����rc�J�d}|j�|��dksJ�dS)Nufoo∀☃õbarufoo&forall;☃&otilde;bar�r��substitute_html�r
�ss  r�test_simple_html_substitutionz4TestEntitySubstitution.test_simple_html_substitutions1��
,���x�'�'��*�*�.Q�Q�Q�Q�Q�Q�Qrc�r�d}t|��}|j�|j��dksJ�dS)Ns��foo��z&lsquo;&rsquo;foo&ldquo;&rdquo;)rr�r�r)r
�quotesrs   r�test_smart_quote_substitutionz4TestEntitySubstitution.test_smart_quote_substitutions@��(���v�&�&���x�'�'��
�6�6�:[�[�[�[�[�[�[rc�n�dD]1\}}d}||z}||z}|j�|��|ksJ��2dS)N)
)z&models;u⊧)z&Nfr;u𝔑)z&ngeqq;u≧̸)z&not;�¬)z&Not;u⫬z||)�fjr�)z&gt;�>)z&lt;�<)z&amp;�&z3 %s 4r�)r
�entity�u�template�raw�
with_entitiess      r�test_html5_entityz(TestEntitySubstitution.test_html5_entity#sc��
�	B�	B�I�F�A�0 �H��Q�,�C�$�v�-�M��8�+�+�C�0�0�M�A�A�A�A�A�7	B�	Brc��d}d}|j�|��|ksJ�d}d}|j�|��|ksJ�dS)Nufjords ⊔ penguinszfjords &sqcup; penguinsufjords ⊔︀ penguinszfjords &sqcups; penguinsr�)r
rNrs   r�)test_html5_entity_with_variation_selectorz@TestEntitySubstitution.test_html5_entity_with_variation_selectorDs`��(��*���x�'�'��-�-��7�7�7�7�-��+���x�'�'��-�-��7�7�7�7�7�7rc�L�d}|j�|d��|ksJ�dS)N�Welcome to "my bar"F�r��substitute_xmlr�s  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_falsePs0��!���x�&�&�q�%�0�0�A�5�5�5�5�5�5rc��|j�dd��dksJ�|j�dd��dksJ�dS)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_quotesTsN���x�&�&�y�$�7�7�;�F�F�F�F��x�&�&�{�D�9�9�^�K�K�K�K�K�Krc�L�d}|j�|d��dksJ�dS)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_quotesXs1��!���x�&�&�q�$�/�/�3L�L�L�L�L�L�Lrc�L�d}|j�|d��dksJ�dS)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\s1��%���x�&�&�q�$�/�/�3X�X�X�X�X�X�Xrc�J�d}|j�|��|ksJ�dS)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�&�&�v�.�.�&�8�8�8�8�8�8rc�F�|j�d��dksJ�dS)Nzfoo<bar>zfoo&lt;bar&gt;r�r�s r�'test_xml_quoting_handles_angle_bracketsz>TestEntitySubstitution.test_xml_quoting_handles_angle_bracketsds*���x�&�&�z�2�2�6F�F�F�F�F�F�Frc�F�|j�d��dksJ�dS)NzAT&TzAT&amp;Tr�r�s r�#test_xml_quoting_handles_ampersandsz:TestEntitySubstitution.test_xml_quoting_handles_ampersandsgs)���x�&�&�v�.�.�*�<�<�<�<�<�<rc�F�|j�d��dksJ�dS)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_entityjs*���x�&�&�}�5�5�9N�N�N�N�N�N�Nrc�F�|j�d��dksJ�dS)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_entityms*���x�:�:�=�I�I�M^�^�^�^�^�^�^rc�J�d}|j�|��|ksJ�dS)z:There's no need to do this except inside attribute values.zBob's "bar"Nr�)r
�texts  r� test_quotes_not_html_substitutedz7TestEntitySubstitution.test_quotes_not_html_substitutedps.�����x�'�'��-�-��5�5�5�5�5�5rN)r>r?r@rAr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rBrrr�r�s������;�;�&�&�&�R�R�R�\�\�\�B�B�B�B
8�
8�
8�6�6�6�L�L�L�M�M�M�Y�Y�Y�9�9�9�G�G�G�=�=�=�O�O�O�_�_�_�6�6�6�6�6rr�)rzrWrUr�
bs4.dammitrrr�objectrrDr�rBrr�<module>r�s��
�
�
�
�����
�
�
�
�����������������E0�E0�E0�E0�E0��E0�E0�E0�N{H�{H�{H�{H�{H�6�{H�{H�{H�|b6�b6�b6�b6�b6�V�b6�b6�b6�b6�b6r