MCPcopy
hub / github.com/pytest-dev/pytest / test_invalid_xml_escape

Function test_invalid_xml_escape

testing/test_junitxml.py:1113–1142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1111
1112
1113def test_invalid_xml_escape() -> None:
1114 # Test some more invalid xml chars, the full range should be
1115 # tested really but let's just test the edges of the ranges
1116 # instead.
1117 # XXX Testing 0xD (\r) is tricky as it overwrites the just written
1118 # line in the output, so we skip it too.
1119 invalid = (
1120 0x00,
1121 0x1,
1122 0xB,
1123 0xC,
1124 0xE,
1125 0x19,
1126 27, # issue #126
1127 0xD800,
1128 0xDFFF,
1129 0xFFFE,
1130 0x0FFFF,
1131 )
1132 valid = (0x9, 0xA, 0x20, 0xD, 0xD7FF, 0xE000, 0xFFFD, 0x10000, 0x10FFFF)
1133
1134 for i in invalid:
1135 got = bin_xml_escape(chr(i))
1136 if i <= 0xFF:
1137 expected = f"#x{i:02X}"
1138 else:
1139 expected = f"#x{i:04X}"
1140 assert got == expected
1141 for i in valid:
1142 assert chr(i) == bin_xml_escape(chr(i))
1143
1144
1145def test_logxml_path_expansion(tmp_path: Path, monkeypatch: MonkeyPatch) -> None:

Callers

nothing calls this directly

Calls 1

bin_xml_escapeFunction · 0.90

Tested by

no test coverage detected