fix: accept either quote character in the XML declaration

This commit is contained in:
randogoth 2026-10-11 20:50:48 +03:00
parent d4b90a3947
commit f54d350216
3 changed files with 18 additions and 2 deletions

View file

@ -34,6 +34,17 @@ def test_rule_failure_maps_to_its_section(fail_page, name, expected):
assert (match[0].section, match[0].level) == (section, level)
def test_either_quote_character_opens_the_declaration(conforming):
"""Serialisers differ: lxml writes single quotes, and XML allows them."""
page = conforming().replace(
b'<?xml version="1.0" encoding="UTF-8"?>',
b"<?xml version='1.0' encoding='UTF-8'?>",
)
report = validate_bytes(page)
assert "xml-declaration" not in [f.code for f in report.findings]
assert report.conforms
def test_entity_declarations_are_refused_before_parsing(fail_page):
"""A page declaring its own entities is rejected without expanding them."""
report = validate_bytes(fail_page("billion-laughs"))