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

Method test_seek_and_tell

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

Source from the content-addressed store, hash-verified

2440 self.assertEqual(b"dddeee", raw._write_stack[0])
2441
2442 def test_seek_and_tell(self):
2443 raw = self.BytesIO(b"asdfghjkl")
2444 rw = self.tp(raw)
2445
2446 self.assertEqual(b"as", rw.read(2))
2447 self.assertEqual(2, rw.tell())
2448 rw.seek(0, 0)
2449 self.assertEqual(b"asdf", rw.read(4))
2450
2451 rw.write(b"123f")
2452 rw.seek(0, 0)
2453 self.assertEqual(b"asdf123fl", rw.read())
2454 self.assertEqual(9, rw.tell())
2455 rw.seek(-4, 2)
2456 self.assertEqual(5, rw.tell())
2457 rw.seek(2, 1)
2458 self.assertEqual(7, rw.tell())
2459 self.assertEqual(b"fl", rw.read(11))
2460 rw.flush()
2461 self.assertEqual(b"asdf123fl", raw.getvalue())
2462
2463 self.assertRaises(TypeError, rw.seek, 0.0)
2464
2465 def check_flush_and_read(self, read_func):
2466 raw = self.BytesIO(b"abcdefghi")

Callers

nothing calls this directly

Calls 8

getvalueMethod · 0.95
assertEqualMethod · 0.45
readMethod · 0.45
tellMethod · 0.45
seekMethod · 0.45
writeMethod · 0.45
flushMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected