You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parameter.py class contains quite a few lines that are not unit tested. When adding the PPF functions I had to look into this (because of the codecov), and it turns out many potential exceptions in the original code are testing for the wrong things and cannot be triggered.
Example:
def get_logpdf(self, value=None, **kwargs):
# RvH: This exception cannot be triggered
if not isinstance(self, Parameter):
raise TypeError("You can only call get_logpdf() on an " "instantiated (named) Parameter.")
This TypeError supposedly is thrown when you use the class factory to obtain a Parameter, such as with par = Uniform(pmin=0, pmax=1). If you then try to use par.get_logpdf(0.5) this should not work, because the class is not instantiated (named). Instead, you need to do: par = Uniform(pmin=0, pmax=1)('testpar').
Thing is, you can never call get_logpdf using the class definition, because you are then not passing self to the function. So that exception can never be triggered. This kind of thing happens a lot in the parameter module. A solution would be to just remove all the exceptions that cannot be triggered.
The text was updated successfully, but these errors were encountered:
The parameter.py class contains quite a few lines that are not unit tested. When adding the PPF functions I had to look into this (because of the codecov), and it turns out many potential exceptions in the original code are testing for the wrong things and cannot be triggered.
Example:
This TypeError supposedly is thrown when you use the class factory to obtain a Parameter, such as with
par = Uniform(pmin=0, pmax=1)
. If you then try to use par.get_logpdf(0.5) this should not work, because the class is not instantiated (named). Instead, you need to do:par = Uniform(pmin=0, pmax=1)('testpar')
.Thing is, you can never call
get_logpdf
using the class definition, because you are then not passingself
to the function. So that exception can never be triggered. This kind of thing happens a lot in the parameter module. A solution would be to just remove all the exceptions that cannot be triggered.The text was updated successfully, but these errors were encountered: