Skip to content

Commit

Permalink
Bug: Fix isfile and isdir do not return bool value
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghua committed Sep 29, 2024
1 parent 7b800f3 commit d768068
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tosfs/tests/test_tosfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,25 +189,25 @@ def test_isdir(tosfs: TosFileSystem, bucket: str, temporary_workspace: str) -> N
assert not tosfs.isdir("")
assert not tosfs.isdir("/")
assert not tosfs.isdir(bucket)
assert tosfs.isdir(f"{bucket}/{temporary_workspace}") == True
assert tosfs.isdir(f"{bucket}/{temporary_workspace}/") == True
assert tosfs.isdir(f"{bucket}/{temporary_workspace}/nonexistent") == False
assert tosfs.isdir(f"{bucket}/{temporary_workspace}/nonexistent/") == False
assert tosfs.isdir(f"{bucket}/{temporary_workspace}")
assert tosfs.isdir(f"{bucket}/{temporary_workspace}/")
assert not tosfs.isdir(f"{bucket}/{temporary_workspace}/nonexistent")
assert not tosfs.isdir(f"{bucket}/{temporary_workspace}/nonexistent/")

file_name = random_str()
tosfs.touch(f"{bucket}/{temporary_workspace}/{file_name}")
assert tosfs.isdir(f"{bucket}/{temporary_workspace}/{file_name}") == False
assert tosfs.isdir(f"{bucket}/{temporary_workspace}/{file_name}/") == False
assert not tosfs.isdir(f"{bucket}/{temporary_workspace}/{file_name}")
assert not tosfs.isdir(f"{bucket}/{temporary_workspace}/{file_name}/")


def test_isfile(tosfs: TosFileSystem, bucket: str, temporary_workspace: str) -> None:
file_name = random_str()
tosfs.touch(f"{bucket}/{temporary_workspace}/{file_name}")
assert tosfs.isfile(f"{bucket}/{temporary_workspace}/{file_name}") == True
assert tosfs.isfile(f"{bucket}/{temporary_workspace}/{file_name}/") == False
assert tosfs.isfile(f"{bucket}/{temporary_workspace}/nonexistfile") == False
assert tosfs.isfile(f"{bucket}/{temporary_workspace}") == False
assert tosfs.isfile(f"{bucket}/{temporary_workspace}/") == False
assert tosfs.isfile(f"{bucket}/{temporary_workspace}/{file_name}")
assert not tosfs.isfile(f"{bucket}/{temporary_workspace}/{file_name}/")
assert not tosfs.isfile(f"{bucket}/{temporary_workspace}/nonexistfile")
assert not tosfs.isfile(f"{bucket}/{temporary_workspace}")
assert not tosfs.isfile(f"{bucket}/{temporary_workspace}/")


def test_exists_bucket(
Expand Down

0 comments on commit d768068

Please sign in to comment.