Skip to content

Commit 1f36160

Browse files
authored
Fix port of old-precision-decimal to present-atol in tests (#2082)
* One-line assert_allclose F: (assert_allclose)\((.*), ?(.*), ?([a-zA-Z0-9=]*)?(\d)\) * I didn't save all before committing, yet again * Revert test_irradiance change in precision * Do not overlap with #2080
1 parent b147600 commit 1f36160

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

pvlib/tests/test_inverter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ def test_sandia_float(cec_inverter_parameters):
6161
idcs = 5.5
6262
pdcs = idcs * vdcs
6363
pacs = inverter.sandia(vdcs, pdcs, cec_inverter_parameters)
64-
assert_allclose(pacs, 132.004278, 5)
64+
assert_allclose(pacs, 132.004278, 1e-5)
6565
# test at low power condition
6666
vdcs = 25.
6767
idcs = 0
6868
pdcs = idcs * vdcs
6969
pacs = inverter.sandia(vdcs, pdcs, cec_inverter_parameters)
70-
assert_allclose(pacs, -1. * cec_inverter_parameters['Pnt'], 5)
70+
assert_allclose(pacs, -1. * cec_inverter_parameters['Pnt'], 1e-5)
7171

7272

7373
def test_sandia_Pnt_micro():

pvlib/tests/test_irradiance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ def test_erbs_all_scalar():
10531053
out = irradiance.erbs(ghi, zenith, doy)
10541054

10551055
for k, v in out.items():
1056-
assert_allclose(v, expected[k], 5)
1056+
assert_allclose(v, expected[k], 1e-2)
10571057

10581058

10591059
def test_dirindex(times):

pvlib/tests/test_pvsystem.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def test_PVSystem_sapm(sapm_module_params, mocker):
206206
out = system.sapm(effective_irradiance, temp_cell)
207207
pvsystem.sapm.assert_called_once_with(effective_irradiance, temp_cell,
208208
sapm_module_params)
209-
assert_allclose(out['p_mp'], 100, atol=100)
209+
assert_allclose(out['p_mp'], 100, 10)
210210

211211

212212
def test_PVSystem_multi_array_sapm(sapm_module_params):
@@ -487,7 +487,7 @@ def test_PVSystem_faiman_celltemp(mocker):
487487
winds = 1
488488
out = system.get_cell_temperature(irrads, temps, winds, model='faiman')
489489
temperature.faiman.assert_called_once_with(irrads, temps, winds, u0, u1)
490-
assert_allclose(out, 56.4, atol=1)
490+
assert_allclose(out, 56.4, atol=1e-1)
491491

492492

493493
def test_PVSystem_noct_celltemp(mocker):
@@ -1062,7 +1062,7 @@ def test_PVSystem_calcparams_desoto(cec_module_params, mocker):
10621062
dEgdT=module_parameters['dEgdT']
10631063
)
10641064

1065-
assert_allclose(IL, np.array([0.0, 6.036]), atol=1)
1065+
assert_allclose(IL, np.array([0.0, 6.036]), atol=1e-1)
10661066
assert_allclose(I0, np.array([2.0e-9, 2.0e-9]), atol=1.0e-9)
10671067
assert_allclose(Rs, np.array([0.1, 0.1]), atol=0.1)
10681068
assert_allclose(Rsh, np.array([np.inf, 20]), atol=1)

pvlib/tests/test_temperature.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ def sapm_default():
2020
def test_sapm_cell(sapm_default):
2121
default = temperature.sapm_cell(900, 20, 5, sapm_default['a'],
2222
sapm_default['b'], sapm_default['deltaT'])
23-
assert_allclose(default, 43.509, 3)
23+
assert_allclose(default, 43.509, 1e-3)
2424

2525

2626
def test_sapm_module(sapm_default):
2727
default = temperature.sapm_module(900, 20, 5, sapm_default['a'],
2828
sapm_default['b'])
29-
assert_allclose(default, 40.809, 3)
29+
assert_allclose(default, 40.809, 1e-3)
3030

3131

3232
def test_sapm_cell_from_module(sapm_default):
@@ -47,8 +47,8 @@ def test_sapm_ndarray(sapm_default):
4747
sapm_default['b'])
4848
expected_cell = np.array([0., 23.06066166, 5.])
4949
expected_module = np.array([0., 21.56066166, 5.])
50-
assert_allclose(expected_cell, cell_temps, 3)
51-
assert_allclose(expected_module, module_temps, 3)
50+
assert_allclose(expected_cell, cell_temps, 1e-3)
51+
assert_allclose(expected_module, module_temps, 1e-3)
5252

5353

5454
def test_sapm_series(sapm_default):

0 commit comments

Comments
 (0)