From 5edc8e7c10a9b841e059a9dee74b369eaea25d2a Mon Sep 17 00:00:00 2001 From: Marcell Vazquez-Chanlatte Date: Thu, 20 Aug 2020 09:40:59 -0700 Subject: [PATCH] Added regression test for input as signal. --- mtl/test_eval.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mtl/test_eval.py b/mtl/test_eval.py index dcbb896..b356f18 100644 --- a/mtl/test_eval.py +++ b/mtl/test_eval.py @@ -1,3 +1,5 @@ +from discrete_signals import signal + import mtl @@ -20,3 +22,13 @@ def test_eval_regression_next_neg(): v = f(d, quantitative=False, dt=1, time=None) assert not f(d, quantitative=False, dt=1) assert min(t for t, _ in v) >= 0 + + +def test_eval_with_signal(): + spec = mtl.parse('F(above_three)') + + raw_data = signal([(0, 1), (1, 2), (2, 3)], start=0, end=10, tag='a') + processed = raw_data.map(lambda val: val['a'] > 3, tag="above_three") + + assert not spec(processed, quantitative=False) + assert spec(processed, quantitative=True) == 0