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 
20 
21  def __init__(self, expand_keywords):
22  self.matched_idsmatched_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_idsmatched_ids.append(kw.id)
def is_list_like(item)
Definition: robottypes.py:66