Skip to content

Commit 6e91a09

Browse files
committed
fixup! ENH: Support fspath protocol
1 parent 03d29ba commit 6e91a09

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pandas/tests/io/test_common.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,21 @@ def test_read_fspath_all(self, reader, module, path):
151151
('to_stata', {}, 'os'),
152152
])
153153
def test_write_fspath_all(self, writer_name, writer_kwargs, module):
154-
with tm.ensure_clean('foo', return_filelike=False) as path:
154+
p1 = tm.ensure_clean('string')
155+
p2 = tm.ensure_clean('fspath')
156+
df = pd.DataFrame({"A": [1, 2]})
157+
158+
with p1 as string, p2 as fspath:
155159
pytest.importorskip(module)
156-
mypath = CustomFSPath(path)
157-
df = pd.DataFrame({"A": [1, 2]})
160+
mypath = CustomFSPath(fspath)
158161
writer = getattr(df, writer_name)
159162

160-
writer(path, **writer_kwargs)
161-
with open(path, 'rb') as f:
163+
writer(string, **writer_kwargs)
164+
with open(string, 'rb') as f:
162165
expected = f.read()
163166

164167
writer(mypath, **writer_kwargs)
165-
with open(path, 'rb') as f:
168+
with open(fspath, 'rb') as f:
166169
result = f.read()
167170

168171
assert result == expected

0 commit comments

Comments
 (0)