Skip to content

Commit 86b9763

Browse files
committed
Add docstrings
1 parent 7f8a747 commit 86b9763

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test_data_handling.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ def teardown_class(cls):
4141
restore_default_turbine_data()
4242

4343
def test_normal_data_check(self):
44+
"""Check data which is fine."""
4445
check_turbine_data(self.filename.format("turbine_data"))
4546

4647
def test_data_check_logging_warnings(self, caplog):
48+
"""Check logging warnings about the checked data."""
4749
self.df.loc["GE158/4800", "has_power_curve"] = True
4850
self.df.loc["GE100/2750", "has_cp_curve"] = True
4951
self.df.to_csv(self.tmp_fn.format("turbine_data"))
@@ -53,6 +55,7 @@ def test_data_check_logging_warnings(self, caplog):
5355
assert "GE100/2750: No cp-curve but has_cp_curve" in caplog.text
5456

5557
def test_global_error(self):
58+
"""Check Error message if turbine data is corrupt."""
5659
msg = r"could not convert string to*"
5760
name = "turbine_data"
5861
copyfile(self.orig_fn.format(name), self.backup_fn.format(name))
@@ -62,6 +65,7 @@ def test_global_error(self):
6265
copyfile(self.backup_fn.format(name), self.orig_fn.format(name))
6366

6467
def test_broken_pwr_curve(self):
68+
"""Check Error message if power_curves data is corrupt."""
6569
name = "power_curves"
6670
copyfile(self.orig_fn.format(name), self.backup_fn.format(name))
6771
copyfile(self.broken_fn.format(name), self.orig_fn.format(name))
@@ -71,6 +75,7 @@ def test_broken_pwr_curve(self):
7175
copyfile(self.backup_fn.format(name), self.orig_fn.format(name))
7276

7377
def test_get_turbine_types(self, capsys):
78+
"""Test the `get_turbine_types` function."""
7479
get_turbine_types()
7580
captured = capsys.readouterr()
7681
assert "Enercon" in captured.out
@@ -80,6 +85,7 @@ def test_get_turbine_types(self, capsys):
8085
get_turbine_types("wrong")
8186

8287
def test_store_turbine_data_from_oedb(self):
88+
"""Test `store_turbine_data_from_oedb` function."""
8389
t = {}
8490
for fn in os.listdir(self.orig_path):
8591
t[fn] = os.path.getmtime(os.path.join(self.orig_path, fn))
@@ -88,14 +94,15 @@ def test_store_turbine_data_from_oedb(self):
8894
assert t[fn] < os.path.getmtime(os.path.join(self.orig_path, fn))
8995

9096
def test_wrong_url_load_turbine_data(self):
91-
"""Load turbine data from oedb."""
97+
"""Load turbine data from oedb with a wrong schema."""
9298
with pytest.raises(
9399
ConnectionError,
94100
match=r"Database \(oep\) connection not successful*",
95101
):
96102
store_turbine_data_from_oedb("wrong_schema")
97103

98104
def test_restore_default_data(self):
105+
"""Test the clean recovery of the data files."""
99106
names = ["turbine_data", "power_curves", "power_coefficient_curves"]
100107
default_path = os.path.join(
101108
self.orig_path, os.pardir, "data", "default_turbine_data"

0 commit comments

Comments
 (0)