@@ -228,8 +228,11 @@ def test_projected_solar_zenith_angle_datatypes(
228228@pytest .fixture
229229def sf_premises_and_expected ():
230230 """Data comprised of solar position, tracker orientations, ground coverage
231- ratios and terrain slopes with respective shade fractions (sf)"""
232- # preserve tracker_shade_fraction's args order and append shadow depth, z
231+ ratios and terrain slopes with respective shade fractions (sf).
232+ Returns a 2-tuple with the premises to be used directly in
233+ tracker_shade_fraction(...) in the first element and the expected shaded
234+ fractions on the second element"""
235+ # tracker_shade_fraction's args order and append shadow depth, z
233236 premises_and_results = pd .DataFrame (
234237 columns = ["solar_zenith" , "solar_azimuth" , "tracker_tilt" ,
235238 "tracker_azimuth" , "gcr" , "cross_axis_slope" , "z" ],
@@ -245,14 +248,14 @@ def sf_premises_and_expected():
245248 ))
246249 # append shaded fraction
247250 premises_and_results ["shaded_fraction" ] = 1 - 1 / premises_and_results ["z" ]
248- return premises_and_results
251+ return (premises_and_results .drop (columns = ["z" , "shaded_fraction" ]),
252+ premises_and_results ["shaded_fraction" ])
249253
250254
251255def test_tracker_shade_fraction (sf_premises_and_expected ):
252256 """Tests tracker_shade_fraction"""
253257 # unwrap sf_premises_and_expected values premises and expected results
254- premises = sf_premises_and_expected .drop (columns = ["z" , "shaded_fraction" ])
255- expected_sf_array = sf_premises_and_expected ["shaded_fraction" ]
258+ premises , expected_sf_array = sf_premises_and_expected
256259 # test scalar inputs from the row iterator
257260 # series label := corresponding index in expected_sf_array
258261 for index , premise in premises .iterrows ():
@@ -266,7 +269,7 @@ def test_tracker_shade_fraction(sf_premises_and_expected):
266269
267270
268271def test_linear_shade_loss (sf_premises_and_expected ):
269- expected_sf_array = sf_premises_and_expected [ "shaded_fraction" ]
272+ _ , expected_sf_array = sf_premises_and_expected # Premises are not needed
270273 loss = shading .linear_shade_loss (expected_sf_array [0 ], 0.2 )
271274 assert_allclose (loss , 0.09289321881345258 )
272275 # if no diffuse, shade fraction is the loss
0 commit comments