@@ -46,6 +46,13 @@ def test_initialization_dataframe(self):
4646 windfarm = WindFarm (wind_turbine_fleet = wind_turbine_fleet )
4747 assert 3 * 4.2e6 + 2 * 2e6 == windfarm .nominal_power
4848
49+ def test_initialization_1 (self ):
50+ """test catching error when wind_turbine_fleet not provided as list"""
51+ msg = 'Wind turbine fleet not provided properly.'
52+ with pytest .raises (ValueError , match = msg ):
53+ WindFarm (wind_turbine_fleet = [{'wind_turbine' : 'turbine' ,
54+ 'number_of_turbines' : 2 }, 'dummy' ])
55+
4956 def test_initialization_2 (self ):
5057 """test catching error when WindTurbine in wind_turbine_fleet
5158 not initialized"""
@@ -109,6 +116,17 @@ def test_initialization_6(self):
109116 with pytest .raises (ValueError , match = msg ):
110117 WindFarm (** test_farm )
111118
119+ def test_initialization_7 (self ):
120+ """test catching error when total capacity cannot be deduced"""
121+ wt = WindTurbine (** self .test_turbine )
122+ wt .nominal_power = None
123+ test_farm = {'wind_turbine_fleet' : [
124+ {'wind_turbine' : wt ,
125+ 'number_of_turbines' : 3 }]}
126+ msg = 'Total capacity of turbines of type'
127+ with pytest .raises (ValueError , match = msg ):
128+ WindFarm (** test_farm )
129+
112130 def test_mean_hub_height (self ):
113131 """tests mean_hub_height method"""
114132 test_farm = {'wind_turbine_fleet' : [
0 commit comments