Robot Framework
expandkeywordmatcher.py
Go to the documentation of this file.
1
# Copyright 2008-2015 Nokia Networks
2
# Copyright 2016- Robot Framework Foundation
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
# http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
16
from
robot.utils
import
MultiMatcher, is_list_like
17
18
19
class
ExpandKeywordMatcher
:
20
21
def
__init__
(self, expand_keywords):
22
self.
matched_ids
matched_ids = []
23
if
not
expand_keywords:
24
expand_keywords = []
25
elif
not
is_list_like
(expand_keywords):
26
expand_keywords = [expand_keywords]
27
names = [n[5:]
for
n
in
expand_keywords
if
n[:5].lower() ==
'name:'
]
28
tags = [p[4:]
for
p
in
expand_keywords
if
p[:4].lower() ==
'tag:'
]
29
self.
_match_name
_match_name = MultiMatcher(names).match
30
self.
_match_tags
_match_tags = MultiMatcher(tags).match_any
31
32
def
match
(self, kw):
33
if
((kw.passed
or
kw.skipped)
34
and
(self.
_match_name
_match_name(kw.name
or
''
)
or
self.
_match_tags
_match_tags(kw.tags))):
35
self.
matched_ids
matched_ids.append(kw.id)
robot.reporting.expandkeywordmatcher.ExpandKeywordMatcher
Definition:
expandkeywordmatcher.py:19
robot.reporting.expandkeywordmatcher.ExpandKeywordMatcher.matched_ids
matched_ids
Definition:
expandkeywordmatcher.py:22
robot.reporting.expandkeywordmatcher.ExpandKeywordMatcher.match
def match(self, kw)
Definition:
expandkeywordmatcher.py:32
robot.reporting.expandkeywordmatcher.ExpandKeywordMatcher._match_tags
_match_tags
Definition:
expandkeywordmatcher.py:30
robot.reporting.expandkeywordmatcher.ExpandKeywordMatcher.__init__
def __init__(self, expand_keywords)
Definition:
expandkeywordmatcher.py:21
robot.reporting.expandkeywordmatcher.ExpandKeywordMatcher._match_name
_match_name
Definition:
expandkeywordmatcher.py:29
robot.utils.robottypes.is_list_like
def is_list_like(item)
Definition:
robottypes.py:66
robot.utils
Definition:
__init__.py:1
src
robot
reporting
expandkeywordmatcher.py
Generated by
1.9.1