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
This commit is contained in:
parent
196d3ba850
commit
f97de95a63
ceilometerclient
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user