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

Conversation

allabakash2
Copy link

@allabakash2 allabakash2 commented Aug 28, 2022

This PR adds a test to check that ascending time steps raise a ValueError.

Copy link
Member

@aperezhortal aperezhortal left a 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():
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


not_ascending_timesteps = [1,2,3,5,4,6,7]
with pytest.raises(ValueError):
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.

@aperezhortal aperezhortal mentioned this pull request Aug 30, 2022
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.

@dnerini
Copy link
Member

dnerini commented Sep 22, 2022

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 ;-)

@dnerini
Copy link
Member

dnerini commented Apr 27, 2024

closing as duplicate of #302

@dnerini dnerini closed this Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants