Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mberk committed Mar 12, 2024
1 parent df0d34e commit 7be1e87
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions tests/test_non_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ def test_get_second_best_price(market_book: dict[str, Any]):


def test_get_market_time_as_datetime(market_book: dict[str, Any]):
assert get_market_time_as_datetime(market_book) == datetime.datetime(
expected = datetime.datetime(
year=2022,
month=4,
day=3,
Expand All @@ -1070,19 +1070,19 @@ def test_get_market_time_as_datetime(market_book: dict[str, Any]):
second=0,
tzinfo=datetime.timezone.utc,
)
assert get_market_time_as_datetime(
MarketBook(
**market_book,
market_definition=MarketDefinition(**market_book["marketDefinition"]),
assert get_market_time_as_datetime(market_book) == expected
assert (
get_market_time_as_datetime(MarketDefinition(**market_book["marketDefinition"]))
== expected
)
assert (
get_market_time_as_datetime(
MarketBook(
**market_book,
market_definition=MarketDefinition(**market_book["marketDefinition"]),
)
)
) == datetime.datetime(
year=2022,
month=4,
day=3,
hour=14,
minute=0,
second=0,
tzinfo=datetime.timezone.utc,
== expected
)


Expand All @@ -1107,6 +1107,9 @@ def test_get_seconds_to_market_time(market_book: dict[str, Any]):
== 0.0
)

with pytest.raises(ValueError):
get_seconds_to_market_time(MarketDefinition(**market_book["marketDefinition"]))


def test_get_win_market_id_from_race_file(
race_change: dict[str, Any], path_to_race_file: Path
Expand Down Expand Up @@ -1338,5 +1341,7 @@ def test_datetime_to_publish_time(market_book: dict[str, Any]):
)


def test_get_inplay_bet_delay_from_prices_file(path_to_prices_file: Path,):
def test_get_inplay_bet_delay_from_prices_file(
path_to_prices_file: Path,
):
assert get_inplay_bet_delay_from_prices_file(path_to_prices_file) == 5

0 comments on commit 7be1e87

Please sign in to comment.