Skip to content

Commit

Permalink
add new fields to dask access test
Browse files Browse the repository at this point in the history
  • Loading branch information
aulemahal committed Sep 3, 2024
1 parent c1d257e commit 8c73b02
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions xarray/tests/test_accessor_dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,22 @@ def test_strftime(self) -> None:
)

@requires_cftime
@pytest.mark.parametrize("calendar,expected", [('standard', 366), ('noleap', 365), ('360_day', 360), ('all_leap', 366)])
@pytest.mark.parametrize(
"calendar,expected",
[("standard", 366), ("noleap", 365), ("360_day", 360), ("all_leap", 366)],
)
def test_days_in_year(self, calendar, expected) -> None:
assert (
self.data.convert_calendar(calendar, align_on='year').time.dt.days_in_year == expected
self.data.convert_calendar(calendar, align_on="year").time.dt.days_in_year
== expected
).all()

@requires_cftime
def test_decimal_year(self) -> None:
h_per_yr = 366 * 24
np.testing.assert_array_equal(
self.data.time.dt.decimal_year[0:3],
[2000, 2000 + 1 / h_per_yr, 2000 + 2 / h_per_yr]
[2000, 2000 + 1 / h_per_yr, 2000 + 2 / h_per_yr],
)

def test_not_datetime_type(self) -> None:
Expand Down Expand Up @@ -192,6 +196,8 @@ def test_not_datetime_type(self) -> None:
"is_year_start",
"is_year_end",
"is_leap_year",
"days_in_year",
"decimal_year",
],
)
def test_dask_field_access(self, field) -> None:
Expand Down

0 comments on commit 8c73b02

Please sign in to comment.