Skip to content

Commit 146cf31

Browse files
committed
Adapt tests to new error raising
1 parent 09d0edc commit 146cf31

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/test_wind_turbine.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def test_initialization_power_coefficient_curve(self):
6868
self.test_turbine_data = {
6969
'hub_height': 100,
7070
'power_coefficient_curve': 'example_power_curves.csv',
71+
'nominal_power': 'example_turbine_data.csv',
7172
'turbine_type': 'DUMMY 3',
7273
'path': os.path.join(os.path.dirname(__file__), '../example/data')}
7374
try:
@@ -80,7 +81,8 @@ def test_initialization_power_coefficient_curve(self):
8081
self.test_turbine_data = {'hub_height': 100,
8182
'power_coefficient_curve':
8283
{'wind_speed': [0, 10],
83-
'value': [0, 3]}}
84+
'value': [0, 0.3]},
85+
'nominal_power': 3e6}
8486
try:
8587
WindTurbine(**self.test_turbine_data)
8688
assert True
@@ -92,7 +94,8 @@ def test_initialization_power_coefficient_curve(self):
9294
'power_coefficient_curve':
9395
pd.DataFrame({
9496
'wind_speed': [0, 10],
95-
'value': [0, 3]})}
97+
'value': [0, 3]}),
98+
'nominal_power': 3e6}
9699
try:
97100
WindTurbine(**self.test_turbine_data)
98101
assert True
@@ -136,6 +139,16 @@ def test_error_raising(self):
136139
with pytest.raises(AttributeError):
137140
WindTurbine(**self.test_turbine_data)
138141

142+
# Raise ValueError due to missing nominal power when using power
143+
# coefficient curve
144+
self.test_turbine_data = {'hub_height': 100,
145+
'power_coefficient_curve':
146+
pd.DataFrame({
147+
'wind_speed': [0, 10],
148+
'value': [0, 3]})}
149+
with pytest.raises(ValueError):
150+
WindTurbine(**self.test_turbine_data)
151+
139152
def test_get_turbine_data_from_file(self):
140153
# Raise FileNotFoundError due to missing
141154
with pytest.raises(FileNotFoundError):

0 commit comments

Comments
 (0)