Skip to content

Commit

Permalink
Add test coverage for computed duration (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
allenporter authored Sep 12, 2024
1 parent 012e75b commit 8ead01a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,19 @@ def test_start_datetime() -> None:
assert ts
assert ts.start == datetime.datetime(2022, 8, 7, 0, 0, 0, tzinfo=datetime.timezone.utc)
assert ts.end == datetime.datetime(2022, 8, 8, 0, 0, 0, tzinfo=datetime.timezone.utc)


def test_computed_duration_date() -> None:
"""Test computed duration for a date."""

journal = Journal(start=datetime.date(2022, 8, 7,))
assert journal.start
assert journal.computed_duration == datetime.timedelta(days=1)


def test_computed_duration_datetime() -> None:
"""Test computed duration for a datetime."""

journal = Journal(start=datetime.datetime(2022, 8, 7, 0, 0, 0))
assert journal.start
assert journal.computed_duration == datetime.timedelta(hours=1)

0 comments on commit 8ead01a

Please sign in to comment.