Skip to content

Commit a2f41bf

Browse files
committed
address Jeff's feedback for test_pyth_client.py
1 parent 6364cea commit a2f41bf

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

tests/test_pyth_client.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
from pythclient.pythclient import PythClient, V2_FIRST_MAPPING_ACCOUNT_KEY, V2_PROGRAM_KEY, WatchSession
1010
from pythclient.solana import (
11-
SOLANA_DEVNET_HTTP_ENDPOINT,
12-
SOLANA_DEVNET_WS_ENDPOINT,
1311
SolanaClient,
1412
SolanaCommitment,
1513
SolanaPublicKey,
@@ -282,6 +280,11 @@ def test_get_ratelimit(
282280
assert ratelimit._get_method_interval() == 0
283281
assert ratelimit._get_connection_interval() == 0
284282

283+
ratelimit.configure(overall_cps=1, method_cps=1, connection_cps=1)
284+
assert ratelimit._get_overall_interval() == 1.0
285+
assert ratelimit._get_method_interval() == 1.0
286+
assert ratelimit._get_connection_interval() == 1.0
287+
285288

286289
@pytest.mark.asyncio
287290
async def test_get_mapping_accounts(
@@ -319,22 +322,18 @@ async def test_get_all_accounts(
319322
price.update_from(buffer=price_account_bytes, version=_VERSION_2)
320323

321324
accounts = await pyth_client.get_all_accounts()
322-
for account in accounts:
323-
if isinstance(account, PythMappingAccount):
324-
assert account.key == mapping_account.key
325-
assert account.entries == mapping_account_entries
326-
elif isinstance(account, PythProductAccount):
327-
assert dict(account) == dict(product_account)
328-
elif isinstance(account, PythPriceAccount):
329-
assert account.key == price_account.key
330-
assert account.price_type == PythPriceType.PRICE
331-
assert account.exponent == -9
332-
assert account.num_components == 27
333-
assert len(account.price_components) == account.num_components
334-
assert account.last_slot == 96878111
335-
assert account.valid_slot == 96878110
336-
assert account.product_account_key == product_account.key
337-
assert account.next_price_account_key is None
325+
assert accounts[0].key == mapping_account.key
326+
assert accounts[0].entries == mapping_account_entries
327+
assert dict(accounts[1]) == dict(product_account)
328+
assert accounts[2].key == price_account.key
329+
assert accounts[2].price_type == PythPriceType.PRICE
330+
assert accounts[2].exponent == -9
331+
assert accounts[2].num_components == 27
332+
assert len(accounts[2].price_components) == accounts[2].num_components
333+
assert accounts[2].last_slot == 96878111
334+
assert accounts[2].valid_slot == 96878110
335+
assert accounts[2].product_account_key == product_account.key
336+
assert accounts[2].next_price_account_key is None
338337

339338

340339
@ pytest.mark.asyncio

0 commit comments

Comments
 (0)