Also add __eq__ for FilterList and Filter
@@ -1242,6 +1242,16 @@ cdef class Filter(object):
output.write(")")
return output.getvalue()
+ def __eq__(self, other):
+ if type(self) != type(other):
+ return False
+ for f in self._attrs_():
+ left = getattr(self, f)
+ right = getattr(other, f)
+ if left != right:
+ return False
+ return True
+
cdef class CompressionFilter(Filter):
"""Base class for filters performing compression.
@@ -1851,6 +1861,14 @@ cdef class FilterList(object):
output = StringIO()
output.write("FilterList([")
+ def __eq__(self, other):
+ if len(self) != len(other):
+ return False
+ for i,f in enumerate(self):
+ if f != other[i]:
+ return False
+ return True
+
@property
def chunksize(self):
"""The chunk size used by the filter list."""
@@ -3054,6 +3072,8 @@ cdef class ArraySchema(object):
return False
if self.domain != other.domain:
return False
+ if self.coords_filters != other.coords_filters:
+ return False
for i in range(nattr):
if self.attr(i) != other.attr(i):
return False
