Skip to content

Commit f3d1407

Browse files
committed
Fix lint errors
1 parent f7eafa5 commit f3d1407

File tree

1 file changed

+44
-26
lines changed

1 file changed

+44
-26
lines changed

pvlib/tests/test_modelchain.py

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,10 @@ def test_ModelChain_creation(sapm_dc_snl_ac_system, location):
174174
(None, (32.2, 180)), ('None', (32.2, 180)), ('flat', (0, 180)),
175175
('south_at_latitude_tilt', (32.2, 180))
176176
])
177-
def test_orientation_strategy(strategy, expected, sapm_dc_snl_ac_system, location):
178-
mc = ModelChain(sapm_dc_snl_ac_system, location, orientation_strategy=strategy)
177+
def test_orientation_strategy(strategy, expected, sapm_dc_snl_ac_system,
178+
location):
179+
mc = ModelChain(sapm_dc_snl_ac_system, location,
180+
orientation_strategy=strategy)
179181

180182
# the || accounts for the coercion of 'None' to None
181183
assert (mc.orientation_strategy == strategy or
@@ -231,7 +233,8 @@ def test_complete_irradiance_times(sapm_dc_snl_ac_system, location):
231233

232234

233235
def test_run_model_perez(sapm_dc_snl_ac_system, location):
234-
mc = ModelChain(sapm_dc_snl_ac_system, location, transposition_model='perez')
236+
mc = ModelChain(sapm_dc_snl_ac_system, location,
237+
transposition_model='perez')
235238
times = pd.date_range('20160101 1200-0700', periods=2, freq='6H')
236239
irradiance = pd.DataFrame({'dni': 900, 'ghi': 600, 'dhi': 150},
237240
index=times)
@@ -243,7 +246,8 @@ def test_run_model_perez(sapm_dc_snl_ac_system, location):
243246

244247

245248
def test_run_model_gueymard_perez(sapm_dc_snl_ac_system, location):
246-
mc = ModelChain(sapm_dc_snl_ac_system, location, airmass_model='gueymard1993',
249+
mc = ModelChain(sapm_dc_snl_ac_system, location,
250+
airmass_model='gueymard1993',
247251
transposition_model='perez')
248252
times = pd.date_range('20160101 1200-0700', periods=2, freq='6H')
249253
irradiance = pd.DataFrame({'dni': 900, 'ghi': 600, 'dhi': 150},
@@ -255,7 +259,8 @@ def test_run_model_gueymard_perez(sapm_dc_snl_ac_system, location):
255259
assert_series_equal(ac, expected)
256260

257261

258-
def test_run_model_with_weather_sapm_temp(sapm_dc_snl_ac_system, location, weather, mocker):
262+
def test_run_model_with_weather_sapm_temp(sapm_dc_snl_ac_system, location,
263+
weather, mocker):
259264
# test with sapm cell temperature model
260265
weather['wind_speed'] = 5
261266
weather['temp_air'] = 10
@@ -273,7 +278,8 @@ def test_run_model_with_weather_sapm_temp(sapm_dc_snl_ac_system, location, weath
273278
assert not mc.ac.empty
274279

275280

276-
def test_run_model_with_weather_pvsyst_temp(sapm_dc_snl_ac_system, location, weather, mocker):
281+
def test_run_model_with_weather_pvsyst_temp(sapm_dc_snl_ac_system, location,
282+
weather, mocker):
277283
# test with pvsyst cell temperature model
278284
weather['wind_speed'] = 5
279285
weather['temp_air'] = 10
@@ -290,11 +296,14 @@ def test_run_model_with_weather_pvsyst_temp(sapm_dc_snl_ac_system, location, wea
290296
assert not mc.ac.empty
291297

292298

293-
def test_run_model_with_weather_faiman_temp(sapm_dc_snl_ac_system, location, weather, mocker):
299+
def test_run_model_with_weather_faiman_temp(sapm_dc_snl_ac_system, location,
300+
weather, mocker):
294301
# test with faiman cell temperature model
295302
weather['wind_speed'] = 5
296303
weather['temp_air'] = 10
297-
sapm_dc_snl_ac_system.temperature_model_parameters = {'u0': 25.0, 'u1': 6.84}
304+
sapm_dc_snl_ac_system.temperature_model_parameters = {
305+
'u0': 25.0, 'u1': 6.84
306+
}
298307
mc = ModelChain(sapm_dc_snl_ac_system, location)
299308
mc.temperature_model = 'faiman'
300309
m_faiman = mocker.spy(sapm_dc_snl_ac_system, 'faiman_celltemp')
@@ -308,7 +317,9 @@ def test_run_model_with_weather_faiman_temp(sapm_dc_snl_ac_system, location, wea
308317
def test_run_model_tracker(sapm_dc_snl_ac_system, location, weather, mocker):
309318
system = SingleAxisTracker(
310319
module_parameters=sapm_dc_snl_ac_system.module_parameters,
311-
temperature_model_parameters=sapm_dc_snl_ac_system.temperature_model_parameters,
320+
temperature_model_parameters=(
321+
sapm_dc_snl_ac_system.temperature_model_parameters
322+
),
312323
inverter_parameters=sapm_dc_snl_ac_system.inverter_parameters)
313324
mocker.spy(system, 'singleaxis')
314325
mc = ModelChain(system, location)
@@ -332,9 +343,9 @@ def poadc(mc):
332343
pytest.param('pvsyst', marks=requires_scipy),
333344
pytest.param('singlediode', marks=requires_scipy),
334345
'pvwatts_dc'])
335-
def test_infer_dc_model(sapm_dc_snl_ac_system, cec_dc_snl_ac_system, pvsyst_dc_snl_ac_system,
336-
pvwatts_dc_pvwatts_ac_system, location, dc_model,
337-
weather, mocker):
346+
def test_infer_dc_model(sapm_dc_snl_ac_system, cec_dc_snl_ac_system,
347+
pvsyst_dc_snl_ac_system, pvwatts_dc_pvwatts_ac_system,
348+
location, dc_model, weather, mocker):
338349
dc_systems = {'sapm': sapm_dc_snl_ac_system,
339350
'cec': cec_dc_snl_ac_system,
340351
'desoto': cec_dc_snl_ac_system,
@@ -374,7 +385,8 @@ def test_infer_dc_model(sapm_dc_snl_ac_system, cec_dc_snl_ac_system, pvsyst_dc_s
374385
'sapm',
375386
pytest.param('cec', marks=requires_scipy),
376387
pytest.param('cec_native', marks=requires_scipy)])
377-
def test_infer_spectral_model(location, sapm_dc_snl_ac_system, cec_dc_snl_ac_system,
388+
def test_infer_spectral_model(location, sapm_dc_snl_ac_system,
389+
cec_dc_snl_ac_system,
378390
cec_dc_native_snl_ac_system, dc_model):
379391
dc_systems = {'sapm': sapm_dc_snl_ac_system,
380392
'cec': cec_dc_snl_ac_system,
@@ -407,16 +419,17 @@ def test_infer_temp_model(location, sapm_dc_snl_ac_system,
407419
def test_infer_temp_model_invalid(location, sapm_dc_snl_ac_system):
408420
sapm_dc_snl_ac_system.temperature_model_parameters.pop('a')
409421
with pytest.raises(ValueError):
410-
ModelChain(sapm_dc_snl_ac_system, location, orientation_strategy='None',
411-
aoi_model='physical', spectral_model='no_loss')
422+
ModelChain(sapm_dc_snl_ac_system, location,
423+
orientation_strategy='None', aoi_model='physical',
424+
spectral_model='no_loss')
412425

413426

414427
@requires_scipy
415428
def test_temperature_model_inconsistent(location, sapm_dc_snl_ac_system):
416429
with pytest.raises(ValueError):
417-
ModelChain(sapm_dc_snl_ac_system, location, orientation_strategy='None',
418-
aoi_model='physical', spectral_model='no_loss',
419-
temperature_model='pvsyst')
430+
ModelChain(sapm_dc_snl_ac_system, location,
431+
orientation_strategy='None', aoi_model='physical',
432+
spectral_model='no_loss', temperature_model='pvsyst')
420433

421434

422435
def test_dc_model_user_func(pvwatts_dc_pvwatts_ac_system, location, weather,
@@ -437,9 +450,11 @@ def acdc(mc):
437450
@pytest.mark.parametrize('ac_model', [
438451
'snlinverter', pytest.param('adrinverter', marks=requires_scipy),
439452
'pvwatts'])
440-
def test_ac_models(sapm_dc_snl_ac_system, cec_dc_adr_ac_system, pvwatts_dc_pvwatts_ac_system,
441-
location, ac_model, weather, mocker):
442-
ac_systems = {'snlinverter': sapm_dc_snl_ac_system, 'adrinverter': cec_dc_adr_ac_system,
453+
def test_ac_models(sapm_dc_snl_ac_system, cec_dc_adr_ac_system,
454+
pvwatts_dc_pvwatts_ac_system, location, ac_model,
455+
weather, mocker):
456+
ac_systems = {'snlinverter': sapm_dc_snl_ac_system,
457+
'adrinverter': cec_dc_adr_ac_system,
443458
'pvwatts': pvwatts_dc_pvwatts_ac_system}
444459
system = ac_systems[ac_model]
445460

@@ -473,7 +488,8 @@ def constant_aoi_loss(mc):
473488
@pytest.mark.parametrize('aoi_model', [
474489
'sapm', 'ashrae', 'physical', 'martin_ruiz'
475490
])
476-
def test_aoi_models(sapm_dc_snl_ac_system, location, aoi_model, weather, mocker):
491+
def test_aoi_models(sapm_dc_snl_ac_system, location, aoi_model,
492+
weather, mocker):
477493
mc = ModelChain(sapm_dc_snl_ac_system, location, dc_model='sapm',
478494
aoi_model=aoi_model, spectral_model='no_loss')
479495
m = mocker.spy(sapm_dc_snl_ac_system, 'get_iam')
@@ -534,7 +550,8 @@ def constant_spectral_loss(mc):
534550
@pytest.mark.parametrize('spectral_model', [
535551
'sapm', 'first_solar', 'no_loss', constant_spectral_loss
536552
])
537-
def test_spectral_models(sapm_dc_snl_ac_system, location, spectral_model, weather):
553+
def test_spectral_models(sapm_dc_snl_ac_system, location, spectral_model,
554+
weather):
538555
# add pw to weather dataframe
539556
weather['precipitable_water'] = [0.3, 0.5]
540557
mc = ModelChain(sapm_dc_snl_ac_system, location, dc_model='sapm',
@@ -766,10 +783,11 @@ def test_basic_chain_altitude_pressure(sam_data, cec_inverter_parameters,
766783
@pytest.mark.parametrize('strategy, strategy_str', [
767784
('south_at_latitude_tilt', 'south_at_latitude_tilt'),
768785
(None, 'None')]) # GitHub issue 352
769-
def test_ModelChain___repr__(sapm_dc_snl_ac_system, location, strategy, strategy_str):
786+
def test_ModelChain___repr__(sapm_dc_snl_ac_system, location, strategy,
787+
strategy_str):
770788

771-
mc = ModelChain(sapm_dc_snl_ac_system, location, orientation_strategy=strategy,
772-
name='my mc')
789+
mc = ModelChain(sapm_dc_snl_ac_system, location,
790+
orientation_strategy=strategy, name='my mc')
773791

774792
expected = '\n'.join([
775793
'ModelChain: ',

0 commit comments

Comments
 (0)