Skip to content

Commit 6dd080f

Browse files
authored
Move encode expected test failures to own function (#5308)
1 parent 95b34f3 commit 6dd080f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

xarray/tests/test_coding_times.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,9 +823,12 @@ def test_encode_cf_datetime_overflow(shape):
823823
roundtrip = decode_cf_datetime(num, units, calendar)
824824
np.testing.assert_array_equal(dates, roundtrip)
825825

826+
827+
def test_encode_expected_failures():
828+
829+
dates = pd.date_range("2000", periods=3)
826830
with pytest.raises(ValueError, match="invalid time units"):
827831
encode_cf_datetime(dates, units="days after 2000-01-01")
828-
829832
with pytest.raises(ValueError, match="invalid reference date"):
830833
encode_cf_datetime(dates, units="days since NO_YEAR")
831834

0 commit comments

Comments
 (0)