From c45d438d6311949f21aca3892499f9660759b820 Mon Sep 17 00:00:00 2001 From: martin-springer Date: Tue, 30 Apr 2024 09:10:30 -0400 Subject: [PATCH] run blake --- rdtools/test/bootstrap_test.py | 40 ++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/rdtools/test/bootstrap_test.py b/rdtools/test/bootstrap_test.py index 0b05c856..e066a024 100644 --- a/rdtools/test/bootstrap_test.py +++ b/rdtools/test/bootstrap_test.py @@ -1,9 +1,11 @@ -'''Bootstrap module tests.''' +"""Bootstrap module tests.""" import pytest -from rdtools.bootstrap import _construct_confidence_intervals, \ - _make_time_series_bootstrap_samples +from rdtools.bootstrap import ( + _construct_confidence_intervals, + _make_time_series_bootstrap_samples, +) from rdtools.degradation import degradation_year_on_year @@ -11,28 +13,34 @@ def test_bootstrap_module( cods_normalized_daily, cods_normalized_daily_wo_noise, decomposition_type ): - ''' Test make time serie bootstrap samples and construct of confidence intervals. ''' + """Test make time serie bootstrap samples and construct of confidence intervals.""" # Test make bootstrap samples - bootstrap_samples = _make_time_series_bootstrap_samples(cods_normalized_daily, - cods_normalized_daily_wo_noise, - sample_nr=10, - block_length=90, - decomposition_type=decomposition_type) + bootstrap_samples = _make_time_series_bootstrap_samples( + cods_normalized_daily, + cods_normalized_daily_wo_noise, + sample_nr=10, + block_length=90, + decomposition_type=decomposition_type, + ) # Check if results are as expected - assert (bootstrap_samples.index == cods_normalized_daily.index).all(), \ - "Index of bootstrapped signals is not as expected" - assert bootstrap_samples.shape[1] == 10, "Number of columns in bootstrapped signals is wrong" + assert ( + bootstrap_samples.index == cods_normalized_daily.index + ).all(), "Index of bootstrapped signals is not as expected" + assert ( + bootstrap_samples.shape[1] == 10 + ), "Number of columns in bootstrapped signals is wrong" # Test construction of confidence intervals confidence_intervals, exceedance_level, metrics = _construct_confidence_intervals( - bootstrap_samples, degradation_year_on_year, uncertainty_method='none') + bootstrap_samples, degradation_year_on_year, uncertainty_method="none" + ) # Check if results are as expected assert len(confidence_intervals) == 2, "2 confidence interval bounds not returned" - assert isinstance(confidence_intervals[0], float) and \ - isinstance(confidence_intervals[1], float), "Confidence interval bounds are not float" + assert isinstance(confidence_intervals[0], float) and isinstance( + confidence_intervals[1], float + ), "Confidence interval bounds are not float" assert isinstance(exceedance_level, float), "Exceedance level is not float" assert len(metrics) == 10, "Length of metrics is not as expected" for m in metrics: assert isinstance(m, float), "Not all metrics are float" -