Example #1
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 = PeriodicDeltaColumn()
     c.configure({
         'position': 0,
         'name': '2',
         'parent': h,
         'function': self._next
     })
     p.start()
     try:
         l = []
         for i in range(0, 100):
             l.append(c.function())
         if l.pop(0) != None:
             raise 'First delta not None.'
         for i in l:
             if i != 1:
                 raise 'Incoreect delta of %s should be %s.' % (i, 1)
     finally:
         p.stop()
     return
Example #2
0
 def test_configure_sequence_get(self):
     p = PeriodicLog()
     p.configure({'name': 'log', 'parent': None, 'period': 1})
     h = CompositeNode()
     h.configure({'name': 'columns', 'parent': p})
     c = PeriodicDeltaColumn()
     c.configure({
         'position': 0,
         'name': '2',
         'parent': h,
         'function': self._next
     })
     p.start()
     try:
         l = []
         if c.get() != None:
             raise 'Get didn\'t return None on first get'
         if c.get() != None:
             raise 'Get didn\'t return None on second get'
         self.seq.value = 0
         c.function()
         self._next()
         self._next()
         self._next()
         if c.get() != self.seq.value - 1:
             raise 'Got incorrect value after incrementing'
     finally:
         p.stop()
     return
 def test_configure_sequence_get(self):
     p = PeriodicLog()
     p.configure({'name':'log','parent':None, 'period':1})
     h = CompositeNode()
     h.configure({'name':'columns','parent':p})
     c = PeriodicDeltaColumn()
     c.configure({'position':0, 'name':'2', 'parent':h,
                  'function':self._next})
     p.start()
     try:
         l = []
         if c.get() != None:
             raise 'Get didn\'t return None on first get'
         if c.get() != None:
             raise 'Get didn\'t return None on second get'
         self.seq.value = 0
         c.function()
         self._next()
         self._next()
         self._next()
         if c.get() != self.seq.value - 1:
             raise 'Got incorrect value after incrementing'
     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 = PeriodicDeltaColumn()
     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
 def test_configure_sequence(self):
     p = PeriodicLog()
     p.configure({'name':'log','parent':None, 'period':1})
     h = CompositeNode()
     h.configure({'name':'columns','parent':p})
     c = PeriodicDeltaColumn()
     c.configure({'position':0, 'name':'2', 'parent':h,
                  'function':self._next})
     p.start()
     try:
         l = []
         for i in range(0,100):
             l.append(c.function())
         if l.pop(0) != None:
             raise 'First delta not None.'
         for i in l:
             if i != 1:
                 raise 'Incoreect delta of %s should be %s.' % (i, 1)
     finally:
         p.stop()
     return
Example #6
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 = PeriodicDeltaColumn()
     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
Example #7
0
 def configuration(self):
     cd = PeriodicDeltaColumn.configuration(self)
     for attr_name, conv, def_val in self.attr_names:
         get_attribute(self, attr_name, cd, conv)
     return cd
Example #8
0
 def configure(self, cd):
     PeriodicDeltaColumn.configure(self, cd)
     for attr_name, conv, def_val in self.attr_names:
         set_attribute(self, attr_name, def_val, cd, conv)
     return
Example #9
0
 def configure(self, cd):
     PeriodicDeltaColumn.configure(self, cd)
     for attr_name,conv,def_val in self.attr_names:
         set_attribute(self, attr_name, def_val, cd, conv)
     return
Example #10
0
 def configuration(self):
     cd = PeriodicDeltaColumn.configuration(self)
     for attr_name,conv,def_val in self.attr_names:
         get_attribute(self, attr_name, cd, conv)
     return cd
Example #11
0
 def configure(self, cd):
     PeriodicDeltaColumn.configure(self, cd)
     set_attribute(self, 'mmafmt_channel_id', REQUIRED, cd, str)
     set_attribute(self, 'mmafmt_channel_label', REQUIRED, cd, str)
     set_attribute(self, 'mmafmt_channel_pos', '', cd, stripped_str)
     return
Example #12
0
 def __init__(self, *args, **kw):
     from mpx.lib import deprecated
     PeriodicDeltaColumn.__init__(self, *args, **kw)
     deprecated("Update configuration to use the MeterMailColumnDecorator.")
     return
Example #13
0
 def configuration(self):
     cd = PeriodicDeltaColumn.configuration(self)
     get_attribute(self, 'mmafmt_channel_id', cd, str)
     get_attribute(self, 'mmafmt_channel_label', cd, str)
     get_attribute(self, 'mmafmt_channel_pos', cd, str)
     return cd
Example #14
0
 def __init__(self, *args, **kw):
     from mpx.lib import deprecated
     PeriodicDeltaColumn.__init__(self, *args, **kw)
     deprecated("Update configuration to use the MeterMailColumnDecorator.")
     return
Example #15
0
 def configuration(self):
     cd = PeriodicDeltaColumn.configuration(self)
     get_attribute(self, 'mmafmt_channel_id', cd, str)
     get_attribute(self, 'mmafmt_channel_label', cd, str)
     get_attribute(self, 'mmafmt_channel_pos', cd, str)
     return cd
Example #16
0
 def configure(self, cd):
     PeriodicDeltaColumn.configure(self, cd)
     set_attribute(self, 'mmafmt_channel_id', REQUIRED, cd, str)
     set_attribute(self, 'mmafmt_channel_label', REQUIRED, cd, str)
     set_attribute(self, 'mmafmt_channel_pos', '', cd, stripped_str)
     return