Skip to content

Commit

Permalink
test: add tests for pathlib.Path.
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Rösner committed Nov 9, 2023
1 parent 0c829ec commit 3b9104f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions fsspec/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io
import sys
from pathlib import Path
from unittest.mock import Mock

import pytest
Expand All @@ -8,6 +9,7 @@
from fsspec.utils import (
can_be_local,
common_prefix,
get_protocol,
infer_storage_options,
merge_offset_ranges,
mirror_from,
Expand Down Expand Up @@ -333,6 +335,24 @@ def test_log():
assert logger.level == logging.DEBUG


@pytest.mark.parametrize(
"par",
[
("afile", "file"),
("file://afile", "file"),
("noproto://afile", "noproto"),
("noproto::stuff", "noproto"),
("simplecache::stuff", "simplecache"),
("simplecache://stuff", "simplecache"),
("s3://afile", "s3"),
(Path("afile"), "file"),
],
)
def test_get_protocol(par):
url, outcome = par
assert get_protocol(url) == outcome


@pytest.mark.parametrize(
"par",
[
Expand All @@ -342,6 +362,7 @@ def test_log():
("noproto::stuff", False),
("simplecache::stuff", True),
("simplecache://stuff", True),
(Path("afile"), True),
],
)
def test_can_local(par):
Expand Down

0 comments on commit 3b9104f

Please sign in to comment.