-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add testing for ascending time step raise Value Error #300
Conversation
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.
Thanks @allabakash2 for submitting the PR!
I left 2 minor comments about code style that would be great to have before merging this PR.
(Note that PR #302 is also open addressing the same issue.)
@@ -19,3 +19,12 @@ def test_semilagrangian(): | |||
# result | |||
result = extrapolate(precip, velocity, num_timesteps) | |||
assert_array_almost_equal(result, expected) | |||
|
|||
def test_ascending_time_step(): |
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.
From the name of the function is not clear what is being tested.
What about: test_not_ascending_timesteps_raise_exceptions
|
||
not_ascending_timesteps = [1,2,3,5,4,6,7] | ||
with pytest.raises(ValueError): | ||
extrapolate(precip, velocity, not_ascending_timesteps) |
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.
End of line missing at line 30. You can fix this and any other format issue by running black
. After running black, commit the changes. For this, you don't need the full pysteps development environment on your computer. A simple conda environment with the latest version of black will do the job.
velocity = np.stack([v, v]) | ||
|
||
not_ascending_timesteps = [1,2,3,5,4,6,7] | ||
with pytest.raises(ValueError): |
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.
pytest module not imported.
import pytest
needs to be added at the top of the file.
hey @allabakash2 , thanks again for your contribution! Any chance to get this PR done in the coming days? Would be nice to include it in an upcoming release of pysteps ;-) |
closing as duplicate of #302 |
This PR adds a test to check that ascending time steps raise a ValueError.