diff --git a/HISTORY.md b/HISTORY.md index 7d37529a16..0e1c5a4c24 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,8 +1,11 @@ -# In Progress +# In-Progress ## Improvements * Refactor display of TileDB objects in Jupyter notebooks to be more readable [#1049](https://github.com/TileDB-Inc/TileDB-Py/pull/1049) +## Bug Fixes +* `Dim.shape` correctly errors out if type is not integer or datetime [#1055](https://github.com/TileDB-Inc/TileDB-Py/pull/1055) + # TileDB-Py 0.14.2 Release Notes ## TileDB Embedded updates: diff --git a/tiledb/libtiledb.pyx b/tiledb/libtiledb.pyx index 9d74fcde85..beaa9b8781 100644 --- a/tiledb/libtiledb.pyx +++ b/tiledb/libtiledb.pyx @@ -2022,9 +2022,16 @@ cdef class Dim(object): cdef _integer_domain(self): cdef tiledb_datatype_t typ = self._get_type() - if typ == TILEDB_FLOAT32 or typ == TILEDB_FLOAT64: - return False - return True + return typ in ( + TILEDB_UINT8, + TILEDB_INT8, + TILEDB_UINT16, + TILEDB_INT16, + TILEDB_UINT32, + TILEDB_INT32, + TILEDB_UINT64, + TILEDB_INT64, + ) cdef _datetime_domain(self): cdef tiledb_datatype_t typ = self._get_type() diff --git a/tiledb/tests/test_libtiledb.py b/tiledb/tests/test_libtiledb.py index 9d799e3478..041d739b94 100644 --- a/tiledb/tests/test_libtiledb.py +++ b/tiledb/tests/test_libtiledb.py @@ -282,6 +282,14 @@ def test_datetime_dimension(self): name="d1", domain=(-10, 10), tile=2, dtype=np.datetime64("", "D") ) + def test_shape(self): + dim = tiledb.Dim(name="", dtype="|S0", var=True) + with self.assertRaisesRegex( + TypeError, + "shape only valid for integer and datetime dimension domains", + ): + dim.shape + class DomainTest(DiskTestCase): def test_domain(self, capfd):