← Back
Editing: test_html5lib.cpython-311.pyc
� G�c� � � � d Z ddlZddlZddlmZ ddlmZ ddlmZm Z m Z ej � e d�� � G d � d e e � � � � Z dS )zDTests to ensure that the html5lib tree builder generates good trees.� N)� BeautifulSoup)�SoupStrainer� )�HTML5LIB_PRESENT�HTML5TreeBuilderSmokeTest�SoupTestz?html5lib seems not to be present, not testing its tree builder.)�reasonc � � 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 � � ddl m} |S )Nr )�HTML5TreeBuilder)�bs4.builderr )�selfr s �9/usr/lib/python3/dist-packages/bs4/tests/test_html5lib.py�default_builderz#TestHTML5LibBuilder.default_builder s � �0�0�0�0�0�0��� c �\ � t d� � }d}t j d�� � 5 }t |d|�� � }d d d � � n# 1 swxY w Y |� � � | � |� � k sJ �|\ }|j t k sJ �dt |j � � v sJ �d S )N�bz<p>A <b>bold</b> statement.</p>T)�record�html5lib)� parse_onlyz4the html5lib tree builder doesn't support parse_only) r �warnings�catch_warningsr �decode�document_for�filename�__file__�str�message)r �strainer�markup�w�soup�warnings r �test_soupstrainerz%TestHTML5LibBuilder.test_soupstrainer s � ���$�$��2�� � $�D� 1� 1� 1� J�Q� ����I�I�I�D� J� J� J� J� J� J� J� J� J� J� J���� J� J� J� J��{�{�}�}�� 1� 1�&� 9� 9�9�9�9�9�� ����8�+�+�+�+�E��W�_�I]�I]�]�]�]�]�]�]s �A�A � A c �` � 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&