Skip to content

Commit

Permalink
Move encode expected test failures to own function (pydata#5308)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcaria authored May 14, 2021
1 parent 95b34f3 commit 6dd080f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xarray/tests/test_coding_times.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,9 +823,12 @@ def test_encode_cf_datetime_overflow(shape):
roundtrip = decode_cf_datetime(num, units, calendar)
np.testing.assert_array_equal(dates, roundtrip)


def test_encode_expected_failures():

dates = pd.date_range("2000", periods=3)
with pytest.raises(ValueError, match="invalid time units"):
encode_cf_datetime(dates, units="days after 2000-01-01")

with pytest.raises(ValueError, match="invalid reference date"):
encode_cf_datetime(dates, units="days since NO_YEAR")

Expand Down

0 comments on commit 6dd080f

Please sign in to comment.