File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ import pandas as pd
2+ from pandas .util .testing import assert_series_equal
3+ import pytest
4+
5+ from windpowerlib .wind_turbine import read_turbine_data , WindTurbine
6+
7+ class TestWindTurbine :
8+
9+ def test_error_raising (self ):
10+ self .test_turbine_data = {'hub_height' : 100 ,
11+ 'rotor_diameter' : 80 ,
12+ 'name' : 'turbine_not_in_file' ,
13+ 'fetch_curve' : 'power_curve' ,
14+ 'data_source' : 'example_power_curves.csv' }
15+ # Raise system exit
16+ with pytest .raises (SystemExit ):
17+ test_turbine = WindTurbine (** self .test_turbine_data )
18+
19+ # Raise ValueError due to invalid parameter `fetch_curve`
20+ self .test_turbine_data ['fetch_curve' ] = 'misspelling'
21+ self .test_turbine_data ['name' ] = 'DUMMY 3'
22+ with pytest .raises (ValueError ):
23+ test_turbine = WindTurbine (** self .test_turbine_data )
24+
25+ def test_read_turbine_data (self ):
26+ # Raise FileNotFoundError due to missing
27+ with pytest .raises (FileNotFoundError ):
28+ read_turbine_data (filename = 'not_existent' )
29+
You can’t perform that action at this time.
0 commit comments