@@ -28,11 +28,7 @@ async def test_basic_pagination_single_page(self):
2828 results = await LowLevelClientBase ._handle_pagination (mock_func )
2929
3030 assert results == [1 , 2 , 3 ]
31- mock_func .assert_called_once_with (
32- page_size = None ,
33- page_token = "" ,
34- order_by = None
35- )
31+ mock_func .assert_called_once_with (page_size = None , page_token = "" , order_by = None )
3632
3733 @pytest .mark .asyncio
3834 async def test_pagination_multiple_pages (self ):
@@ -42,7 +38,7 @@ async def test_pagination_multiple_pages(self):
4238 mock_func .side_effect = [
4339 ([1 , 2 , 3 ], "token1" ), # First page
4440 ([4 , 5 , 6 ], "token2" ), # Second page
45- ([7 , 8 , 9 ], "" ), # Last page (empty token)
41+ ([7 , 8 , 9 ], "" ), # Last page (empty token)
4642 ]
4743
4844 results = await LowLevelClientBase ._handle_pagination (mock_func )
@@ -61,50 +57,33 @@ async def test_pagination_with_page_size(self):
6157 """Test pagination with specified page size."""
6258 mock_func = AsyncMock (return_value = ([1 , 2 ], "" ))
6359
64- results = await LowLevelClientBase ._handle_pagination (
65- mock_func ,
66- page_size = 2
67- )
60+ results = await LowLevelClientBase ._handle_pagination (mock_func , page_size = 2 )
6861
6962 assert results == [1 , 2 ]
70- mock_func .assert_called_once_with (
71- page_size = 2 ,
72- page_token = "" ,
73- order_by = None
74- )
63+ mock_func .assert_called_once_with (page_size = 2 , page_token = "" , order_by = None )
7564
7665 @pytest .mark .asyncio
7766 async def test_pagination_with_order_by (self ):
7867 """Test pagination with order_by parameter."""
7968 mock_func = AsyncMock (return_value = ([1 , 2 , 3 ], "" ))
8069
81- results = await LowLevelClientBase ._handle_pagination (
82- mock_func ,
83- order_by = "name asc"
84- )
70+ results = await LowLevelClientBase ._handle_pagination (mock_func , order_by = "name asc" )
8571
8672 assert results == [1 , 2 , 3 ]
87- mock_func .assert_called_once_with (
88- page_size = None ,
89- page_token = "" ,
90- order_by = "name asc"
91- )
73+ mock_func .assert_called_once_with (page_size = None , page_token = "" , order_by = "name asc" )
9274
9375 @pytest .mark .asyncio
9476 async def test_pagination_with_initial_page_token (self ):
9577 """Test pagination starting with a specific page token."""
9678 mock_func = AsyncMock (return_value = ([4 , 5 , 6 ], "" ))
9779
9880 results = await LowLevelClientBase ._handle_pagination (
99- mock_func ,
100- page_token = "start_token"
81+ mock_func , page_token = "start_token"
10182 )
10283
10384 assert results == [4 , 5 , 6 ]
10485 mock_func .assert_called_once_with (
105- page_size = None ,
106- page_token = "start_token" ,
107- order_by = None
86+ page_size = None , page_token = "start_token" , order_by = None
10887 )
10988
11089 @pytest .mark .asyncio
@@ -113,29 +92,23 @@ async def test_pagination_with_kwargs(self):
11392 mock_func = AsyncMock (return_value = ([1 , 2 , 3 ], "" ))
11493 kwargs = {"filter" : "active" , "include_archived" : False }
11594
116- results = await LowLevelClientBase ._handle_pagination (
117- mock_func ,
118- kwargs = kwargs
119- )
95+ results = await LowLevelClientBase ._handle_pagination (mock_func , kwargs = kwargs )
12096
12197 assert results == [1 , 2 , 3 ]
12298 mock_func .assert_called_once_with (
12399 page_size = None ,
124100 page_token = "" ,
125101 order_by = None ,
126102 filter = "active" ,
127- include_archived = False
103+ include_archived = False ,
128104 )
129105
130106 @pytest .mark .asyncio
131107 async def test_pagination_with_max_results_single_page (self ):
132108 """Test pagination with max_results that fits in a single page."""
133109 mock_func = AsyncMock (return_value = ([1 , 2 , 3 , 4 , 5 ], "" ))
134110
135- results = await LowLevelClientBase ._handle_pagination (
136- mock_func ,
137- max_results = 3
138- )
111+ results = await LowLevelClientBase ._handle_pagination (mock_func , max_results = 3 )
139112
140113 # Should return only the max results
141114 assert results == [1 , 2 , 3 ]
@@ -150,10 +123,7 @@ async def test_pagination_with_max_results_multiple_pages(self):
150123 ([4 , 5 , 6 ], "token2" ), # Second page (6 total items, exceeds max_results=5)
151124 ]
152125
153- results = await LowLevelClientBase ._handle_pagination (
154- mock_func ,
155- max_results = 5
156- )
126+ results = await LowLevelClientBase ._handle_pagination (mock_func , max_results = 5 )
157127
158128 # Should include 2 pages and return the full first page but limited 2nd page
159129 assert results == [1 , 2 , 3 , 4 , 5 ]
@@ -165,13 +135,10 @@ async def test_pagination_with_max_results_exact_match(self):
165135 mock_func = AsyncMock ()
166136 mock_func .side_effect = [
167137 ([1 , 2 , 3 ], "token1" ), # First page
168- ([4 , 5 ], "" ), # Second page, total = 5
138+ ([4 , 5 ], "" ), # Second page, total = 5
169139 ]
170140
171- results = await LowLevelClientBase ._handle_pagination (
172- mock_func ,
173- max_results = 5
174- )
141+ results = await LowLevelClientBase ._handle_pagination (mock_func , max_results = 5 )
175142
176143 assert results == [1 , 2 , 3 , 4 , 5 ]
177144 assert mock_func .call_count == 2
@@ -186,18 +153,13 @@ async def test_pagination_empty_results(self):
186153 assert results == []
187154 mock_func .assert_called_once ()
188155
189-
190156 @pytest .mark .asyncio
191157 async def test_pagination_max_results_zero (self ):
192158 """Test pagination with max_results=0."""
193159 mock_func = AsyncMock (return_value = ([1 , 2 , 3 ], "" ))
194160
195- results = await LowLevelClientBase ._handle_pagination (
196- mock_func ,
197- max_results = 0
198- )
161+ results = await LowLevelClientBase ._handle_pagination (mock_func , max_results = 0 )
199162
200163 # Should return empty list without calling the function
201164 assert results == []
202165 mock_func .assert_not_called ()
203-
0 commit comments