Skip to content

Commit 23253b7

Browse files
committed
update test
1 parent 0f5cce1 commit 23253b7

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

tests/test_field.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import glob
21
from pathlib import Path
32

43
import cftime
@@ -105,19 +104,11 @@ def test_sanitize_field_filenames_cases(input_, expected):
105104
@pytest.mark.parametrize(
106105
"input_,expected",
107106
[
108-
("file*.nc", ["file0.nc", "file1.nc", "file2.nc"]),
107+
pytest.param("file*.nc", [], id="glob-no-match"),
109108
],
110109
)
111-
def test_sanitize_field_filenames_glob(input_, expected, tmp_path, monkeypatch):
112-
def monkey_glob(pattern):
113-
return glob.glob(pattern, root_dir=tmp_path)
114-
115-
monkeypatch.setattr(_sanitize_field_filenames, "glob", monkey_glob)
116-
117-
for f in expected:
118-
Path(tmp_path / f).touch()
119-
120-
assert _sanitize_field_filenames(input_, tmp_path) == expected
110+
def test_sanitize_field_filenames_glob(input_, expected):
111+
assert _sanitize_field_filenames(input_) == expected
121112

122113

123114
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)