1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Add test.

This commit is contained in:
eternnoir 2015-09-10 21:44:14 +08:00
parent c213b7732b
commit a8fccdbeb3

View File

@ -9,7 +9,6 @@ import os
import telebot import telebot
from telebot import types from telebot import types
from telebot import apihelper
from telebot import util from telebot import util
should_skip = 'TOKEN' and 'CHAT_ID' not in os.environ should_skip = 'TOKEN' and 'CHAT_ID' not in os.environ
@ -68,6 +67,17 @@ class TestTeleBot:
time.sleep(1) time.sleep(1)
assert msg.text == 'got' assert msg.text == 'got'
def test_message_handler_lambda_fail(self):
bot = telebot.TeleBot('')
msg = self.create_text_message(r'text')
@bot.message_handler(func=lambda message: r'lambda' in message.text)
def command_url(message):
msg.text = 'got'
bot.process_new_messages([msg])
time.sleep(1)
assert not msg.text == 'got'
def test_message_handler_reg_fail(self): def test_message_handler_reg_fail(self):
bot = telebot.TeleBot('') bot = telebot.TeleBot('')