Download env/lib/python3.12/site-packages/bs4/tests/test_builder.py from janggi3/myapp: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/janggi3/myapp/resolve/main/env/lib/python3.12/site-packages/bs4/tests/test_builder.py
- Command line
-
hf download hf://spaces/janggi3/myapp/env/lib/python3.12/site-packages/bs4/tests/test_builder.py
-
curl -L -o test_builder.py https://huggingface.co/spaces/janggi3/myapp/resolve/main/env/lib/python3.12/site-packages/bs4/tests/test_builder.py
1.1 kB
| import pytest | |
| from unittest.mock import patch | |
| from bs4.builder import DetectsXMLParsedAsHTML | |
| class TestDetectsXMLParsedAsHTML: | |
| 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() | |