Skip to content

assert_model

Python reference for nagasim.modelcheck.assert_model.

Assert, in a test, that a model passes its own assertions, reality and path checks.

Raises AssertionError naming every failed assertion, so a normal pytest report shows what went wrong. An inconclusive result (an assertion's confidence interval straddles the bound) does not raise by default; it is reported through warnings.warn.

Parameters:

Name Type Description Default
path_or_layout str or dict

The model file or the layout dict.

required
strict bool

Treat an inconclusive result as a failure too.

False

Returns:

Type Description
None
See Also

nagasim.api.run_model : Runs the model without checking its assertions.

Examples:

>>> from pathlib import Path
>>> import nagasim
>>> from nagasim.modelcheck import assert_model
>>> path = Path(nagasim.__file__).parent / "models" / "single_server.json"
>>> assert_model(str(path)) is None
True