Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SabineHaas committed Aug 19, 2019
1 parent da5f2e8 commit 90c4737
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/test_wind_turbine.py
Expand Up @@ -42,11 +42,29 @@ def test_get_turbine_types(self, capsys):

def test_wrong_url_load_turbine_data(self):
"""Load turbine data from oedb."""

with pytest.raises(ConnectionError,
match="Database connection not successful"):
load_turbine_data_from_oedb('wrong_schema')

@pytest.mark.filterwarnings("ignore:The WindTurbine")
def test_string_representation_of_wind_turbine(self):
assert "Wind turbine: ['hub height=120 m'" in repr(WindTurbine(120))

def test_power_curve_is_of_wrong_type(self):
"""Error raising due to wrong type of WindTurbine.power_curve."""
test_turbine_data = {'hub_height': 100,
'rotor_diameter': 80,
'turbine_type': 'test_type',
'power_curve': 'string'}
with pytest.raises(TypeError):
WindTurbine(**test_turbine_data)

def test_power_coefficient_curve_is_of_wrong_type(self):
"""Error raising due to wrong type of
WindTurbine.power_coefficient_curve."""
test_turbine_data = {'hub_height': 100,
'rotor_diameter': 80,
'turbine_type': 'test_type',
'power_coefficient_curve': 'string'}
with pytest.raises(TypeError):
WindTurbine(**test_turbine_data)

0 comments on commit 90c4737

Please sign in to comment.