Main Page
Namespaces
Classes
Files
File List
test
test_text_filter.py
Go to the documentation of this file.
1
# Copyright (c) 2012, Willow Garage, Inc.
2
# All rights reserved.
3
#
4
# Software License Agreement (BSD License 2.0)
5
#
6
# Redistribution and use in source and binary forms, with or without
7
# modification, are permitted provided that the following conditions
8
# are met:
9
#
10
# * Redistributions of source code must retain the above copyright
11
# notice, this list of conditions and the following disclaimer.
12
# * Redistributions in binary form must reproduce the above
13
# copyright notice, this list of conditions and the following
14
# disclaimer in the documentation and/or other materials provided
15
# with the distribution.
16
# * Neither the name of Willow Garage, Inc. nor the names of its
17
# contributors may be used to endorse or promote products derived
18
# from this software without specific prior written permission.
19
#
20
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
# POSSIBILITY OF SUCH DAMAGE.
32
#
33
# Author: Isaac Saito
34
35
import
unittest
36
37
from
python_qt_binding.QtCore
import
QRegExp, Qt
38
39
from
rqt_reconfigure.text_filter
import
TextFilter
40
41
42
class
MyTest
(unittest.TestCase):
43
_query_text =
'filter'
44
_filtered_text =
'filtered_text'
45
46
def
setUp
(self):
47
unittest.TestCase.setUp(self)
48
49
syntax_nr = QRegExp.RegExp
50
syntax = QRegExp.PatternSyntax(syntax_nr)
51
self.
_regExp
= QRegExp(self.
_query_text
, Qt.CaseInsensitive, syntax)
52
53
self.
_filter
=
TextFilter
(self.
_regExp
)
54
self._filter.set_text(self.
_query_text
)
55
56
def
tearDown
(self):
57
unittest.TestCase.tearDown(self)
58
59
def
test_test_message
(self):
60
"""Testing test_message method."""
61
result_regex = self._filter.test_message(self.
_filtered_text
)
62
print(
'result_regex={}'
.format(result_regex))
63
self.assertEqual(result_regex,
64
True
# Both _query_text & filtered_text overlaps.
65
)
rqt_reconfigure.text_filter.TextFilter
Definition:
text_filter.py:40
test.test_text_filter.MyTest._filter
_filter
Definition:
test_text_filter.py:53
test.test_text_filter.MyTest
Definition:
test_text_filter.py:42
test.test_text_filter.MyTest.tearDown
def tearDown(self)
Definition:
test_text_filter.py:56
test.test_text_filter.MyTest._regExp
_regExp
Definition:
test_text_filter.py:51
test.test_text_filter.MyTest._filtered_text
string _filtered_text
Definition:
test_text_filter.py:44
test.test_text_filter.MyTest.setUp
def setUp(self)
Definition:
test_text_filter.py:46
rqt_reconfigure.text_filter
Definition:
text_filter.py:1
test.test_text_filter.MyTest._query_text
string _query_text
Definition:
test_text_filter.py:43
test.test_text_filter.MyTest.test_test_message
def test_test_message(self)
Definition:
test_text_filter.py:59
rqt_reconfigure
Author(s): Isaac Saito, Ze'ev Klapow
autogenerated on Sat Mar 20 2021 02:51:58