| Server IP : 172.67.131.151 / Your IP : 104.23.243.121 Web Server : Apache System : Linux keen-cori.18-142-40-148.plesk.page 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 06:59:36 UTC 2025 x86_64 User : simottodesign.com_2tntp341vs7 ( 10011) PHP Version : 8.3.31 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/bs4/tests/__pycache__/ |
Upload File : |
U
t�^] �
@ s� d Z ddlZzddlmZ dZW n& ek
rF Z zdZW 5 dZ[X Y nX ddlmZ ddl m
Z
mZmZ ee d�G d d
� d
ee
��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 @ s� e Zd ZdZedd� �Zdd� Zdd� Zdd � Zd
d� Z dd
� Z
dd� Zdd� Zdd� Z
dd� Zdd� Zdd� Zdd� Zdd� ZdS )�HTML5LibBuilderSmokeTestz"See ``HTML5TreeBuilderSmokeTest``.c C s t S )Nr )�self� r
�9/usr/lib/python3/dist-packages/bs4/tests/test_html5lib.py�default_builder s z(HTML5LibBuilderSmokeTest.default_builderc C sd t d�}d}tjdd��}| j||d�}W 5 Q R X | �|�� | �|�� | �dt|d j �k� d S )N�bz<p>A <b>bold</b> statement.</p>T)�record)Z
parse_onlyz4the html5lib tree builder doesn't support parse_onlyr )
r �warnings�catch_warnings�soup�assertEqual�decodeZdocument_forZ
assertTrue�str�message)r Zstrainer�markup�wr r
r
r �test_soupstrainer s ���z*HTML5LibBuilderSmokeTest.test_soupstrainerc C s 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)ZassertSoupEquals)r r r
r
r �test_correctly_nested_tables( s ��z5HTML5LibBuilderSmokeTest.test_correctly_nested_tablesc C s$ d}| � |�}| �d|j�� � 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 r �p�encode�r r r r
r
r �(test_xml_declaration_followed_by_doctype<