Remove xfail from simple3d_sparse_vector
Vestigial xfail
@@ -1998,24 +1998,28 @@ class TestSparseArray(DiskTestCase):
with tiledb.SparseArray(ctx, self.path("foo"), mode="r") as T:
assert_array_equal(T[[1, 2], [1, 2]], values)
- @pytest.mark.xfail
def test_simple3d_sparse_vector(self):
+ uri = self.path("simple3d_sparse_vector")
dom = tiledb.Domain(
- ctx,
- tiledb.Dim(ctx, "x", domain=(0, 3), tile=4, dtype=int),
- tiledb.Dim(ctx, "y", domain=(0, 3), tile=4, dtype=int),
- tiledb.Dim(ctx, "z", domain=(0, 3), tile=4, dtype=int),
+ tiledb.Dim("x", domain=(0, 3), tile=4, dtype=int),
+ tiledb.Dim("y", domain=(0, 3), tile=4, dtype=int),
+ tiledb.Dim("z", domain=(0, 3), tile=4, dtype=int),
)
- attr = tiledb.Attr(ctx, dtype=float)
- schema = tiledb.ArraySchema(ctx, domain=dom, attrs=(attr,), sparse=True)
- tiledb.SparseArray.create(self.path("foo"), schema)
+ attr = tiledb.Attr(dtype=float)
+ schema = tiledb.ArraySchema(domain=dom, attrs=(attr,), sparse=True)
+ tiledb.SparseArray.create(uri, schema)
values = np.array([3, 4], dtype=float)
- with tiledb.SparseArray(ctx, self.path("foo"), mode="w") as T:
- T[[1, 2], [1, 2], [1, 2]] = values
+ coords = (1, 2), (1, 2), (1, 2)
+ with tiledb.SparseArray(uri, mode="w") as T:
+ T[coords] = values
- with tiledb.SparseArray(ctx, self.path("foo"), mode="r") as T:
- assert_array_equal(T[[1, 2], [1, 2], [1, 2]], values)
+ with tiledb.SparseArray(uri, mode="r") as T:
+ res = T.multi_index[coords]
+ assert_array_equal(res[""], values)
+ assert_array_equal(res["x"], coords[0])
+ assert_array_equal(res["y"], coords[1])
+ assert_array_equal(res["z"], coords[2])
@pytest.mark.xfail
def test_sparse_ordered_fp_domain(self):
