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

Function test_python_file_write

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

Source from the content-addressed store, hash-verified

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