Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
0e4ef622 committed Oct 10, 2024
1 parent 0856157 commit a3fa09e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ntropy_sdk/v3/paging.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if TYPE_CHECKING:
from . import ExtraKwargs
from pydantic import BaseModel as GenericModel
from typing_extensions import Unpack
from typing_extensions import Unpack, Self

elif PYDANTIC_V2:
from pydantic import BaseModel as GenericModel
Expand Down Expand Up @@ -112,3 +112,6 @@ def __next__(self) -> T:
self.current_iter = iter(next_page.data)
self.next_cursor = next_page.next_cursor
return next(self.current_iter)

def __iter__(self) -> "Self":
return self
10 changes: 10 additions & 0 deletions tests/test_v3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from itertools import islice
from ntropy_sdk import SDK


def test_pagination(sdk: SDK):
tx_ids = set()
it = sdk.v3.transactions.list(limit=2).auto_paginate(page_size=2)
for tx in islice(it, 10):
tx_ids.add(tx.id)
assert len(tx_ids) == 10

0 comments on commit a3fa09e

Please sign in to comment.