summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryuyafei <yu.yafei@zte.com.cn>2016-07-04 16:23:12 +0800
committeryuyafei <yu.yafei@zte.com.cn>2016-07-04 07:08:14 +0000
commitf97de95a638347993545686ac9c225d831838340 (patch)
tree03a2268fa46843fb60d055182d83d07a919fae1f
parent196d3ba8509acfcade69d095d8126a64c45fe880 (diff)
downloadpython-ceilometerclient-f97de95a638347993545686ac9c225d831838340.tar.gz
base.Resource not define __ne__() built-in function
Class base.Resource defines __eq__() built-in function, but does not define __ne__() built-in function, so self.assertEqual works but self.assertNotEqual does not work at all in this test case in python2. This patch fixes it by defining __eq__() built-in function of class base.Resource. Also fixes spelling errors:resoruces. Change-Id: I8a4e09e277a14a16105feab81ba8d07ceee5b47f Closes-Bug: #1586268
-rw-r--r--ceilometerclient/openstack/common/apiclient/base.py3
-rw-r--r--ceilometerclient/tests/unit/test_openstack_common.py2
2 files changed, 4 insertions, 1 deletions
diff --git a/ceilometerclient/openstack/common/apiclient/base.py b/ceilometerclient/openstack/common/apiclient/base.py
index 17016eb..3e5dc22 100644
--- a/ceilometerclient/openstack/common/apiclient/base.py
+++ b/ceilometerclient/openstack/common/apiclient/base.py
@@ -523,6 +523,9 @@ class Resource(object):
return False
return self._info == other._info
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
def is_loaded(self):
return self._loaded
diff --git a/ceilometerclient/tests/unit/test_openstack_common.py b/ceilometerclient/tests/unit/test_openstack_common.py
index 9fea065..04a94e2 100644
--- a/ceilometerclient/tests/unit/test_openstack_common.py
+++ b/ceilometerclient/tests/unit/test_openstack_common.py
@@ -33,7 +33,7 @@ class BaseTest(utils.BaseTestCase):
self.assertEqual(r1, r2)
def test_two_resources_with_diff_type_are_not_equal(self):
- # Two resoruces of different types: never equal
+ # Two resources of different types: never equal
r1 = base.Resource(None, {'id': 1})
r2 = events.Event(None, {'id': 1})
self.assertNotEqual(r1, r2)