Skip to content
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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pysteps/tests/test_extrapolation_semilagrangian.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Copy link
Member

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

precip = np.ones((8, 8))
v = np.ones((8, 8))
velocity = np.stack([v, v])

not_ascending_timesteps = [1,2,3,5,4,6,7]
with pytest.raises(ValueError):
Copy link
Member

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.

extrapolate(precip, velocity, not_ascending_timesteps)
Copy link
Member

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.