44import nbformat
55import sys
66from example import basic_example as be
7+ from example import further_example as fe
78from numpy .testing import assert_allclose
89import pytest
910
@@ -21,6 +22,21 @@ def test_basic_example_flh(self):
2122 assert_allclose (1882.7567 , (my_turbine .power_output .sum () /
2223 my_turbine .nominal_power ), 0.01 )
2324
25+ def test_further_example_flh (self ):
26+ # tests full load hours
27+ weather = be .get_weather_data ('weather.csv' )
28+ my_turbine , e126 = be .initialise_wind_turbines ()
29+ example_farm , example_farm_2 = fe .initialise_wind_farms (my_turbine ,
30+ e126 )
31+ example_cluster = fe .initialise_wind_turbine_cluster (example_farm ,
32+ example_farm_2 )
33+ fe .calculate_power_output (weather , example_farm , example_cluster )
34+ assert_allclose (1586.23527 , (example_farm .power_output .sum () /
35+ example_farm .installed_power ), 0.01 )
36+ example_cluster .installed_power = example_cluster .get_installed_power ()
37+ assert_allclose (1813.66122 , (example_cluster .power_output .sum () /
38+ example_cluster .installed_power ), 0.01 )
39+
2440 def _notebook_run (self , path ):
2541 """
2642 Execute a notebook via nbconvert and collect output.
@@ -49,3 +65,10 @@ def test_basic_example_ipynb(self):
4965 nb , errors = self ._notebook_run (
5066 os .path .join (dir_path , 'basic_example.ipynb' ))
5167 assert errors == []
68+
69+ @pytest .mark .skipif (sys .version_info < (3 , 6 ), reason = "requires python3.6" )
70+ def test_further_example_ipynb (self ):
71+ dir_path = os .path .dirname (os .path .realpath (__file__ ))
72+ nb , errors = self ._notebook_run (
73+ os .path .join (dir_path , 'further_example.ipynb' ))
74+ assert errors == []
0 commit comments