本文整理汇总了Python中utils.check_re函数的典型用法代码示例。如果您正苦于以下问题:Python check_re函数的具体用法?Python check_re怎么用?Python check_re使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_re函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_simple
def test_simple():
module_wolfram_alpha.init(bot)
query = "42"
# Wolfram Alpha seems to randomly return also Roman numerals
regex = u"(42 = forty-two|forty-two = XLII)"
result = module_wolfram_alpha.command_wa(bot, None, "#channel", query)[1]
check_re(regex, result)
示例2: test_liveleak
def test_liveleak():
regex = "Title: (.*?) by (.*?) \[%s views - Jul-23-2013 - tags\: sword, cut, hand, watermelon, fail\]" % (
views_str_regex
)
msg = "http://www.liveleak.com/view?i=f8e_1374614129"
module_urltitle.init(bot)
check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
示例3: test_areena_not_available
def test_areena_not_available(botmock):
regex = u"Title: (.*?) \[%s - %s - not available\]" % (
length_str_regex,
age_str_regex,
)
msg = "http://areena.yle.fi/1-2372901"
check_re(regex, module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
示例4: test_areena_tv_exiting
def test_areena_tv_exiting(botmock):
regex = u"Title: (.*?) \[%s - %s( - exits in %s)?\]" % (
length_str_regex,
age_str_regex,
age_str_regex,
)
msg = "http://areena.yle.fi/1-3093932"
check_re(regex, module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
示例5: test_youtube
def test_youtube():
regex = "Title: (.*?) by (.*?) \[%s - %s views - %s( - age restricted)?\]" % (
lengh_str_regex,
views_str_regex,
age_str_regex,
)
msg = "http://www.youtube.com/watch?v=awsolTK175c"
module_urltitle.init(bot)
check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
示例6: test_areena_tv_exiting_in_far_far_future
def test_areena_tv_exiting_in_far_far_future(botmock):
from datetime import datetime
if datetime.utcnow() < datetime(2098, 1, 1):
regex = u'Title: Kummeli - 5x03 \[%s - %s\]' % (length_str_regex, age_str_regex)
else:
regex = u'Title: Kummeli - 5x03 \[%s - %s( - exits in %s)?\]' % (length_str_regex, age_str_regex, age_str_regex)
msg = "http://areena.yle.fi/1-1823488"
check_re(regex, module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
示例7: test_vimeo
def test_vimeo():
regex = "Title: (.*?) by (.*?) \[%s - %s likes - %s views - %s]" % (
lengh_str_regex,
views_str_regex,
views_str_regex,
age_str_regex,
)
msg = "http://vimeo.com/29996808"
module_urltitle.init(bot)
check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
示例8: test_areena_live
def test_areena_live(botmock):
regex = u"Title: Yle TV2 - (.*?)( <http://areena.yle.fi/\d-\d+>)? \(LIVE\)"
msg = "http://areena.yle.fi/tv/suora/tv2"
check_re(regex, module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
示例9: test_youtube
def test_youtube(botmock):
regex = 'Title: (.*?) by (.*?) \[%s - %s views - %s( - age restricted)?\]' % (lengh_str_regex, views_str_regex, age_str_regex)
msg = "http://www.youtube.com/watch?v=awsolTK175c"
module_urltitle.init(botmock)
check_re(regex, __handle_url(botmock, msg))
示例10: test_gfycat_reddit_title
def test_gfycat_reddit_title(botmock):
regex = "Title: California Sunset \(/r/NatureGifs\) [email protected] \d+ views"
msg = "http://www.gfycat.com/ZanyFragrantHoneyeater"
check_re(regex, __handle_url(botmock, msg))
示例11: test_areena_series
def test_areena_series(botmock):
regex = u"Title: Kummeli \[SERIES - 54 episodes - latest episode: %s\]" % (
age_str_regex
)
msg = "http://areena.yle.fi/1-3339547"
check_re(regex, module_urltitle.handle_url(botmock, None, "#channel", msg, msg)[1])
示例12: test_add_feed
def test_add_feed():
check_re(
r'feed added with \d+ items',
command_rss(bot, ADMIN_USER, '#pyfibot', 'add http://feeds.feedburner.com/ampparit-kaikki?format=xml')[1]
)
示例13: test_gfycat_own_title
def test_gfycat_own_title(botmock):
regex = "Title: Star Trail's in the Desert [email protected] \d+ views"
msg = "https://www.gfycat.com/EcstaticWelllitHarpseal"
check_re(regex, __handle_url(botmock, msg))
示例14: test_areena_live
def test_areena_live():
regex = u'Title: Yle TV2 - (.*?)( <http://areena.yle.fi/\d-\d+>)? \(LIVE\)'
msg = "http://areena.yle.fi/tv/suora/tv2"
module_urltitle.init(bot)
check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
示例15: test_alko
def test_alko():
regex = u'Title: Sandels IV A tölkki \[\d\.\d\de, \d\.\d\dl, \d\.\d\de/l, oluet, 5\.30\%\]'
msg = 'http://www.alko.fi/tuotteet/798684/'
module_urltitle.init(bot)
check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])