testsuite.cases¶
The semantic test cases of the SBML test suite.
A case is a directory NNNNN with the model in several SBML levels and
versions, NNNNN-settings.txt (simulation settings and tolerances),
NNNNN-results.csv (expected timecourse) and NNNNN-model.m (tags and the
test type). The suite is downloaded from its GitHub release into a cache on
first use.
TestSuiteError
¶
Bases: RuntimeError
The test suite cannot be obtained or a case cannot be read.
Settings
dataclass
¶
Simulation settings of a case (NNNNN-settings.txt).
Case
dataclass
¶
One semantic test case.
expected is None for a case without expected results (e.g. a model
from a model repository): the roadrunner simulation of the original model
becomes the expected results for the later stages. name is a display name (e.g. the model
name), empty for the SBML test suite cases.
ensure_suite
¶
Directory of the semantic cases, downloaded and unpacked on first use.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
release of the test suite. |
SUITE_VERSION
|
cache
|
Path | None
|
cache root, |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The |
Raises:
| Type | Description |
|---|---|
TestSuiteError
|
if the download fails or the archive has not the expected layout. |
parse_settings
¶
Parse a settings file.
Cases of a test type other than TimeCourse (e.g. FluxBalanceSteadyState)
leave start, duration and steps empty; they parse to 0 and are never
used because skip_reason filters them out before a run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
content of |
required |
Returns:
| Type | Description |
|---|---|
Settings
|
The settings. |
Raises:
| Type | Description |
|---|---|
TestSuiteError
|
if |
parse_model_info
¶
Parse the key: values lines of a NNNNN-model.m file.
A model file opens with a comment marker on its own line, a blank line,
the header block of key: value pairs, a blank line and then the prose
description (a few files carry an extra "Previous version of this
file:" comment line before the marker, or wrap a value like synopsis
onto its own blank-line-separated continuation). Only the header block
is parsed: the paragraphs (blocks separated by a blank line) up to and
including the first genuine key: value paragraph, plus at most one
further blank-line gap, so a wrapped value does not cut the header
short but prose describing the model later in the file (typically
several paragraphs further, e.g. a "Note:" line) is not mistaken for
more of it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
content of the file. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, list[str]]
|
The values per key, e.g. |
load_case
¶
Read a case directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case_dir
|
Path
|
directory |
required |
Returns:
| Type | Description |
|---|---|
Case
|
The case; |
Raises:
| Type | Description |
|---|---|
TestSuiteError
|
if the settings, results or model file is missing. |