|
8 | 8 |
|
9 | 9 | from pythclient.pythclient import PythClient, V2_FIRST_MAPPING_ACCOUNT_KEY, V2_PROGRAM_KEY, WatchSession
|
10 | 10 | from pythclient.solana import (
|
11 |
| - SOLANA_DEVNET_HTTP_ENDPOINT, |
12 |
| - SOLANA_DEVNET_WS_ENDPOINT, |
13 | 11 | SolanaClient,
|
14 | 12 | SolanaCommitment,
|
15 | 13 | SolanaPublicKey,
|
@@ -282,6 +280,11 @@ def test_get_ratelimit(
|
282 | 280 | assert ratelimit._get_method_interval() == 0
|
283 | 281 | assert ratelimit._get_connection_interval() == 0
|
284 | 282 |
|
| 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 | + |
285 | 288 |
|
286 | 289 | @pytest.mark.asyncio
|
287 | 290 | async def test_get_mapping_accounts(
|
@@ -319,22 +322,18 @@ async def test_get_all_accounts(
|
319 | 322 | price.update_from(buffer=price_account_bytes, version=_VERSION_2)
|
320 | 323 |
|
321 | 324 | 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 |
338 | 337 |
|
339 | 338 |
|
340 | 339 | @ pytest.mark.asyncio
|
|
0 commit comments