Skip to content

Commit

Permalink
Revise test regex matches
Browse files Browse the repository at this point in the history
Revises test regex matches for compatibility across py39 through
py311.
  • Loading branch information
maread99 committed Jan 31, 2024
1 parent 052ba9a commit 2bb4c7a
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 79 deletions.
9 changes: 4 additions & 5 deletions src/market_prices/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from market_prices import errors, helpers, mptypes, intervals
from market_prices.helpers import UTC
from market_prices.intervals import TDInterval


def verify_period_parameters(pp: mptypes.PP):
Expand Down Expand Up @@ -226,20 +227,18 @@ def _parse_start_end(
if start_is_date:
mrs = mr_session if mr_session is not None else _now_mr_session(cal, delay)
if start > mrs:
raise errors.StartTooLateError(start, mrs, intervals.BI_ONE_DAY, delay)
raise errors.StartTooLateError(start, mrs, TDInterval.D1, delay)
elif not as_times: # start is time and require as_date
mrs = mr_session if mr_session is not None else _now_mr_session(cal, delay)
mrs_start = cal.session_first_minute(mrs)
if start > mrs_start:
raise errors.StartTooLateError(
start, mrs_start, intervals.BI_ONE_MIN, delay
)
raise errors.StartTooLateError(start, mrs_start, TDInterval.T1, delay)
else: # start is time and require as_time
mrm = (
mr_minute if mr_minute is not None else _now_mr_minute_left(cal, delay)
)
if start > mrm:
raise errors.StartTooLateError(start, mrm, intervals.BI_ONE_MIN, delay)
raise errors.StartTooLateError(start, mrm, TDInterval.T1, delay)

# if `start` or `end` earlier than left calendar bound
end_parsed: pd.Timestamp | None
Expand Down
Loading

0 comments on commit 2bb4c7a

Please sign in to comment.