diff --git a/pvlib/tests/test_modelchain.py b/pvlib/tests/test_modelchain.py index 0632d34212..5678470f10 100644 --- a/pvlib/tests/test_modelchain.py +++ b/pvlib/tests/test_modelchain.py @@ -1305,6 +1305,21 @@ def test_temperature_model_inconsistent(location, sapm_dc_snl_ac_system): spectral_model='no_loss', temperature_model='pvsyst') +def test_temperature_model_not_specified(): + # GH 1759 -- ensure correct error is raised when temperature model params + # are specified on the PVSystem instead of the Arrays + location = Location(latitude=32.2, longitude=-110.9) + arrays = [pvsystem.Array(pvsystem.FixedMount(), + module_parameters={'pdc0': 1, 'gamma_pdc': 0})] + system = pvsystem.PVSystem(arrays, + temperature_model_parameters={'u0': 1, 'u1': 1}, + inverter_parameters={'pdc0': 1}) + with pytest.raises(ValueError, + match='could not infer temperature model ' + 'from system.temperature_model_parameters'): + _ = ModelChain(system, location, + aoi_model='no_loss', spectral_model='no_loss') + def test_dc_model_user_func(pvwatts_dc_pvwatts_ac_system, location, weather, mocker): m = mocker.spy(sys.modules[__name__], 'poadc')