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

Method test_encoded_writes

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

Source from the content-addressed store, hash-verified

719 f.close()
720
721 def test_encoded_writes(self):
722 data = "1234567890"
723 tests = ("utf-16",
724 "utf-16-le",
725 "utf-16-be",
726 "utf-32",
727 "utf-32-le",
728 "utf-32-be")
729 for encoding in tests:
730 buf = self.BytesIO()
731 f = self.TextIOWrapper(buf, encoding=encoding)
732 # Check if the BOM is written only once (see issue1753).
733 f.write(data)
734 f.write(data)
735 f.seek(0)
736 self.assertEqual(f.read(), data * 2)
737 f.seek(0)
738 self.assertEqual(f.read(), data * 2)
739 self.assertEqual(buf.getvalue(), (data * 2).encode(encoding))
740
741 def test_unreadable(self):
742 class UnReadable(self.BytesIO):

Callers

nothing calls this directly

Calls 6

writeMethod · 0.95
seekMethod · 0.95
readMethod · 0.95
getvalueMethod · 0.95
assertEqualMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected