File tree 2 files changed +18
-3
lines changed
2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -1781,14 +1781,14 @@ void init_core(py::module &m) {
1781
1781
m.def (" datatype_size" , &tiledb_datatype_size);
1782
1782
m.def (" as_built_dump" , &as_built_dump);
1783
1783
m.def (" object_type" ,
1784
- [](const std::string &uri, const Context &ctx) -> py::str {
1784
+ [](const std::string &uri, const Context &ctx) -> py::object {
1785
1785
tiledb_object_t res;
1786
1786
ctx.handle_error (
1787
1787
tiledb_object_type (ctx.ptr ().get (), uri.c_str (), &res));
1788
1788
if (res == TILEDB_ARRAY) {
1789
- return std::string (" array" );
1789
+ return py::str (" array" );
1790
1790
} else if (res == TILEDB_GROUP) {
1791
- return std::string (" group" );
1791
+ return py::str (" group" );
1792
1792
}
1793
1793
return py::none ();
1794
1794
});
Original file line number Diff line number Diff line change @@ -165,3 +165,18 @@ def create_array(array_name, sparse):
165
165
with self .assertRaises (tiledb .TileDBError ) as excinfo :
166
166
tiledb .ls (dense_arrays_uri , lambda x , y : 1 / 0 )
167
167
assert "ZeroDivisionError: division by zero" in str (excinfo .value )
168
+
169
+ def test_object_type (self ):
170
+ uri = self .path ("test_object_type" )
171
+
172
+ # None case
173
+ self .assertIsNone (tiledb .object_type (uri ))
174
+
175
+ # Array case
176
+ with tiledb .from_numpy (uri , np .arange (0 , 5 )) as T :
177
+ self .assertEqual (tiledb .object_type (uri ), "array" )
178
+ tiledb .Array .delete_array (uri )
179
+
180
+ # Group case
181
+ tiledb .group_create (uri )
182
+ self .assertEqual (tiledb .object_type (uri ), "group" )
You can’t perform that action at this time.
0 commit comments