From eaf765dcbc1706edbb3ac425bec2c33db0f900c0 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 3 Jun 2017 01:48:30 +0800 Subject: [PATCH] Remove duplicated/useless codes, added Filters.invoice test --- telegram/ext/filters.py | 7 ------- telegram/message.py | 38 -------------------------------------- tests/test_filters.py | 6 ++++++ 3 files changed, 6 insertions(+), 45 deletions(-) diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py index 8987773b0..1942fa859 100644 --- a/telegram/ext/filters.py +++ b/telegram/ext/filters.py @@ -293,13 +293,6 @@ class Filters(object): game = _Game() - class _SuccessfulPayment(BaseFilter): - - def filter(self, message): - return bool(message.successful_payment) - - successful_payment = _SuccessfulPayment() - class entity(BaseFilter): """Filters messages to only allow those which have a :class:`telegram.MessageEntity` where their `type` matches `entity_type`. diff --git a/telegram/message.py b/telegram/message.py index fff4adcb6..5e9dc3837 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -106,44 +106,6 @@ class Message(TelegramObject): left_chat_participant (:class:`telegram.User`): Use `left_chat_member` instead. - -<<<<<<<<< Temporary merge branch 1 -========= - Args: - message_id (int): - from_user (:class:`telegram.User`): - date (:class:`datetime.datetime`): - chat (:class:`telegram.Chat`): - forward_from (Optional[:class:`telegram.User`]): - forward_from_chat (Optional[:class:`telegram.Chat`]): - forward_from_message_id (Optional[int]): - forward_date (Optional[:class:`datetime.datetime`]): - reply_to_message (Optional[:class:`telegram.Message`]): - edit_date (Optional[:class:`datetime.datetime`]): - text (Optional[str]): - audio (Optional[:class:`telegram.Audio`]): - document (Optional[:class:`telegram.Document`]): - game (Optional[:class:`telegram.Game`]): - photo (Optional[List[:class:`telegram.PhotoSize`]]): - sticker (Optional[:class:`telegram.Sticker`]): - video (Optional[:class:`telegram.Video`]): - voice (Optional[:class:`telegram.Voice`]): - video_note (Optional[:class:`telegram.VideoNote`]): - caption (Optional[str]): - contact (Optional[:class:`telegram.Contact`]): - location (Optional[:class:`telegram.Location`]): - new_chat_member (Optional[:class:`telegram.User`]): - left_chat_member (Optional[:class:`telegram.User`]): - new_chat_title (Optional[str]): - new_chat_photo (Optional[List[:class:`telegram.PhotoSize`]): - delete_chat_photo (Optional[bool]): - group_chat_created (Optional[bool]): - supergroup_chat_created (Optional[bool]): - migrate_to_chat_id (Optional[int]): - migrate_from_chat_id (Optional[int]): - channel_chat_created (Optional[bool]): - bot (Optional[Bot]): The Bot to use for instance methods ->>>>>>>>> Temporary merge branch 2 """ def __init__(self, diff --git a/tests/test_filters.py b/tests/test_filters.py index 3db6167fa..029fc5861 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -124,6 +124,12 @@ class FiltersTest(BaseTest, unittest.TestCase): self.message.successful_payment = None self.assertFalse(Filters.successful_payment(self.message)) + def test_filters_invoice(self): + self.message.invoice = 'test' + self.assertTrue(Filters.invoice(self.message)) + self.message.invoice = None + self.assertFalse(Filters.imvoice(self.message)) + def test_filters_status_update(self): self.assertFalse(Filters.status_update(self.message))