Merge "Fixed the __ne__ implementation in base.Resource"
This commit is contained in:
commit
084b0abb75
@ -210,7 +210,9 @@ class Resource(RequestIdMixin):
|
|||||||
return self._info == other._info
|
return self._info == other._info
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return not self.__eq__(other)
|
# Using not of '==' implementation because the not of
|
||||||
|
# __eq__, when it returns NotImplemented, is returning False.
|
||||||
|
return not self == other
|
||||||
|
|
||||||
def is_loaded(self):
|
def is_loaded(self):
|
||||||
return self._loaded
|
return self._loaded
|
||||||
|
@ -71,6 +71,12 @@ class BaseTest(utils.TestCase):
|
|||||||
r2 = base.Resource(None, {'name': 'joe', 'age': 12})
|
r2 = base.Resource(None, {'name': 'joe', 'age': 12})
|
||||||
self.assertEqual(r1, r2)
|
self.assertEqual(r1, r2)
|
||||||
|
|
||||||
|
def test_ne(self):
|
||||||
|
# Two resources of different types: never equal
|
||||||
|
r1 = base.Resource(None, {'id': 1, 'name': 'test'})
|
||||||
|
r2 = object()
|
||||||
|
self.assertNotEqual(r1, r2)
|
||||||
|
|
||||||
def test_findall_invalid_attribute(self):
|
def test_findall_invalid_attribute(self):
|
||||||
cs = fakes.FakeClient(api_versions.APIVersion("2.0"))
|
cs = fakes.FakeClient(api_versions.APIVersion("2.0"))
|
||||||
# Make sure findall with an invalid attribute doesn't cause errors.
|
# Make sure findall with an invalid attribute doesn't cause errors.
|
||||||
|
Loading…
Reference in New Issue
Block a user