MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_invalid_xml_escape

Function test_invalid_xml_escape

testing/test_junitxml.py:1047–1080  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1045
1046
1047def test_invalid_xml_escape() -> None:
1048 # Test some more invalid xml chars, the full range should be
1049 # tested really but let's just test the edges of the ranges
1050 # instead.
1051 # XXX This only tests low unicode character points for now as
1052 # there are some issues with the testing infrastructure for
1053 # the higher ones.
1054 # XXX Testing 0xD (\r) is tricky as it overwrites the just written
1055 # line in the output, so we skip it too.
1056 invalid = (
1057 0x00,
1058 0x1,
1059 0xB,
1060 0xC,
1061 0xE,
1062 0x19,
1063 27, # issue #126
1064 0xD800,
1065 0xDFFF,
1066 0xFFFE,
1067 0x0FFFF,
1068 ) # , 0x110000)
1069 valid = (0x9, 0xA, 0x20)
1070 # 0xD, 0xD7FF, 0xE000, 0xFFFD, 0x10000, 0x10FFFF)
1071
1072 for i in invalid:
1073 got = bin_xml_escape(chr(i))
1074 if i <= 0xFF:
1075 expected = "#x%02X" % i
1076 else:
1077 expected = "#x%04X" % i
1078 assert got == expected
1079 for i in valid:
1080 assert chr(i) == bin_xml_escape(chr(i))
1081
1082
1083def 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