diff options
| author | yuyafei <yu.yafei@zte.com.cn> | 2016-05-28 16:10:15 +0800 |
|---|---|---|
| committer | yuyafei <yu.yafei@zte.com.cn> | 2016-07-04 07:15:11 +0000 |
| commit | ccde9b3ba78e2dd0f2a726e6d23dba91f8ee061f (patch) | |
| tree | 6f0b64b696770823bdb85fe90de74624717de6de | |
| parent | b734a1b0ed135b2e95adf714464d52073d9761e9 (diff) | |
| download | python-cinderclient-ccde9b3ba78e2dd0f2a726e6d23dba91f8ee061f.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 __ne__() built-in function
of class base.Resource. Also fixes spelling errors:resoruces.
Change-Id: I845d531880ad74d928a3e15335ed10e71590826e
Closes-Bug: #1586268
| -rw-r--r-- | cinderclient/openstack/common/apiclient/base.py | 3 | ||||
| -rw-r--r-- | cinderclient/tests/unit/test_base.py | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/cinderclient/openstack/common/apiclient/base.py b/cinderclient/openstack/common/apiclient/base.py index 619af93..2503898 100644 --- a/cinderclient/openstack/common/apiclient/base.py +++ b/cinderclient/openstack/common/apiclient/base.py @@ -524,6 +524,9 @@ class Resource(RequestIdMixin): 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/cinderclient/tests/unit/test_base.py b/cinderclient/tests/unit/test_base.py index 48ec60b..437ff2e 100644 --- a/cinderclient/tests/unit/test_base.py +++ b/cinderclient/tests/unit/test_base.py @@ -58,7 +58,7 @@ class BaseTest(utils.TestCase): r2 = base.Resource(None, {'id': 1, 'name': 'hello'}) self.assertEqual(r1, r2) - # Two resoruces of different types: never equal + # Two resources of different types: never equal r1 = base.Resource(None, {'id': 1}) r2 = volumes.Volume(None, {'id': 1}) self.assertNotEqual(r1, r2) |
