Skip to content

Commit

Permalink
fix start and end datetimes that could be equal
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-k committed Oct 1, 2024
1 parent b0b4240 commit b191ec1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from datetime import datetime, timezone
from datetime import datetime, timedelta, timezone

import hypothesis
import pytest
Expand All @@ -24,14 +24,21 @@
),
)

DATETIME_TODAY_MIDNIGHT = datetime.now().replace(
hour=0,
minute=0,
second=0,
microsecond=0,
)

datetime_today_until_now_strategy = st.datetimes(
min_value=datetime.now().replace(hour=0),
min_value=DATETIME_TODAY_MIDNIGHT,
max_value=datetime.now(),
timezones=st.just(timezone.utc),
)

datetime_before_today_strategy = st.datetimes(
max_value=datetime.now().replace(hour=0),
max_value=DATETIME_TODAY_MIDNIGHT - timedelta(microseconds=1),
min_value=datetime(1970, 1, 1, 12, 0, 0),
timezones=st.just(timezone.utc),
)
Expand Down

0 comments on commit b191ec1

Please sign in to comment.