Skip to content

Commit 82718a8

Browse files
authored
Add all array properties to ArraySchema.__eq__ (#1875)
* Add properties to ArraySchema.__eq__ * Fix test reference schema `from_csv` defaults to having `allow_duplicates=True`
1 parent b822509 commit 82718a8

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

tiledb/array_schema.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,21 @@ def __eq__(self, other):
132132
"""Instance is equal to another ArraySchema"""
133133
if not isinstance(other, ArraySchema):
134134
return False
135-
nattr = self.nattr
136-
if nattr != other.nattr:
137-
return False
138-
if (
139-
self.sparse != other.sparse
140-
or self.cell_order != other.cell_order
141-
or self.tile_order != other.tile_order
135+
if not (
136+
self.sparse == other.sparse
137+
and self.cell_order == other.cell_order
138+
and self.tile_order == other.tile_order
139+
and self.capacity == other.capacity
140+
and self.coords_filters == other.coords_filters
141+
and self.offsets_filters == other.offsets_filters
142+
and self.validity_filters == other.validity_filters
143+
and self.nattr == other.nattr
144+
and self.domain == other.domain
142145
):
143146
return False
144-
if self.capacity != other.capacity:
145-
return False
146-
if self.domain != other.domain:
147+
if self.sparse and self.allows_duplicates != other.allows_duplicates:
147148
return False
148-
if self.coords_filters != other.coords_filters:
149-
return False
150-
for i in range(nattr):
149+
for i in range(self.nattr):
151150
if self.attr(i) != other.attr(i):
152151
return False
153152
return True

tiledb/tests/test_pandas_dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ def test_dataframe_csv_schema_only(self):
823823
tile_order="row-major",
824824
capacity=1001,
825825
sparse=True,
826-
allows_duplicates=False,
826+
allows_duplicates=True,
827827
)
828828
# note: filters omitted
829829

0 commit comments

Comments
 (0)