test_rqt_ros_graph.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 
3 # Software License Agreement (BSD License)
4 #
5 # Copyright (c) 2012, Willow Garage, Inc.
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 #
12 # * Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # * Redistributions in binary form must reproduce the above
15 # copyright notice, this list of conditions and the following
16 # disclaimer in the documentation and/or other materials provided
17 # with the distribution.
18 # * Neither the name of Willow Garage, Inc. nor the names of its
19 # contributors may be used to endorse or promote products derived
20 # from this software without specific prior written permission.
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 # POSSIBILITY OF SUCH DAMAGE.
34 #
35 # Author: Isaac Saito
36 
37 import unittest
38 
39 from python_qt_binding.QtGui import QStandardItem, QStandardItemModel
40 from rqt_reconfigure.rqt_ros_graph import RqtRosGraph
41 
42 
43 class TestRqtRosGraph(unittest.TestCase):
44 
45  """
46  :author: Isaac Saito
47  """
48 
49  def setUp(self):
50  unittest.TestCase.setUp(self)
51 
52  self._model = QStandardItemModel()
53  node1 = QStandardItem('node1')
54  self._node1_1 = QStandardItem('node1_1')
55  self._node1_1_1 = QStandardItem('node1_1_1')
56  node1_1_2 = QStandardItem('node1_1_2')
57  node1_2 = QStandardItem('node1_2')
58 
59  node1.appendRow(self._node1_1)
60  self._node1_1.appendRow(self._node1_1_1)
61  self._node1_1.appendRow(node1_1_2)
62  node1.appendRow(node1_2)
63 
64  self._model.appendRow(node1)
65 
66  # node_list = [node1, node1_1, self._node1_1_1, node1_1_2, node1_2]
67  # self._model.appendRow(node_list)
68 
69  self._grn_node1_1_1 = '/node1/node1_1/node1_1_1'
71 
72  def tearDown(self):
73  unittest.TestCase.tearDown(self)
74  del self._model
75 
76  def test_get_upper_grn(self):
77  self.assertEqual(RqtRosGraph.get_upper_grn(self._node1_1_1.index(), ''),
78  self._grn_node1_1_1)
79 
81  self.assertEqual(
82  len(RqtRosGraph.get_lower_grn_dfs(self._node1_1.index(), '')), self._len_lower_grn_node1_1)
83 
84  def test_get_full_grn(self):
85  self.assertEqual(RqtRosGraph.get_full_grn(self._node1_1_1.index()),
86  self._grn_node1_1_1)
87 
88 
89 if __name__ == '__main__':
90  unittest.main()


rqt_py_common
Author(s): Dorian Scholz, Isaac Saito, Dirk Thomas
autogenerated on Mon Mar 22 2021 02:13:26