From d65d3312e6fb8dc752741c46cf5796f22497c593 Mon Sep 17 00:00:00 2001 From: gecong1973 Date: Wed, 23 Nov 2016 15:10:56 +0800 Subject: Add __ne__ built-in function In Python 3 __ne__ by default delegates to __eq__ and inverts the result, but in Python 2 they urge you to define __ne__ when you define __eq__ for it to work properly [1].There are no implied relationships among the comparison operators. The truth of x==y does not imply that x!=y is false. Accordingly, when defining __eq__(), one should also define __ne__() so that the operators will behave as expected. [1]https://docs.python.org/2/reference/datamodel.html#object.__ne_ Change-Id: I4ba5b370e34cd64b13d87ef3ce2869d224dd0969 --- ceilometerclient/apiclient/fake_client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ceilometerclient/apiclient/fake_client.py b/ceilometerclient/apiclient/fake_client.py index 30a0731..d897cc5 100644 --- a/ceilometerclient/apiclient/fake_client.py +++ b/ceilometerclient/apiclient/fake_client.py @@ -87,6 +87,9 @@ class TestResponse(requests.Response): self.headers == other.headers and self._content == other._content) + def __ne__(self, other): + return not self.__eq__(other) + class FakeHTTPClient(client.HTTPClient): -- cgit v1.2.1