Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ required-version = ">=0.12.0,<0.13.0"

[tool.uv.build-backend]
module-root = ""
source-exclude = ["**/*_test.py"]
wheel-exclude = ["**/*_test.py"]
source-exclude = ["**/*_test.py", "**/__pycache__"]
wheel-exclude = ["**/*_test.py", "**/__pycache__"]

[tool.black]
target-version = ["py311"]
Expand Down
12 changes: 2 additions & 10 deletions seam/pagination.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
from typing import Any, Dict, List, Optional

from .resources.pagination import Pagination

class Pagination:
def __init__(
self,
has_next_page: bool,
next_page_cursor: str | None,
next_page_url: str | None,
):
self.has_next_page = has_next_page
self.next_page_cursor = next_page_cursor
self.next_page_url = next_page_url
__all__ = ["PaginatedList", "Pagination"]


class PaginatedList(List[Any]):
Expand Down
12 changes: 12 additions & 0 deletions test/paginator_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import pytest

from seam import Seam
from seam.pagination import Pagination
from seam.paginator import SeamPaginator
from seam.resources import Pagination as ResourcePagination


def test_create_paginator_returns_a_paginator(seam: Seam):
Expand Down Expand Up @@ -82,3 +84,13 @@ def test_paginator_flatten(seam: Seam):

assert len(collected_accounts) > 1
assert len(collected_accounts) == len(all_connected_accounts)


def test_paginator_returns_the_generated_pagination_resource(seam: Seam):
assert Pagination is ResourcePagination

paginator = seam.create_paginator(seam.connected_accounts.list, {"limit": 2})
_, pagination = paginator.first_page()

assert isinstance(pagination, ResourcePagination)
assert pagination.has_next_page is True
Loading