Skip to content

Commit 48770ec

Browse files
committed
update docstring, fix error msg
1 parent b7e055c commit 48770ec

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pandas/io/common.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,8 +1356,9 @@ def iterdir(
13561356
13571357
Returns
13581358
------
1359-
pathlib.Path or pathlib.PurePosixPath
1360-
File paths within the directory.
1359+
list of str or Path, BaseBuffer
1360+
If `path` is a file-like object, returns it directly.
1361+
Otherwise, returns list of file paths in the directory.
13611362
13621363
Raises
13631364
------

pandas/tests/io/parser/common/test_file_buffer_url.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,21 +314,21 @@ class InvalidBuffer:
314314
pass
315315

316316
parser = all_parsers
317-
msg = "Invalid file path or buffer object type"
317+
msg = "Expected file path name or file-like object"
318318

319-
with pytest.raises(ValueError, match=msg):
319+
with pytest.raises(TypeError, match=msg):
320320
parser.read_csv(InvalidBuffer())
321321

322322

323323
def test_invalid_file_buffer_mock(all_parsers):
324324
# see gh-15337
325325
parser = all_parsers
326-
msg = "Invalid file path or buffer object type"
326+
msg = "Expected file path name or file-like object"
327327

328328
class Foo:
329329
pass
330330

331-
with pytest.raises(ValueError, match=msg):
331+
with pytest.raises(TypeError, match=msg):
332332
parser.read_csv(Foo())
333333

334334

0 commit comments

Comments
 (0)