本文整理汇总了Python中robot.model.tagstatistics.TagStatLink类的典型用法代码示例。如果您正苦于以下问题:Python TagStatLink类的具体用法?Python TagStatLink怎么用?Python TagStatLink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TagStatLink类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_link_returns_correct_link_when_matches
def test_get_link_returns_correct_link_when_matches(self):
for arg, exp in [(('smoke', 'http://tobacco.com', 'Lung_cancer'),
('http://tobacco.com', 'Lung cancer')),
(('tag', 'ftp://foo:809/bar.zap', 'Foo_in a Bar'),
('ftp://foo:809/bar.zap', 'Foo in a Bar'))]:
link = TagStatLink(*arg)
assert_equal(exp, link.get_link(arg[0]))
示例2: test_matches_are_ignored_in_pattern_substitution
def test_matches_are_ignored_in_pattern_substitution(self):
link = TagStatLink('???-*-*-?', '%4-%2-%2-%4', 'Tracker')
assert_equal(link.get_link('AAA-XXX-ABC-B'), ('B-XXX-XXX-B', 'Tracker'))
示例3: test_pattern_substitution_with_multiple_substitutions
def test_pattern_substitution_with_multiple_substitutions(self):
link = TagStatLink('??-?-*', '%3-%3-%1-%2-%3', 'Tracker')
assert_equal(link.get_link('aa-b-XXX'), ('XXX-XXX-aa-b-XXX', 'Tracker'))
示例4: test_pattern_substitution_with_multiple_matches
def test_pattern_substitution_with_multiple_matches(self):
link = TagStatLink('?-*', 'http://tracker/?id=%1-%2', 'Tracker')
for id1, id2 in [('1', '2'), ('3', '45'), ('f', 'bar')]:
exp = ('http://tracker/?id=%s-%s' % (id1, id2), 'Tracker')
assert_equal(exp, link.get_link('%s-%s' % (id1, id2)))
示例5: test_pattern_substitution_with_one_match
def test_pattern_substitution_with_one_match(self):
link = TagStatLink('tag-*', 'http://tracker/?id=%1', 'Tracker')
for id in ['1', '23', '456']:
exp = ('http://tracker/?id=%s' % id, 'Tracker')
assert_equal(exp, link.get_link('tag-%s' % id))
示例6: test_pattern_match
def test_pattern_match(self):
link = TagStatLink('f?o*r', 'http://foo/bar.html', 'FooBar')
for tag in ['foobar', 'foor', 'f_ofoobarfoobar', 'fOoBAr']:
assert_equal(link.get_link(tag), ('http://foo/bar.html', 'FooBar'))
示例7: test_pattern_matches_when_spaces
def test_pattern_matches_when_spaces(self):
exp = 'http://tobacco.com', 'Lung cancer'
link = TagStatLink('smoking kills', *exp)
for tag in ['Smoking Kills', 'SMOKING KILLS']:
assert_equal(exp, link.get_link(tag))
示例8: test_pattern_matches_case_insensitively
def test_pattern_matches_case_insensitively(self):
exp = 'http://tobacco.com', 'Lung cancer'
link = TagStatLink('smoke', *exp)
for tag in ['Smoke', 'SMOKE', 'smoke']:
assert_equal(exp, link.get_link(tag))
示例9: test_get_link_returns_none_when_no_match
def test_get_link_returns_none_when_no_match(self):
link = TagStatLink('smoke', 'http://tobacco.com', 'Lung cancer')
for tag in ['foo', 'b a r', 's moke']:
assert_none(link.get_link(tag))