def test_configure_sequence(self):
     p = PeriodicLog()
     p.configure({'name':'log','parent':None, 'period':1})
     h = CompositeNode()
     h.configure({'name':'columns','parent':p})
     c = PeriodicAverageColumn()
     c.configure({'position':0, 'name':'2', 'parent':h,
                  'function':self._next})
     p.start()
     try:
         l = []
         v = []
         for i in range(0,100):
             l.append(c._evaluate())
             v.append(i-0.5)
         if l.pop(0) != None:
             raise 'First delta not None.'
         v.pop(0)
         for i in l:
             j = v.pop(0)
             if i != j:
                 raise 'Incorrect average of %s should be %s.' % (i, j)
     finally:
         p.stop()
     return
Ejemplo n.º 2
0
 def test_configure_sequence(self):
     p = PeriodicLog()
     p.configure({'name': 'log', 'parent': None, 'period': 1})
     h = CompositeNode()
     h.configure({'name': 'columns', 'parent': p})
     c = PeriodicAverageColumn()
     c.configure({
         'position': 0,
         'name': '2',
         'parent': h,
         'function': self._next
     })
     p.start()
     try:
         l = []
         v = []
         for i in range(0, 100):
             l.append(c._evaluate())
             v.append(i - 0.5)
         if l.pop(0) != None:
             raise 'First delta not None.'
         v.pop(0)
         for i in l:
             j = v.pop(0)
             if i != j:
                 raise 'Incorrect average of %s should be %s.' % (i, j)
     finally:
         p.stop()
     return
 def test_configure_random(self):
     p = PeriodicLog()
     p.configure({'name':'log','parent':None, 'period':1})
     h = CompositeNode()
     h.configure({'name':'columns','parent':p})
     c = PeriodicAverageColumn()
     c.configure({'position':0, 'name':'0', 'parent':h,
                  'function':self._random, 'args':()})
     p.start()
     try:
         for i in range(0,1000):
             c.function()
     finally:
         p.stop()
     return
Ejemplo n.º 4
0
 def test_configure_random(self):
     p = PeriodicLog()
     p.configure({'name': 'log', 'parent': None, 'period': 1})
     h = CompositeNode()
     h.configure({'name': 'columns', 'parent': p})
     c = PeriodicAverageColumn()
     c.configure({
         'position': 0,
         'name': '0',
         'parent': h,
         'function': self._random,
         'args': ()
     })
     p.start()
     try:
         for i in range(0, 1000):
             c.function()
     finally:
         p.stop()
     return