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

Method large_file_ops

Lib/test/test_io/test_general.py:97–115  ·  view source on GitHub ↗
(self, f)

Source from the content-addressed store, hash-verified

95 LARGE = 2**31
96
97 def large_file_ops(self, f):
98 assert f.readable()
99 assert f.writable()
100 try:
101 self.assertEqual(f.seek(self.LARGE), self.LARGE)
102 except (OverflowError, ValueError):
103 self.skipTest("no largefile support")
104 self.assertEqual(f.tell(), self.LARGE)
105 self.assertEqual(f.write(b"xxx"), 3)
106 self.assertEqual(f.tell(), self.LARGE + 3)
107 self.assertEqual(f.seek(-1, 1), self.LARGE + 2)
108 self.assertEqual(f.truncate(), self.LARGE + 2)
109 self.assertEqual(f.tell(), self.LARGE + 2)
110 self.assertEqual(f.seek(0, 2), self.LARGE + 2)
111 self.assertEqual(f.truncate(self.LARGE + 1), self.LARGE + 1)
112 self.assertEqual(f.tell(), self.LARGE + 2)
113 self.assertEqual(f.seek(0, 2), self.LARGE + 1)
114 self.assertEqual(f.seek(-1, 2), self.LARGE)
115 self.assertEqual(f.read(2), b"x")
116
117 def test_invalid_operations(self):
118 # 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