Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update tests after changing fixtures #60

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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