@@ -181,8 +181,8 @@ def weather():
181181@pytest .fixture
182182def total_irrad (weather ):
183183 return pd .DataFrame ({'poa_global' : [800. , 500. ],
184- 'poa_diffuse ' : [300 . , 200 . ],
185- 'poa_direct ' : [500 . , 300 . ]}, index = weather .index )
184+ 'poa_direct ' : [500 . , 300 . ],
185+ 'poa_diffuse ' : [300 . , 200 . ]}, index = weather .index )
186186
187187
188188def test_ModelChain_creation (sapm_dc_snl_ac_system , location ):
@@ -336,21 +336,25 @@ def test_run_model_tracker(sapm_dc_snl_ac_system, location, weather, mocker):
336336
337337def test__assign_total_irrad (sapm_dc_snl_ac_system , location , weather ,
338338 total_irrad ):
339- weather [[ 'poa_global' , 'poa_diffuse' , 'poa_direct' ]] = total_irrad
339+ data = pd . concat ([ weather , total_irrad ], axis = 1 )
340340 mc = ModelChain (sapm_dc_snl_ac_system , location )
341- mc ._assign_total_irrad (weather )
342- for k in modelchain .POA_DATA_KEYS :
343- assert_series_equal (mc .total_irrad [k ], total_irrad [k ])
341+ mc ._assign_total_irrad (data )
342+ assert_frame_equal (mc .total_irrad , total_irrad )
344343
345344
346345def test_prepare_inputs_from_poa (sapm_dc_snl_ac_system , location ,
347346 weather , total_irrad ):
348- data = weather .copy ()
349- data [['poa_global' , 'poa_diffuse' , 'poa_direct' ]] = total_irrad
347+ data = pd .concat ([weather , total_irrad ], axis = 1 )
350348 mc = ModelChain (sapm_dc_snl_ac_system , location )
351349 mc .prepare_inputs_from_poa (data )
350+ weather_expected = weather .copy ()
351+ weather_expected ['temp_air' ] = 20
352+ weather_expected ['wind_speed' ] = 0
353+ # order as expected
354+ weather_expected = weather_expected [
355+ ['ghi' , 'dhi' , 'dni' , 'wind_speed' , 'temp_air' ]]
352356 # weather attribute
353- assert_frame_equal (mc .weather , weather )
357+ assert_frame_equal (mc .weather , weather_expected )
354358 # total_irrad attribute
355359 assert_frame_equal (mc .total_irrad , total_irrad )
356360
0 commit comments