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

Method test_write

Lib/test/test_codecs.py:3663–3672  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3661 self.assertEqual(bio.getvalue(), b'ab')
3662
3663 def test_write(self):
3664 bio = io.BytesIO()
3665 codec = codecs.lookup('latin1')
3666 # Recode from Latin-1 to utf-8.
3667 sr = codecs.StreamRecoder(bio, codec.encode, codec.decode,
3668 encodings.utf_8.StreamReader, encodings.utf_8.StreamWriter)
3669
3670 text = 'àñé'
3671 sr.write(text.encode('latin1'))
3672 self.assertEqual(bio.getvalue(), text.encode('utf-8'))
3673
3674 def test_seeking_read(self):
3675 bio = io.BytesIO('line1\nline2\nline3\n'.encode('utf-16-le'))

Callers

nothing calls this directly

Calls 5

writeMethod · 0.95
getvalueMethod · 0.95
lookupMethod · 0.45
encodeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected