From 0efbc11a31efe2d6b32d168aa4ee6b570333e303 Mon Sep 17 00:00:00 2001
From: leufen1 <l.leufen@fz-juelich.de>
Date: Thu, 4 Feb 2021 16:31:20 +0100
Subject: [PATCH] fixed tests

---
 mlair/run_modules/pre_processing.py          | 6 +++---
 test/test_run_modules/test_pre_processing.py | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/mlair/run_modules/pre_processing.py b/mlair/run_modules/pre_processing.py
index 4888a60b..bf54b061 100644
--- a/mlair/run_modules/pre_processing.py
+++ b/mlair/run_modules/pre_processing.py
@@ -13,7 +13,7 @@ import numpy as np
 import pandas as pd
 
 from mlair.data_handler import DataCollection, AbstractDataHandler
-from mlair.helpers import TimeTracking
+from mlair.helpers import TimeTracking, to_list
 from mlair.configuration import path_config
 from mlair.helpers.join import EmptyQueryResult
 from mlair.run_modules.run_environment import RunEnvironment
@@ -334,8 +334,8 @@ class PreProcessing(RunEnvironment):
         data if required.
         """
         logging.info("Searching for competitors to be prepared for use.")
-        competitors = self.data_store.get_default("competitors", default=None)
-        if competitors is not None:
+        competitors = to_list(self.data_store.get_default("competitors", default=[]))
+        if len(competitors) > 0:
             for competitor_name in competitors:
                 if competitor_name.lower() == "IntelliO3-ts-v1".lower():
                     logging.info("Prepare IntelliO3-ts-v1 model")
diff --git a/test/test_run_modules/test_pre_processing.py b/test/test_run_modules/test_pre_processing.py
index 11c46e99..b5a1914e 100644
--- a/test/test_run_modules/test_pre_processing.py
+++ b/test/test_run_modules/test_pre_processing.py
@@ -46,8 +46,12 @@ class TestPreProcessing:
         with PreProcessing():
             assert caplog.record_tuples[0] == ('root', 20, 'PreProcessing started')
             assert caplog.record_tuples[1] == ('root', 20, 'check valid stations started (preprocessing)')
-            assert caplog.record_tuples[-1] == ('root', 20, PyTestRegex(r'run for \d+:\d+:\d+ \(hh:mm:ss\) to check 5 '
+            assert caplog.record_tuples[-3] == ('root', 20, PyTestRegex(r'run for \d+:\d+:\d+ \(hh:mm:ss\) to check 5 '
                                                                         r'station\(s\). Found 5/5 valid stations.'))
+            assert caplog.record_tuples[-2] == ('root', 20, "Searching for competitors to be prepared for use.")
+            assert caplog.record_tuples[-1] == (
+            'root', 20, "No preparation required because no competitor was provided "
+                        "to the workflow.")
         RunEnvironment().__del__()
 
     def test_run(self, obj_with_exp_setup):
-- 
GitLab