44"""
55
66import os
7+ import time
78from datetime import datetime
8-
99from shutil import copyfile
1010
1111import pandas as pd
1212import pytest
1313
14- from windpowerlib .data import check_imported_data , check_data_integretiy
14+ from windpowerlib .data import (
15+ check_data_integrity , check_imported_data , get_turbine_types ,
16+ store_turbine_data_from_oedb )
1517
1618
1719class TestDataCheck :
@@ -58,7 +60,7 @@ def test_normal_data_check(self):
5860 def test_data_check_logging_warnings (self , caplog ):
5961 self .df .loc ["GE158/4800" , "has_power_curve" ] = True
6062 self .df .loc ["GE100/2750" , "has_cp_curve" ] = True
61- check_data_integretiy (self .df , min_pc_length = 26 )
63+ check_data_integrity (self .df , min_pc_length = 26 )
6264 assert "E48/800: power_curve is to short (25 values)" in caplog .text
6365 assert "GE158/4800: No power curve" in caplog .text
6466 assert "GE100/2750: No cp-curve but has_cp_curve" in caplog .text
@@ -75,3 +77,22 @@ def test_broken_pwr_curve(self):
7577 msg = "could not convert string to float"
7678 with pytest .raises (ValueError , match = msg ):
7779 check_imported_data (self .df , self .filename , self .time_stamp )
80+
81+ def test_get_turbine_types (self , capsys ):
82+ get_turbine_types ()
83+ captured = capsys .readouterr ()
84+ assert "Enercon" in captured .out
85+ get_turbine_types ("oedb" , print_out = False , filter_ = False )
86+ msg = "`turbine_library` is 'wrong' but must be 'local' or 'oedb'."
87+ with pytest .raises (ValueError , match = msg ):
88+ get_turbine_types ("wrong" )
89+
90+ def test_store_turbine_data_from_oedb (self ):
91+ store_turbine_data_from_oedb ()
92+
93+ def test_wrong_url_load_turbine_data (self ):
94+ """Load turbine data from oedb."""
95+ with pytest .raises (
96+ ConnectionError , match = "Database connection not successful"
97+ ):
98+ store_turbine_data_from_oedb ("wrong_schema" )
0 commit comments