22
33import numpy as np
44import numpy .testing as npt
5+ import pytest
56
6- from inflammation .models import daily_mean
7+ from inflammation .models import daily_mean , daily_max , daily_min
78
8- def test_daily_mean_zeros ():
9+ @pytest .mark .parametrize (
10+ "test, expected" ,
11+ [
12+ ([[0 ,0 ],[0 ,0 ],[0 ,0 ]],[0 ,0 ]),
13+ ([[0 , 0 ],[0 , 0 ],[0 , 0 ]], [0 , 0 ]),
14+ ([[- 1 , - 1 ],[- 1 , - 1 ],[- 1 , - 1 ]],[- 1 , - 1 ]),
15+ ([[1 , 2 ],[3 , 4 ],[5 , 6 ]],[3 , 4 ]),
16+ ([[1 , 2 ],[3 , 4 ],[5 , 6 ]], [6 , 7 ])
17+ ]
18+ )
19+ #not sure why pytest seems to be required here. error says it should be test but doesn't seem to work
20+ def pytest_daily_mean_zeros ():
921 """Test that mean function works for an array of zeros."""
1022
1123 test_input = np .array ([[0 , 0 ],
@@ -46,3 +58,34 @@ def test_daily_mean():
4658 test_result = np .array ([3 , 4 ])
4759
4860 npt .assert_array_equal (daily_mean (test_input ), test_result )
61+ """
62+ def test_daily_mean_string():
63+ test_input = np.array([["this is something incorrect", 2],
64+ [3, 4],
65+ [5, 6]])
66+ test_result = np.array([3, 4])
67+
68+ npt.assert_array_equal(daily_mean(test_input), test_result)
69+ """
70+
71+
72+ """
73+ def test_daily_min_string():
74+ #test for typeerror when passing strings
75+
76+ #with pytest.raises(TypeError):
77+ # error_expected = daily_min([["one", "two"],["3","4"]])
78+ """
79+
80+
81+ """Tests for the Patient model - class/file in this folder
82+
83+ from inflammation.models import Patient
84+
85+ def test_create_patient():
86+
87+ name = 'Alice'
88+ p = Patient(name=name)
89+
90+ assert p.name == name
91+ """
0 commit comments