HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib64/python3.10/site-packages/bs4/tests/__pycache__/test_fuzz.cpython-310.pyc
o

�h<�@s�dZddlZddlZddlmZmZzddlmZddlZddl	Z	dZ
Wney/dZ
Ynwejj
e
dd�Gd	d
�d
e��ZdS)aThis file contains test cases reported by third parties using
fuzzing tools, primarily from Google's oss-fuzz project. Some of these
represent real problems with Beautiful Soup, but many are problems in
libraries that Beautiful Soup depends on, and many of the test cases
represent different ways of triggering the same problem.

Grouping these test cases together makes it easy to see which test
cases represent the same problem, and puts the test cases in close
proximity to code that can trigger the problems.
�N)�
BeautifulSoup�ParserRejectedMarkup)�SelectorSyntaxErrorTFz/Prerequisites for fuzz tests are not installed.��reasonc@s�eZdZdZdd�Zej�dddg�dd��Zej�dgd	��d
d��Z	ej�dgd��d
d��Z
ej�dddg�dd��Zejjdd�ej�dgd��dd���Z
ejjdd�ej�ddg�dd���Zdd�ZdS)�TestFuzzz	.testcasecCs�|�|�}gd�}zt|d�t|�}Wn
tyYdSw|dd�|dd�}}zt|dd�||d�}WntyEYdStyNYdSwt|�d��z|j�	|�
dd��Wn
tylYdSw|��dS)	N)zlxml-xml�html5lib�html.parser�lxmlr��
)�featuresTzutf-8�replace)
�_TestFuzz__markup�int�len�
ValueErrorrr�list�find_all�css�select�decoder�prettify)�self�filename�data�parsers�idx�css_selector�soup�r �F/usr/local/CyberCP/lib/python3.10/site-packages/bs4/tests/test_fuzz.py�fuzz_test_with_css)s,
���zTestFuzz.fuzz_test_with_cssrz:clusterfuzz-testcase-minimized-bs4_fuzzer-5703933063462912z.crash-ffbdfa8a2b26f13537b68d3794b0478a4090ee4acCsD|�|�}t�t��t|d�Wd�dS1swYdS�Nr	)r�pytest�raisesrr�rr�markupr r r!�test_rejected_markupDs
"�zTestFuzz.test_rejected_markup)z:clusterfuzz-testcase-minimized-bs4_fuzzer-5984173902397440z:clusterfuzz-testcase-minimized-bs4_fuzzer-5167584867909632z:clusterfuzz-testcase-minimized-bs4_fuzzer-6124268085182464z:clusterfuzz-testcase-minimized-bs4_fuzzer-6450958476902400cCs|�|�}t|d���dSr#)rr�encoder&r r r!�'test_deeply_nested_document_without_cssVs
z0TestFuzz.test_deeply_nested_document_without_css)z:clusterfuzz-testcase-minimized-bs4_fuzzer-5000587759190016z:clusterfuzz-testcase-minimized-bs4_fuzzer-5375146639360000z:clusterfuzz-testcase-minimized-bs4_fuzzer-5492400320282624cC�|�|�dS�N�r"�rrr r r!�test_deeply_nested_documenti�z$TestFuzz.test_deeply_nested_documentz:clusterfuzz-testcase-minimized-bs4_fuzzer-4670634698080256z:clusterfuzz-testcase-minimized-bs4_fuzzer-5270998950477824cCr+r,r-r.r r r!�test_soupsieve_errorssszTestFuzz.test_soupsieve_errorszhtml5lib-specific problemsr)z:clusterfuzz-testcase-minimized-bs4_fuzzer-4818336571064320z:clusterfuzz-testcase-minimized-bs4_fuzzer-4999465949331456z:clusterfuzz-testcase-minimized-bs4_fuzzer-5843991618256896z:clusterfuzz-testcase-minimized-bs4_fuzzer-6241471367348224z:clusterfuzz-testcase-minimized-bs4_fuzzer-6600557255327744z.crash-0d306a50c8ed8bcd0785b67000fcd5dea1d33f08cCs |�|�}tt|d����dS)Nr)r�printrr)r&r r r!�&test_html5lib_parse_errors_without_css�s
z/TestFuzz.test_html5lib_parse_errors_without_cssz:clusterfuzz-testcase-minimized-bs4_fuzzer-6306874195312640cCr+r,r-r.r r r!�test_html5lib_parse_errors�r0z#TestFuzz.test_html5lib_parse_errorscCsD|�|j�s||j7}tj�t�d}tj�|d|�}t|d���S)Nr�fuzz�rb)	�endswith�TESTCASE_SUFFIX�os�path�split�__file__�join�open�read)rr�this_dirr:r r r!�__markup�s

zTestFuzz.__markupN)�__name__�
__module__�__qualname__r8r"r$�mark�parametrizer(r*r/r1�skipr3r4rr r r r!rsL
��
�
�
��

���r)�__doc__r9r$�bs4rr�soupsieve.utilrr
r�fully_fuzzable�ImportErrorrE�skipif�objectrr r r r!�<module>s
�