MCPcopy
hub / github.com/urllib3/urllib3 / test_configurable_backoff_max

Method test_configurable_backoff_max

test/test_retry.py:160–182  ·  test/test_retry.py::TestRetry.test_configurable_backoff_max

Configurable backoff is computed correctly

(self)

Source from the content-addressed store, hash-verified

158 assert retry.get_backoff_time() == max_backoff
159
160 def test_configurable_backoff_max(self) -> None:
161 class="st">""class="st">"Configurable backoff is computed correctly"class="st">""
162 max_backoff = 1
163
164 retry = Retry(total=100, backoff_factor=0.2, backoff_max=max_backoff)
165 assert retry.get_backoff_time() == 0 class="cm"># First request
166
167 retry = retry.increment(method=class="st">"GET")
168 assert retry.get_backoff_time() == 0 class="cm"># First retry
169
170 retry = retry.increment(method=class="st">"GET")
171 assert retry.backoff_factor == 0.2
172 assert retry.total == 98
173 assert retry.get_backoff_time() == 0.4 class="cm"># Start backoff
174
175 retry = retry.increment(method=class="st">"GET")
176 assert retry.get_backoff_time() == 0.8
177
178 retry = retry.increment(method=class="st">"GET")
179 assert retry.get_backoff_time() == max_backoff
180
181 retry = retry.increment(method=class="st">"GET")
182 assert retry.get_backoff_time() == max_backoff
183
184 def test_configurable_retry_after_max(self) -> None:
185 class="st">""class="st">"Configurable retry after is computed correctly"class="st">""

Callers

nothing calls this directly

Calls 3

get_backoff_timeMethod · 0.95
incrementMethod · 0.95
RetryClass · 0.90

Tested by

no test coverage detected