From: Tom Christie Date: Thu, 25 Apr 2019 16:05:40 +0000 (+0100) Subject: Drop unneccessary __hash__ methods X-Git-Tag: 0.3.0~66^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d35506277f66f6e88e85a75a2dadd758d98cce2;p=thirdparty%2Fhttpx.git Drop unneccessary __hash__ methods --- diff --git a/httpcore/config.py b/httpcore/config.py index b0fadc40..7166c05f 100644 --- a/httpcore/config.py +++ b/httpcore/config.py @@ -27,10 +27,6 @@ class SSLConfig: and self.verify == other.verify ) - def __hash__(self) -> int: - as_tuple = (self.cert, self.verify) - return hash(as_tuple) - def __repr__(self) -> str: class_name = self.__class__.__name__ return f"{class_name}(cert={self.cert}, verify={self.verify})" @@ -144,15 +140,6 @@ class TimeoutConfig: and self.pool_timeout == other.pool_timeout ) - def __hash__(self) -> int: - as_tuple = ( - self.connect_timeout, - self.read_timeout, - self.write_timeout, - self.pool_timeout, - ) - return hash(as_tuple) - def __repr__(self) -> str: class_name = self.__class__.__name__ if self.timeout is not None: @@ -181,10 +168,6 @@ class PoolLimits: and self.hard_limit == other.hard_limit ) - def __hash__(self) -> int: - as_tuple = (self.soft_limit, self.hard_limit) - return hash(as_tuple) - def __repr__(self) -> str: class_name = self.__class__.__name__ return ( diff --git a/tests/test_config.py b/tests/test_config.py index 8112d7c2..74c1267e 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -35,24 +35,3 @@ def test_timeout_eq(): def test_limits_eq(): limits = httpcore.PoolLimits(hard_limit=100) assert limits == httpcore.PoolLimits(hard_limit=100) - - -def test_ssl_hash(): - cache = {} - ssl = httpcore.SSLConfig(verify=False) - cache[ssl] = "example" - assert cache[httpcore.SSLConfig(verify=False)] == "example" - - -def test_timeout_hash(): - cache = {} - timeout = httpcore.TimeoutConfig(timeout=5.0) - cache[timeout] = "example" - assert cache[httpcore.TimeoutConfig(timeout=5.0)] == "example" - - -def test_limits_hash(): - cache = {} - limits = httpcore.PoolLimits(hard_limit=100) - cache[limits] = "example" - assert cache[httpcore.PoolLimits(hard_limit=100)] == "example"