def setUp(self): x = [0.5, 2, 4, 5.5, 6.5, 7, 7.25, 7.3] y = [i * 2 for i in x] t = [i for i in range(len(x))] ts = TimeSeries(values=x, time=t, feature='x') ts2 = TimeSeries(values=y, time=t, feature='y') self.tsg = TimeSeriesGroup([ts, ts2]) a = Node('A') b = Node('B') c = Node('C') d = Node('D') self.first_order_deg = Edge(source=a, target=None, id=1) self.zero_order_prod = Edge(source=None, target=b, id=2) self.first_order_transition = Edge(source=a, target=b, id=3) self.complex_break = Edge(source=a, target=[b, c], id=4) self.complex_form = Edge(source=[a, b], target=c, id=5) self.second_order_transition = Edge(source=[a, b], target=[c, d], id=6) self.second_order_deg = Edge(source=[a, b], target=None, id=7)
def test_second_order_transition(self): E = Edge(source=[self.a, self.b], target=[self.c, self.d], id=6) self.assertTrue(E.form == 'second_order_transition')
def test_complex_break(self): ## a -> x + y E = Edge(source=self.a, target=[self.b, self.c], id=4) self.assertTrue(E.form == 'complex_break')
def test_complex_form(self): ## x + y -> z E = Edge(source=[self.a, self.b], target=self.c, id=5) self.assertTrue(E.form == 'complex_form')
def test_first_order_transition(self): E = Edge(source=self.a, target=self.b, id=3) self.assertTrue(E.form == 'first_order_transition')
def test_raises_error_With_two_targets_no_source(self): ## -> A + B E = Edge(target=[self.a, self.b], id=1) with self.assertRaises(ValueError): E.form
def test_zero_order_prod(self): ## i.e. -> x; k E = Edge(source=None, target=self.b, id=2) self.assertTrue(E.form == 'zero_order_prod')
def test_second_order_deg(self): ##i.e. x + y -> ; k*x*y E = Edge(source=[self.a, self.b], target=None, id=7) self.assertTrue(E.form == 'second_order_deg')
def test_first_order_deg(self): ## i.e. x -> ; k E = Edge(source=self.a, target=None, id=1) self.assertTrue(E.form == 'first_order_deg')