Skip to content

Commit

Permalink
Core: Implement glob api
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua committed Sep 8, 2024
1 parent 848605b commit ae303eb
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions tosfs/tests/test_tosfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,23 +598,24 @@ def test_glob(tosfs: TosFileSystem, bucket: str, temporary_workspace: str) -> No
)

# Test with maxdepth
assert (sorted(
tosfs.glob(f"{bucket}/{temporary_workspace}/**", maxdepth=2)
) == sorted(
[
f"{bucket}/{temporary_workspace}/{dir_name}",
f"{bucket}/{temporary_workspace}/{dir_name}/{file_name}",
f"{bucket}/{temporary_workspace}/{dir_name}/{sub_dir_name}",
]
) if fsspec_version == "2023.5.0" else
sorted(
[
f"{bucket}/{temporary_workspace}",
f"{bucket}/{temporary_workspace}/{dir_name}",
f"{bucket}/{temporary_workspace}/{dir_name}/{file_name}",
f"{bucket}/{temporary_workspace}/{dir_name}/{sub_dir_name}",
]
)
assert (
sorted(tosfs.glob(f"{bucket}/{temporary_workspace}/**", maxdepth=2))
== sorted(
[
f"{bucket}/{temporary_workspace}/{dir_name}",
f"{bucket}/{temporary_workspace}/{dir_name}/{file_name}",
f"{bucket}/{temporary_workspace}/{dir_name}/{sub_dir_name}",
]
)
if fsspec_version == "2023.5.0"
else sorted(
[
f"{bucket}/{temporary_workspace}",
f"{bucket}/{temporary_workspace}/{dir_name}",
f"{bucket}/{temporary_workspace}/{dir_name}/{file_name}",
f"{bucket}/{temporary_workspace}/{dir_name}/{sub_dir_name}",
]
)
)

# Test with detail
Expand Down

0 comments on commit ae303eb

Please sign in to comment.