| Server IP : 35.80.110.71 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/bs4/tests/__pycache__/ |
Upload File : |
�
��eC � � � d dl Z d dlZd dlmZ d dlmZmZmZ ddlm Z m
Z
e
rd dlmZ e j j e
d�� G d � d
e � � Zy)� N)� MagicMock)�CSS�
BeautifulSoup� ResultSet� )�SoupTest�SOUP_SIEVE_PRESENT)�SelectorSyntaxErrorzSoup Sieve not installed)�reasonc � � e Zd ZdZdZd� Zd� ZeZd� Zd� Z d� Z
d� Zd � Zd
� Z
d� Zd� Zd
� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z!d� Z"d � Z#d!� Z$d"� Z%d#� Z&d$� Z'd%� Z(d&� Z)d'� Z*d(� Z+d)� Z,d*� Z-d+� Z.d,� Z/d-� Z0d.� Z1d/� Z2d0� Z3d1� Z4d2� Z5d3� Z6d4� Z7d5� Z8d6� Z9d7� Z:d8� Z;d9� Z<d:� Z=d;� Z>d<� Z?d=� Z@d>� ZAd?� ZBd@� ZCdA� ZDyB)C�TestCSSSelectorsz�Test basic CSS selector functionality.
This functionality is implemented in soupsieve, which has a much
more comprehensive test suite, so this is basically an extra check
that soupsieve works as expected.
a�
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>The title</title>
<link rel="stylesheet" href="blah.css" type="text/css" id="l1">
</head>
<body>
<custom-dashed-tag class="dashed" id="dash1">Hello there.</custom-dashed-tag>
<div id="main" class="fancy">
<div id="inner">
<h1 id="header1">An H1</h1>
<p>Some text</p>
<p class="onep" id="p1">Some more text</p>
<h2 id="header2">An H2</h2>
<p class="class1 class2 class3" id="pmulti">Another</p>
<a href="http://bob.example.org/" rel="friend met" id="bob">Bob</a>
<h2 id="header3">Another H2</h2>
<a id="me" href="http://simonwillison.net/" rel="me">me</a>
<span class="s1">
<a href="#" id="s1a1">span1a1</a>
<a href="#" id="s1a2">span1a2 <span id="s1a2s1">test</span></a>
<span class="span2">
<a href="#" id="s2a1">span2a1</a>
</span>
<span class="span3"></span>
<custom-dashed-tag class="dashed" id="dash2"/>
<div data-tag="dashedvalue" id="data1"/>
</span>
</div>
<x id="xid">
<z id="zida"/>
<z id="zidab"/>
<z id="zidac"/>
</x>
<y id="yid">
<z id="zidb"/>
</y>
<p lang="en" id="lang-en">English</p>
<p lang="en-gb" id="lang-en-gb">English UK</p>
<p lang="en-us" id="lang-en-us">English US</p>
<p lang="fr" id="lang-fr">French</p>
</div>
<div id="footer">
</div>
c �: � t | j d� | _ y )N�html.parser)r �HTML�soup��selfs �4/usr/lib/python3/dist-packages/bs4/tests/test_css.py�setup_methodzTestCSSSelectors.setup_methodN s � �!�$�)�)�]�;�� � c �8 � | j j |fi |��}t |t � sJ �|D �cg c] }|d �� }}|j � |j � ||k( s/J d|�ddj |� �ddj |� �d�� �y c c}w )N�idz Selector z, expected [z, z], got [�])r �select�
isinstancer �sort�join)r �selector�expected_ids�kwargs�results�el�el_idss r �assert_selectszTestCSSSelectors.assert_selectsQ s� � �"�$�)�)�"�"�8�6�v�6���'�9�-�-�-�%,�-�r�"�T�(�-��-����
������v�%�
��$�)�)�L�1�4�9�9�V�3D�(
�
�%�� .s �Bc �<