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

Method test_seeking_read

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

Source from the content-addressed store, hash-verified

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'))
3676 sr = codecs.EncodedFile(bio, 'utf-8', 'utf-16-le')
3677
3678 self.assertEqual(sr.readline(), b'line1\n')
3679 sr.seek(0)
3680 self.assertEqual(sr.readline(), b'line1\n')
3681 self.assertEqual(sr.readline(), b'line2\n')
3682 self.assertEqual(sr.readline(), b'line3\n')
3683 self.assertEqual(sr.readline(), b'')
3684
3685 def test_seeking_write(self):
3686 bio = io.BytesIO('123456789\n'.encode('utf-16-le'))

Callers

nothing calls this directly

Calls 4

encodeMethod · 0.45
assertEqualMethod · 0.45
readlineMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected