Skip to content

Commit

Permalink
Tests ant type hint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Badiboy committed Jan 10, 2022
1 parent 2e6b6bd commit 9140044
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion telebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ def set_my_commands(self, commands: List[types.BotCommand],
return apihelper.set_my_commands(self.token, commands, scope, language_code)

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.
After deletion, higher level commands will be shown to affected users.
Expand Down
21 changes: 12 additions & 9 deletions tests/test_telebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,15 @@ def test_send_photo_dis_noti(self):
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'

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'
Expand Down Expand Up @@ -439,8 +439,10 @@ def test_export_chat_invite_link(self):

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))
Expand All @@ -464,9 +466,10 @@ def test_edit_markup(self):
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):
Expand Down Expand Up @@ -585,14 +588,14 @@ def test_chat_commands(self):
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 == []


Expand Down

0 comments on commit 9140044

Please sign in to comment.