def test_xml_xhtml():
    """XHTML responses are handled by the XML formatter."""
    file = XML_FILES_PATH / 'xhtml' / 'xhtml_raw.xml'
    xml_data = file.read_text(encoding=UTF8)

    # Python < 3.8 was sorting attributes (https://bugs.python.org/issue34160)
    # so we have 2 different output expected given the Python version.
    expected_file_name = (
        'xhtml_formatted_python_less_than_3.8.xml'
        if sys.version_info < (3, 8)
        else 'xhtml_formatted.xml'
    )
    expected_xml_file = file.with_name(expected_file_name)
    expected_xml_output = expected_xml_file.read_text(encoding=UTF8)
    responses.add(
        responses.GET,
        DUMMY_URL,
        body=xml_data,
        content_type='application/xhtml+xml',
    )

    r = http(DUMMY_URL)
    assert expected_xml_output in r
XHTML responses are handled by the XML formatter.
tests/test_xml.py