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

Tests ant type hint fix

This commit is contained in:
Badiboy
2022-01-10 16:49:49 +03:00
parent 2e6b6bda53
commit 9140044956
2 changed files with 13 additions and 10 deletions

View File

@ -222,7 +222,7 @@ class TestTeleBot:
def test_send_audio(self):
file_data = open('./test_data/record.mp3', 'rb')
tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_audio(CHAT_ID, file_data, 1, performer='eternnoir', title='pyTelegram')
ret_msg = tb.send_audio(CHAT_ID, file_data, duration = 1, performer='eternnoir', title='pyTelegram')
assert ret_msg.content_type == 'audio'
assert ret_msg.audio.performer == 'eternnoir'
assert ret_msg.audio.title == 'pyTelegram'
@ -230,7 +230,7 @@ class TestTeleBot:
def test_send_audio_dis_noti(self):
file_data = open('./test_data/record.mp3', 'rb')
tb = telebot.TeleBot(TOKEN)
ret_msg = tb.send_audio(CHAT_ID, file_data, 1, performer='eternnoir', title='pyTelegram',
ret_msg = tb.send_audio(CHAT_ID, file_data, duration = 1, performer='eternnoir', title='pyTelegram',
disable_notification=True)
assert ret_msg.content_type == 'audio'
assert ret_msg.audio.performer == 'eternnoir'
@ -439,8 +439,10 @@ class TestTeleBot:
def test_create_revoke_detailed_chat_invite_link(self):
tb = telebot.TeleBot(TOKEN)
cil = tb.create_chat_invite_link(GROUP_ID,
(datetime.now() + timedelta(minutes=1)).timestamp(), member_limit=5)
cil = tb.create_chat_invite_link(
GROUP_ID,
expire_date = datetime.now() + timedelta(minutes=1),
member_limit=5)
assert isinstance(cil.invite_link, str)
assert cil.creator.id == tb.get_me().id
assert isinstance(cil.expire_date, (float, int))
@ -464,9 +466,10 @@ class TestTeleBot:
def test_antiflood(self):
text = "Flooding"
tb = telebot.TeleBot(TOKEN)
for _ in range(0,100):
i = -1
for i in range(0,100):
util.antiflood(tb.send_message, CHAT_ID, text)
assert _
assert i
@staticmethod
def create_text_message(text):
@ -585,14 +588,14 @@ class TestTeleBot:
ret_msg = tb.set_my_commands([telebot.types.BotCommand(command, description)], scope, lang)
assert ret_msg is True
ret_msg = tb.get_my_commands(scope, lang)
ret_msg = tb.get_my_commands(scope = scope, language_code = lang)
assert ret_msg[0].command == command
assert ret_msg[0].description == description
ret_msg = tb.delete_my_commands(scope, lang)
ret_msg = tb.delete_my_commands(scope = scope, language_code = lang)
assert ret_msg is True
ret_msg = tb.get_my_commands(scope, lang)
ret_msg = tb.get_my_commands(scope = scope, language_code = lang)
assert ret_msg == []