File: test_helpers.py

package info (click to toggle)
python-cobra 0.29.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,512 kB
  • sloc: python: 14,703; xml: 12,841; makefile: 137; sh: 32
file content (28 lines) | stat: -rw-r--r-- 792 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Test functionalities of flux analysis helper functions."""

import pytest

from cobra.core import Model
from cobra.flux_analysis.helpers import normalize_cutoff


def test_normalize_cutoff(model: Model) -> None:
    """Test normalize cutoff."""
    cutoff = normalize_cutoff(model)
    assert cutoff == 1e-7


def test_normalize_cutoff_with_specified_cutoff_above_default(
    model: Model,
) -> None:
    """Test normalize cutoff with specified cutoff greater than default."""
    cutoff = normalize_cutoff(model, 1e-3)
    assert cutoff == 1e-3


def test_normalize_cutoff_with_specified_cutoff_below_default(
    model: Model,
) -> None:
    """Test normalize cutoff with specified cutoff less than default."""
    with pytest.raises(ValueError):
        normalize_cutoff(model, 1e-10)