-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve prior build error message #889
base: develop
Are you sure you want to change the base?
Improve prior build error message #889
Conversation
If there is an error during the attempt of building a builtin prior (methods implemented in SpaceBuilder), the builder assumes the expression is not a builtin prior and then tries to create a scipy.stat prior which also fails. The error message is then that the name of the expression is not a valid prior. We should instead explicitly verify if the name of the prior is one that is builtin and then try to build it without silencing error messages. This way we get the correct error message for the prior.
self, dimbuilder | ||
): | ||
"""Build fails because ValueError happens on init of builtin prior.""" | ||
with pytest.raises(ValueError) as exc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use the match
argument of raises
instead of checking if the value is in the exception message, I think.
(That might be only true for pytest.warns
though, not 100% sure).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. This test is looking at two different parts of exc.value
however.
If there is an error during the attempt of building a builtin prior
(methods implemented in SpaceBuilder), the builder assumes the
expression is not a builtin prior and then tries to create a scipy.stat
prior which also fails. The error message is then that the name of the
expression is not a valid prior. We should instead explicitly verify if
the name of the prior is one that is builtin and then try to build it
without silencing error messages. This way we get the correct error
message for the prior.