File: D:/Python311/Lib/site-packages/bs4/tests/__pycache__/test_html5lib.cpython-311.pyc
�
��nc6 � � � d Z ddlZ ddlmZ dZn# e$ rZdZY dZ[ndZ[ww xY wddlmZ ddl m
Z
mZmZ ee d � � G d
� 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 � � e Zd ZdZed� � � Zd� Zd� Zd� Zd� Z d� Z
d� Zd � Zd
� Z
d� Zd� Zd
� Zd� Zd� Zd� Zd� ZdS )�TestHTML5LibBuilderz"See ``HTML5TreeBuilderSmokeTest``.c � � t S �Nr ��selfs �9D:\Python311\Lib\site-packages\bs4/tests/test_html5lib.py�default_builderz#TestHTML5LibBuilder.default_builder s � ��� c �F � t d� � }d}t j d�� � 5 }| � ||�� � }d d d � � n# 1 swxY w Y |� � � | � |� � k sJ �dt
|d j � � v sJ �d S )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�wr s r �test_soupstrainerz%TestHTML5LibBuilder.test_soupstrainer s� � ���$�$��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)r r s r �test_correctly_nested_tablesz0TestHTML5LibBuilder.test_correctly_nested_tables% sT � �"��
����
)� *� *� *�
���
;� <� <� <� <� <r c �r � d}| � |� � }d|j � � � k sJ �d S )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�r r r s r �(test_xml_declaration_followed_by_doctypez<TestHTML5LibBuilder.test_xml_declaration_followed_by_doctype9 s= � ��� �y�y�� � �����
�
���/�/�/�/�/�/r c �� � d}| � |� � }d|j � � � k sJ �dt |� d� � � � k sJ �d S )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&