Skip to content

Commit

Permalink
Update assertion accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
WeilerP committed Apr 12, 2024
1 parent d384414 commit 860c009
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/preprocessing/test_moments.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_first_moments(
f"-layer={layer}-mode={mode}_first_moment.npy"
)
)
np.testing.assert_almost_equal(first_order_moment, ground_truth)
np.testing.assert_almost_equal(first_order_moment, ground_truth, decimal=3)

@pytest.mark.parametrize("dataset", ["pancreas", "dentategyrus"])
@pytest.mark.parametrize("n_obs", [50, 100])
Expand Down Expand Up @@ -84,7 +84,7 @@ def test_second_moments(
f"-layer={layer}-mode={mode}_second_moment.npy"
)
)
np.testing.assert_almost_equal(second_order_moment, ground_truth)
np.testing.assert_almost_equal(second_order_moment, ground_truth, decimal=3)

@pytest.mark.parametrize("dataset", ["pancreas", "dentategyrus"])
@pytest.mark.parametrize("n_obs", [50, 100])
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_passing_array_for_layer(
f"-layer={layer}-mode={mode}_first_moment.npy"
)
)
np.testing.assert_almost_equal(first_order_moment, ground_truth)
np.testing.assert_almost_equal(first_order_moment, ground_truth, decimal=3)

@pytest.mark.parametrize("sparse", [True, False])
def test_analytic_example(self, sparse: bool):
Expand Down Expand Up @@ -187,7 +187,7 @@ def _compare_adatas(self, adata_1, adata_2):
)
assert issparse(adata_1.obsp["distances"])
np.testing.assert_almost_equal(
adata_1.obsp["distances"].A, adata_2.obsp["distances"].A, decimal=4
adata_1.obsp["distances"].A, adata_2.obsp["distances"].A, decimal=3
)

# Check `.uns` is unchanged
Expand Down Expand Up @@ -377,7 +377,9 @@ def test_raw_input(self, adata, dataset: str, n_obs: int):
f"first_moment_spliced.npy"
)
)
np.testing.assert_almost_equal(adata.layers["Ms"], ground_truth_spliced)
np.testing.assert_almost_equal(
adata.layers["Ms"], ground_truth_spliced, decimal=3
)


class TestSecondOrderMoments:
Expand Down Expand Up @@ -497,4 +499,4 @@ def test_output(self, adata, dataset: str, n_obs: int):
f"-layer=unspliced-mode=connectivities_second_moment.npy"
)
)
np.testing.assert_almost_equal(second_order_moment, ground_truth)
np.testing.assert_almost_equal(second_order_moment, ground_truth, decimal=3)

0 comments on commit 860c009

Please sign in to comment.