Skip to content

Commit c885d32

Browse files
committed
black formatting
1 parent 2df76ee commit c885d32

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

src/mudata/_core/mudata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ def _update_attr_legacy(
12971297

12981298
# Update .obsp/.varp (size might have changed)
12991299
for mx_key, mx in attrp.items():
1300-
attrp[mx_key] = attrp[mx_key][index_order, :][:,index_order]
1300+
attrp[mx_key] = attrp[mx_key][index_order, :][:, index_order]
13011301
attrp[mx_key][index_order == -1, :] = -1
13021302
attrp[mx_key][:, index_order == -1] = -1
13031303

tests/test_merge.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import numpy as np
32
import pytest
43
from anndata import AnnData

tests/test_view_copy.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,34 @@ def test_obsp_slicing(self, mdata_with_obsp):
164164

165165
# Slice a subset of cells
166166
n_obs_subset = 50
167-
random_indices = np.random.choice(mdata_with_obsp.obs_names, size=n_obs_subset, replace=False)
167+
random_indices = np.random.choice(
168+
mdata_with_obsp.obs_names, size=n_obs_subset, replace=False
169+
)
168170

169171
# Create a slice view
170172
mdata_slice = mdata_with_obsp[random_indices]
171173

172174
# Check that the sliced obsp matrices have correct shape in the view
173-
assert mdata_slice.obsp["distances"].shape == (n_obs_subset, n_obs_subset), \
174-
f"Expected shape in view: {(n_obs_subset, orig_n_obs)}, got: {mdata_slice.obsp['distances'].shape}"
175-
assert mdata_slice.obsp["connectivities"].shape == (n_obs_subset, n_obs_subset), \
176-
f"Expected shape in view: {(n_obs_subset, orig_n_obs)}, got: {mdata_slice.obsp['connectivities'].shape}"
175+
assert mdata_slice.obsp["distances"].shape == (
176+
n_obs_subset,
177+
n_obs_subset,
178+
), f"Expected shape in view: {(n_obs_subset, orig_n_obs)}, got: {mdata_slice.obsp['distances'].shape}"
179+
assert mdata_slice.obsp["connectivities"].shape == (
180+
n_obs_subset,
181+
n_obs_subset,
182+
), f"Expected shape in view: {(n_obs_subset, orig_n_obs)}, got: {mdata_slice.obsp['connectivities'].shape}"
177183

178184
# Make a copy of the sliced MuData object
179185
mdata_copy = mdata_slice.copy()
180186
# Check shapes after copy - these should be (n_obs_subset, n_obs_subset) if correctly copied
181-
assert mdata_copy.obsp["distances"].shape == (n_obs_subset, n_obs_subset), \
182-
f"Expected shape after copy: {(n_obs_subset, n_obs_subset)}, got: {mdata_copy.obsp['distances'].shape}"
183-
assert mdata_copy.obsp["connectivities"].shape == (n_obs_subset, n_obs_subset), \
184-
f"Expected shape after copy: {(n_obs_subset, n_obs_subset)}, got: {mdata_copy.obsp['connectivities'].shape}"
187+
assert mdata_copy.obsp["distances"].shape == (
188+
n_obs_subset,
189+
n_obs_subset,
190+
), f"Expected shape after copy: {(n_obs_subset, n_obs_subset)}, got: {mdata_copy.obsp['distances'].shape}"
191+
assert mdata_copy.obsp["connectivities"].shape == (
192+
n_obs_subset,
193+
n_obs_subset,
194+
), f"Expected shape after copy: {(n_obs_subset, n_obs_subset)}, got: {mdata_copy.obsp['connectivities'].shape}"
185195

186196
def test_varp_slicing(self, mdata_with_obsp):
187197
"""Test that varp matrices are correctly sliced when subsetting a MuData object."""
@@ -199,11 +209,15 @@ def test_varp_slicing(self, mdata_with_obsp):
199209
mdata_slice = mdata_with_obsp[:, random_var_indices]
200210

201211
# Check that the sliced varp matrix has correct shape in the view
202-
assert mdata_slice.varp["correlations"].shape == (n_var_subset, n_var_subset), \
203-
f"Expected shape in view: {(n_var_subset, orig_n_var)}, got: {mdata_slice.varp['correlations'].shape}"
212+
assert mdata_slice.varp["correlations"].shape == (
213+
n_var_subset,
214+
n_var_subset,
215+
), f"Expected shape in view: {(n_var_subset, orig_n_var)}, got: {mdata_slice.varp['correlations'].shape}"
204216

205217
# Copy the sliced MuData object
206218
mdata_copy = mdata_slice.copy()
207219
# Check shapes after copy
208-
assert mdata_copy.varp["correlations"].shape == (n_var_subset, n_var_subset), \
209-
f"Expected shape after copy: {(n_var_subset, n_var_subset)}, got: {mdata_copy.varp['correlations'].shape}"
220+
assert mdata_copy.varp["correlations"].shape == (
221+
n_var_subset,
222+
n_var_subset,
223+
), f"Expected shape after copy: {(n_var_subset, n_var_subset)}, got: {mdata_copy.varp['correlations'].shape}"

0 commit comments

Comments
 (0)