Skip to content

Commit 01efbb8

Browse files
committed
Add from_netcdf path object test
Contributes to #1706
1 parent 7e5cf3f commit 01efbb8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_field.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,25 @@ def test_field_from_netcdf(with_timestamps):
5050
Field.from_netcdf(filenames, variable, dimensions, interp_method="cgrid_velocity")
5151

5252

53+
@pytest.mark.parametrize(
54+
"f",
55+
[
56+
pytest.param(lambda x: x, id="Path"),
57+
pytest.param(lambda x: str(x), id="str"),
58+
],
59+
)
60+
def test_from_netcdf_path_object(f):
61+
filenames = {
62+
"lon": f(TEST_DATA / "mask_nemo_cross_180lon.nc"),
63+
"lat": f(TEST_DATA / "mask_nemo_cross_180lon.nc"),
64+
"data": f(TEST_DATA / "Uu_eastward_nemo_cross_180lon.nc"),
65+
}
66+
variable = "U"
67+
dimensions = {"lon": "glamf", "lat": "gphif"}
68+
69+
Field.from_netcdf(filenames, variable, dimensions, interp_method="cgrid_velocity")
70+
71+
5372
@pytest.mark.parametrize(
5473
"calendar, cftime_datetime", zip(_get_cftime_calendars(), _get_cftime_datetimes(), strict=True)
5574
)

0 commit comments

Comments
 (0)