Skip to content

Commit

Permalink
Added regression test for input as signal.
Browse files Browse the repository at this point in the history
  • Loading branch information
mvcisback committed Aug 20, 2020
1 parent 4f2f72d commit 5edc8e7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mtl/test_eval.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from discrete_signals import signal

import mtl


Expand All @@ -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

0 comments on commit 5edc8e7

Please sign in to comment.