File: D:/Python311/Lib/site-packages/bs4/tests/__pycache__/__init__.cpython-311.pyc
�
��nc!� � � � d Z dZddlZddlZddlZddlZddlZddlmZ ddl m
Z
mZmZm
Z
mZmZmZmZmZ ddlmZmZmZ eZdZ G d� d e� � Z G d
� de� � Z G d� d
e� � Z G d� de� � Z G d� de� � Zd� ZdS )zHelper classes for tests.�MIT� N)�
BeautifulSoup) �CharsetMetaAttributeValue�Comment�ContentMetaAttributeValue�Doctype�PYTHON_SPECIFIC_ENCODINGS�SoupStrainer�Script�
Stylesheet�Tag)�DetectsXMLParsedAsHTML�HTMLParserTreeBuilder�XMLParsedAsHTMLWarningu-
A bare string
<!DOCTYPE xsl:stylesheet SYSTEM "htmlent.dtd">
<!DOCTYPE xsl:stylesheet PUBLIC "htmlent.dtd">
<div><![CDATA[A CDATA section where it doesn't belong]]></div>
<div><svg><![CDATA[HTML5 does allow CDATA sections in SVG]]></svg></div>
<div>A <meta> tag</div>
<div>A <br> tag that supposedly has contents.</br></div>
<div>AT&T</div>
<div><textarea>Within a textarea, markup like <b> tags and <&<& should be treated as literal</textarea></div>
<div><script>if (i < 2) { alert("<b>Markup within script tags should be treated as literal.</b>"); }</script></div>
<div>This numeric entity is missing the final semicolon: <x t="piñata"></div>
<div><a href="http://example.com/</a> that attribute value never got closed</div>
<div><a href="foo</a>, </a><a href="bar">that attribute value was closed by the subsequent tag</a></div>
<! This document starts with a bogus declaration ><div>a</div>
<div>This document contains <!an incomplete declaration <div>(do you see it?)</div>
<div>This document ends with <!an incomplete declaration
<div><a style={height:21px;}>That attribute value was bogus</a></div>
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">The doctype is invalid because it contains extra whitespace
<div><table><td nowrap>That boolean attribute had no value</td></table></div>
<div>Here's a nonexistent entity: &#foo; (do you see it?)</div>
<div>This document ends before the entity finishes: >
<div><p>Paragraphs shouldn't contain block display elements, but this one does: <dl><dt>you see?</dt></p>
<b b="20" a="1" b="10" a="2" a="3" a="4">Multiple values for the same attribute.</b>
<div><table><tr><td>Here's a table</td></tr></table></div>
<div><table id="1"><tr><td>Here's a nested table:<table id="2"><tr><td>foo</td></tr></table></td></div>
<div>This tag contains nothing but whitespace: <b> </b></div>
<div><blockquote><p><b>This p tag is cut off by</blockquote></p>the end of the blockquote tag</div>
<div><table><div>This table contains bare markup</div></table></div>
<div><div id="1">
<a href="link1">This link is never closed.
</div>
<div id="2">
<div id="3">
<a href="link2">This link is closed.</a>
</div>
</div></div>
<div>This document contains a <!DOCTYPE surprise>surprise doctype</div>
<div><a><B><Cd><EFG>Mixed case tags are folded to lowercase</efg></CD></b></A></div>
<div><our☃>Tag name contains Unicode characters</our☃></div>
<div><a ☃="snowman">Attribute name contains Unicode characters</a></div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
c �V � e Zd Zed� � � Zd� Zd� Zdd�ZeZd� Z dd�Z
d � Zd
� ZdS )
�SoupTestc � � t S �N)�default_builder��selfs �4D:\Python311\Lib\site-packages\bs4/tests/__init__.pyr zSoupTest.default_builderG s � ��� c �V � |� d| j � � }t |fd|i|��S )z*Build a Beautiful Soup object from markup.�builder)�popr r )r �markup�kwargsr s r �soupz
SoupTest.soupK s3 � ��*�*�Y��(<�=�=���V�?�?�W�?��?�?�?r c �B � | j di |��� |� � S )z[Turn an HTML fragment into a document.
The details depend on the builder.
� )r �test_fragment_to_document)r r r s r �document_forzSoupTest.document_forP s+ � �
$�t�#�-�-�f�-�-�G�G��O�O�Or Nc �P � | j }t ||�� � }|�|}|� � � | � |� � k sJ �t d� t |j � � � � � D � � � � sJ �|j gd� |j D � � k sJ �dS )ziParse some markup using Beautiful Soup and verify that
the output markup is as expected.
)r Nc 3 �"