MCPcopy
hub / github.com/urllib3/urllib3 / test_http_pool_key_fields

Method test_http_pool_key_fields

test/test_poolmanager.py:93–119  ·  view source on GitHub ↗

Assert the HTTPPoolKey fields are honored when selecting a pool.

(self)

Source from the content-addressed store, hash-verified

91 assert len(p.pools) == 0
92
93 def test_http_pool_key_fields(self) -> None:
94 """Assert the HTTPPoolKey fields are honored when selecting a pool."""
95 connection_pool_kw = {
96 "timeout": timeout.Timeout(3.14),
97 "retries": retry.Retry(total=6, connect=2),
98 "block": True,
99 "source_address": "127.0.0.1",
100 "blocksize": _DEFAULT_BLOCKSIZE + 1,
101 }
102 p = PoolManager()
103 conn_pools = [
104 p.connection_from_url("http://example.com/"),
105 p.connection_from_url("http://example.com:8000/"),
106 p.connection_from_url("http://other.example.com/"),
107 ]
108
109 for key, value in connection_pool_kw.items():
110 p.connection_pool_kw[key] = value
111 conn_pools.append(p.connection_from_url("http://example.com/"))
112
113 assert all(
114 x is not y
115 for i, x in enumerate(conn_pools)
116 for j, y in enumerate(conn_pools)
117 if i != j
118 )
119 assert all(isinstance(key, PoolKey) for key in p.pools.keys())
120
121 def test_https_pool_key_fields(self) -> None:
122 """Assert the HTTPSPoolKey fields are honored when selecting a pool."""

Callers

nothing calls this directly

Calls 4

connection_from_urlMethod · 0.95
PoolManagerClass · 0.90
itemsMethod · 0.80
keysMethod · 0.45

Tested by

no test coverage detected