Skip to content

Commit

Permalink
Fix ModelNotDefinedError
Browse files Browse the repository at this point in the history
This error should be raised when self exporter is used and a model
component is declared before Model().
  • Loading branch information
alubbock committed Jul 11, 2019
1 parent 4f9f4a1 commit 649df3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions pysb/core.py
Expand Up @@ -2056,8 +2056,7 @@ class CompartmentAlreadySpecifiedError(ValueError):
class ModelNotDefinedError(RuntimeError):
"""SelfExporter method was called before a model was defined."""
def __init__(self):
ValueError.__init__(
self,
super(RuntimeError, self).__init__(
"A Model must be declared before declaring any model components"
)

Expand Down
4 changes: 4 additions & 0 deletions pysb/tests/test_core.py
Expand Up @@ -478,3 +478,7 @@ def test_update_initial_condition():
assert len(model.initials) == 1
assert as_complex_pattern(B()).is_equivalent_to(
as_complex_pattern(model.initials[0].pattern))


def test_model_not_defined():
assert_raises(ModelNotDefinedError, Monomer, 'A')

0 comments on commit 649df3d

Please sign in to comment.