MCPcopy Create free account
hub / github.com/apache/arrow / test_memory_map_resize

Function test_memory_map_resize

python/pyarrow/tests/test_io.py:1203–1220  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

1201
1202
1203def test_memory_map_resize(tmpdir):
1204 SIZE = 4096
1205 arr = [random.randint(0, 255) for _ in range(SIZE)]
1206 data1 = bytes(arr[:(SIZE // 2)])
1207 data2 = bytes(arr[(SIZE // 2):])
1208
1209 path = os.path.join(str(tmpdir), guid())
1210
1211 mmap = pa.create_memory_map(path, SIZE / 2)
1212 mmap.write(data1)
1213
1214 mmap.resize(SIZE)
1215 mmap.write(data2)
1216
1217 mmap.close()
1218
1219 with open(path, 'rb') as f:
1220 assert f.read() == bytes(arr[:SIZE])
1221
1222
1223def test_memory_zero_length(tmpdir):

Callers

nothing calls this directly

Calls 7

guidFunction · 0.90
bytesFunction · 0.85
resizeMethod · 0.80
joinMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected