Skip to content

Commit

Permalink
improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
xebab committed Jan 18, 2024
1 parent 7b774c2 commit 49d6b9f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions fsspec/tests/abstract/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_copy_directory_to_existing_directory(
fs.touch(dummy)
assert fs.isdir(target)

for source_slash, target_slash in zip([False, True], [False, True]):
for source_slash, target_slash in product([False, True], [False, True]):
s = fs_join(source, "subdir")
if source_slash:
s += "/"
Expand Down Expand Up @@ -195,7 +195,7 @@ def test_copy_directory_to_new_directory(
target = fs_target
fs.mkdir(target)

for source_slash, target_slash in zip([False, True], [False, True]):
for source_slash, target_slash in product([False, True], [False, True]):
s = fs_join(source, "subdir")
if source_slash:
s += "/"
Expand Down Expand Up @@ -274,7 +274,7 @@ def test_copy_glob_to_existing_directory(
assert fs.ls(target) == ([] if supports_empty_directories else [dummy])

# With recursive
for glob, recursive in zip(["*", "**"], [True, False]):
for glob, recursive in product(["*", "**"], [True, False]):
fs.cp(fs_join(source, "subdir", glob), t, recursive=recursive)
assert fs.isfile(fs_join(target, "subfile1"))
assert fs.isfile(fs_join(target, "subfile2"))
Expand Down Expand Up @@ -338,7 +338,7 @@ def test_copy_glob_to_new_directory(
assert not fs.exists(fs_join(target, "newdir"))

# With recursive
for glob, recursive in zip(["*", "**"], [True, False]):
for glob, recursive in product(["*", "**"], [True, False]):
fs.cp(fs_join(source, "subdir", glob), t, recursive=recursive)
assert fs.isdir(fs_join(target, "newdir"))
assert fs.isfile(fs_join(target, "newdir", "subfile1"))
Expand Down
8 changes: 4 additions & 4 deletions fsspec/tests/abstract/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_get_directory_to_existing_directory(
local_fs.mkdir(target)
assert local_fs.isdir(target)

for source_slash, target_slash in zip([False, True], [False, True]):
for source_slash, target_slash in product([False, True], [False, True]):
s = fs_join(source, "subdir")
if source_slash:
s += "/"
Expand Down Expand Up @@ -205,7 +205,7 @@ def test_get_directory_to_new_directory(
target = local_target
local_fs.mkdir(target)

for source_slash, target_slash in zip([False, True], [False, True]):
for source_slash, target_slash in product([False, True], [False, True]):
s = fs_join(source, "subdir")
if source_slash:
s += "/"
Expand Down Expand Up @@ -278,7 +278,7 @@ def test_get_glob_to_existing_directory(
assert local_fs.ls(target) == []

# With recursive
for glob, recursive in zip(["*", "**"], [True, False]):
for glob, recursive in product(["*", "**"], [True, False]):
fs.get(fs_join(source, "subdir", glob), t, recursive=recursive)
assert local_fs.isfile(local_join(target, "subfile1"))
assert local_fs.isfile(local_join(target, "subfile2"))
Expand Down Expand Up @@ -350,7 +350,7 @@ def test_get_glob_to_new_directory(
assert local_fs.ls(target) == []

# With recursive
for glob, recursive in zip(["*", "**"], [True, False]):
for glob, recursive in product(["*", "**"], [True, False]):
fs.get(fs_join(source, "subdir", glob), t, recursive=recursive)
assert local_fs.isdir(local_join(target, "newdir"))
assert local_fs.isfile(local_join(target, "newdir", "subfile1"))
Expand Down
8 changes: 4 additions & 4 deletions fsspec/tests/abstract/put.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_put_directory_to_existing_directory(
fs.touch(dummy)
assert fs.isdir(target)

for source_slash, target_slash in zip([False, True], [False, True]):
for source_slash, target_slash in product([False, True], [False, True]):
s = fs_join(source, "subdir")
if source_slash:
s += "/"
Expand Down Expand Up @@ -198,7 +198,7 @@ def test_put_directory_to_new_directory(
target = fs_target
fs.mkdir(target)

for source_slash, target_slash in zip([False, True], [False, True]):
for source_slash, target_slash in product([False, True], [False, True]):
s = fs_join(source, "subdir")
if source_slash:
s += "/"
Expand Down Expand Up @@ -278,7 +278,7 @@ def test_put_glob_to_existing_directory(
assert fs.ls(target) == ([] if supports_empty_directories else [dummy])

# With recursive
for glob, recursive in zip(["*", "**"], [True, False]):
for glob, recursive in product(["*", "**"], [True, False]):
fs.put(local_join(source, "subdir", glob), t, recursive=recursive)
assert fs.isfile(fs_join(target, "subfile1"))
assert fs.isfile(fs_join(target, "subfile2"))
Expand Down Expand Up @@ -345,7 +345,7 @@ def test_put_glob_to_new_directory(
assert not fs.exists(fs_join(target, "newdir"))

# With recursive
for glob, recursive in zip(["*", "**"], [True, False]):
for glob, recursive in product(["*", "**"], [True, False]):
fs.put(local_join(source, "subdir", glob), t, recursive=recursive)
assert fs.isdir(fs_join(target, "newdir"))
assert fs.isfile(fs_join(target, "newdir", "subfile1"))
Expand Down

0 comments on commit 49d6b9f

Please sign in to comment.