Skip to content

Commit 243a376

Browse files
committed
Test data type array
1 parent a96c5bb commit 243a376

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_modelchain.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@ def test_rho_hub(self):
4747
assert_series_equal(test_mc.rho_hub(weather_df, data_height), rho_exp)
4848
rho_exp = np.array([1.30591464, 1.30919432])
4949
assert_allclose(test_mc.rho_hub(weather_arr, data_height), rho_exp)
50+
assert isinstance(test_mc.rho_hub(weather_arr, data_height),
51+
np.ndarray)
5052
rho_exp = pd.Series(data=[1.30309, 1.42707])
5153
assert_series_equal(test_mc_2.rho_hub(weather, data_height), rho_exp)
5254
assert_series_equal(test_mc_2.rho_hub(weather_df, data_height),
5355
rho_exp)
5456
rho_exp = np.array([1.30309439, 1.42706674])
5557
assert_allclose(test_mc_2.rho_hub(weather_arr, data_height), rho_exp)
58+
assert isinstance(test_mc_2.rho_hub(weather_arr, data_height),
59+
np.ndarray)
5660

5761
# temp_air is closer to hub height than temp_air_2
5862
data_height['temp_air'] = 10
@@ -62,12 +66,16 @@ def test_rho_hub(self):
6266
assert_series_equal(test_mc.rho_hub(weather_df, data_height), rho_exp)
6367
rho_exp = np.array([1.30591464, 1.29940284])
6468
assert_allclose(test_mc.rho_hub(weather_arr, data_height), rho_exp)
69+
assert isinstance(test_mc.rho_hub(weather_arr, data_height),
70+
np.ndarray)
6571
rho_exp = pd.Series(data=[1.30309, 1.19618])
6672
assert_series_equal(test_mc_2.rho_hub(weather, data_height), rho_exp)
6773
assert_series_equal(test_mc_2.rho_hub(weather_df, data_height),
6874
rho_exp)
6975
rho_exp = np.array([1.30309439, 1.19618159])
7076
assert_allclose(test_mc_2.rho_hub(weather_arr, data_height), rho_exp)
77+
assert isinstance(test_mc_2.rho_hub(weather_arr, data_height),
78+
np.ndarray)
7179

7280
# temp_air at hub height
7381
rho_exp = pd.Series(data=[1.30305, 1.29657])
@@ -76,6 +84,8 @@ def test_rho_hub(self):
7684
assert_series_equal(test_mc.rho_hub(weather_df, data_height), rho_exp)
7785
rho_exp = np.array([1.30305336, 1.29656645])
7886
assert_allclose(test_mc.rho_hub(weather_arr, data_height), rho_exp)
87+
assert isinstance(test_mc.rho_hub(weather_arr, data_height),
88+
np.ndarray)
7989

8090
# temp_air_2 at hub height
8191
rho_exp = pd.Series(data=[1.30309, 1.30636])
@@ -86,6 +96,8 @@ def test_rho_hub(self):
8696
rho_exp)
8797
rho_exp = np.array([1.30309439, 1.30635621])
8898
assert_allclose(test_mc_2.rho_hub(weather_arr, data_height), rho_exp)
99+
assert isinstance(test_mc_2.rho_hub(weather_arr, data_height),
100+
np.ndarray)
89101

90102
# temp_air_2 is not in weather
91103
rho_exp = pd.Series(data=[1.30591, 1.29940])
@@ -141,6 +153,8 @@ def test_v_wind_hub(self):
141153
v_wind_exp = np.array([7.74136523, 10.0637748])
142154
assert_allclose(test_mc.v_wind_hub(weather_arr, data_height),
143155
v_wind_exp)
156+
assert isinstance(test_mc.v_wind_hub(weather_arr, data_height),
157+
np.ndarray)
144158
v_wind_exp = pd.Series(data=[7.12462, 9.26201])
145159
assert_series_equal(test_mc_2.v_wind_hub(weather, data_height),
146160
v_wind_exp)
@@ -149,6 +163,8 @@ def test_v_wind_hub(self):
149163
v_wind_exp = np.array([7.12462437, 9.26201168])
150164
assert_allclose(test_mc_2.v_wind_hub(weather_arr, data_height),
151165
v_wind_exp)
166+
assert isinstance(test_mc_2.v_wind_hub(weather_arr, data_height),
167+
np.ndarray)
152168

153169
# v_wind_2 is closer to hub height than v_wind
154170
data_height['v_wind'] = 8
@@ -161,6 +177,8 @@ def test_v_wind_hub(self):
161177
v_wind_exp = np.array([6.19309218, 7.74136523])
162178
assert_allclose(test_mc.v_wind_hub(weather_arr, data_height),
163179
v_wind_exp)
180+
assert isinstance(test_mc.v_wind_hub(weather_arr, data_height),
181+
np.ndarray)
164182
v_wind_exp = pd.Series(data=[5.69970, 7.12462])
165183
assert_series_equal(test_mc_2.v_wind_hub(weather, data_height),
166184
v_wind_exp)
@@ -169,6 +187,8 @@ def test_v_wind_hub(self):
169187
v_wind_exp = np.array([5.69970, 7.12462437])
170188
assert_allclose(test_mc_2.v_wind_hub(weather_arr, data_height),
171189
v_wind_exp)
190+
assert isinstance(test_mc_2.v_wind_hub(weather_arr, data_height),
191+
np.ndarray)
172192

173193
# v_wind is given at hub height
174194
data_height['v_wind'] = 100

0 commit comments

Comments
 (0)