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

Function test_python_file_writelines

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

Source from the content-addressed store, hash-verified

346
347
348def test_python_file_writelines(tmpdir):
349 lines = [b'line1\n', b'line2\n' b'line3']
350 path = os.path.join(str(tmpdir), 'foo.txt')
351 with open(path, 'wb') as f:
352 try:
353 f = pa.PythonFile(f, mode='w')
354 assert f.writable()
355 f.writelines(lines)
356 finally:
357 f.close()
358
359 with open(path, 'rb') as f:
360 try:
361 f = pa.PythonFile(f, mode='r')
362 assert f.readable()
363 assert f.read() == b''.join(lines)
364 finally:
365 f.close()
366
367
368def test_python_file_closing():

Callers

nothing calls this directly

Calls 5

PythonFileMethod · 0.80
writableMethod · 0.80
joinMethod · 0.45
closeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected