from metadatastore.examples.sample_data.common import apply_deadband, noisy
from metadatastore.examples.sample_data import (temperature_ramp,
                                                multisource_event)
from metadatastore.utils.testing import mds_setup, mds_teardown
import numpy as np
from nose.tools import raises

def setup():
    mds_setup()

def teardown():
    mds_teardown()

@raises(ValueError)
def test_bad_deadbands():
    # the -1 should throw a ValueError
    apply_deadband(None, -1)


def _noisy_helper(val):
    noisy(val)


def test_noisy_for_smoke():
    vals = [0, np.arange(0, 5)]
    for v in vals:
        yield _noisy_helper, v

@raises(NotImplementedError)
def _failing_sleepy_ramp_helper(delay_time):
    # any non-zero values should work
    temperature_ramp.run(sleep=delay_time)

def test_sleepy_ramp():
    failing_times = [-1, 1]
    for failing_time in failing_times:
        yield _failing_sleepy_ramp_helper, failing_time


def test_multisource_event():
    multisource_event.run()


def test_temperature_ramp():
    temperature_ramp.run()


if __name__ == "__main__":
    import nose
    nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

@@ -285,16 +285,33 @@
 y as np%0A
+import itertools%0A
 from nos
@@ -713,27 +713,20 @@
 ing_
-sleepy_ramp_
 helper(
+mod, 
 dela
@@ -776,32 +776,19 @@
 ork%0A    
-temperature_ramp
+mod
 .run(sle
@@ -819,20 +819,24 @@
 _sleepy_
-ramp
+failures
 ():%0A    
@@ -867,27 +867,111 @@
     
-for failing_time in
+modules = %5Btemperature_ramp, multisource_event%5D%0A    for mod, failing_time in itertools.product(modules,
  fai
@@ -980,16 +980,17 @@
 ng_times
+)
 :%0A      
@@ -1010,27 +1010,20 @@
 ing_
-sleepy_ramp_
 helper,
+ mod,
  fai
@@ -1033,17 +1033,16 @@
 g_time%0A%0A
-%0A
 def test

Test sleepy multisource event