1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00
This commit is contained in:
eternnoir 2015-07-22 14:12:56 +08:00
parent 53769f9e8c
commit f513270971

View File

@ -36,12 +36,15 @@ def test_message_handler():
time.sleep(1)
assert msg.text == 'got'
def test_message_handler_reg():
bot = telebot.TeleBot('')
msg = create_text_message(r'https://web.telegram.org/')
@bot.message_handler(regexp='((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)')
def command_url(message):
msg.text = 'got'
bot.process_new_messages([msg])
time.sleep(1)
assert msg.text == 'got'
@ -50,9 +53,11 @@ def test_message_handler_reg():
def test_message_handler_reg_fail():
bot = telebot.TeleBot('')
msg = create_text_message(r'web.telegram.org/')
@bot.message_handler(regexp='((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)')
def command_url(message):
msg.text = 'got'
bot.process_new_messages([msg])
time.sleep(1)
assert not msg.text == 'got'
@ -136,4 +141,3 @@ def test_is_string_string():
def test_not_string():
i1 = 10
assert not apihelper.is_string(i1)