File: conftest.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 (21 lines) | stat: -rw-r--r-- 505 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Define module level fixtures."""

from typing import TYPE_CHECKING

import pytest

from cobra.sampling import ACHRSampler


if TYPE_CHECKING:
    from cobra import Model


@pytest.fixture(scope="function")
def achr(model: "Model") -> ACHRSampler:
    """Return ACHRSampler instance for tests."""
    sampler = ACHRSampler(model, thinning=1)
    assert (sampler.n_warmup > 0) and (sampler.n_warmup <= 2 * len(model.variables))
    assert all(sampler.validate(sampler.warmup) == "v")

    return sampler