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

Method test_seeking_write

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

Source from the content-addressed store, hash-verified

3683 self.assertEqual(sr.readline(), b'')
3684
3685 def test_seeking_write(self):
3686 bio = io.BytesIO('123456789\n'.encode('utf-16-le'))
3687 sr = codecs.EncodedFile(bio, 'utf-8', 'utf-16-le')
3688
3689 # Test that seek() only resets its internal buffer when offset
3690 # and whence are zero.
3691 sr.seek(2)
3692 sr.write(b'\nabc\n')
3693 self.assertEqual(sr.readline(), b'789\n')
3694 sr.seek(0)
3695 self.assertEqual(sr.readline(), b'1\n')
3696 self.assertEqual(sr.readline(), b'abc\n')
3697 self.assertEqual(sr.readline(), b'789\n')
3698
3699 def test_copy(self):
3700 bio = io.BytesIO()

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected