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


Python tagstatistics.TagStatisticsBuilder類代碼示例

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


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

示例1: 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

示例2: test_tags_equal_to_critical_or_non_critical_pattern_are_not_removed

 def test_tags_equal_to_critical_or_non_critical_pattern_are_not_removed(self):
     builder = TagStatisticsBuilder(Criticality('sORry'))
     builder.add_test(TestCase(tags=['sorry']))
     builder.add_test(TestCase(tags=['s OR ry']))
     assert_equal([(s.name, s.info, s.total) for s in builder.stats],
                  [('s OR ry', 'critical', 0),
                   ('sorry', '', 2)])
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:7,代碼來源:test_tagstatistics.py

示例3: test_pattern

 def test_pattern(self):
     builder = TagStatisticsBuilder(docs=[('t?', '*doc*')])
     builder.add_test(TestCase(tags=['t1', 'T2']))
     builder.add_test(TestCase(tags=['_t__1_', 'T 3']))
     self._verify_stats(builder.stats.tags['t1'], '*doc*', 2)
     self._verify_stats(builder.stats.tags['t2'], '*doc*', 1)
     self._verify_stats(builder.stats.tags['t3'], '*doc*', 1)
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:7,代碼來源:test_tagstatistics.py

示例4: test_combine

 def test_combine(self):
     # This is more like an acceptance test than a unit test ...
     for comb_tags, tests_tags, crit_tags in [
             (['t1&t2'], [['t1','t2','t3'],['t1','t3']], []),
             (['1&2&3'], [['1','2','3'],['1','2','3','4']], ['1','2']),
             (['1&2','1&3'], [['1','2','3'],['1','3'],['1']], ['1']),
             (['t*'], [['t1','x','y'],['tee','z'],['t']], ['x']),
             (['t?&s'], [['t1','s'],['tt','s','u'],['tee','s'],['s']], []),
             (['t*&s','*'], [['s','t','u'],['tee','s'],[],['x']], []),
             (['tNOTs'], [['t','u'],['t','s']], []),
             (['tNOTs','t&s','tNOTsNOTu', 't&sNOTu'],
               [['t','u'],['t','s'],['s','t','u'],['t'],['t','v']], ['t']),
             (['nonex'], [['t1'],['t1,t2'],[]], [])
             ]:
         # 1) Create tag stats
         builder = TagStatisticsBuilder(Criticality(crit_tags),
                                        combined=[(t, '') for t in comb_tags])
         all_tags = []
         for tags in tests_tags:
             builder.add_test(TestCase(status='PASS', tags=tags),)
             all_tags.extend(tags)
         # 2) Actual values
         names = [stat.name for stat in builder.stats]
         # 3) Expected values
         exp_crit = []; exp_noncr = []
         for tag in Tags(all_tags):
             if tag in crit_tags:
                 exp_crit.append(tag)
             else:
                 exp_noncr.append(tag)
         exp_names = exp_crit + sorted(comb_tags) + exp_noncr
         # 4) Verify names (match counts were already verified)
         assert_equal(names, exp_names)
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:33,代碼來源:test_tagstatistics.py

示例5: test_combine_with_same_name_as_existing_tag

 def test_combine_with_same_name_as_existing_tag(self):
     builder = TagStatisticsBuilder(combined=[('x*', 'name')])
     builder.add_test(TestCase(tags=['name', 'another']))
     assert_equal([(s.name, s.combined) for s in builder.stats],
                   [('name', 'x*'),
                    ('another', None),
                    ('name', None)])
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:7,代碼來源:test_tagstatistics.py

示例6: 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

示例7: test_exclude

 def test_exclude(self):
     for excl, tags in self._incl_excl_data:
         builder = TagStatisticsBuilder(Criticality(), [], excl)
         builder.add_test(TestCase(status='PASS', tags=tags))
         expected = [tag for tag in tags
                     if not any(utils.matches(tag, e) for e in excl)]
         assert_equals([s.name for s in builder.stats], sorted(expected))
開發者ID:Senseg,項目名稱:robotframework,代碼行數:7,代碼來源:test_tagstatistics.py

示例8: test_sorting

 def test_sorting(self):
     builder = TagStatisticsBuilder(Criticality(['c2', 'c1'], ['n*']),
                                    combined=[('c*', ''), ('xxx', 'a title')])
     builder.add_test(TestCase(tags=['c1', 'c2', 't1']))
     builder.add_test(TestCase(tags=['c1', 'n2', 't2']))
     builder.add_test(TestCase(tags=['n1', 'n2', 't1', 't3']))
     assert_equal([(s.name, s.info, s.total) for s in builder.stats],
                    [('c1', 'critical', 2), ('c2', 'critical', 1),
                     ('n1', 'non-critical', 1), ('n2', 'non-critical', 2),
                     ('a title', 'combined', 0), ('c*', 'combined', 2),
                     ('t1', '', 2), ('t2', '', 1), ('t3', '', 1)])
開發者ID:synsun,項目名稱:robotframework,代碼行數:11,代碼來源:test_tagstatistics.py

示例9: test_include_and_exclude

 def test_include_and_exclude(self):
     for incl, excl, tags, exp in [
            ([], [], ['t0','t1','t2'], ['t0','t1','t2']),
            (['t1'], ['t2'], ['t0','t1','t2'], ['t1']),
            (['t?'], ['t2'], ['t0','t1','t2','x'], ['t0','t1']),
            (['t?'], ['*2'], ['t0','t1','t2','x2'], ['t0','t1']),
            (['t1','t2'], ['t2'], ['t0','t1','t2'], ['t1']),
            (['t1','t2','t3','not'], ['t2','t0'],
             ['t0','t1','t2','t3','x'], ['t1','t3'] )
           ]:
         builder = TagStatisticsBuilder(included=incl, excluded=excl)
         builder.add_test(TestCase(status='PASS', tags=tags))
         assert_equal([s.name for s in builder.stats], exp),
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:13,代碼來源:test_tagstatistics.py

示例10: test_critical_and_combined

 def test_critical_and_combined(self):
     builder = TagStatisticsBuilder(Criticality('crit', 'nonc'),
                                    combined=[('non*',)],
                                    docs=[('crit', 'critical doc'),
                                          ('non?', 'not so critical doc')])
     crit, nonc, comb = builder.stats
     self._verify_stats(crit, 'critical doc', 0, critical=True)
     self._verify_stats(nonc, 'not so critical doc', 0, non_critical=True)
     self._verify_stats(comb, 'not so critical doc', 0, combined='non*')
     builder.add_test(TestCase(tags=['xxx', 'crit']))
     builder.add_test(TestCase(tags=['Crit', 'NoNo', 'NoNc']))
     crit, nonc, comb, nono, xxx = builder.stats
     self._verify_stats(crit, 'critical doc', 2, critical=True)
     self._verify_stats(nonc, 'not so critical doc', 1, non_critical=True)
     self._verify_stats(comb, 'not so critical doc', 1, combined='non*')
     self._verify_stats(nono, 'not so critical doc', 1)
     self._verify_stats(xxx, '', 1)
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:17,代碼來源:test_tagstatistics.py

示例11: test_iter

 def test_iter(self):
     builder = TagStatisticsBuilder()
     assert_equal(list(builder.stats), [])
     builder.add_test(TestCase())
     assert_equal(list(builder.stats), [])
     builder.add_test(TestCase(tags=['a']))
     assert_equal(len(list(builder.stats)), 1)
     builder.add_test(TestCase(tags=['A', 'B']))
     assert_equal(len(list(builder.stats)), 2)
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:9,代碼來源:test_tagstatistics.py

示例12: test_tags_equal_to_critical_or_non_critical_are_removed_in_iter

 def test_tags_equal_to_critical_or_non_critical_are_removed_in_iter(self):
     builder = TagStatisticsBuilder(Criticality('smoke', 'not-ready'),
                                    combined=[('xxx',)])
     builder.add_test(TestCase(tags=['smoke']))
     builder.add_test(TestCase(tags=['SMOKE', 'not-ready', 'xxx']))
     builder.add_test(TestCase(tags=['_ _ S M O K E _ _', 'X_X_X', 'YYY']))
     assert_equal([(s.name, s.info, s.total) for s in builder.stats],
                  [('smoke', 'critical', 3),
                   ('not-ready', 'non-critical', 1),
                   ('xxx', 'combined', 2),
                   ('xxx', '', 2),
                   ('YYY', '', 1)])
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:12,代碼來源:test_tagstatistics.py

示例13: _verify_combined_statistics

 def _verify_combined_statistics(self, comb_tags, test_tags, expected_count):
     builder = TagStatisticsBuilder(combined=[(comb_tags, 'name')])
     builder.add_test(TestCase(tags=test_tags))
     assert_equal([s.total for s in builder.stats if s.combined], [expected_count])
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:4,代碼來源:test_tagstatistics.py

示例14: test_multiple_matches

 def test_multiple_matches(self):
     builder = TagStatisticsBuilder(docs=[('t_1', 'd1'), ('t?', 'd2')])
     builder.add_test(TestCase(tags=['t1', 't_2']))
     self._verify_stats(builder.stats.tags['t1'], 'd1 & d2', 1)
     self._verify_stats(builder.stats.tags['t2'], 'd2', 1)
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:5,代碼來源:test_tagstatistics.py

示例15: test_simple

 def test_simple(self):
     builder = TagStatisticsBuilder(docs=[('t1', 'doc')])
     builder.add_test(TestCase(tags=['t1', 't2']))
     builder.add_test(TestCase(tags=['T 1']))
     builder.add_test(TestCase(tags=['T_1'], status='PASS'))
     self._verify_stats(builder.stats.tags['t1'], 'doc', 2, 1)
開發者ID:BanerjeeSandipan,項目名稱:robotframework,代碼行數:6,代碼來源:test_tagstatistics.py


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