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

Function test_python_file_writelines

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

Source from the content-addressed store, hash-verified

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