Skip to content

Commit

Permalink
test 467 (#481)
Browse files Browse the repository at this point in the history
* test 467

* address code review

* fix str comp
  • Loading branch information
d-chambers authored Jan 5, 2025
1 parent 0ed99b6 commit bc1a02f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_core/test_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import datetime
import pickle
from functools import partial
from io import BytesIO
Expand Down Expand Up @@ -360,6 +361,16 @@ def test_coord_range(self, monotonic_float_coord):
with pytest.raises(CoordError, match=msg):
monotonic_float_coord.coord_range()

def test_get_coord_datetime(self):
"""Ensure get_coord accepts a datetime object. See #467."""
d1 = datetime.datetime.fromisoformat("2017-09-18T01")
d2 = datetime.datetime.fromisoformat("2017-09-18T02")
step = datetime.timedelta(minutes=1)
coord = get_coord(start=d1, stop=d2, step=step)
assert isinstance(coord, BaseCoord)
assert str(d1) == str(coord.min())
assert str(d2) == str(coord.max() + coord.step)


class TestCoordSummary:
"""tests for converting to and from summary coords."""
Expand Down

0 comments on commit bc1a02f

Please sign in to comment.