Skip to content

Commit

Permalink
fix: update tests after changing fixtures (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-bahjati authored Feb 12, 2025
1 parent 65c2d92 commit 235303b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/test_price_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from pythclient.pythaccounts import (
ACCOUNT_HEADER_BYTES,
DEFAULT_MAX_LATENCY,
PythPriceAccount,
PythPriceType,
PythPriceStatus,
Expand All @@ -14,7 +13,7 @@


# Yes, this sucks, but it is actually a monster datastructure
# Equity.US.AAPL/USD symbol
# Equity.US.AAPL/USD symbol with a max latency of 50 slots
@pytest.fixture
def price_account_bytes():
return base64.b64decode((
Expand Down Expand Up @@ -316,15 +315,15 @@ def test_price_account_agregate_conf_interval(
):
price_account.update_from(buffer=price_account_bytes, version=2, offset=ACCOUNT_HEADER_BYTES)
price_account.slot = price_account.aggregate_price_info.pub_slot
assert price_account.aggregate_price_confidence_interval == 0.366305
assert price_account.aggregate_price_confidence_interval == 0.14454


def test_price_account_agregate_price(
price_account_bytes: bytes, price_account: PythPriceAccount,
):
price_account.update_from(buffer=price_account_bytes, version=2, offset=ACCOUNT_HEADER_BYTES)
price_account.slot = price_account.aggregate_price_info.pub_slot
assert price_account.aggregate_price == 707.125
assert price_account.aggregate_price == 236.23373

def test_price_account_unknown_status(
price_account_bytes: bytes, price_account: PythPriceAccount,
Expand All @@ -340,7 +339,7 @@ def test_price_account_get_aggregate_price_status_still_trading(
price_account_bytes: bytes, price_account: PythPriceAccount
):
price_account.update_from(buffer=price_account_bytes, version=2, offset=ACCOUNT_HEADER_BYTES)
price_account.slot = price_account.aggregate_price_info.pub_slot + DEFAULT_MAX_LATENCY
price_account.slot = price_account.aggregate_price_info.pub_slot + 50

price_status = price_account.aggregate_price_status
assert price_status == PythPriceStatus.TRADING
Expand All @@ -349,7 +348,7 @@ def test_price_account_get_aggregate_price_status_got_stale(
price_account_bytes: bytes, price_account: PythPriceAccount
):
price_account.update_from(buffer=price_account_bytes, version=2, offset=ACCOUNT_HEADER_BYTES)
price_account.slot = price_account.aggregate_price_info.pub_slot + DEFAULT_MAX_LATENCY + 1
price_account.slot = price_account.aggregate_price_info.pub_slot + 50 + 1

price_status = price_account.aggregate_price_status
assert price_status == PythPriceStatus.UNKNOWN

0 comments on commit 235303b

Please sign in to comment.