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

Method test_write_to_binary_file

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

Source from the content-addressed store, hash-verified

4326 self.assertEqual(f.read(), b'''<site>\xf8</site>''')
4327
4328 def test_write_to_binary_file(self):
4329 self.addCleanup(os_helper.unlink, TESTFN)
4330 tree = ET.ElementTree(ET.XML('''<site>\xf8</site>'''))
4331 with open(TESTFN, 'wb') as f:
4332 tree.write(f)
4333 self.assertFalse(f.closed)
4334 with open(TESTFN, 'rb') as f:
4335 self.assertEqual(f.read(), b'''<site>&#248;</site>''')
4336
4337 def test_write_to_binary_file_with_encoding(self):
4338 self.addCleanup(os_helper.unlink, TESTFN)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected