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.

Change-Id: I13ed9ddd6ae6ef074232b33695916bc83930dcf0
Closes-Bug: #1586268
This commit is contained in:
yuyafei 2016-07-04 16:17:51 +08:00
parent e84621ecc0
commit 4c2a88b959
1 changed files with 3 additions and 0 deletions

View File

@ -529,6 +529,9 @@ class Resource(object):
"function."))
return self._info == other._info
def __ne__(self, other):
return not self.__eq__(other)
def is_same_obj(self, other):
"""Identify the two objects are same one with same id."""
if isinstance(other, self.__class__):