Skip to content

Commit

Permalink
Fix protocol, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Jan 16, 2023
1 parent 24e22b8 commit 09decac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/sdist/amici/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ def _imported_from_setup() -> bool:
from .sbml_import import SbmlImporter, assignmentRules2observables
from .ode_export import ODEModel, ODEExporter

from typing import Protocol
from typing import Protocol, runtime_checkable


@runtime_checkable
class ModelModule(Protocol):
"""Enable Python static type checking for AMICI-generated model
modules"""
module: "ModelModule"

def getModel(self) -> amici.Model:
...
Expand Down
5 changes: 5 additions & 0 deletions python/tests/test_sbml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ def test_logging_works(observable_dependent_error_model, caplog):
assert rdata.status != amici.AMICI_SUCCESS
assert "mxstep steps taken" in caplog.text

@skip_on_valgrind
def test_model_module_is_set(observable_dependent_error_model):
model_module = observable_dependent_error_model
assert isinstance(model_module.getModel().module, amici.ModelModule)


@pytest.fixture(scope='session')
def model_steadystate_module():
Expand Down

0 comments on commit 09decac

Please sign in to comment.