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:
parent
2e6b6bda53
commit
9140044956
@ -1929,7 +1929,7 @@ class TeleBot:
|
|||||||
return apihelper.set_my_commands(self.token, commands, scope, language_code)
|
return apihelper.set_my_commands(self.token, commands, scope, language_code)
|
||||||
|
|
||||||
def delete_my_commands(self, scope: Optional[types.BotCommandScope]=None,
|
def delete_my_commands(self, scope: Optional[types.BotCommandScope]=None,
|
||||||
language_code: Optional[int]=None) -> bool:
|
language_code: Optional[str]=None) -> bool:
|
||||||
"""
|
"""
|
||||||
Use this method to delete the list of the bot's commands for the given scope and user language.
|
Use this method to delete the list of the bot's commands for the given scope and user language.
|
||||||
After deletion, higher level commands will be shown to affected users.
|
After deletion, higher level commands will be shown to affected users.
|
||||||
|
@ -222,7 +222,7 @@ class TestTeleBot:
|
|||||||
def test_send_audio(self):
|
def test_send_audio(self):
|
||||||
file_data = open('./test_data/record.mp3', 'rb')
|
file_data = open('./test_data/record.mp3', 'rb')
|
||||||
tb = telebot.TeleBot(TOKEN)
|
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.content_type == 'audio'
|
||||||
assert ret_msg.audio.performer == 'eternnoir'
|
assert ret_msg.audio.performer == 'eternnoir'
|
||||||
assert ret_msg.audio.title == 'pyTelegram'
|
assert ret_msg.audio.title == 'pyTelegram'
|
||||||
@ -230,7 +230,7 @@ class TestTeleBot:
|
|||||||
def test_send_audio_dis_noti(self):
|
def test_send_audio_dis_noti(self):
|
||||||
file_data = open('./test_data/record.mp3', 'rb')
|
file_data = open('./test_data/record.mp3', 'rb')
|
||||||
tb = telebot.TeleBot(TOKEN)
|
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)
|
disable_notification=True)
|
||||||
assert ret_msg.content_type == 'audio'
|
assert ret_msg.content_type == 'audio'
|
||||||
assert ret_msg.audio.performer == 'eternnoir'
|
assert ret_msg.audio.performer == 'eternnoir'
|
||||||
@ -439,8 +439,10 @@ class TestTeleBot:
|
|||||||
|
|
||||||
def test_create_revoke_detailed_chat_invite_link(self):
|
def test_create_revoke_detailed_chat_invite_link(self):
|
||||||
tb = telebot.TeleBot(TOKEN)
|
tb = telebot.TeleBot(TOKEN)
|
||||||
cil = tb.create_chat_invite_link(GROUP_ID,
|
cil = tb.create_chat_invite_link(
|
||||||
(datetime.now() + timedelta(minutes=1)).timestamp(), member_limit=5)
|
GROUP_ID,
|
||||||
|
expire_date = datetime.now() + timedelta(minutes=1),
|
||||||
|
member_limit=5)
|
||||||
assert isinstance(cil.invite_link, str)
|
assert isinstance(cil.invite_link, str)
|
||||||
assert cil.creator.id == tb.get_me().id
|
assert cil.creator.id == tb.get_me().id
|
||||||
assert isinstance(cil.expire_date, (float, int))
|
assert isinstance(cil.expire_date, (float, int))
|
||||||
@ -464,9 +466,10 @@ class TestTeleBot:
|
|||||||
def test_antiflood(self):
|
def test_antiflood(self):
|
||||||
text = "Flooding"
|
text = "Flooding"
|
||||||
tb = telebot.TeleBot(TOKEN)
|
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)
|
util.antiflood(tb.send_message, CHAT_ID, text)
|
||||||
assert _
|
assert i
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_text_message(text):
|
def create_text_message(text):
|
||||||
@ -585,14 +588,14 @@ class TestTeleBot:
|
|||||||
ret_msg = tb.set_my_commands([telebot.types.BotCommand(command, description)], scope, lang)
|
ret_msg = tb.set_my_commands([telebot.types.BotCommand(command, description)], scope, lang)
|
||||||
assert ret_msg is True
|
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].command == command
|
||||||
assert ret_msg[0].description == description
|
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
|
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 == []
|
assert ret_msg == []
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user