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

Method large_file_ops

Lib/test/test_io.py:403–421  ·  view source on GitHub ↗
(self, f)

Source from the content-addressed store, hash-verified

401 LARGE = 2**31
402
403 def large_file_ops(self, f):
404 assert f.readable()
405 assert f.writable()
406 try:
407 self.assertEqual(f.seek(self.LARGE), self.LARGE)
408 except (OverflowError, ValueError):
409 self.skipTest("no largefile support")
410 self.assertEqual(f.tell(), self.LARGE)
411 self.assertEqual(f.write(b"xxx"), 3)
412 self.assertEqual(f.tell(), self.LARGE + 3)
413 self.assertEqual(f.seek(-1, 1), self.LARGE + 2)
414 self.assertEqual(f.truncate(), self.LARGE + 2)
415 self.assertEqual(f.tell(), self.LARGE + 2)
416 self.assertEqual(f.seek(0, 2), self.LARGE + 2)
417 self.assertEqual(f.truncate(self.LARGE + 1), self.LARGE + 1)
418 self.assertEqual(f.tell(), self.LARGE + 2)
419 self.assertEqual(f.seek(0, 2), self.LARGE + 1)
420 self.assertEqual(f.seek(-1, 2), self.LARGE)
421 self.assertEqual(f.read(2), b"x")
422
423 def test_invalid_operations(self):
424 # Try writing on a file opened in read mode and vice-versa.

Callers 1

test_large_file_opsMethod · 0.95

Calls 9

skipTestMethod · 0.80
readableMethod · 0.45
writableMethod · 0.45
assertEqualMethod · 0.45
seekMethod · 0.45
tellMethod · 0.45
writeMethod · 0.45
truncateMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected