Skip to content

Commit

Permalink
add datetime property test
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Dec 17, 2024
1 parent c395bc8 commit 88573ba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions properties/test_encode_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
# isort: split

import hypothesis.extra.numpy as npst
import hypothesis.strategies as st
import numpy as np
from hypothesis import given

import xarray as xr
from xarray.coding.times import _parse_iso8601_without_reso
from xarray.testing.strategies import variables


Expand Down Expand Up @@ -43,3 +45,10 @@ def test_CFScaleOffset_coder_roundtrip(original) -> None:
coder = xr.coding.variables.CFScaleOffsetCoder()
roundtripped = coder.decode(coder.encode(original))
xr.testing.assert_identical(original, roundtripped)


# TODO: add cftime.datetime
@given(dt=st.datetimes())
def test_iso8601_decode(dt):
iso = dt.isoformat()
assert dt == _parse_iso8601_without_reso(type(dt), iso)

0 comments on commit 88573ba

Please sign in to comment.