test_OutPortPullConnector.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- Python -*-
3 
4 #
5 # \file test_OutPortPullConnector.py
6 # \brief test for OutPortPullConnector class
7 # \date $Date: 2007/09/19$
8 # \author Shinji Kurihara
9 #
10 # Copyright (C) 2006
11 # Noriaki Ando
12 # Task-intelligence Research Group,
13 # Intelligent Systems Research Institute,
14 # National Institute of
15 # Advanced Industrial Science and Technology (AIST), Japan
16 # All rights reserved.
17 #
18 
19 import sys
20 sys.path.insert(1,"../")
21 
22 from omniORB import *
23 from omniORB import any
24 
25 import unittest
26 from OutPortPullConnector import *
27 
28 import RTC, RTC__POA
29 
30 import OpenRTM_aist
31 
32 class MyBuffer:
33  def __init__(self):
34  self._data = None
35  return
36 
37  def write(self, data):
38  self._data = data
39  return
40 
41  def read(self):
42  return self._data
43 
44  def init(self,info):
45  pass
46 
47 class OutPortProviderMock:
48  _buffer = None
49  _prop = None
50 
51  def init(self, prop):
52  self._prop = prop
53 
54  def setBuffer(self, buff):
55  self._buffer = buff
56 
57  def setListener(self, info, listener):
58  pass
59 
60  def setConnector(self, con):
61  pass
62 
63 
64 class TestOutPortPullConnector(unittest.TestCase):
65  def setUp(self):
66  self._buffer = MyBuffer()
68  "id",
69  ["in","out"],
71 
73  return
74 
75  def test_write(self):
76  self._oc.write(123)
77  # self.assertEqual(self._buffer.read(), 123)
78  return
79 
80 
81  def test_disconnect(self):
82  self.assertEqual(self._oc.disconnect(), OpenRTM_aist.DataPortStatus.PORT_OK)
83  return
84 
85 
86  def test_getBuffer(self):
87  self.assertEqual(self._oc.getBuffer(),self._buffer)
88  return
89 
90 
91 
92 if __name__ == '__main__':
93  unittest.main()
The Properties class represents a persistent set of properties.
Definition: Properties.py:83


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