MCPcopy
hub / github.com/urllib3/urllib3 / test_history

Method test_history

test/test_retry.py:315–338  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

313 assert "Caused by redirect" not in str(e.value)
314
315 def test_history(self) -> None:
316 retry = Retry(total=10, allowed_methods=frozenset(["GET", "POST"]))
317 assert retry.history == tuple()
318 connection_error = ConnectTimeoutError("conntimeout")
319 retry = retry.increment("GET", "/test1", None, connection_error)
320 test_history1 = (RequestHistory("GET", "/test1", connection_error, None, None),)
321 assert retry.history == test_history1
322
323 read_error = ReadTimeoutError(DUMMY_POOL, "/test2", "read timed out")
324 retry = retry.increment("POST", "/test2", None, read_error)
325 test_history2 = (
326 RequestHistory("GET", "/test1", connection_error, None, None),
327 RequestHistory("POST", "/test2", read_error, None, None),
328 )
329 assert retry.history == test_history2
330
331 response = HTTPResponse(status=500)
332 retry = retry.increment("GET", "/test3", response, None)
333 test_history3 = (
334 RequestHistory("GET", "/test1", connection_error, None, None),
335 RequestHistory("POST", "/test2", read_error, None, None),
336 RequestHistory("GET", "/test3", None, 500, None),
337 )
338 assert retry.history == test_history3
339
340 def test_retry_method_not_allowed(self) -> None:
341 error = ReadTimeoutError(DUMMY_POOL, "/", "read timed out")

Callers

nothing calls this directly

Calls 6

incrementMethod · 0.95
RetryClass · 0.90
ConnectTimeoutErrorClass · 0.90
RequestHistoryClass · 0.90
ReadTimeoutErrorClass · 0.90
HTTPResponseClass · 0.90

Tested by

no test coverage detected