Skip to content

Commit 258d5a6

Browse files
committed
use assert_allclose, not assert np.isclose
1 parent 0fa4bc9 commit 258d5a6

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

tests/bifacial/test_ants2d.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,10 @@ def test_get_irradiance_vertical(ants_params, solar_zenith, tracker_rotation):
250250
'shaded_fraction_front']
251251
for front_key in front_keys:
252252
back_key = front_key.replace("front", "back")
253-
assert np.isclose(out.iloc[0][front_key], out.iloc[1][back_key])
254-
assert np.isclose(out.iloc[1][front_key], out.iloc[0][back_key])
253+
np.testing.assert_allclose(out.iloc[0][front_key],
254+
out.iloc[1][back_key])
255+
np.testing.assert_allclose(out.iloc[1][front_key],
256+
out.iloc[0][back_key])
255257

256258
# now with >1 row segment
257259
out = ants2d.get_irradiance(**ants_params, n_row_segments=2)
@@ -261,14 +263,14 @@ def test_get_irradiance_vertical(ants_params, solar_zenith, tracker_rotation):
261263
afternoon = 1
262264
for front_key in front_keys:
263265
back_key = front_key.replace("front", "back")
264-
assert np.isclose(out[front_key][lower_half, morning],
265-
out[back_key][lower_half, afternoon])
266-
assert np.isclose(out[front_key][upper_half, morning],
267-
out[back_key][upper_half, afternoon])
268-
assert np.isclose(out[back_key][lower_half, morning],
269-
out[front_key][lower_half, afternoon])
270-
assert np.isclose(out[back_key][upper_half, morning],
271-
out[front_key][upper_half, afternoon])
266+
np.testing.assert_allclose(out[front_key][lower_half, morning],
267+
out[back_key][lower_half, afternoon])
268+
np.testing.assert_allclose(out[front_key][upper_half, morning],
269+
out[back_key][upper_half, afternoon])
270+
np.testing.assert_allclose(out[back_key][lower_half, morning],
271+
out[front_key][lower_half, afternoon])
272+
np.testing.assert_allclose(out[back_key][upper_half, morning],
273+
out[front_key][upper_half, afternoon])
272274

273275

274276
def test_get_irradiance_limit(ants_params):
@@ -363,11 +365,11 @@ def test_get_irradiance_multiple_row_segments(ants_params_fixed):
363365
for k in out4:
364366
# check two bottom quarters average to the bottom half, and top
365367
# two quarters average to the top half
366-
assert np.isclose(np.mean(out4[k][0:2, 0]), out2[k][0, 0])
367-
assert np.isclose(np.mean(out4[k][2:4, 0]), out2[k][1, 0])
368+
np.testing.assert_allclose(np.mean(out4[k][0:2, 0]), out2[k][0, 0])
369+
np.testing.assert_allclose(np.mean(out4[k][2:4, 0]), out2[k][1, 0])
368370

369371
# check that two halves average to the whole
370-
assert np.isclose(np.mean(out2[k][:, 0]), out1[k])
372+
np.testing.assert_allclose(np.mean(out2[k][:, 0]), out1[k])
371373

372374

373375
def test_get_irradiance_slope(ants_params_fixed):

0 commit comments

Comments
 (0)