Skip to content

Commit dea507d

Browse files
committed
Fix callbackquery shortcut tests
1 parent 4a84e75 commit dea507d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/test_callbackquery.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,20 @@ def test(*args, **kwargs):
8888

8989
def test_edit_message_text(self, monkeypatch, callback_query):
9090
def test(*args, **kwargs):
91+
print(args, kwargs)
9192
try:
93+
text = args[1] == 'test'
9294
id = kwargs['inline_message_id'] == callback_query.inline_message_id
93-
text = kwargs['text'] == 'test'
9495
return id and text
9596
except KeyError:
97+
text = args[1] == 'test'
9698
chat_id = kwargs['chat_id'] == callback_query.message.chat_id
9799
message_id = kwargs['message_id'] == callback_query.message.message_id
98-
text = kwargs['text'] == 'test'
99100
return chat_id and message_id and text
100101

101102
monkeypatch.setattr('telegram.Bot.edit_message_text', test)
102103
assert callback_query.edit_message_text(text='test')
104+
assert callback_query.edit_message_text('test')
103105

104106
def test_edit_message_caption(self, monkeypatch, callback_query):
105107
def test(*args, **kwargs):
@@ -115,6 +117,7 @@ def test(*args, **kwargs):
115117

116118
monkeypatch.setattr('telegram.Bot.edit_message_caption', test)
117119
assert callback_query.edit_message_caption(caption='new caption')
120+
assert callback_query.edit_message_caption('new caption')
118121

119122
def test_edit_message_reply_markup(self, monkeypatch, callback_query):
120123
def test(*args, **kwargs):
@@ -130,6 +133,7 @@ def test(*args, **kwargs):
130133

131134
monkeypatch.setattr('telegram.Bot.edit_message_reply_markup', test)
132135
assert callback_query.edit_message_reply_markup(reply_markup=[['1', '2']])
136+
assert callback_query.edit_message_reply_markup([['1', '2']])
133137

134138
def test_equality(self):
135139
a = CallbackQuery(self.id, self.from_user, 'chat')

0 commit comments

Comments
 (0)