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_html5lib.cpython-311.pyc
�

��nc6 ���dZddlZ	ddlmZdZn#e$rZdZYdZ[ndZ[wwxYwddlmZddl	m
Z
mZmZeed	��Gd
�dee
����Z
dS)zDTests to ensure that the html5lib tree builder generates good trees.�N��HTML5TreeBuilderTF)�SoupStrainer�)�HTML5TreeBuilderSmokeTest�SoupTest�skipIfz?html5lib seems not to be present, not testing its tree builder.c��eZdZdZed���Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�ZdS)�TestHTML5LibBuilderz"See ``HTML5TreeBuilderSmokeTest``.c��tS�Nr��selfs �9D:\Python311\Lib\site-packages\bs4/tests/test_html5lib.py�default_builderz#TestHTML5LibBuilder.default_builders����c�F�td��}d}tjd���5}|�||���}ddd��n#1swxYwY|���|�|��ksJ�dt
|dj��vsJ�dS)N�bz<p>A <b>bold</b> statement.</p>T)�record)�
parse_onlyz4the html5lib tree builder doesn't support parse_onlyr)r�warnings�catch_warnings�soup�decode�document_for�str�message)r�strainer�markup�wrs     r�test_soupstrainerz%TestHTML5LibBuilder.test_soupstrainers�����$�$��2��
�
$�D�
1�
1�
1�	:�Q��9�9�V��9�9�9�D�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:�	:����	:�	:�	:�	:��{�{�}�}�� 1� 1�&� 9� 9�9�9�9�9�E��Q�q�T�\�IZ�IZ�Z�Z�Z�Z�Z�Zs�A�A�Ac�`�d}|�|d��|�d��dS)z8html5lib inserts <tbody> tags where other parsers don't.z[<table id="1"><tr><td>Here's another table:<table id="2"><tr><td>foo</td></tr></table></td>z�<table id="1"><tbody><tr><td>Here's another table:<table id="2"><tbody><tr><td>foo</td></tr></tbody></table></td></tr></tbody></table>z{<table><thead><tr><td>Foo</td></tr></thead><tbody><tr><td>Bar</td></tr></tbody><tfoot><tr><td>Baz</td></tr></tfoot></table>N)�assert_soup)rrs  r�test_correctly_nested_tablesz0TestHTML5LibBuilder.test_correctly_nested_tables%sT��"��	
����
)�	*�	*�	*�	
���
;�	<�	<�	<�	<�	<rc�r�d}|�|��}d|j���ksJ�dS)Nzy<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
   <p>foo</p>
  </body>
</html>s
<p>foo</p>)r�p�encode�rrrs   r�(test_xml_declaration_followed_by_doctypez<TestHTML5LibBuilder.test_xml_declaration_followed_by_doctype9s=�����y�y�� � �����
�
���/�/�/�/�/�/rc���d}|�|��}d|j���ksJ�dt|�d����ksJ�dS)Nz%<p><em>foo</p>
<p>bar<a></a></em></p>zD<body><p><em>foo</em></p><em>
</em><p><em>bar<a></a></em></p></body>�r&�r�bodyr�len�find_allr(s   r�test_reparented_markupz*TestHTML5LibBuilder.test_reparented_markupGsd��9���y�y�� � ��V�Z^�Zc�Zj�Zj�Zl�Zl�l�l�l�l��C��
�
�c�*�*�+�+�+�+�+�+�+�+rc���d}|�|��}d|j���ksJ�dt|�d����ksJ�dS)Nz&<p><em>foo</p>
<p>bar<a></a></em></p>
zE<body><p><em>foo</em></p><em>
</em><p><em>bar<a></a></em></p>
</body>r+r&r,r(s   r�+test_reparented_markup_ends_with_whitespacez?TestHTML5LibBuilder.test_reparented_markup_ends_with_whitespaceNsd��;���y�y�� � ��X�\`�\e�\l�\l�\n�\n�n�n�n�n��C��
�
�c�*�*�+�+�+�+�+�+�+�+rc���d}|�|��}|�d���\}}|�d��\}}|j|usJ�|j|usJ�dS)z�Verify that we keep the two whitespace nodes in this
        document distinct when reparenting the adjacent <tbody> tags.
        z,<table> <tbody><tbody><ims></tbody> </table>� ��string�tbodyN)rr/�next_element)rrr�space1�space2�tbody1�tbody2s       r�<test_reparented_markup_containing_identical_whitespace_nodeszPTestHTML5LibBuilder.test_reparented_markup_containing_identical_whitespace_nodesTsu��@���y�y�� � �����c��2�2�������w�/�/�����"�f�,�,�,�,��"�f�,�,�,�,�,�,rc���d}|�|��}|j}d|jksJ�|�d���}|�d���d}||jksJ�||jksJ�dS)NzF<div><a>aftermath<p><noscript>target</noscript>aftermath</a></p></div>�targetr5�	aftermath���)r�noscriptr8�findr/�previous_element)rrrrBr?�final_aftermaths      r�*test_reparented_markup_containing_childrenz>TestHTML5LibBuilder.test_reparented_markup_containing_children_s���Y���y�y�� � ���=���8�0�0�0�0�0����(��+�+���-�-�{�-�;�;�B�?��
�&�"5�5�5�5�5���9�9�9�9�9�9�9rc�|�d}|�|��}t|���d��sJ�dS)z(Processing instructions become comments.s<?PITarget PIContent?>z<!--?PITarget PIContent?-->N)rr�
startswithr(s   r�test_processing_instructionz/TestHTML5LibBuilder.test_processing_instructionos?��.���y�y�� � ���4�y�y�#�#�$A�B�B�B�B�B�B�Brc��d}|�|��}|�d��\}}||ksJ�||usJ�dS)Ns<a class="my_class"><p></a>�a)rr/)rrr�a1�a2s     r�test_cloned_multivalue_nodez/TestHTML5LibBuilder.test_cloned_multivalue_nodeusP��3���y�y�� � �����s�#�#���B��R�x������|�����rc�r�d}|�|��}d|j���ksJ�dS)Ns<table><td></tbody>Az><body>A<table><tbody><tr><td></td></tr></tbody></table></body>)rr-rr(s   r�test_foster_parentingz)TestHTML5LibBuilder.test_foster_parenting|s?��,���y�y�� � ��O�SW�S\�Sc�Sc�Se�Se�e�e�e�e�e�erc���d}|�|��}d�|d��D��d�|d��D��t|�d����dksJ�dS)	z�
        Test that extraction does not destroy the tree.

        https://bugs.launchpad.net/beautifulsoup/+bug/1782928
        zW
<html><head></head>
<style>
</style><script></script><body><p>hello</p></body></html>
c�6�g|]}|�����S���extract��.0�ss  r�
<listcomp>z7TestHTML5LibBuilder.test_extraction.<locals>.<listcomp>�s ��-�-�-�������-�-�-r�scriptc�6�g|]}|�����SrSrTrVs  rrYz7TestHTML5LibBuilder.test_extraction.<locals>.<listcomp>�s ��,�,�,�������,�,�,r�styler&rN)rr.r/r(s   r�test_extractionz#TestHTML5LibBuilder.test_extraction�s����
�y�y�� � ��-�-�d�d�8�n�n�-�-�-�-�,�,�d�d�7�m�m�,�,�,�,��4�=�=��%�%�&�&�!�+�+�+�+�+�+rc���d}|�|��}g}|�d��D]*}|�|�d�����+t|��dksJ�dS)z�
        Test that empty comment does not break structure.

        https://bugs.launchpad.net/beautifulsoup/+bug/1806598
        zI
<html>
<body>
<form>
<!----><input type="text">
</form>
</body>
</html>
�form�inputrN)rr/�extendr.)rrr�inputsr_s     r�test_empty_commentz&TestHTML5LibBuilder.test_empty_comment�sz�����y�y�� � �����M�M�&�)�)�	2�	2�D��M�M�$�-�-��0�0�1�1�1�1��6�{�{�a������rc�P�d}|�|��}d|jjksJ�d|jjksJ�d|j�d��jksJ�|�|d���}d|jjjksJ�d|jjjksJ�dS)Nz=
   <p>

<sourceline>
<b>text</b></sourceline><sourcepos></p>r+��
sourcelineF)�store_line_numbers�	sourcepos)rr&rfrhrC�namer(s   r�test_tracking_line_numbersz.TestHTML5LibBuilder.test_tracking_line_numbers�s���U���y�y�� � ���D�F�%�%�%�%�%��D�F�$�$�$�$�$��t�v�{�{�<�8�8�=�=�=�=�=��y�y��E�y�:�:���t�v�0�5�5�5�5�5��d�f�.�3�3�3�3�3�3�3rc��dSr
rSrs r�test_special_string_containersz2TestHTML5LibBuilder.test_special_string_containers�s	��	
�rc��dD]|\}}}d|z}|�|��j}|���}d|�d��z}||ksJ�|�d���}d|z}||ksJ��}dS)N))z&RightArrowLeftArrow;u⇄s&rlarr;)z&models;u⊧s&models;)z&Nfr;u𝔑s&Nfr;)z&ngeqq;u≧̸s&ngeqq;)z&not;�¬s&not;)z&Not;u⫬s&Not;)z&quot;�"�")z&there4;�∴�&there4;)z&Therefore;rqrr)z&therefore;rqrr)z&fjlig;�fjsfj)z&sqcup;u⊔s&sqcup;)z&sqcups;u⊔︀s&sqcups;)z&apos;�'�')z&verbar;�|�|z
<div>%s</div>s
<div>%s</div>�utf8�html)�	formatter)r�divr')	r�
input_element�output_unicode�output_elementrr{�without_element�expect�with_elements	         r�test_html5_attributesz)TestHTML5LibBuilder.test_html5_attributes�s���>
�	*�	*�9�M�>�>�"%�}�4�F��)�)�F�#�#�'�C�!�j�j�l�l�O�%��(=�(=�f�(E�(E�E�F�"�f�,�,�,�,��:�:��:�7�7�L�%��6�F��6�)�)�)�)�)�3	*�	*rN)�__name__�
__module__�__qualname__�__doc__�propertyrr!r$r)r0r2r=rFrIrNrPr]rcrjrlr�rSrrrrs������-�,�
� � ��X� �[�[�[�<�<�<�(0�0�0�,�,�,�,�,�,�	-�	-�	-�:�:�:� C�C�C����f�f�f�
,�,�,�$ � � �,4�4�4�
�
�
�"*�"*�"*�"*�"*rr)r�r�bs4.builderr�HTML5LIB_PRESENT�ImportError�e�bs4.elementr�rrr	rrSrr�<module>r�s��J�J������,�,�,�,�,�,������������������������$�$�$�$�$�$���������������E�G�G�K*�K*�K*�K*�K*�(�$=�K*�K*�G�G�K*�K*�K*s��"��"