Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix invalid component handling (#431)
Previously, if one added an invalid parameter, rule etc. that generated an exception in `__init__`, (e.g. a validation error), the component was still added to the model. In interactive mode, this is annoying, as the model has to be re-instantiated. Example: Model() Parameter('a', 'invalid_value') # raises ValueError assert len(model.parameters) == 0 # fixed in this PR Parameter('a', 1.0) # should succeed This PR fixes this situation by adding the Component to the Model (by calling `Component.__init__()`) last instead of first.
- Loading branch information
Showing
2 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters