403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/bs4/tests/__pycache__/test_html5lib.cpython-38.pyc
U

t�^]�
@s�dZddlZzddlmZdZWn&ek
rFZzdZW5dZ[XYnXddlmZddl	m
Z
mZmZeed�Gd	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�eZdZdZedd��Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)�HTML5LibBuilderSmokeTestz"See ``HTML5TreeBuilderSmokeTest``.cCstS)Nr)�self�r
�9/usr/lib/python3/dist-packages/bs4/tests/test_html5lib.py�default_buildersz(HTML5LibBuilderSmokeTest.default_builderc	Csdtd�}d}tjdd��}|j||d�}W5QRX|�|��|�|��|�dt|dj	�k�dS)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�decodeZdocument_forZ
assertTrue�str�message)r	Zstrainer�markup�wrr
r
r�test_soupstrainers���z*HTML5LibBuilderSmokeTest.test_soupstrainercCsd}|�|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	rr
r
r�test_correctly_nested_tables(s��z5HTML5LibBuilderSmokeTest.test_correctly_nested_tablescCs$d}|�|�}|�d|j���dS)Nzy<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
   <p>foo</p>
  </body>
</html>s
<p>foo</p>)rr�p�encode�r	rrr
r
r�(test_xml_declaration_followed_by_doctype<s	
zAHTML5LibBuilderSmokeTest.test_xml_declaration_followed_by_doctypecCs:d}|�|�}|�d|j���|�dt|�d���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�rr�bodyr�len�find_allrr
r
r�test_reparented_markupJs
z/HTML5LibBuilderSmokeTest.test_reparented_markupcCs:d}|�|�}|�d|j���|�dt|�d���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>rrrrr
r
r�+test_reparented_markup_ends_with_whitespaceQs
zDHTML5LibBuilderSmokeTest.test_reparented_markup_ends_with_whitespacecCsLd}|�|�}|jdd�\}}|�d�\}}|j|ks:t�|j|ksHt�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>� ��stringZtbodyN)rr"�next_element�AssertionError)r	rrZspace1Zspace2Ztbody1Ztbody2r
r
r�<test_reparented_markup_containing_identical_whitespace_nodesWs
zUHTML5LibBuilderSmokeTest.test_reparented_markup_containing_identical_whitespace_nodescCs^d}|�|�}|j}|�d|j�|jdd�}|jdd�d}|�||j�|�||j�dS)NzF<div><a>aftermath<p><noscript>target</noscript>aftermath</a></p></div>�targetr&Z	aftermath���)r�noscriptrr(�findr"Zprevious_element)r	rrr-r+Zfinal_aftermathr
r
r�*test_reparented_markup_containing_childrenbs
zCHTML5LibBuilderSmokeTest.test_reparented_markup_containing_childrencCs$d}|�|�}t|��d�s t�dS)z(Processing instructions become comments.s<?PITarget PIContent?>z<!--?PITarget PIContent?-->N)rr�
startswithr)rr
r
r�test_processing_instructionrs
z4HTML5LibBuilderSmokeTest.test_processing_instructioncCs8d}|�|�}|�d�\}}|�||�||k	s4t�dS)Ns<a class="my_class"><p></a>�a)rr"rr))r	rrZa1Za2r
r
r�test_cloned_multivalue_nodexs

z4HTML5LibBuilderSmokeTest.test_cloned_multivalue_nodecCs$d}|�|�}|�d|j���dS)Ns<table><td></tbody>Az><body>A<table><tbody><tr><td></td></tr></tbody></table></body>)rrr rrr
r
r�test_foster_parentings
z.HTML5LibBuilderSmokeTest.test_foster_parentingcCsLd}|�|�}dd�|d�D�dd�|d�D�|�t|�d��d�d	S)
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>
cSsg|]}|���qSr
��extract��.0�sr
r
r�
<listcomp>�sz<HTML5LibBuilderSmokeTest.test_extraction.<locals>.<listcomp>ZscriptcSsg|]}|���qSr
r5r7r
r
rr:�sZstyler�N)rrr!r"rr
r
r�test_extraction�s

z(HTML5LibBuilderSmokeTest.test_extractioncCsFd}|�|�}g}|�d�D]}|�|�d��q|�t|�d�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�inputr;N)rr"�extendrr!)r	rrZinputsr=r
r
r�test_empty_comment�s	
z+HTML5LibBuilderSmokeTest.test_empty_commentcCszd}|�|�}|�d|jj�|�d|jj�|�d|j�d�j�|j|dd�}|�d|jjj�|�d|jjj�dS)Nz=
   <p>

<sourceline>
<b>text</b></sourceline><sourcepos></p>r��
sourcelineF)Zstore_line_numbers�	sourcepos)rrrrBrCr.�namerr
r
r�test_tracking_line_numbers�s
z3HTML5LibBuilderSmokeTest.test_tracking_line_numbersN)�__name__�
__module__�__qualname__�__doc__�propertyrrrrr#r$r*r/r1r3r4r<r@rEr
r
r
rrs 

r)rIrZbs4.builderrZHTML5LIB_PRESENT�ImportError�eZbs4.elementrZbs4.testingrrrrr
r
r
r�<module>s�

Youez - 2016 - github.com/yon3zu
LinuXploit