Skip to content

Commit 4e1901a

Browse files
committed
test - recompute the list of batch effects even if one already exists
Clean up regression tests for the fixed bug: register_batch_effects with `force` flag
1 parent 5c0ba3f commit 4e1901a

2 files changed

Lines changed: 23 additions & 192 deletions

File tree

test/test_norm/test_normative_model_transfer.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,26 @@ def test_004_transfer_should_fit_when_unwarped(
170170
transferred = model.transfer(transfer_norm_data_from_arrays)
171171

172172
assert transferred.is_fitted
173+
174+
175+
def test_005_split_should_keepOnlyItsOwnBatchEffects(
176+
transfer_norm_data_from_arrays: NormData,
177+
) -> None:
178+
"""A split must not keep listing the batch effects it dropped.
179+
180+
Regression test for commit 3f1a01301a35b2e19c17003f565c9c46e78d5bfd:
181+
Both splits of NormData.batch_effects_split() kept listing batch effect
182+
values they no longer contained. A model transferred to such a split
183+
then claimed batches it had never seen.
184+
185+
Parameters
186+
----------
187+
transfer_norm_data_from_arrays : NormData
188+
Transfer dataset, with 2 levels on the first batch effect.
189+
"""
190+
first, second = transfer_norm_data_from_arrays.batch_effects_split(
191+
{"batch_effect_0": ["0"]}, names=("first", "second")
192+
)
193+
194+
assert first.unique_batch_effects["batch_effect_0"] == ["0"]
195+
assert second.unique_batch_effects["batch_effect_0"] == ["1"]

test/test_norm/test_transfer_multisite.py

Lines changed: 0 additions & 192 deletions
This file was deleted.

0 commit comments

Comments
 (0)