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