Skip to content

Commit c15db68

Browse files
committed
fix unit tests
1 parent 0732790 commit c15db68

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

apis/python/src/tiledbsoma/soma_dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def write(self, values: pa.Table) -> None:
271271
if name != ROWID:
272272
attr_cols_map[name] = np.asarray(
273273
values.column(name).to_pandas(
274-
types_mapper=util_arrow.tiledb_type_from_arrow_type,
274+
types_mapper=util_arrow.tiledb_type_from_arrow_type_for_write,
275275
)
276276
)
277277

apis/python/src/tiledbsoma/util_arrow.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@
4343
}
4444

4545

46+
def tiledb_type_from_arrow_type_for_write(t: pa.DataType) -> Union[type, np.dtype, str]:
47+
"""
48+
Same as ``tiledb_type_from_arrow_type`` except that this is used for writing to a TileDB array.
49+
The syntax of TileDB-Py is such that when we want to create a schema with an ASCII column,
50+
we use the string ``"ascii"`` in place of a dtype. But when we want to write data, we need to
51+
use a dtype of ``np.str``, which is now deprecated in favor of simply ``str``.
52+
"""
53+
retval = tiledb_type_from_arrow_type(t)
54+
if retval == "ascii":
55+
return str
56+
else:
57+
return retval
58+
59+
4660
def tiledb_type_from_arrow_type(t: pa.DataType) -> Union[type, np.dtype, str]:
4761
"""
4862
Given an Arrow type, return the corresponding TileDB type as a Numpy dtype.

apis/python/tools/peek-exp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def count_obs(exp: tiledbsoma.SOMAExperiment, attr_name: str) -> None:
3838
sys.exit(1)
3939

4040
cfg = tiledb.Config()
41-
cfg["py.init_buffer_bytes"] = 4 * 1024**3
41+
cfg["py.init_buffer_bytes"] = 4 * 1024 ** 3
4242
ctx = tiledb.Ctx(cfg)
4343

4444
exp = tiledbsoma.SOMAExperiment(input_path, ctx=ctx)

libtiledbsoma/test/test_query_condition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_query_condition_and():
9090

9191
def test_query_condition_and_or():
9292
uri = os.path.join(SOMA_URI, "obs")
93-
condition = "(percent_mito > 0.02 and n_genes > 700) or (percent_mito < 0.015 and louvain == 'B cells')"
93+
condition = '(percent_mito > 0.02 and n_genes > 700) or (percent_mito < 0.015 and louvain == "B cells")'
9494

9595
pandas = pandas_query(uri, condition)
9696

0 commit comments

Comments
 (0)