From 8018863b45d80c8c026235e9fa3edb00f1368f5e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 27 Aug 2026 22:05:27 +0000 Subject: [PATCH] fix: Use the generated pagination dataclass in the paginator Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Y1RzepycXEYA3LStfjt8cY --- pyproject.toml | 4 ++-- seam/pagination.py | 12 ++---------- test/paginator_test.py | 12 ++++++++++++ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b8bc9c28..2f7bd889 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/seam/pagination.py b/seam/pagination.py index a6cd346c..ee1ca9ed 100644 --- a/seam/pagination.py +++ b/seam/pagination.py @@ -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]): diff --git a/test/paginator_test.py b/test/paginator_test.py index 65af163b..5bcfe66a 100644 --- a/test/paginator_test.py +++ b/test/paginator_test.py @@ -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): @@ -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