test_Timer.py
Go to the documentation of this file.
1 #!/usr/bin/env/python
2 # -*- Python -*-
3 
4 #
5 # \file Timer.py
6 # \brief Timer class
7 # \date $Date: $
8 # \author Noriaki Ando <n-ando@aist.go.jp>
9 #
10 # Copyright (C) 2007
11 # Task-intelligence Research Group,
12 # Intelligent Systems Research Institute,
13 # National Institute of
14 # Advanced Industrial Science and Technology (AIST), Japan
15 # All rights reserved.
16 #
17 
18 import sys,time
19 sys.path.insert(1,"../")
20 
21 import unittest
22 import OpenRTM_aist
23 
24 from Timer import *
25 
26 
27 class test:
28  def func(self):
29  print "test.hello."
30 
31  def invoke(self):
32  print "test invoke"
33 
34 class TestTimer(unittest.TestCase):
35  def setUp(self):
37 
38  def tearDown(self):
39  self.tm.__del__()
40  OpenRTM_aist.Manager.instance().shutdownManager()
41  time.sleep(0.1)
42 
43  def test_start_stop(self):
44  self.tm.start()
45  self.tm.stop()
46 
47 
48  def test_invoke(self):
49  self.tm.registerListenerFunc(test().func, OpenRTM_aist.TimeValue())
50  self.tm.registerListenerFunc(test().func, OpenRTM_aist.TimeValue())
51  self.tm.invoke()
52 
53 
55  self.tm.registerListener(test(), OpenRTM_aist.TimeValue())
56  self.tm.invoke()
57  pass
58 
59 
61  self.tm.registerListenerObj(test(), test.func, OpenRTM_aist.TimeValue())
62  self.tm.invoke()
63 
64 
66  self.tm.registerListenerFunc(test().func, OpenRTM_aist.TimeValue())
67  self.tm.invoke()
68 
69 
71  obj = OpenRTM_aist.ListenerObject(test(),test.func)
72  self.tm.registerListener(obj, OpenRTM_aist.TimeValue())
73  self.assertEqual(self.tm.unregisterListener(obj),True)
74  self.assertEqual(self.tm.unregisterListener(obj),False)
75 
76 
77 
78 if __name__ == '__main__':
79  unittest.main()
ListenerObject class.
Definition: Listener.py:66
def invoke(self)
Definition: test_Timer.py:31
def test_invoke(self)
Definition: test_Timer.py:48
def func(self)
Definition: test_Timer.py:28
def test_registerListenerObj(self)
Definition: test_Timer.py:60
def test_start_stop(self)
Definition: test_Timer.py:43
def test_unregisterListener(self)
Definition: test_Timer.py:70
def test_registerListenerFunc(self)
Definition: test_Timer.py:65
def tearDown(self)
Definition: test_Timer.py:38
def test_registerListener(self)
Definition: test_Timer.py:54


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Mon Feb 28 2022 23:01:07