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

Method test_write_to_filename_as_unicode

Lib/test/test_xml_etree.py:4296–4305  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4294 b'''<site>\xf8</site>'''))
4295
4296 def test_write_to_filename_as_unicode(self):
4297 self.addCleanup(os_helper.unlink, TESTFN)
4298 with open(TESTFN, 'w') as f:
4299 encoding = f.encoding
4300 os_helper.unlink(TESTFN)
4301
4302 tree = ET.ElementTree(ET.XML('''<site>\xf8</site>'''))
4303 tree.write(TESTFN, encoding='unicode')
4304 with open(TESTFN, 'rb') as f:
4305 self.assertEqual(f.read(), b"<site>\xc3\xb8</site>")
4306
4307 def test_write_to_text_file(self):
4308 self.addCleanup(os_helper.unlink, TESTFN)

Callers

nothing calls this directly

Calls 6

writeMethod · 0.95
addCleanupMethod · 0.80
openFunction · 0.50
unlinkMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected