當前位置: 首頁>>代碼示例>>Python>>正文


Python utils.MultiMatcher類代碼示例

本文整理匯總了Python中robot.utils.MultiMatcher的典型用法代碼示例。如果您正苦於以下問題:Python MultiMatcher類的具體用法?Python MultiMatcher怎麽用?Python MultiMatcher使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了MultiMatcher類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_include

 def test_include(self):
     for incl, tags in self._incl_excl_data:
         builder = TagStatisticsBuilder(Criticality(), incl, [])
         builder.add_test(TestCase(status='PASS', tags=tags))
         matcher = MultiMatcher(incl, match_if_no_patterns=True)
         expected = [tag for tag in tags if matcher.match(tag)]
         assert_equal([s.name for s in builder.stats], sorted(expected))
開發者ID:synsun,項目名稱:robotframework,代碼行數:7,代碼來源:test_tagstatistics.py

示例2: test_exclude

 def test_exclude(self):
     for excl, tags in self._incl_excl_data:
         builder = TagStatisticsBuilder(excluded=excl)
         builder.add_test(TestCase(status='PASS', tags=tags))
         matcher = MultiMatcher(excl)
         expected = [tag for tag in tags if not matcher.match(tag)]
         assert_equal([s.name for s in builder.stats], sorted(expected))
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:7,代碼來源:test_tagstatistics.py

示例3: __init__

 def __init__(self, include=None, exclude=None, combine=None, docs=None,
              links=None):
     self.stats = NormalizedDict(ignore=['_'])
     self._include = MultiMatcher(include, ignore=['_'])
     self._exclude = MultiMatcher(exclude, ignore=['_'])
     self._combine = combine or []
     info = TagStatInfo(docs or [], links or [])
     self._get_doc = info.get_doc
     self._get_links = info.get_links
開發者ID:AppsFuel,項目名稱:sublime-robot-plugin,代碼行數:9,代碼來源:statistics.py

示例4: FlattenKeywordMatcher

class FlattenKeywordMatcher(object):

    def __init__(self, flattened):
        self._types = []
        names = self._yield_names_and_set_types(flattened, self._types)
        self._name_matcher = MultiMatcher(names)

    def _yield_names_and_set_types(self, flattened, types):
        if isinstance(flattened, basestring):
            flattened = [flattened]
        for flat in flattened:
            upper = flat.upper()
            if upper in ('FOR', 'FORITEM'):
                types.append(flat.lower())
            elif upper.startswith('NAME:'):
                yield flat[5:]
            else:
                raise DataError("Expected 'FOR', 'FORITEM', or "
                                "'NAME:<pattern>' but got '%s'." % flat)

    def match_name(self, kwname, libname=None):
        name = '%s.%s' % (libname, kwname) if libname else kwname
        return self._name_matcher.match(name)

    def match_type(self, kwtype):
        return kwtype in self._types
開發者ID:Pascale22,項目名稱:robotframework,代碼行數:26,代碼來源:flattenkeywordmatcher.py

示例5: FlattenByNameMatcher

class FlattenByNameMatcher(object):

    def __init__(self, flatten):
        if not is_list_like(flatten):
            flatten = [flatten]
        names = [n[5:] for n in flatten if n[:5].lower() == 'name:']
        self._matcher = MultiMatcher(names)

    def match(self, kwname, libname=None):
        name = '%s.%s' % (libname, kwname) if libname else kwname
        return self._matcher.match(name)

    def __nonzero__(self):
        return bool(self._matcher)
開發者ID:toonst,項目名稱:robotframework,代碼行數:14,代碼來源:flattenkeywordmatcher.py

示例6: _NamePatterns

class _NamePatterns(object):

    def __init__(self, patterns=None):
        self._matcher = MultiMatcher(patterns, ignore=['_'])

    def match(self, name, longname=None):
        return self._match(name) or longname and self._match_longname(longname)

    def _match(self, name):
        return self._matcher.match(name)

    def _match_longname(self, name):
        raise NotImplementedError

    def __nonzero__(self):
        return bool(self._matcher)
開發者ID:Acidburn0zzz,項目名稱:RIDE,代碼行數:16,代碼來源:namepatterns.py

示例7: FlattenKeywordMatcher

class FlattenKeywordMatcher(object):
    def __init__(self, flattened):
        self._types = []
        names = self._yield_names_and_set_types(flattened, self._types)
        self._name_matcher = MultiMatcher(names)

    def _yield_names_and_set_types(self, flattened, types):
        if isinstance(flattened, string_types):
            flattened = [flattened]
        for flat in flattened:
            upper = flat.upper()
            if upper in ("FOR", "FORITEM"):
                types.append(flat.lower())
            elif upper.startswith("NAME:"):
                yield flat[5:]
            else:
                raise DataError("Expected 'FOR', 'FORITEM', or " "'NAME:<pattern>' but got '%s'." % flat)

    def match(self, name, type):
        return self._name_matcher.match(name) or type in self._types
開發者ID:userzimmermann,項目名稱:robotframework-python3,代碼行數:20,代碼來源:flattenkeywordmatcher.py

示例8: search

 def search(self, patterns):
     matcher = MultiMatcher(patterns, match_if_no_patterns=True)
     for kw in self._keywords:
         if matcher.match(kw.name):
             yield kw
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:5,代碼來源:consoleviewer.py

示例9: __init__

 def __init__(self, flatten):
     if not is_list_like(flatten):
         flatten = [flatten]
     names = [n[5:] for n in flatten if n[:5].lower() == 'name:']
     self._matcher = MultiMatcher(names)
開發者ID:toonst,項目名稱:robotframework,代碼行數:5,代碼來源:flattenkeywordmatcher.py

示例10: test_regexp_match_any

 def test_regexp_match_any(self):
     matcher = MultiMatcher(['H.llo', 'w.*'], regexp=True)
     assert matcher.match_any(('Hi', 'world'))
     assert matcher.match_any(['jam', 'is', 'hillo'])
     assert not matcher.match_any(('no', 'match', 'here'))
     assert not matcher.match_any(())
開發者ID:HelioGuilherme66,項目名稱:robotframework,代碼行數:6,代碼來源:test_match.py

示例11: test_match_any

 def test_match_any(self):
     matcher = MultiMatcher(['H?llo', 'w*'])
     assert matcher.match_any(('Hi', 'world'))
     assert matcher.match_any(['jam', 'is', 'hillo'])
     assert not matcher.match_any(('no', 'match', 'here'))
     assert not matcher.match_any(())
開發者ID:HelioGuilherme66,項目名稱:robotframework,代碼行數:6,代碼來源:test_match.py

示例12: test_match_regexp_pattern

 def test_match_regexp_pattern(self):
     matcher = MultiMatcher(['xxx', 'f.*'], ignore='_:', regexp=True)
     assert matcher.match('xxx')
     assert matcher.match('foo')
     assert matcher.match('__::FOO::__')
     assert not matcher.match('bar')
開發者ID:HelioGuilherme66,項目名稱:robotframework,代碼行數:6,代碼來源:test_match.py

示例13: test_match_pattern

 def test_match_pattern(self):
     matcher = MultiMatcher(['xxx', 'f*'], ignore='.:')
     assert matcher.match('xxx')
     assert matcher.match('foo')
     assert matcher.match('..::FOO::..')
     assert not matcher.match('bar')
開發者ID:HelioGuilherme66,項目名稱:robotframework,代碼行數:6,代碼來源:test_match.py

示例14: __init__

 def __init__(self, flattened):
     self._types = []
     names = self._yield_names_and_set_types(flattened, self._types)
     self._name_matcher = MultiMatcher(names)
開發者ID:Pascale22,項目名稱:robotframework,代碼行數:4,代碼來源:flattenkeywordmatcher.py

示例15: __init__

 def __init__(self, patterns=None):
     self._matcher = MultiMatcher(patterns, ignore=['_'])
開發者ID:userzimmermann,項目名稱:robotframework-python3,代碼行數:2,代碼來源:namepatterns.py


注:本文中的robot.utils.MultiMatcher類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。