-
Notifications
You must be signed in to change notification settings - Fork 31
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
Given valid inputs, some functions return values outside of valid ranges #83
Comments
Hi! I'm not strictly one of the python devs, but since the python library bundles the same C library that R does I'm interested in what's going on here. For this case, I would point out that your input conductivity range is very wrong -- seawater conductivity in mS/cm should be in the range of 0-60 or so. I'll let the python devs comment specifically on the tests and we can see if the underlying C functions need to be fixed (or potentially the Matlab originals). |
Thank you for letting me know about the seawater conductivity ranges, I've updated the tests and it's no longer a problem for |
First off, love the idea of hypothesis and have never really been able to find ways to incorporate it into my own testing stuff. Here is my impression of these results so far...
|
Bug
I have been writing Property Based Tests for GSW using the Hypothesis Framework. I have tried to provide reasonable inputs and outputs for these functions, however they sometimes return values outside of this range.
The following input ranges were used:
The following output ranges were used:
The following functions are affected:
melting_ice_into_seawater
pt0_from_t_ice
SA_freezing_from_CT
SA_freezing_from_CT_poly
SA_freezing_from_t
Resources
I used these resources to generate the input ranges. If they are incorrect, please let me know and I can adjust my tests and rerun.
To Reproduce
I have added tests to this branch and added
Hypothesis
as a dependency torequirements-dev.txt
. Clone the repo, checkout the branch, install the depedencies and run the tests usingpytest
as normal.I have also listed falsifying examples for each of the functions below.
To find examples in
melting_ice_into_seawater
running Hypothesis, you may to increase the number of max examples. This can be done by adding the decorator@settings(max_examples=25000)
before thetest_melting_ice_into_seawater
function.Please note that many of the parameters are
0.0
because Hypothesis tries to shrink falsifying examples. All of the functions (except for sometimesmelting_ice_into_seawater
) are still able to find falsifying examples even if the min/max values are +/-0.1
.Expected behaviour
I would expect the functions to always return scalar values within the output ranges.
Environment
The text was updated successfully, but these errors were encountered: