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

Method test_seek_append_bom

Lib/test/test_io/test_textio.py:889–900  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

887 self.assertEqual(f.read(), 'bbbzzz'.encode(charset))
888
889 def test_seek_append_bom(self):
890 # Same test, but first seek to the start and then to the end
891 filename = os_helper.TESTFN
892 for charset in ('utf-8-sig', 'utf-16', 'utf-32'):
893 with self.open(filename, 'w', encoding=charset) as f:
894 f.write('aaa')
895 with self.open(filename, 'a', encoding=charset) as f:
896 f.seek(0)
897 f.seek(0, self.SEEK_END)
898 f.write('xxx')
899 with self.open(filename, 'rb') as f:
900 self.assertEqual(f.read(), 'aaaxxx'.encode(charset))
901
902 def test_errors_property(self):
903 with self.open(os_helper.TESTFN, "w", encoding="utf-8") as f:

Callers

nothing calls this directly

Calls 6

openMethod · 0.45
writeMethod · 0.45
seekMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected