Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f291d9
commit a389b11
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pandas as pd | ||
from pandas.util.testing import assert_series_equal | ||
import pytest | ||
|
||
from windpowerlib.wind_turbine import read_turbine_data, WindTurbine | ||
|
||
class TestWindTurbine: | ||
|
||
def test_error_raising(self): | ||
self.test_turbine_data = {'hub_height': 100, | ||
'rotor_diameter': 80, | ||
'name': 'turbine_not_in_file', | ||
'fetch_curve': 'power_curve', | ||
'data_source': 'example_power_curves.csv'} | ||
# Raise system exit | ||
with pytest.raises(SystemExit): | ||
test_turbine = WindTurbine(**self.test_turbine_data) | ||
|
||
# Raise ValueError due to invalid parameter `fetch_curve` | ||
self.test_turbine_data['fetch_curve'] = 'misspelling' | ||
self.test_turbine_data['name'] = 'DUMMY 3' | ||
with pytest.raises(ValueError): | ||
test_turbine = WindTurbine(**self.test_turbine_data) | ||
|
||
def test_read_turbine_data(self): | ||
# Raise FileNotFoundError due to missing | ||
with pytest.raises(FileNotFoundError): | ||
read_turbine_data(filename='not_existent') | ||
|