def test_html_parsing():
    """Test the constructor for the HTML class."""
    _test_resource(FakeHTML, 'doc1.html', _check_doc1)
    _test_resource(
        FakeHTML, 'doc1_UTF-16BE.html', _check_doc1, encoding='UTF-16BE')

    with chdir(Path(__file__).parent):
        path = Path('resources') / 'doc1.html'
        string = path.read_text('utf-8')
        _test_resource(FakeHTML, 'doc1.html', _check_doc1, base_url=path)
        _check_doc1(FakeHTML(string=string, base_url=path))
        _check_doc1(FakeHTML(string=string), has_base_url=False)
        string_with_base = string.replace(
            '<meta', '<base href="resources/"><meta')
        _check_doc1(FakeHTML(string=string_with_base, base_url='.'))
        string_with_no_base = string.replace('<meta', '<base><meta')
        _check_doc1(FakeHTML(string=string_with_no_base), has_base_url=False)
Test the constructor for the HTML class.
tests/test_api.py