From 1cecf7331cb182f4d350a32f593ad7ad828dba1e Mon Sep 17 00:00:00 2001 From: Phil Schaf Date: Tue, 1 Oct 2024 16:13:21 +0200 Subject: [PATCH] simpler --- tests/test_readwrite.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/test_readwrite.py b/tests/test_readwrite.py index e729f4ace..04d20d272 100644 --- a/tests/test_readwrite.py +++ b/tests/test_readwrite.py @@ -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}") @@ -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}"