Skip to content

Commit

Permalink
Add test for size API (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua authored Oct 15, 2024
1 parent d92e317 commit 2f699da
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tosfs/tests/test_fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,3 +875,14 @@ def test_tail(fsspecfs: Any, bucket: str, temporary_workspace: str):

with pytest.raises(IsADirectoryError):
fsspecfs.tail(path, 3)


def test_size(fsspecfs: Any, bucket: str, temporary_workspace: str):
file_name = random_str()
path = f"{bucket}/{temporary_workspace}/{file_name}"
content = "hello world"
with fsspecfs.open(path, "w") as f:
f.write(content)

assert fsspecfs.size(path) == len(content)
assert fsspecfs.size(f"{bucket}/{temporary_workspace}") == 0

0 comments on commit 2f699da

Please sign in to comment.