@@ -334,6 +334,23 @@ def test_collect_paginated_results_raises_on_invalid_page_batch_types():
334334 )
335335
336336
337+ def test_collect_paginated_results_raises_on_boolean_page_batch_values ():
338+ with pytest .raises (
339+ HyperbrowserPollingError ,
340+ match = "Invalid current page batch for sync paginated invalid bools" ,
341+ ):
342+ collect_paginated_results (
343+ operation_name = "sync paginated invalid bools" ,
344+ get_next_page = lambda page : {"current" : True , "total" : 2 , "items" : []},
345+ get_current_page_batch = lambda response : response ["current" ],
346+ get_total_page_batches = lambda response : response ["total" ],
347+ on_page_success = lambda response : None ,
348+ max_wait_seconds = 1.0 ,
349+ max_attempts = 2 ,
350+ retry_delay_seconds = 0.0001 ,
351+ )
352+
353+
337354def test_collect_paginated_results_async_times_out ():
338355 async def run () -> None :
339356 with pytest .raises (
@@ -416,6 +433,28 @@ async def run() -> None:
416433 asyncio .run (run ())
417434
418435
436+ def test_collect_paginated_results_async_raises_on_boolean_page_batch_values ():
437+ async def run () -> None :
438+ with pytest .raises (
439+ HyperbrowserPollingError ,
440+ match = "Invalid total page batches for async paginated invalid bools" ,
441+ ):
442+ await collect_paginated_results_async (
443+ operation_name = "async paginated invalid bools" ,
444+ get_next_page = lambda page : asyncio .sleep (
445+ 0 , result = {"current" : 1 , "total" : False , "items" : []}
446+ ),
447+ get_current_page_batch = lambda response : response ["current" ],
448+ get_total_page_batches = lambda response : response ["total" ],
449+ on_page_success = lambda response : None ,
450+ max_wait_seconds = 1.0 ,
451+ max_attempts = 2 ,
452+ retry_delay_seconds = 0.0001 ,
453+ )
454+
455+ asyncio .run (run ())
456+
457+
419458def test_wait_for_job_result_returns_fetched_value ():
420459 status_values = iter (["running" , "completed" ])
421460
0 commit comments