@@ -291,9 +291,42 @@ async def main():
291291 output = self .start (main )
292292 self .assert_exit_result_error (output , ValueError , "oops" )
293293
294- def start (self , main : Callable , * args : Any , ** kwargs : Any ) -> Output :
294+ def test_min_max_results_clamping (self ):
295+ @durable
296+ async def main ():
297+ return await call_concurrently ("a" , "b" , "c" )
298+
299+ output = self .start (main , poll_min_results = 1 , poll_max_results = 10 )
300+ self .assert_poll_call_functions (
301+ output , ["a" , "b" , "c" ], min_results = 1 , max_results = 3
302+ )
303+
304+ output = self .start (main , poll_min_results = 1 , poll_max_results = 2 )
305+ self .assert_poll_call_functions (
306+ output , ["a" , "b" , "c" ], min_results = 1 , max_results = 2
307+ )
308+
309+ output = self .start (main , poll_min_results = 10 , poll_max_results = 10 )
310+ self .assert_poll_call_functions (
311+ output , ["a" , "b" , "c" ], min_results = 3 , max_results = 3
312+ )
313+
314+ def start (
315+ self ,
316+ main : Callable ,
317+ * args : Any ,
318+ poll_min_results = 1 ,
319+ poll_max_results = 10 ,
320+ poll_max_wait_seconds = None ,
321+ ** kwargs : Any ,
322+ ) -> Output :
295323 input = Input .from_input_arguments (main .__qualname__ , * args , ** kwargs )
296- return OneShotScheduler (main ).run (input )
324+ return OneShotScheduler (
325+ main ,
326+ poll_min_results = poll_min_results ,
327+ poll_max_results = poll_max_results ,
328+ poll_max_wait_seconds = poll_max_wait_seconds ,
329+ ).run (input )
297330
298331 def resume (
299332 self ,
0 commit comments