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

Method test_write

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

Source from the content-addressed store, hash-verified

3674 self.assertEqual(bio.getvalue(), b'ab')
3675
3676 def test_write(self):
3677 bio = io.BytesIO()
3678 codec = codecs.lookup('latin1')
3679 # Recode from Latin-1 to utf-8.
3680 sr = codecs.StreamRecoder(bio, codec.encode, codec.decode,
3681 encodings.utf_8.StreamReader, encodings.utf_8.StreamWriter)
3682
3683 text = 'àñé'
3684 sr.write(text.encode('latin1'))
3685 self.assertEqual(bio.getvalue(), text.encode('utf-8'))
3686
3687 def test_seeking_read(self):
3688 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