1
0
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:
Ross McFarland
2018-12-03 16:46:18 -08:00
parent 446f66f562
commit b80348c2c7
2 changed files with 136 additions and 1 deletions

View File

@@ -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):