| 249 | retry.sleep() |
| 250 | |
| 251 | def test_status_forcelist(self) -> None: |
| 252 | retry = Retry(status_forcelist=range(500, 600)) |
| 253 | assert not retry.is_retry("GET", status_code=200) |
| 254 | assert not retry.is_retry("GET", status_code=400) |
| 255 | assert retry.is_retry("GET", status_code=500) |
| 256 | |
| 257 | retry = Retry(total=1, status_forcelist=[418]) |
| 258 | assert not retry.is_retry("GET", status_code=400) |
| 259 | assert retry.is_retry("GET", status_code=418) |
| 260 | |
| 261 | # String status codes are not matched. |
| 262 | retry = Retry(total=1, status_forcelist=["418"]) # type: ignore[list-item] |
| 263 | assert not retry.is_retry("GET", status_code=418) |
| 264 | |
| 265 | def test_allowed_methods_with_status_forcelist(self) -> None: |
| 266 | # Falsey allowed_methods means to retry on any method. |