test_config.py
This file
Path
tests/test_config.py
58 lines · 1.5 KiB · Python
Last changed by
Merge pull request #9 from encode/allow_per_request_timeout_and_sslTom Christiebefore adoptiondf84cde
History of this fileTake it
Merge pull request #9 from encode/allow_per_request_timeout_and_sslTom Christiebefore adoptiondf84cde
lines 1–58why, one step back1import httpcore234def test_ssl_repr():5 ssl = httpcore.SSLConfig(verify=False)6 assert repr(ssl) == "SSLConfig(cert=None, verify=False)"789def test_timeout_repr():10 timeout = httpcore.TimeoutConfig(timeout=5.0)11 assert repr(timeout) == "TimeoutConfig(timeout=5.0)"1213 timeout = httpcore.TimeoutConfig(read_timeout=5.0)14 assert (15 repr(timeout)16 == "TimeoutConfig(connect_timeout=None, read_timeout=5.0, pool_timeout=None)"17 )181920def test_limits_repr():21 limits = httpcore.PoolLimits(hard_limit=100)22 assert repr(limits) == "PoolLimits(soft_limit=None, hard_limit=100)"232425def test_ssl_eq():26 ssl = httpcore.SSLConfig(verify=False)27 assert ssl == httpcore.SSLConfig(verify=False)282930def test_timeout_eq():31 timeout = httpcore.TimeoutConfig(timeout=5.0)32 assert timeout == httpcore.TimeoutConfig(timeout=5.0)333435def test_limits_eq():36 limits = httpcore.PoolLimits(hard_limit=100)37 assert limits == httpcore.PoolLimits(hard_limit=100)383940def test_ssl_hash():41 cache = {}42 ssl = httpcore.SSLConfig(verify=False)43 cache[ssl] = "example"44 assert cache[httpcore.SSLConfig(verify=False)] == "example"454647def test_timeout_hash():48 cache = {}49 timeout = httpcore.TimeoutConfig(timeout=5.0)50 cache[timeout] = "example"51 assert cache[httpcore.TimeoutConfig(timeout=5.0)] == "example"525354def test_limits_hash():55 cache = {}56 limits = httpcore.PoolLimits(hard_limit=100)57 cache[limits] = "example"58 assert cache[httpcore.PoolLimits(hard_limit=100)] == "example"