Add __ne__ built-in function
In Python 3 __ne__ by default delegates to __eq__ and inverts the
result, but in Python 2 they urge you to define __ne__ when you
define __eq__ for it to work properly [1].There are no implied
relationships among the comparison operators. The truth of x==y
does not imply that x!=y is false. Accordingly, when defining __eq__(),
one should also define __ne__() so that the operators will behave as
expected.
[1]https://docs.python.org/2/reference/datamodel.html#object.__ne__
Change-Id: I5abcaa9d74712df591499e8334f1d627b2d7d1ca
diff --git a/designate_tempest_plugin/common/models.py b/designate_tempest_plugin/common/models.py
index e69bd09..b2a1687 100644
--- a/designate_tempest_plugin/common/models.py
+++ b/designate_tempest_plugin/common/models.py
@@ -31,6 +31,9 @@
def __eq__(self, other):
return self.__dict__ == other.__dict__
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
@classmethod
def from_text(cls, text):
"""Return a ZoneFile from a string containing the zone file contents"""
@@ -64,6 +67,9 @@
def __eq__(self, other):
return self.__dict__ == other.__dict__
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
def __hash__(self):
return hash(tuple(sorted(self.__dict__.items())))