From c866429c663cf65ea19141969bb5ce9009236e1e Mon Sep 17 00:00:00 2001
From: pcain <pcain@usgs.gov>
Date: Wed, 25 Aug 2021 10:01:43 -0600
Subject: [PATCH] add test for handling empty stream

---
 test/DerivedTimeseriesFactory_test.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/test/DerivedTimeseriesFactory_test.py b/test/DerivedTimeseriesFactory_test.py
index 5a8eeaea..debb0b21 100644
--- a/test/DerivedTimeseriesFactory_test.py
+++ b/test/DerivedTimeseriesFactory_test.py
@@ -2,8 +2,9 @@ from typing import List
 
 from obspy import Stream
 
-from geomagio import DerivedTimeseriesFactory, TimeseriesUtility
+from geomagio import TimeseriesUtility
 from geomagio.algorithm import Algorithm, DeltaFAlgorithm, XYZAlgorithm
+from geomagio.DerivedTimeseriesFactory import DerivedTimeseriesFactory, get_missing
 from geomagio.iaga2002 import StreamIAGA2002Factory
 from geomagio.edge import EdgeFactory
 
@@ -91,6 +92,17 @@ def test_get_timeseries():
     assert set(TimeseriesUtility.get_channels(timeseries)) == set(["H", "D"])
 
 
+def test_get_missing():
+    """test.DerivedTimeseriesFactory_test.test_get_missing()"""
+    desired = ["X", "Y", "D", "G"]
+    assert set(get_missing(input=Stream(), desired=desired)) == set(desired)
+    desired = ["H", "E", "Z", "F"]
+    timeseries = get_derived_timeseries(
+        "etc/filter/BOU20200101vsec.sec", desired, "variation", "second"
+    )
+    assert get_missing(input=timeseries, desired=desired) == []
+
+
 def get_derived_timeseries(
     url: str, channels: List[str], data_type: str, interval: str
 ) -> Stream:
-- 
GitLab