mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Add __eq__, __ne__, and __repr__ to Dynamic objects and test
This commit is contained in:
@@ -396,6 +396,15 @@ class _DynamicPool(object):
|
||||
def _data(self):
|
||||
return self.data
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.data == other.data
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __repr__(self):
|
||||
return '{}'.format(self.data)
|
||||
|
||||
|
||||
class _DynamicRule(object):
|
||||
|
||||
@@ -407,6 +416,15 @@ class _DynamicRule(object):
|
||||
def _data(self):
|
||||
return self.data
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.data == other.data
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __repr__(self):
|
||||
return '{}'.format(self.data)
|
||||
|
||||
|
||||
class _Dynamic(object):
|
||||
|
||||
@@ -426,6 +444,16 @@ class _Dynamic(object):
|
||||
'rules': rules,
|
||||
}
|
||||
|
||||
def __eq__(self, other):
|
||||
ret = self.pools == other.pools and self.rules == other.rules
|
||||
return ret
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __repr__(self):
|
||||
return '{}, {}'.format(self.pools, self.rules)
|
||||
|
||||
|
||||
class _DynamicMixin(object):
|
||||
|
||||
|
Reference in New Issue
Block a user