Skip to content

Commit

Permalink
simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Oct 1, 2024
1 parent fd98d3c commit 1cecf73
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions tests/test_readwrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,15 +661,9 @@ def random_cats(n):


def test_write_string_type_error(tmp_path, diskfmt):
adata = ad.AnnData(
obs=pd.DataFrame(
np.ones((3, 2)),
columns=["a", np.str_("b")],
index=["a", "b", "c"],
),
)

adata = ad.AnnData(obs=dict(obs_names=list("abc")))
adata.obs[b"c"] = np.zeros(3)

# This should error, and tell you which key is at fault
with pytest.raises(TypeError, match=r"writing key 'obs'") as exc_info:
getattr(adata, f"write_{diskfmt}")(tmp_path / f"adata.{diskfmt}")
Expand Down Expand Up @@ -726,9 +720,6 @@ def roundtrip(diskfmt):
return partial(_do_roundtrip, diskfmt=diskfmt)


diskfmt2 = diskfmt


def test_write_string_types(tmp_path, diskfmt, roundtrip):
# https://github.com/scverse/anndata/issues/456
adata_pth = tmp_path / f"adata.{diskfmt}"
Expand Down

0 comments on commit 1cecf73

Please sign in to comment.