MitoInteract / recovery /tests /test_affinity.py
ethanolivertroy's picture
feat: build leakage-aware MitoInteract recovery pipeline
6019d52
Raw
History Blame Contribute Delete
866 Bytes
import math
import pytest
from mitointeract_recovery import micromolar_to_paffinity, paffinity_to_micromolar
def test_one_micromolar_is_paffinity_six():
assert micromolar_to_paffinity(1.0) == pytest.approx(6.0)
def test_dataset_example_500_micromolar():
assert micromolar_to_paffinity(500.0) == pytest.approx(3.3010299957)
@pytest.mark.parametrize("paffinity", [2.0, 3.3010299957, 6.0, 7.5850267, 9.0])
def test_round_trip(paffinity):
assert micromolar_to_paffinity(paffinity_to_micromolar(paffinity)) == pytest.approx(
paffinity
)
@pytest.mark.parametrize("bad", [0.0, -1.0, math.inf, math.nan])
def test_invalid_affinity_rejected(bad):
with pytest.raises(ValueError):
micromolar_to_paffinity(bad)
def test_nonfinite_paffinity_rejected():
with pytest.raises(ValueError):
paffinity_to_micromolar(math.nan)