From be7208a17d28cead69c49acb8cea6a631e3e489b Mon Sep 17 00:00:00 2001
From: Peter Luenenschloss <peter.luenenschloss@ufz.de>
Date: Thu, 30 Apr 2020 14:10:50 +0200
Subject: [PATCH] added missing-data fixture to conftest

---
 test/funcs/conftest.py            | 25 ++++++++++++++++++++++++-
 test/funcs/test_proc_functions.py | 21 +++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 test/funcs/test_proc_functions.py

diff --git a/test/funcs/conftest.py b/test/funcs/conftest.py
index 933e4539d..430aaae51 100644
--- a/test/funcs/conftest.py
+++ b/test/funcs/conftest.py
@@ -10,7 +10,8 @@ def char_dict():
     return {"raise": pd.DatetimeIndex([]),
             "drop": pd.DatetimeIndex([]),
             "peak": pd.DatetimeIndex([]),
-            "return": pd.DatetimeIndex([])}
+            "return": pd.DatetimeIndex([]),
+            "missing": pd.DatetimeIndex([])}
 
 
 @pytest.fixture
@@ -124,3 +125,25 @@ def course_4(char_dict):
         return data, char_dict
 
     return fix_funk
+
+@pytest.fixture
+def course_5(char_dict):
+    # NAN_holes values , that remain on value level "base_level" and than begin exposing an outlierish or
+    # spikey value of magnitude "out_val" every second timestep, starting at periods/2, with the first spike. number
+    # periods better be even!
+    # periods better be greater 5
+
+    def fix_funk(freq='10min', periods=100, nan_slice=slice(0, None, 5), initial_level=0, final_level=10,
+                 initial_index=pd.Timestamp(2000, 1, 1, 0, 0, 0), char_dict=char_dict):
+        t_index = pd.date_range(initial_index, freq=freq, periods=periods)
+        values = np.linspace(initial_level, final_level, periods)
+        s = pd.Series(values, index=t_index)
+        s[nan_slice] = np.nan
+        char_dict['missing'] = s[nan_slice].index
+
+        data = DictOfSeries(data=s, columns=['data'])
+        return data, char_dict
+
+    return fix_funk
+
+    return fix_funk
\ No newline at end of file
diff --git a/test/funcs/test_proc_functions.py b/test/funcs/test_proc_functions.py
new file mode 100644
index 000000000..48777e7da
--- /dev/null
+++ b/test/funcs/test_proc_functions.py
@@ -0,0 +1,21 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import pytest
+import numpy as np
+import pandas as pd
+import dios
+
+from saqc.funcs.proc_functions import (
+    proc_interpolateMissing,
+    proc_resample,
+    proc_transform
+)
+
+from test.common import TESTFLAGGER
+
+@pytest.mark.parametrize("flagger", TESTFLAGGER)
+def test_interpolateMissing(course_1, flagger):
+    data, *_ = course_1(periods=100)
+    data[1] = np.nan
+    data[]
-- 
GitLab