Test XML formatter limits with data containing comments, doctypes and other XML-specific subtles.
(file)
| 34 | @pytest.mark.parametrize('file', XML_FILES_VALID) |
| 35 | @responses.activate |
| 36 | def test_valid_xml(file): |
| 37 | """Test XML formatter limits with data containing comments, doctypes |
| 38 | and other XML-specific subtles. |
| 39 | """ |
| 40 | if 'standalone' in file.stem and sys.version_info < (3, 9): |
| 41 | pytest.skip('Standalone XML requires Python 3.9+') |
| 42 | |
| 43 | xml_data = file.read_text(encoding=UTF8) |
| 44 | expected_xml_file = file.with_name(file.name.replace('_raw', '_formatted')) |
| 45 | expected_xml_output = expected_xml_file.read_text(encoding=UTF8) |
| 46 | responses.add( |
| 47 | responses.GET, |
| 48 | DUMMY_URL, |
| 49 | body=xml_data, |
| 50 | content_type='application/xml', |
| 51 | ) |
| 52 | |
| 53 | r = http(DUMMY_URL) |
| 54 | assert expected_xml_output in r |
| 55 | |
| 56 | |
| 57 | @responses.activate |