__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import pytest
from unittest.mock import patch
from bs4.builder import DetectsXMLParsedAsHTML
class TestDetectsXMLParsedAsHTML:
@pytest.mark.parametrize(
"markup,looks_like_xml",
[
("No xml declaration", False),
("<html>obviously HTML</html", False),
("<?xml ><html>Actually XHTML</html>", False),
("<?xml> < html>Tricky XHTML</html>", False),
("<?xml ><no-html-tag>", True),
],
)
def test_warn_if_markup_looks_like_xml(self, markup, looks_like_xml):
# Test of our ability to guess at whether markup looks XML-ish
# _and_ not HTML-ish.
with patch("bs4.builder.DetectsXMLParsedAsHTML._warn") as mock:
for data in markup, markup.encode("utf8"):
result = DetectsXMLParsedAsHTML.warn_if_markup_looks_like_xml(data)
assert result == looks_like_xml
if looks_like_xml:
assert mock.called
else:
assert not mock.called
mock.reset_mock()
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| fuzz | Folder | 0755 |
|
|
| __init__.py | File | 51.04 KB | 0644 |
|
| test_builder.py | File | 1.07 KB | 0644 |
|
| test_builder_registry.py | File | 4.95 KB | 0644 |
|
| test_css.py | File | 18.19 KB | 0644 |
|
| test_dammit.py | File | 17.42 KB | 0644 |
|
| test_element.py | File | 4.27 KB | 0644 |
|
| test_filter.py | File | 26.4 KB | 0644 |
|
| test_formatter.py | File | 6.78 KB | 0644 |
|
| test_fuzz.py | File | 6.96 KB | 0644 |
|
| test_html5lib.py | File | 8.99 KB | 0644 |
|
| test_htmlparser.py | File | 6.51 KB | 0644 |
|
| test_lxml.py | File | 7.28 KB | 0644 |
|
| test_navigablestring.py | File | 4.98 KB | 0644 |
|
| test_pageelement.py | File | 15.82 KB | 0644 |
|
| test_soup.py | File | 22.14 KB | 0644 |
|
| test_tag.py | File | 9.46 KB | 0644 |
|
| test_tree.py | File | 53.55 KB | 0644 |
|