MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_encoded_writes

Method test_encoded_writes

Lib/test/test_io.py:3381–3399  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3379 f.close()
3380
3381 def test_encoded_writes(self):
3382 data = "1234567890"
3383 tests = ("utf-16",
3384 "utf-16-le",
3385 "utf-16-be",
3386 "utf-32",
3387 "utf-32-le",
3388 "utf-32-be")
3389 for encoding in tests:
3390 buf = self.BytesIO()
3391 f = self.TextIOWrapper(buf, encoding=encoding)
3392 # Check if the BOM is written only once (see issue1753).
3393 f.write(data)
3394 f.write(data)
3395 f.seek(0)
3396 self.assertEqual(f.read(), data * 2)
3397 f.seek(0)
3398 self.assertEqual(f.read(), data * 2)
3399 self.assertEqual(buf.getvalue(), (data * 2).encode(encoding))
3400
3401 def test_unreadable(self):
3402 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