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

Function test_python_file_write

python/pyarrow/tests/test_io.py:76–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74
75
76def test_python_file_write():
77 buf = BytesIO()
78
79 f = pa.PythonFile(buf)
80
81 assert f.tell() == 0
82
83 s1 = b'enga\xc3\xb1ado'
84 s2 = b'foobar'
85
86 f.write(s1)
87 assert f.tell() == len(s1)
88
89 f.write(s2)
90
91 expected = s1 + s2
92
93 result = buf.getvalue()
94 assert result == expected
95
96 assert not f.closed
97 f.close()
98 assert f.closed
99
100 with pytest.raises(TypeError, match="binary file expected"):
101 pa.PythonFile(StringIO())
102
103
104def test_python_file_read():

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
PythonFileMethod · 0.80
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected