Satisfy the needs of defusedxml.defuse_stdlib() whilst still retaining functionality and passing tests
Some checks failed
CI / test (push) Successful in 40s
Lint / test (push) Failing after 23s
Trivy / test (push) Successful in 23s

This commit is contained in:
Miguel Jacq 2025-11-27 15:21:17 +11:00
parent 910234ed65
commit 3840b71812
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
2 changed files with 7 additions and 10 deletions

View file

@ -566,8 +566,7 @@ def test_generate_template_xml_structural_fallback():
</root>
"""
)
parser = ET.XMLParser(target=ET.TreeBuilder(insert_comments=False))
root = ET.fromstring(xml_text, parser=parser)
root = ET.fromstring(xml_text)
tmpl = generate_template("xml", parsed=root, role_prefix="role")
@ -643,8 +642,7 @@ def test_flatten_xml_text_with_attributes_uses_value_suffix():
the text at path + ('value',), not just path.
"""
xml_text = "<root><node attr='x'>text</node></root>"
parser = ET.XMLParser(target=ET.TreeBuilder(insert_comments=False))
root = ET.fromstring(xml_text, parser=parser)
root = ET.fromstring(xml_text)
items = flatten_config("xml", root)