-
Notifications
You must be signed in to change notification settings - Fork 0
Add implementation of standard deviation on data #2
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| import numpy as np | ||
| import numpy.testing as npt | ||
| import os | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is fine
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the course content, you're meant to have more tests in this file. What you should have is: |
||
| import pytest | ||
|
|
||
| def test_daily_mean_zeros(): | ||
| """Test that mean function works for an array of zeros.""" | ||
|
|
@@ -37,3 +37,14 @@ def test_load_from_json(tmpdir): | |
| temp_json_file.write('[{"observations":[1, 2, 3]},{"observations":[4, 5, 6]}]') | ||
| result = load_json(example_path) | ||
| npt.assert_array_equal(result, [[1, 2, 3], [4, 5, 6]]) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize('data, expected_standard_deviation', [ | ||
| ([0, 0, 0], 0.0), | ||
| ([1.0, 1.0, 1.0], 0), | ||
| ([0.0, 2.0], 1.0) | ||
| ]) | ||
| def test_daily_standard_deviation(data, expected_standard_deviation): | ||
| from inflammation.models import s_dev | ||
| result_data = s_dev(data)['standard deviation'] | ||
| npt.assert_approx_equal(result_data, expected_standard_deviation) | ||
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.
I don't understand this but it seems right 👍