@@ -524,6 +524,34 @@ async def get_status() -> str:
524524 asyncio .run (run ())
525525
526526
527+ def test_poll_until_terminal_status_async_handles_signed_string_status_codes_as_retryable_unknown ():
528+ async def run () -> None :
529+ attempts = {"count" : 0 }
530+
531+ async def get_status () -> str :
532+ attempts ["count" ] += 1
533+ if attempts ["count" ] < 3 :
534+ raise HyperbrowserError (
535+ "signed status code metadata" ,
536+ status_code = "+400" , # type: ignore[arg-type]
537+ )
538+ return "completed"
539+
540+ status = await poll_until_terminal_status_async (
541+ operation_name = "async poll signed status metadata retries" ,
542+ get_status = get_status ,
543+ is_terminal_status = lambda value : value == "completed" ,
544+ poll_interval_seconds = 0.0001 ,
545+ max_wait_seconds = 1.0 ,
546+ max_status_failures = 5 ,
547+ )
548+
549+ assert status == "completed"
550+ assert attempts ["count" ] == 3
551+
552+ asyncio .run (run ())
553+
554+
527555def test_poll_until_terminal_status_async_handles_unicode_digit_like_status_codes_as_retryable ():
528556 async def run () -> None :
529557 attempts = {"count" : 0 }
@@ -1101,6 +1129,29 @@ def operation() -> str:
11011129 assert attempts ["count" ] == 3
11021130
11031131
1132+ def test_retry_operation_handles_signed_string_status_codes_as_retryable_unknown ():
1133+ attempts = {"count" : 0 }
1134+
1135+ def operation () -> str :
1136+ attempts ["count" ] += 1
1137+ if attempts ["count" ] < 3 :
1138+ raise HyperbrowserError (
1139+ "signed status code metadata" ,
1140+ status_code = "-400" , # type: ignore[arg-type]
1141+ )
1142+ return "ok"
1143+
1144+ result = retry_operation (
1145+ operation_name = "sync retry signed status metadata" ,
1146+ operation = operation ,
1147+ max_attempts = 5 ,
1148+ retry_delay_seconds = 0.0001 ,
1149+ )
1150+
1151+ assert result == "ok"
1152+ assert attempts ["count" ] == 3
1153+
1154+
11041155def test_retry_operation_handles_unicode_digit_like_status_codes_as_retryable ():
11051156 attempts = {"count" : 0 }
11061157
0 commit comments