MCPcopy Index your code
hub / github.com/python/cpython / test_xml_encodings

Method test_xml_encodings

Lib/test/test_plistlib.py:892–909  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

890 self.assertEqual(value, 123)
891
892 def test_xml_encodings(self):
893 base = TESTDATA[plistlib.FMT_XML]
894
895 for xml_encoding, encoding, bom in [
896 (b'utf-8', 'utf-8', codecs.BOM_UTF8),
897 (b'utf-16', 'utf-16-le', codecs.BOM_UTF16_LE),
898 (b'utf-16', 'utf-16-be', codecs.BOM_UTF16_BE),
899 # Expat does not support UTF-32
900 #(b'utf-32', 'utf-32-le', codecs.BOM_UTF32_LE),
901 #(b'utf-32', 'utf-32-be', codecs.BOM_UTF32_BE),
902 ]:
903
904 pl = self._create(fmt=plistlib.FMT_XML)
905 with self.subTest(encoding=encoding):
906 data = base.replace(b'UTF-8', xml_encoding)
907 data = bom + data.decode('utf-8').encode(encoding)
908 pl2 = plistlib.loads(data)
909 self.assertEqual(dict(pl), dict(pl2))
910
911 def test_dump_invalid_format(self):
912 with self.assertRaises(ValueError):

Callers

nothing calls this directly

Calls 7

_createMethod · 0.95
subTestMethod · 0.45
replaceMethod · 0.45
encodeMethod · 0.45
decodeMethod · 0.45
loadsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected