Skip to content

Commit eaf765d

Browse files
committed
Remove duplicated/useless codes, added Filters.invoice test
1 parent f735a37 commit eaf765d

File tree

3 files changed

+6
-45
lines changed

3 files changed

+6
-45
lines changed

telegram/ext/filters.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,6 @@ def filter(self, message):
293293

294294
game = _Game()
295295

296-
class _SuccessfulPayment(BaseFilter):
297-
298-
def filter(self, message):
299-
return bool(message.successful_payment)
300-
301-
successful_payment = _SuccessfulPayment()
302-
303296
class entity(BaseFilter):
304297
"""Filters messages to only allow those which have a :class:`telegram.MessageEntity`
305298
where their `type` matches `entity_type`.

telegram/message.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -106,44 +106,6 @@ class Message(TelegramObject):
106106
107107
left_chat_participant (:class:`telegram.User`): Use `left_chat_member`
108108
instead.
109-
110-
<<<<<<<<< Temporary merge branch 1
111-
=========
112-
Args:
113-
message_id (int):
114-
from_user (:class:`telegram.User`):
115-
date (:class:`datetime.datetime`):
116-
chat (:class:`telegram.Chat`):
117-
forward_from (Optional[:class:`telegram.User`]):
118-
forward_from_chat (Optional[:class:`telegram.Chat`]):
119-
forward_from_message_id (Optional[int]):
120-
forward_date (Optional[:class:`datetime.datetime`]):
121-
reply_to_message (Optional[:class:`telegram.Message`]):
122-
edit_date (Optional[:class:`datetime.datetime`]):
123-
text (Optional[str]):
124-
audio (Optional[:class:`telegram.Audio`]):
125-
document (Optional[:class:`telegram.Document`]):
126-
game (Optional[:class:`telegram.Game`]):
127-
photo (Optional[List[:class:`telegram.PhotoSize`]]):
128-
sticker (Optional[:class:`telegram.Sticker`]):
129-
video (Optional[:class:`telegram.Video`]):
130-
voice (Optional[:class:`telegram.Voice`]):
131-
video_note (Optional[:class:`telegram.VideoNote`]):
132-
caption (Optional[str]):
133-
contact (Optional[:class:`telegram.Contact`]):
134-
location (Optional[:class:`telegram.Location`]):
135-
new_chat_member (Optional[:class:`telegram.User`]):
136-
left_chat_member (Optional[:class:`telegram.User`]):
137-
new_chat_title (Optional[str]):
138-
new_chat_photo (Optional[List[:class:`telegram.PhotoSize`]):
139-
delete_chat_photo (Optional[bool]):
140-
group_chat_created (Optional[bool]):
141-
supergroup_chat_created (Optional[bool]):
142-
migrate_to_chat_id (Optional[int]):
143-
migrate_from_chat_id (Optional[int]):
144-
channel_chat_created (Optional[bool]):
145-
bot (Optional[Bot]): The Bot to use for instance methods
146-
>>>>>>>>> Temporary merge branch 2
147109
"""
148110

149111
def __init__(self,

tests/test_filters.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ def test_filters_successful_payment(self):
124124
self.message.successful_payment = None
125125
self.assertFalse(Filters.successful_payment(self.message))
126126

127+
def test_filters_invoice(self):
128+
self.message.invoice = 'test'
129+
self.assertTrue(Filters.invoice(self.message))
130+
self.message.invoice = None
131+
self.assertFalse(Filters.imvoice(self.message))
132+
127133
def test_filters_status_update(self):
128134
self.assertFalse(Filters.status_update(self.message))
129135

0 commit comments

Comments
 (0)