Skip to content

Commit b087746

Browse files
Took RNG out of categorical label test (#306)
2 parents c7c6569 + 4b58b04 commit b087746

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ and this project adheres to [Semantic Versioning][].
1010

1111
## [0.2.4] - tbd
1212

13+
### Added
14+
15+
### Changed
16+
17+
-
18+
19+
### Fixed
20+
21+
- Took RNG out of categorical label test (#306)
22+
1323
## [0.2.3] - 2024-07-03
1424

1525
### Added

tests/pl/test_render_labels.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,14 @@ def test_plot_label_categorical_color(self, sdata_blobs: SpatialData, label: str
111111
self._make_tablemodel_with_categorical_labels(sdata_blobs, label)
112112

113113
def _make_tablemodel_with_categorical_labels(self, sdata_blobs, label):
114+
114115
n_obs = max(get_element_instances(sdata_blobs[label]))
115-
adata = AnnData(
116-
RNG.normal(size=(n_obs, 10)),
117-
obs=pd.DataFrame(RNG.normal(size=(n_obs, 3)), columns=["a", "b", "c"]),
118-
)
119-
adata.obs["instance_id"] = np.arange(adata.n_obs)
120-
adata.obs["category"] = RNG.choice(["a", "b", "c"], size=adata.n_obs)
121-
adata.obs["category"][:3] = ["a", "b", "c"]
122-
adata.obs["instance_id"] = list(range(adata.n_obs))
116+
vals = np.arange(n_obs)
117+
obs = pd.DataFrame({"a": vals, "b": vals + 0.3, "c": vals + 0.7})
118+
119+
adata = AnnData(vals.reshape(-1, 1), obs=obs)
120+
adata.obs["instance_id"] = vals
121+
adata.obs["category"] = list(["a", "b", "c"] * ((n_obs // 3) + 1))[:n_obs]
123122
adata.obs["region"] = label
124123
table = TableModel.parse(
125124
adata=adata,

0 commit comments

Comments
 (0)