diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b579f4b14..64f6452ab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,10 +6,12 @@ args: - --diff - repo: git://github.com/pre-commit/pre-commit-hooks - sha: v1.2.0 + sha: v2.0.0 hooks: - id: flake8 exclude: ^(setup.py|docs/source/conf.py)$ + args: + - --ignore=W605,W503 - repo: git://github.com/pre-commit/mirrors-pylint sha: v1.7.1 hooks: diff --git a/telegram/__init__.py b/telegram/__init__.py index fdc75f46f..db5c682d9 100644 --- a/telegram/__init__.py +++ b/telegram/__init__.py @@ -118,7 +118,7 @@ from .passport.credentials import (Credentials, SecureData, FileCredentials, TelegramDecryptionError) -from .version import __version__ # flake8: noqa +from .version import __version__ # noqa: F401 __author__ = 'devs@python-telegram-bot.org' diff --git a/telegram/ext/conversationhandler.py b/telegram/ext/conversationhandler.py index 208ef6d78..a8f3bca6e 100644 --- a/telegram/ext/conversationhandler.py +++ b/telegram/ext/conversationhandler.py @@ -244,11 +244,11 @@ class ConversationHandler(Handler): """ # Ignore messages in channels - if (not isinstance(update, Update) or - update.channel_post or - self.per_chat and not update.effective_chat or - self.per_message and not update.callback_query or - update.callback_query and self.per_chat and not update.callback_query.message): + if (not isinstance(update, Update) + or update.channel_post + or self.per_chat and not update.effective_chat + or self.per_message and not update.callback_query + or update.callback_query and self.per_chat and not update.callback_query.message): return None key = self._get_key(update) diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py index 784403e9e..856343103 100644 --- a/telegram/ext/filters.py +++ b/telegram/ext/filters.py @@ -441,8 +441,8 @@ class Filters(object): name = 'Filters.status_update.chat_created' def filter(self, message): - return bool(message.group_chat_created or message.supergroup_chat_created or - message.channel_chat_created) + return bool(message.group_chat_created or message.supergroup_chat_created + or message.channel_chat_created) chat_created = _ChatCreated() """:obj:`Filter`: Messages that contain :attr:`telegram.Message.group_chat_created`, @@ -480,11 +480,11 @@ class Filters(object): name = 'Filters.status_update' def filter(self, message): - return bool(self.new_chat_members(message) or self.left_chat_member(message) or - self.new_chat_title(message) or self.new_chat_photo(message) or - self.delete_chat_photo(message) or self.chat_created(message) or - self.migrate(message) or self.pinned_message(message) or - self.connected_website(message)) + return bool(self.new_chat_members(message) or self.left_chat_member(message) + or self.new_chat_title(message) or self.new_chat_photo(message) + or self.delete_chat_photo(message) or self.chat_created(message) + or self.migrate(message) or self.pinned_message(message) + or self.connected_website(message)) status_update = _StatusUpdate() """Subset for messages containing a status update. @@ -628,8 +628,8 @@ class Filters(object): return bool(message.from_user and message.from_user.id in self.user_ids) else: # self.usernames is not None - return bool(message.from_user and message.from_user.username and - message.from_user.username in self.usernames) + return bool(message.from_user and message.from_user.username + and message.from_user.username in self.usernames) class chat(BaseFilter): """Filters messages to allow only those which are from specified chat ID. diff --git a/telegram/files/inputfile.py b/telegram/files/inputfile.py index 977c325c5..eb28c11a2 100644 --- a/telegram/files/inputfile.py +++ b/telegram/files/inputfile.py @@ -55,9 +55,9 @@ class InputFile(object): if filename: self.filename = filename - elif (hasattr(obj, 'name') and - not isinstance(obj.name, int) and # py3 - obj.name != ''): # py2 + elif (hasattr(obj, 'name') + and not isinstance(obj.name, int) # py3 + and obj.name != ''): # py2 # on py2.7, pylint fails to understand this properly # pylint: disable=E1101 self.filename = os.path.basename(obj.name) diff --git a/telegram/passport/passportelementerrors.py b/telegram/passport/passportelementerrors.py index d69935b49..7a88efaa7 100644 --- a/telegram/passport/passportelementerrors.py +++ b/telegram/passport/passportelementerrors.py @@ -148,8 +148,8 @@ class PassportElementErrorFiles(PassportElementError): super(PassportElementErrorFiles, self).__init__('files', type, message) self.file_hashes = file_hashes - self._id_attrs = ((self.source, self.type, self.message) + - tuple([file_hash for file_hash in file_hashes])) + self._id_attrs = ((self.source, self.type, self.message) + + tuple([file_hash for file_hash in file_hashes])) class PassportElementErrorFrontSide(PassportElementError): @@ -323,8 +323,8 @@ class PassportElementErrorTranslationFiles(PassportElementError): type, message) self.file_hashes = file_hashes - self._id_attrs = ((self.source, self.type, self.message) + - tuple([file_hash for file_hash in file_hashes])) + self._id_attrs = ((self.source, self.type, self.message) + + tuple([file_hash for file_hash in file_hashes])) class PassportElementErrorUnspecified(PassportElementError): diff --git a/tests/test_encryptedcredentials.py b/tests/test_encryptedcredentials.py index 301af577e..4f6e4cbec 100644 --- a/tests/test_encryptedcredentials.py +++ b/tests/test_encryptedcredentials.py @@ -43,12 +43,12 @@ class TestEncryptedCredentials(object): encrypted_credentials_dict = encrypted_credentials.to_dict() assert isinstance(encrypted_credentials_dict, dict) - assert (encrypted_credentials_dict['data'] == - encrypted_credentials.data) - assert (encrypted_credentials_dict['hash'] == - encrypted_credentials.hash) - assert (encrypted_credentials_dict['secret'] == - encrypted_credentials.secret) + assert (encrypted_credentials_dict['data'] + == encrypted_credentials.data) + assert (encrypted_credentials_dict['hash'] + == encrypted_credentials.hash) + assert (encrypted_credentials_dict['secret'] + == encrypted_credentials.secret) def test_equality(self): a = EncryptedCredentials(self.data, self.hash, self.secret) diff --git a/tests/test_encryptedpassportelement.py b/tests/test_encryptedpassportelement.py index 10e53cf3c..6db823ae8 100644 --- a/tests/test_encryptedpassportelement.py +++ b/tests/test_encryptedpassportelement.py @@ -58,21 +58,21 @@ class TestEncryptedPassportElement(object): encrypted_passport_element_dict = encrypted_passport_element.to_dict() assert isinstance(encrypted_passport_element_dict, dict) - assert (encrypted_passport_element_dict['type'] == - encrypted_passport_element.type) - assert (encrypted_passport_element_dict['data'] == - encrypted_passport_element.data) - assert (encrypted_passport_element_dict['phone_number'] == - encrypted_passport_element.phone_number) - assert (encrypted_passport_element_dict['email'] == - encrypted_passport_element.email) + assert (encrypted_passport_element_dict['type'] + == encrypted_passport_element.type) + assert (encrypted_passport_element_dict['data'] + == encrypted_passport_element.data) + assert (encrypted_passport_element_dict['phone_number'] + == encrypted_passport_element.phone_number) + assert (encrypted_passport_element_dict['email'] + == encrypted_passport_element.email) assert isinstance(encrypted_passport_element_dict['files'], list) - assert (encrypted_passport_element_dict['front_side'] == - encrypted_passport_element.front_side.to_dict()) - assert (encrypted_passport_element_dict['reverse_side'] == - encrypted_passport_element.reverse_side.to_dict()) - assert (encrypted_passport_element_dict['selfie'] == - encrypted_passport_element.selfie.to_dict()) + assert (encrypted_passport_element_dict['front_side'] + == encrypted_passport_element.front_side.to_dict()) + assert (encrypted_passport_element_dict['reverse_side'] + == encrypted_passport_element.reverse_side.to_dict()) + assert (encrypted_passport_element_dict['selfie'] + == encrypted_passport_element.selfie.to_dict()) def test_equality(self): a = EncryptedPassportElement(self.type, data=self.data) diff --git a/tests/test_inlinekeyboardbutton.py b/tests/test_inlinekeyboardbutton.py index 65f3a968e..8a0e9b06a 100644 --- a/tests/test_inlinekeyboardbutton.py +++ b/tests/test_inlinekeyboardbutton.py @@ -48,8 +48,8 @@ class TestInlineKeyboardButton(object): assert inline_keyboard_button.url == self.url assert inline_keyboard_button.callback_data == self.callback_data assert inline_keyboard_button.switch_inline_query == self.switch_inline_query - assert (inline_keyboard_button.switch_inline_query_current_chat == - self.switch_inline_query_current_chat) + assert (inline_keyboard_button.switch_inline_query_current_chat + == self.switch_inline_query_current_chat) assert inline_keyboard_button.callback_game == self.callback_game assert inline_keyboard_button.pay == self.pay @@ -60,9 +60,9 @@ class TestInlineKeyboardButton(object): assert inline_keyboard_button_dict['text'] == inline_keyboard_button.text assert inline_keyboard_button_dict['url'] == inline_keyboard_button.url assert inline_keyboard_button_dict['callback_data'] == inline_keyboard_button.callback_data - assert (inline_keyboard_button_dict['switch_inline_query'] == - inline_keyboard_button.switch_inline_query) - assert (inline_keyboard_button_dict['switch_inline_query_current_chat'] == - inline_keyboard_button.switch_inline_query_current_chat) + assert (inline_keyboard_button_dict['switch_inline_query'] + == inline_keyboard_button.switch_inline_query) + assert (inline_keyboard_button_dict['switch_inline_query_current_chat'] + == inline_keyboard_button.switch_inline_query_current_chat) assert inline_keyboard_button_dict['callback_game'] == inline_keyboard_button.callback_game assert inline_keyboard_button_dict['pay'] == inline_keyboard_button.pay diff --git a/tests/test_inlinequeryresultarticle.py b/tests/test_inlinequeryresultarticle.py index 37137794f..07bdd1934 100644 --- a/tests/test_inlinequeryresultarticle.py +++ b/tests/test_inlinequeryresultarticle.py @@ -55,8 +55,8 @@ class TestInlineQueryResultArticle(object): assert inline_query_result_article.type == self.type assert inline_query_result_article.id == self.id assert inline_query_result_article.title == self.title - assert (inline_query_result_article.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_article.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_article.reply_markup.to_dict() == self.reply_markup.to_dict() assert inline_query_result_article.url == self.url assert inline_query_result_article.hide_url == self.hide_url @@ -72,20 +72,20 @@ class TestInlineQueryResultArticle(object): assert inline_query_result_article_dict['type'] == inline_query_result_article.type assert inline_query_result_article_dict['id'] == inline_query_result_article.id assert inline_query_result_article_dict['title'] == inline_query_result_article.title - assert (inline_query_result_article_dict['input_message_content'] == - inline_query_result_article.input_message_content.to_dict()) - assert (inline_query_result_article_dict['reply_markup'] == - inline_query_result_article.reply_markup.to_dict()) + assert (inline_query_result_article_dict['input_message_content'] + == inline_query_result_article.input_message_content.to_dict()) + assert (inline_query_result_article_dict['reply_markup'] + == inline_query_result_article.reply_markup.to_dict()) assert inline_query_result_article_dict['url'] == inline_query_result_article.url assert inline_query_result_article_dict['hide_url'] == inline_query_result_article.hide_url - assert (inline_query_result_article_dict['description'] == - inline_query_result_article.description) - assert (inline_query_result_article_dict['thumb_url'] == - inline_query_result_article.thumb_url) - assert (inline_query_result_article_dict['thumb_height'] == - inline_query_result_article.thumb_height) - assert (inline_query_result_article_dict['thumb_width'] == - inline_query_result_article.thumb_width) + assert (inline_query_result_article_dict['description'] + == inline_query_result_article.description) + assert (inline_query_result_article_dict['thumb_url'] + == inline_query_result_article.thumb_url) + assert (inline_query_result_article_dict['thumb_height'] + == inline_query_result_article.thumb_height) + assert (inline_query_result_article_dict['thumb_width'] + == inline_query_result_article.thumb_width) def test_equality(self): a = InlineQueryResultArticle(self.id, self.title, self.input_message_content) diff --git a/tests/test_inlinequeryresultaudio.py b/tests/test_inlinequeryresultaudio.py index 0b1288dc4..0b24e6383 100644 --- a/tests/test_inlinequeryresultaudio.py +++ b/tests/test_inlinequeryresultaudio.py @@ -58,8 +58,8 @@ class TestInlineQueryResultAudio(object): assert inline_query_result_audio.audio_duration == self.audio_duration assert inline_query_result_audio.caption == self.caption assert inline_query_result_audio.parse_mode == self.parse_mode - assert (inline_query_result_audio.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_audio.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_audio.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_audio): @@ -71,14 +71,14 @@ class TestInlineQueryResultAudio(object): assert inline_query_result_audio_dict['audio_url'] == inline_query_result_audio.audio_url assert inline_query_result_audio_dict['title'] == inline_query_result_audio.title assert inline_query_result_audio_dict['performer'] == inline_query_result_audio.performer - assert (inline_query_result_audio_dict['audio_duration'] == - inline_query_result_audio.audio_duration) + assert (inline_query_result_audio_dict['audio_duration'] + == inline_query_result_audio.audio_duration) assert inline_query_result_audio_dict['caption'] == inline_query_result_audio.caption assert inline_query_result_audio_dict['parse_mode'] == inline_query_result_audio.parse_mode - assert (inline_query_result_audio_dict['input_message_content'] == - inline_query_result_audio.input_message_content.to_dict()) - assert (inline_query_result_audio_dict['reply_markup'] == - inline_query_result_audio.reply_markup.to_dict()) + assert (inline_query_result_audio_dict['input_message_content'] + == inline_query_result_audio.input_message_content.to_dict()) + assert (inline_query_result_audio_dict['reply_markup'] + == inline_query_result_audio.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultAudio(self.id, self.audio_url, self.title) diff --git a/tests/test_inlinequeryresultcachedaudio.py b/tests/test_inlinequeryresultcachedaudio.py index d5aef8db9..788cec06c 100644 --- a/tests/test_inlinequeryresultcachedaudio.py +++ b/tests/test_inlinequeryresultcachedaudio.py @@ -49,28 +49,28 @@ class TestInlineQueryResultCachedAudio(object): assert inline_query_result_cached_audio.audio_file_id == self.audio_file_id assert inline_query_result_cached_audio.caption == self.caption assert inline_query_result_cached_audio.parse_mode == self.parse_mode - assert (inline_query_result_cached_audio.input_message_content.to_dict() == - self.input_message_content.to_dict()) - assert (inline_query_result_cached_audio.reply_markup.to_dict() == - self.reply_markup.to_dict()) + assert (inline_query_result_cached_audio.input_message_content.to_dict() + == self.input_message_content.to_dict()) + assert (inline_query_result_cached_audio.reply_markup.to_dict() + == self.reply_markup.to_dict()) def test_to_dict(self, inline_query_result_cached_audio): inline_query_result_cached_audio_dict = inline_query_result_cached_audio.to_dict() assert isinstance(inline_query_result_cached_audio_dict, dict) - assert (inline_query_result_cached_audio_dict['type'] == - inline_query_result_cached_audio.type) + assert (inline_query_result_cached_audio_dict['type'] + == inline_query_result_cached_audio.type) assert inline_query_result_cached_audio_dict['id'] == inline_query_result_cached_audio.id - assert (inline_query_result_cached_audio_dict['audio_file_id'] == - inline_query_result_cached_audio.audio_file_id) - assert (inline_query_result_cached_audio_dict['caption'] == - inline_query_result_cached_audio.caption) - assert (inline_query_result_cached_audio_dict['parse_mode'] == - inline_query_result_cached_audio.parse_mode) - assert (inline_query_result_cached_audio_dict['input_message_content'] == - inline_query_result_cached_audio.input_message_content.to_dict()) - assert (inline_query_result_cached_audio_dict['reply_markup'] == - inline_query_result_cached_audio.reply_markup.to_dict()) + assert (inline_query_result_cached_audio_dict['audio_file_id'] + == inline_query_result_cached_audio.audio_file_id) + assert (inline_query_result_cached_audio_dict['caption'] + == inline_query_result_cached_audio.caption) + assert (inline_query_result_cached_audio_dict['parse_mode'] + == inline_query_result_cached_audio.parse_mode) + assert (inline_query_result_cached_audio_dict['input_message_content'] + == inline_query_result_cached_audio.input_message_content.to_dict()) + assert (inline_query_result_cached_audio_dict['reply_markup'] + == inline_query_result_cached_audio.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultCachedAudio(self.id, self.audio_file_id) diff --git a/tests/test_inlinequeryresultcacheddocument.py b/tests/test_inlinequeryresultcacheddocument.py index e70fd596b..9aca101a9 100644 --- a/tests/test_inlinequeryresultcacheddocument.py +++ b/tests/test_inlinequeryresultcacheddocument.py @@ -55,33 +55,33 @@ class TestInlineQueryResultCachedDocument(object): assert inline_query_result_cached_document.caption == self.caption assert inline_query_result_cached_document.parse_mode == self.parse_mode assert inline_query_result_cached_document.description == self.description - assert (inline_query_result_cached_document.input_message_content.to_dict() == - self.input_message_content.to_dict()) - assert (inline_query_result_cached_document.reply_markup.to_dict() == - self.reply_markup.to_dict()) + assert (inline_query_result_cached_document.input_message_content.to_dict() + == self.input_message_content.to_dict()) + assert (inline_query_result_cached_document.reply_markup.to_dict() + == self.reply_markup.to_dict()) def test_to_dict(self, inline_query_result_cached_document): inline_query_result_cached_document_dict = inline_query_result_cached_document.to_dict() assert isinstance(inline_query_result_cached_document_dict, dict) - assert (inline_query_result_cached_document_dict['id'] == - inline_query_result_cached_document.id) - assert (inline_query_result_cached_document_dict['type'] == - inline_query_result_cached_document.type) - assert (inline_query_result_cached_document_dict['document_file_id'] == - inline_query_result_cached_document.document_file_id) - assert (inline_query_result_cached_document_dict['title'] == - inline_query_result_cached_document.title) - assert (inline_query_result_cached_document_dict['caption'] == - inline_query_result_cached_document.caption) - assert (inline_query_result_cached_document_dict['parse_mode'] == - inline_query_result_cached_document.parse_mode) - assert (inline_query_result_cached_document_dict['description'] == - inline_query_result_cached_document.description) - assert (inline_query_result_cached_document_dict['input_message_content'] == - inline_query_result_cached_document.input_message_content.to_dict()) - assert (inline_query_result_cached_document_dict['reply_markup'] == - inline_query_result_cached_document.reply_markup.to_dict()) + assert (inline_query_result_cached_document_dict['id'] + == inline_query_result_cached_document.id) + assert (inline_query_result_cached_document_dict['type'] + == inline_query_result_cached_document.type) + assert (inline_query_result_cached_document_dict['document_file_id'] + == inline_query_result_cached_document.document_file_id) + assert (inline_query_result_cached_document_dict['title'] + == inline_query_result_cached_document.title) + assert (inline_query_result_cached_document_dict['caption'] + == inline_query_result_cached_document.caption) + assert (inline_query_result_cached_document_dict['parse_mode'] + == inline_query_result_cached_document.parse_mode) + assert (inline_query_result_cached_document_dict['description'] + == inline_query_result_cached_document.description) + assert (inline_query_result_cached_document_dict['input_message_content'] + == inline_query_result_cached_document.input_message_content.to_dict()) + assert (inline_query_result_cached_document_dict['reply_markup'] + == inline_query_result_cached_document.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultCachedDocument(self.id, self.title, self.document_file_id) diff --git a/tests/test_inlinequeryresultcachedgif.py b/tests/test_inlinequeryresultcachedgif.py index 6f457600a..b0f05803a 100644 --- a/tests/test_inlinequeryresultcachedgif.py +++ b/tests/test_inlinequeryresultcachedgif.py @@ -52,8 +52,8 @@ class TestInlineQueryResultCachedGif(object): assert inline_query_result_cached_gif.title == self.title assert inline_query_result_cached_gif.caption == self.caption assert inline_query_result_cached_gif.parse_mode == self.parse_mode - assert (inline_query_result_cached_gif.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_cached_gif.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_cached_gif.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_cached_gif): @@ -62,17 +62,17 @@ class TestInlineQueryResultCachedGif(object): assert isinstance(inline_query_result_cached_gif_dict, dict) assert inline_query_result_cached_gif_dict['type'] == inline_query_result_cached_gif.type assert inline_query_result_cached_gif_dict['id'] == inline_query_result_cached_gif.id - assert (inline_query_result_cached_gif_dict['gif_file_id'] == - inline_query_result_cached_gif.gif_file_id) + assert (inline_query_result_cached_gif_dict['gif_file_id'] + == inline_query_result_cached_gif.gif_file_id) assert inline_query_result_cached_gif_dict['title'] == inline_query_result_cached_gif.title - assert (inline_query_result_cached_gif_dict['caption'] == - inline_query_result_cached_gif.caption) - assert (inline_query_result_cached_gif_dict['parse_mode'] == - inline_query_result_cached_gif.parse_mode) - assert (inline_query_result_cached_gif_dict['input_message_content'] == - inline_query_result_cached_gif.input_message_content.to_dict()) - assert (inline_query_result_cached_gif_dict['reply_markup'] == - inline_query_result_cached_gif.reply_markup.to_dict()) + assert (inline_query_result_cached_gif_dict['caption'] + == inline_query_result_cached_gif.caption) + assert (inline_query_result_cached_gif_dict['parse_mode'] + == inline_query_result_cached_gif.parse_mode) + assert (inline_query_result_cached_gif_dict['input_message_content'] + == inline_query_result_cached_gif.input_message_content.to_dict()) + assert (inline_query_result_cached_gif_dict['reply_markup'] + == inline_query_result_cached_gif.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultCachedGif(self.id, self.gif_file_id) diff --git a/tests/test_inlinequeryresultcachedmpeg4gif.py b/tests/test_inlinequeryresultcachedmpeg4gif.py index 0983f0927..6de7be9dd 100644 --- a/tests/test_inlinequeryresultcachedmpeg4gif.py +++ b/tests/test_inlinequeryresultcachedmpeg4gif.py @@ -52,31 +52,31 @@ class TestInlineQueryResultCachedMpeg4Gif(object): assert inline_query_result_cached_mpeg4_gif.title == self.title assert inline_query_result_cached_mpeg4_gif.caption == self.caption assert inline_query_result_cached_mpeg4_gif.parse_mode == self.parse_mode - assert (inline_query_result_cached_mpeg4_gif.input_message_content.to_dict() == - self.input_message_content.to_dict()) - assert (inline_query_result_cached_mpeg4_gif.reply_markup.to_dict() == - self.reply_markup.to_dict()) + assert (inline_query_result_cached_mpeg4_gif.input_message_content.to_dict() + == self.input_message_content.to_dict()) + assert (inline_query_result_cached_mpeg4_gif.reply_markup.to_dict() + == self.reply_markup.to_dict()) def test_to_dict(self, inline_query_result_cached_mpeg4_gif): inline_query_result_cached_mpeg4_gif_dict = inline_query_result_cached_mpeg4_gif.to_dict() assert isinstance(inline_query_result_cached_mpeg4_gif_dict, dict) - assert (inline_query_result_cached_mpeg4_gif_dict['type'] == - inline_query_result_cached_mpeg4_gif.type) - assert (inline_query_result_cached_mpeg4_gif_dict['id'] == - inline_query_result_cached_mpeg4_gif.id) - assert (inline_query_result_cached_mpeg4_gif_dict['mpeg4_file_id'] == - inline_query_result_cached_mpeg4_gif.mpeg4_file_id) - assert (inline_query_result_cached_mpeg4_gif_dict['title'] == - inline_query_result_cached_mpeg4_gif.title) - assert (inline_query_result_cached_mpeg4_gif_dict['caption'] == - inline_query_result_cached_mpeg4_gif.caption) - assert (inline_query_result_cached_mpeg4_gif_dict['parse_mode'] == - inline_query_result_cached_mpeg4_gif.parse_mode) - assert (inline_query_result_cached_mpeg4_gif_dict['input_message_content'] == - inline_query_result_cached_mpeg4_gif.input_message_content.to_dict()) - assert (inline_query_result_cached_mpeg4_gif_dict['reply_markup'] == - inline_query_result_cached_mpeg4_gif.reply_markup.to_dict()) + assert (inline_query_result_cached_mpeg4_gif_dict['type'] + == inline_query_result_cached_mpeg4_gif.type) + assert (inline_query_result_cached_mpeg4_gif_dict['id'] + == inline_query_result_cached_mpeg4_gif.id) + assert (inline_query_result_cached_mpeg4_gif_dict['mpeg4_file_id'] + == inline_query_result_cached_mpeg4_gif.mpeg4_file_id) + assert (inline_query_result_cached_mpeg4_gif_dict['title'] + == inline_query_result_cached_mpeg4_gif.title) + assert (inline_query_result_cached_mpeg4_gif_dict['caption'] + == inline_query_result_cached_mpeg4_gif.caption) + assert (inline_query_result_cached_mpeg4_gif_dict['parse_mode'] + == inline_query_result_cached_mpeg4_gif.parse_mode) + assert (inline_query_result_cached_mpeg4_gif_dict['input_message_content'] + == inline_query_result_cached_mpeg4_gif.input_message_content.to_dict()) + assert (inline_query_result_cached_mpeg4_gif_dict['reply_markup'] + == inline_query_result_cached_mpeg4_gif.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultCachedMpeg4Gif(self.id, self.mpeg4_file_id) diff --git a/tests/test_inlinequeryresultcachedphoto.py b/tests/test_inlinequeryresultcachedphoto.py index 94287eeb9..2f356c447 100644 --- a/tests/test_inlinequeryresultcachedphoto.py +++ b/tests/test_inlinequeryresultcachedphoto.py @@ -55,32 +55,32 @@ class TestInlineQueryResultCachedPhoto(object): assert inline_query_result_cached_photo.description == self.description assert inline_query_result_cached_photo.caption == self.caption assert inline_query_result_cached_photo.parse_mode == self.parse_mode - assert (inline_query_result_cached_photo.input_message_content.to_dict() == - self.input_message_content.to_dict()) - assert (inline_query_result_cached_photo.reply_markup.to_dict() == - self.reply_markup.to_dict()) + assert (inline_query_result_cached_photo.input_message_content.to_dict() + == self.input_message_content.to_dict()) + assert (inline_query_result_cached_photo.reply_markup.to_dict() + == self.reply_markup.to_dict()) def test_to_dict(self, inline_query_result_cached_photo): inline_query_result_cached_photo_dict = inline_query_result_cached_photo.to_dict() assert isinstance(inline_query_result_cached_photo_dict, dict) - assert (inline_query_result_cached_photo_dict['type'] == - inline_query_result_cached_photo.type) + assert (inline_query_result_cached_photo_dict['type'] + == inline_query_result_cached_photo.type) assert inline_query_result_cached_photo_dict['id'] == inline_query_result_cached_photo.id - assert (inline_query_result_cached_photo_dict['photo_file_id'] == - inline_query_result_cached_photo.photo_file_id) - assert (inline_query_result_cached_photo_dict['title'] == - inline_query_result_cached_photo.title) - assert (inline_query_result_cached_photo_dict['description'] == - inline_query_result_cached_photo.description) - assert (inline_query_result_cached_photo_dict['caption'] == - inline_query_result_cached_photo.caption) - assert (inline_query_result_cached_photo_dict['parse_mode'] == - inline_query_result_cached_photo.parse_mode) - assert (inline_query_result_cached_photo_dict['input_message_content'] == - inline_query_result_cached_photo.input_message_content.to_dict()) - assert (inline_query_result_cached_photo_dict['reply_markup'] == - inline_query_result_cached_photo.reply_markup.to_dict()) + assert (inline_query_result_cached_photo_dict['photo_file_id'] + == inline_query_result_cached_photo.photo_file_id) + assert (inline_query_result_cached_photo_dict['title'] + == inline_query_result_cached_photo.title) + assert (inline_query_result_cached_photo_dict['description'] + == inline_query_result_cached_photo.description) + assert (inline_query_result_cached_photo_dict['caption'] + == inline_query_result_cached_photo.caption) + assert (inline_query_result_cached_photo_dict['parse_mode'] + == inline_query_result_cached_photo.parse_mode) + assert (inline_query_result_cached_photo_dict['input_message_content'] + == inline_query_result_cached_photo.input_message_content.to_dict()) + assert (inline_query_result_cached_photo_dict['reply_markup'] + == inline_query_result_cached_photo.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultCachedPhoto(self.id, self.photo_file_id) diff --git a/tests/test_inlinequeryresultcachedsticker.py b/tests/test_inlinequeryresultcachedsticker.py index 840dc16cf..107996369 100644 --- a/tests/test_inlinequeryresultcachedsticker.py +++ b/tests/test_inlinequeryresultcachedsticker.py @@ -44,25 +44,25 @@ class TestInlineQueryResultCachedSticker(object): assert inline_query_result_cached_sticker.type == self.type assert inline_query_result_cached_sticker.id == self.id assert inline_query_result_cached_sticker.sticker_file_id == self.sticker_file_id - assert (inline_query_result_cached_sticker.input_message_content.to_dict() == - self.input_message_content.to_dict()) - assert (inline_query_result_cached_sticker.reply_markup.to_dict() == - self.reply_markup.to_dict()) + assert (inline_query_result_cached_sticker.input_message_content.to_dict() + == self.input_message_content.to_dict()) + assert (inline_query_result_cached_sticker.reply_markup.to_dict() + == self.reply_markup.to_dict()) def test_to_dict(self, inline_query_result_cached_sticker): inline_query_result_cached_sticker_dict = inline_query_result_cached_sticker.to_dict() assert isinstance(inline_query_result_cached_sticker_dict, dict) - assert (inline_query_result_cached_sticker_dict['type'] == - inline_query_result_cached_sticker.type) - assert (inline_query_result_cached_sticker_dict['id'] == - inline_query_result_cached_sticker.id) - assert (inline_query_result_cached_sticker_dict['sticker_file_id'] == - inline_query_result_cached_sticker.sticker_file_id) - assert (inline_query_result_cached_sticker_dict['input_message_content'] == - inline_query_result_cached_sticker.input_message_content.to_dict()) - assert (inline_query_result_cached_sticker_dict['reply_markup'] == - inline_query_result_cached_sticker.reply_markup.to_dict()) + assert (inline_query_result_cached_sticker_dict['type'] + == inline_query_result_cached_sticker.type) + assert (inline_query_result_cached_sticker_dict['id'] + == inline_query_result_cached_sticker.id) + assert (inline_query_result_cached_sticker_dict['sticker_file_id'] + == inline_query_result_cached_sticker.sticker_file_id) + assert (inline_query_result_cached_sticker_dict['input_message_content'] + == inline_query_result_cached_sticker.input_message_content.to_dict()) + assert (inline_query_result_cached_sticker_dict['reply_markup'] + == inline_query_result_cached_sticker.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultCachedSticker(self.id, self.sticker_file_id) diff --git a/tests/test_inlinequeryresultcachedvideo.py b/tests/test_inlinequeryresultcachedvideo.py index 2b4e68781..fe873cddb 100644 --- a/tests/test_inlinequeryresultcachedvideo.py +++ b/tests/test_inlinequeryresultcachedvideo.py @@ -55,32 +55,32 @@ class TestInlineQueryResultCachedVideo(object): assert inline_query_result_cached_video.description == self.description assert inline_query_result_cached_video.caption == self.caption assert inline_query_result_cached_video.parse_mode == self.parse_mode - assert (inline_query_result_cached_video.input_message_content.to_dict() == - self.input_message_content.to_dict()) - assert (inline_query_result_cached_video.reply_markup.to_dict() == - self.reply_markup.to_dict()) + assert (inline_query_result_cached_video.input_message_content.to_dict() + == self.input_message_content.to_dict()) + assert (inline_query_result_cached_video.reply_markup.to_dict() + == self.reply_markup.to_dict()) def test_to_dict(self, inline_query_result_cached_video): inline_query_result_cached_video_dict = inline_query_result_cached_video.to_dict() assert isinstance(inline_query_result_cached_video_dict, dict) - assert (inline_query_result_cached_video_dict['type'] == - inline_query_result_cached_video.type) + assert (inline_query_result_cached_video_dict['type'] + == inline_query_result_cached_video.type) assert inline_query_result_cached_video_dict['id'] == inline_query_result_cached_video.id - assert (inline_query_result_cached_video_dict['video_file_id'] == - inline_query_result_cached_video.video_file_id) - assert (inline_query_result_cached_video_dict['title'] == - inline_query_result_cached_video.title) - assert (inline_query_result_cached_video_dict['description'] == - inline_query_result_cached_video.description) - assert (inline_query_result_cached_video_dict['caption'] == - inline_query_result_cached_video.caption) - assert (inline_query_result_cached_video_dict['parse_mode'] == - inline_query_result_cached_video.parse_mode) - assert (inline_query_result_cached_video_dict['input_message_content'] == - inline_query_result_cached_video.input_message_content.to_dict()) - assert (inline_query_result_cached_video_dict['reply_markup'] == - inline_query_result_cached_video.reply_markup.to_dict()) + assert (inline_query_result_cached_video_dict['video_file_id'] + == inline_query_result_cached_video.video_file_id) + assert (inline_query_result_cached_video_dict['title'] + == inline_query_result_cached_video.title) + assert (inline_query_result_cached_video_dict['description'] + == inline_query_result_cached_video.description) + assert (inline_query_result_cached_video_dict['caption'] + == inline_query_result_cached_video.caption) + assert (inline_query_result_cached_video_dict['parse_mode'] + == inline_query_result_cached_video.parse_mode) + assert (inline_query_result_cached_video_dict['input_message_content'] + == inline_query_result_cached_video.input_message_content.to_dict()) + assert (inline_query_result_cached_video_dict['reply_markup'] + == inline_query_result_cached_video.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultCachedVideo(self.id, self.video_file_id, self.title) diff --git a/tests/test_inlinequeryresultcachedvoice.py b/tests/test_inlinequeryresultcachedvoice.py index e072c2c5b..5710be431 100644 --- a/tests/test_inlinequeryresultcachedvoice.py +++ b/tests/test_inlinequeryresultcachedvoice.py @@ -52,30 +52,30 @@ class TestInlineQueryResultCachedVoice(object): assert inline_query_result_cached_voice.title == self.title assert inline_query_result_cached_voice.caption == self.caption assert inline_query_result_cached_voice.parse_mode == self.parse_mode - assert (inline_query_result_cached_voice.input_message_content.to_dict() == - self.input_message_content.to_dict()) - assert (inline_query_result_cached_voice.reply_markup.to_dict() == - self.reply_markup.to_dict()) + assert (inline_query_result_cached_voice.input_message_content.to_dict() + == self.input_message_content.to_dict()) + assert (inline_query_result_cached_voice.reply_markup.to_dict() + == self.reply_markup.to_dict()) def test_to_dict(self, inline_query_result_cached_voice): inline_query_result_cached_voice_dict = inline_query_result_cached_voice.to_dict() assert isinstance(inline_query_result_cached_voice_dict, dict) - assert (inline_query_result_cached_voice_dict['type'] == - inline_query_result_cached_voice.type) + assert (inline_query_result_cached_voice_dict['type'] + == inline_query_result_cached_voice.type) assert inline_query_result_cached_voice_dict['id'] == inline_query_result_cached_voice.id - assert (inline_query_result_cached_voice_dict['voice_file_id'] == - inline_query_result_cached_voice.voice_file_id) - assert (inline_query_result_cached_voice_dict['title'] == - inline_query_result_cached_voice.title) - assert (inline_query_result_cached_voice_dict['caption'] == - inline_query_result_cached_voice.caption) - assert (inline_query_result_cached_voice_dict['parse_mode'] == - inline_query_result_cached_voice.parse_mode) - assert (inline_query_result_cached_voice_dict['input_message_content'] == - inline_query_result_cached_voice.input_message_content.to_dict()) - assert (inline_query_result_cached_voice_dict['reply_markup'] == - inline_query_result_cached_voice.reply_markup.to_dict()) + assert (inline_query_result_cached_voice_dict['voice_file_id'] + == inline_query_result_cached_voice.voice_file_id) + assert (inline_query_result_cached_voice_dict['title'] + == inline_query_result_cached_voice.title) + assert (inline_query_result_cached_voice_dict['caption'] + == inline_query_result_cached_voice.caption) + assert (inline_query_result_cached_voice_dict['parse_mode'] + == inline_query_result_cached_voice.parse_mode) + assert (inline_query_result_cached_voice_dict['input_message_content'] + == inline_query_result_cached_voice.input_message_content.to_dict()) + assert (inline_query_result_cached_voice_dict['reply_markup'] + == inline_query_result_cached_voice.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultCachedVoice(self.id, self.voice_file_id, self.title) diff --git a/tests/test_inlinequeryresultcontact.py b/tests/test_inlinequeryresultcontact.py index 74e18078b..350e08ec1 100644 --- a/tests/test_inlinequeryresultcontact.py +++ b/tests/test_inlinequeryresultcontact.py @@ -58,8 +58,8 @@ class TestInlineQueryResultContact(object): assert inline_query_result_contact.thumb_url == self.thumb_url assert inline_query_result_contact.thumb_width == self.thumb_width assert inline_query_result_contact.thumb_height == self.thumb_height - assert (inline_query_result_contact.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_contact.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_contact.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_contact): @@ -68,22 +68,22 @@ class TestInlineQueryResultContact(object): assert isinstance(inline_query_result_contact_dict, dict) assert inline_query_result_contact_dict['id'] == inline_query_result_contact.id assert inline_query_result_contact_dict['type'] == inline_query_result_contact.type - assert (inline_query_result_contact_dict['phone_number'] == - inline_query_result_contact.phone_number) - assert (inline_query_result_contact_dict['first_name'] == - inline_query_result_contact.first_name) - assert (inline_query_result_contact_dict['last_name'] == - inline_query_result_contact.last_name) - assert (inline_query_result_contact_dict['thumb_url'] == - inline_query_result_contact.thumb_url) - assert (inline_query_result_contact_dict['thumb_width'] == - inline_query_result_contact.thumb_width) - assert (inline_query_result_contact_dict['thumb_height'] == - inline_query_result_contact.thumb_height) - assert (inline_query_result_contact_dict['input_message_content'] == - inline_query_result_contact.input_message_content.to_dict()) - assert (inline_query_result_contact_dict['reply_markup'] == - inline_query_result_contact.reply_markup.to_dict()) + assert (inline_query_result_contact_dict['phone_number'] + == inline_query_result_contact.phone_number) + assert (inline_query_result_contact_dict['first_name'] + == inline_query_result_contact.first_name) + assert (inline_query_result_contact_dict['last_name'] + == inline_query_result_contact.last_name) + assert (inline_query_result_contact_dict['thumb_url'] + == inline_query_result_contact.thumb_url) + assert (inline_query_result_contact_dict['thumb_width'] + == inline_query_result_contact.thumb_width) + assert (inline_query_result_contact_dict['thumb_height'] + == inline_query_result_contact.thumb_height) + assert (inline_query_result_contact_dict['input_message_content'] + == inline_query_result_contact.input_message_content.to_dict()) + assert (inline_query_result_contact_dict['reply_markup'] + == inline_query_result_contact.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultContact(self.id, self.phone_number, self.first_name) diff --git a/tests/test_inlinequeryresultdocument.py b/tests/test_inlinequeryresultdocument.py index bba9cc4c0..889c20fe4 100644 --- a/tests/test_inlinequeryresultdocument.py +++ b/tests/test_inlinequeryresultdocument.py @@ -67,8 +67,8 @@ class TestInlineQueryResultDocument(object): assert inline_query_result_document.thumb_url == self.thumb_url assert inline_query_result_document.thumb_width == self.thumb_width assert inline_query_result_document.thumb_height == self.thumb_height - assert (inline_query_result_document.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_document.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_document.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_document): @@ -77,26 +77,26 @@ class TestInlineQueryResultDocument(object): assert isinstance(inline_query_result_document_dict, dict) assert inline_query_result_document_dict['id'] == inline_query_result_document.id assert inline_query_result_document_dict['type'] == inline_query_result_document.type - assert (inline_query_result_document_dict['document_url'] == - inline_query_result_document.document_url) + assert (inline_query_result_document_dict['document_url'] + == inline_query_result_document.document_url) assert inline_query_result_document_dict['title'] == inline_query_result_document.title assert inline_query_result_document_dict['caption'] == inline_query_result_document.caption - assert (inline_query_result_document_dict['parse_mode'] == - inline_query_result_document.parse_mode) - assert (inline_query_result_document_dict['mime_type'] == - inline_query_result_document.mime_type) - assert (inline_query_result_document_dict['description'] == - inline_query_result_document.description) - assert (inline_query_result_document_dict['thumb_url'] == - inline_query_result_document.thumb_url) - assert (inline_query_result_document_dict['thumb_width'] == - inline_query_result_document.thumb_width) - assert (inline_query_result_document_dict['thumb_height'] == - inline_query_result_document.thumb_height) - assert (inline_query_result_document_dict['input_message_content'] == - inline_query_result_document.input_message_content.to_dict()) - assert (inline_query_result_document_dict['reply_markup'] == - inline_query_result_document.reply_markup.to_dict()) + assert (inline_query_result_document_dict['parse_mode'] + == inline_query_result_document.parse_mode) + assert (inline_query_result_document_dict['mime_type'] + == inline_query_result_document.mime_type) + assert (inline_query_result_document_dict['description'] + == inline_query_result_document.description) + assert (inline_query_result_document_dict['thumb_url'] + == inline_query_result_document.thumb_url) + assert (inline_query_result_document_dict['thumb_width'] + == inline_query_result_document.thumb_width) + assert (inline_query_result_document_dict['thumb_height'] + == inline_query_result_document.thumb_height) + assert (inline_query_result_document_dict['input_message_content'] + == inline_query_result_document.input_message_content.to_dict()) + assert (inline_query_result_document_dict['reply_markup'] + == inline_query_result_document.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultDocument(self.id, self.document_url, self.title, diff --git a/tests/test_inlinequeryresultgame.py b/tests/test_inlinequeryresultgame.py index f3c65e9f8..6833573a8 100644 --- a/tests/test_inlinequeryresultgame.py +++ b/tests/test_inlinequeryresultgame.py @@ -40,8 +40,8 @@ class TestInlineQueryResultGame(object): assert inline_query_result_game.type == self.type assert inline_query_result_game.id == self.id assert inline_query_result_game.game_short_name == self.game_short_name - assert (inline_query_result_game.reply_markup.to_dict() == - self.reply_markup.to_dict()) + assert (inline_query_result_game.reply_markup.to_dict() + == self.reply_markup.to_dict()) def test_to_dict(self, inline_query_result_game): inline_query_result_game_dict = inline_query_result_game.to_dict() @@ -49,10 +49,10 @@ class TestInlineQueryResultGame(object): assert isinstance(inline_query_result_game_dict, dict) assert inline_query_result_game_dict['type'] == inline_query_result_game.type assert inline_query_result_game_dict['id'] == inline_query_result_game.id - assert (inline_query_result_game_dict['game_short_name'] == - inline_query_result_game.game_short_name) - assert (inline_query_result_game_dict['reply_markup'] == - inline_query_result_game.reply_markup.to_dict()) + assert (inline_query_result_game_dict['game_short_name'] + == inline_query_result_game.game_short_name) + assert (inline_query_result_game_dict['reply_markup'] + == inline_query_result_game.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultGame(self.id, self.game_short_name) diff --git a/tests/test_inlinequeryresultgif.py b/tests/test_inlinequeryresultgif.py index 68c8ed4b4..673ca4ca0 100644 --- a/tests/test_inlinequeryresultgif.py +++ b/tests/test_inlinequeryresultgif.py @@ -64,8 +64,8 @@ class TestInlineQueryResultGif(object): assert inline_query_result_gif.title == self.title assert inline_query_result_gif.caption == self.caption assert inline_query_result_gif.parse_mode == self.parse_mode - assert (inline_query_result_gif.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_gif.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_gif.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_gif): @@ -82,10 +82,10 @@ class TestInlineQueryResultGif(object): assert inline_query_result_gif_dict['title'] == inline_query_result_gif.title assert inline_query_result_gif_dict['caption'] == inline_query_result_gif.caption assert inline_query_result_gif_dict['parse_mode'] == inline_query_result_gif.parse_mode - assert (inline_query_result_gif_dict['input_message_content'] == - inline_query_result_gif.input_message_content.to_dict()) - assert (inline_query_result_gif_dict['reply_markup'] == - inline_query_result_gif.reply_markup.to_dict()) + assert (inline_query_result_gif_dict['input_message_content'] + == inline_query_result_gif.input_message_content.to_dict()) + assert (inline_query_result_gif_dict['reply_markup'] + == inline_query_result_gif.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultGif(self.id, self.gif_url, self.thumb_url) diff --git a/tests/test_inlinequeryresultlocation.py b/tests/test_inlinequeryresultlocation.py index 2356ada05..d70bad42e 100644 --- a/tests/test_inlinequeryresultlocation.py +++ b/tests/test_inlinequeryresultlocation.py @@ -61,8 +61,8 @@ class TestInlineQueryResultLocation(object): assert inline_query_result_location.thumb_url == self.thumb_url assert inline_query_result_location.thumb_width == self.thumb_width assert inline_query_result_location.thumb_height == self.thumb_height - assert (inline_query_result_location.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_location.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_location.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_location): @@ -71,23 +71,23 @@ class TestInlineQueryResultLocation(object): assert isinstance(inline_query_result_location_dict, dict) assert inline_query_result_location_dict['id'] == inline_query_result_location.id assert inline_query_result_location_dict['type'] == inline_query_result_location.type - assert (inline_query_result_location_dict['latitude'] == - inline_query_result_location.latitude) - assert (inline_query_result_location_dict['longitude'] == - inline_query_result_location.longitude) + assert (inline_query_result_location_dict['latitude'] + == inline_query_result_location.latitude) + assert (inline_query_result_location_dict['longitude'] + == inline_query_result_location.longitude) assert inline_query_result_location_dict['title'] == inline_query_result_location.title - assert (inline_query_result_location_dict['live_period'] == - inline_query_result_location.live_period) - assert (inline_query_result_location_dict['thumb_url'] == - inline_query_result_location.thumb_url) - assert (inline_query_result_location_dict['thumb_width'] == - inline_query_result_location.thumb_width) - assert (inline_query_result_location_dict['thumb_height'] == - inline_query_result_location.thumb_height) - assert (inline_query_result_location_dict['input_message_content'] == - inline_query_result_location.input_message_content.to_dict()) - assert (inline_query_result_location_dict['reply_markup'] == - inline_query_result_location.reply_markup.to_dict()) + assert (inline_query_result_location_dict['live_period'] + == inline_query_result_location.live_period) + assert (inline_query_result_location_dict['thumb_url'] + == inline_query_result_location.thumb_url) + assert (inline_query_result_location_dict['thumb_width'] + == inline_query_result_location.thumb_width) + assert (inline_query_result_location_dict['thumb_height'] + == inline_query_result_location.thumb_height) + assert (inline_query_result_location_dict['input_message_content'] + == inline_query_result_location.input_message_content.to_dict()) + assert (inline_query_result_location_dict['reply_markup'] + == inline_query_result_location.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultLocation(self.id, self.longitude, self.latitude, self.title) diff --git a/tests/test_inlinequeryresultmpeg4gif.py b/tests/test_inlinequeryresultmpeg4gif.py index ff4815525..abc0790c0 100644 --- a/tests/test_inlinequeryresultmpeg4gif.py +++ b/tests/test_inlinequeryresultmpeg4gif.py @@ -64,8 +64,8 @@ class TestInlineQueryResultMpeg4Gif(object): assert inline_query_result_mpeg4_gif.title == self.title assert inline_query_result_mpeg4_gif.caption == self.caption assert inline_query_result_mpeg4_gif.parse_mode == self.parse_mode - assert (inline_query_result_mpeg4_gif.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_mpeg4_gif.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_mpeg4_gif.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_mpeg4_gif): @@ -74,25 +74,25 @@ class TestInlineQueryResultMpeg4Gif(object): assert isinstance(inline_query_result_mpeg4_gif_dict, dict) assert inline_query_result_mpeg4_gif_dict['type'] == inline_query_result_mpeg4_gif.type assert inline_query_result_mpeg4_gif_dict['id'] == inline_query_result_mpeg4_gif.id - assert (inline_query_result_mpeg4_gif_dict['mpeg4_url'] == - inline_query_result_mpeg4_gif.mpeg4_url) - assert (inline_query_result_mpeg4_gif_dict['mpeg4_width'] == - inline_query_result_mpeg4_gif.mpeg4_width) - assert (inline_query_result_mpeg4_gif_dict['mpeg4_height'] == - inline_query_result_mpeg4_gif.mpeg4_height) - assert (inline_query_result_mpeg4_gif_dict['mpeg4_duration'] == - inline_query_result_mpeg4_gif.mpeg4_duration) - assert (inline_query_result_mpeg4_gif_dict['thumb_url'] == - inline_query_result_mpeg4_gif.thumb_url) + assert (inline_query_result_mpeg4_gif_dict['mpeg4_url'] + == inline_query_result_mpeg4_gif.mpeg4_url) + assert (inline_query_result_mpeg4_gif_dict['mpeg4_width'] + == inline_query_result_mpeg4_gif.mpeg4_width) + assert (inline_query_result_mpeg4_gif_dict['mpeg4_height'] + == inline_query_result_mpeg4_gif.mpeg4_height) + assert (inline_query_result_mpeg4_gif_dict['mpeg4_duration'] + == inline_query_result_mpeg4_gif.mpeg4_duration) + assert (inline_query_result_mpeg4_gif_dict['thumb_url'] + == inline_query_result_mpeg4_gif.thumb_url) assert inline_query_result_mpeg4_gif_dict['title'] == inline_query_result_mpeg4_gif.title - assert (inline_query_result_mpeg4_gif_dict['caption'] == - inline_query_result_mpeg4_gif.caption) - assert (inline_query_result_mpeg4_gif_dict['parse_mode'] == - inline_query_result_mpeg4_gif.parse_mode) - assert (inline_query_result_mpeg4_gif_dict['input_message_content'] == - inline_query_result_mpeg4_gif.input_message_content.to_dict()) - assert (inline_query_result_mpeg4_gif_dict['reply_markup'] == - inline_query_result_mpeg4_gif.reply_markup.to_dict()) + assert (inline_query_result_mpeg4_gif_dict['caption'] + == inline_query_result_mpeg4_gif.caption) + assert (inline_query_result_mpeg4_gif_dict['parse_mode'] + == inline_query_result_mpeg4_gif.parse_mode) + assert (inline_query_result_mpeg4_gif_dict['input_message_content'] + == inline_query_result_mpeg4_gif.input_message_content.to_dict()) + assert (inline_query_result_mpeg4_gif_dict['reply_markup'] + == inline_query_result_mpeg4_gif.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultMpeg4Gif(self.id, self.mpeg4_url, self.thumb_url) diff --git a/tests/test_inlinequeryresultphoto.py b/tests/test_inlinequeryresultphoto.py index 957a5013a..caaa67aa5 100644 --- a/tests/test_inlinequeryresultphoto.py +++ b/tests/test_inlinequeryresultphoto.py @@ -64,8 +64,8 @@ class TestInlineQueryResultPhoto(object): assert inline_query_result_photo.description == self.description assert inline_query_result_photo.caption == self.caption assert inline_query_result_photo.parse_mode == self.parse_mode - assert (inline_query_result_photo.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_photo.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_photo.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_photo): @@ -75,20 +75,20 @@ class TestInlineQueryResultPhoto(object): assert inline_query_result_photo_dict['type'] == inline_query_result_photo.type assert inline_query_result_photo_dict['id'] == inline_query_result_photo.id assert inline_query_result_photo_dict['photo_url'] == inline_query_result_photo.photo_url - assert (inline_query_result_photo_dict['photo_width'] == - inline_query_result_photo.photo_width) - assert (inline_query_result_photo_dict['photo_height'] == - inline_query_result_photo.photo_height) + assert (inline_query_result_photo_dict['photo_width'] + == inline_query_result_photo.photo_width) + assert (inline_query_result_photo_dict['photo_height'] + == inline_query_result_photo.photo_height) assert inline_query_result_photo_dict['thumb_url'] == inline_query_result_photo.thumb_url assert inline_query_result_photo_dict['title'] == inline_query_result_photo.title - assert (inline_query_result_photo_dict['description'] == - inline_query_result_photo.description) + assert (inline_query_result_photo_dict['description'] + == inline_query_result_photo.description) assert inline_query_result_photo_dict['caption'] == inline_query_result_photo.caption assert inline_query_result_photo_dict['parse_mode'] == inline_query_result_photo.parse_mode - assert (inline_query_result_photo_dict['input_message_content'] == - inline_query_result_photo.input_message_content.to_dict()) - assert (inline_query_result_photo_dict['reply_markup'] == - inline_query_result_photo.reply_markup.to_dict()) + assert (inline_query_result_photo_dict['input_message_content'] + == inline_query_result_photo.input_message_content.to_dict()) + assert (inline_query_result_photo_dict['reply_markup'] + == inline_query_result_photo.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultPhoto(self.id, self.photo_url, self.thumb_url) diff --git a/tests/test_inlinequeryresultvenue.py b/tests/test_inlinequeryresultvenue.py index dd9f57bd0..87e87dbaf 100644 --- a/tests/test_inlinequeryresultvenue.py +++ b/tests/test_inlinequeryresultvenue.py @@ -67,8 +67,8 @@ class TestInlineQueryResultVenue(object): assert inline_query_result_venue.thumb_url == self.thumb_url assert inline_query_result_venue.thumb_width == self.thumb_width assert inline_query_result_venue.thumb_height == self.thumb_height - assert (inline_query_result_venue.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_venue.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_venue.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_venue): @@ -81,19 +81,19 @@ class TestInlineQueryResultVenue(object): assert inline_query_result_venue_dict['longitude'] == inline_query_result_venue.longitude assert inline_query_result_venue_dict['title'] == inline_query_result_venue.title assert inline_query_result_venue_dict['address'] == inline_query_result_venue.address - assert (inline_query_result_venue_dict['foursquare_id'] == - inline_query_result_venue.foursquare_id) - assert (inline_query_result_venue_dict['foursquare_type'] == - inline_query_result_venue.foursquare_type) + assert (inline_query_result_venue_dict['foursquare_id'] + == inline_query_result_venue.foursquare_id) + assert (inline_query_result_venue_dict['foursquare_type'] + == inline_query_result_venue.foursquare_type) assert inline_query_result_venue_dict['thumb_url'] == inline_query_result_venue.thumb_url - assert (inline_query_result_venue_dict['thumb_width'] == - inline_query_result_venue.thumb_width) - assert (inline_query_result_venue_dict['thumb_height'] == - inline_query_result_venue.thumb_height) - assert (inline_query_result_venue_dict['input_message_content'] == - inline_query_result_venue.input_message_content.to_dict()) - assert (inline_query_result_venue_dict['reply_markup'] == - inline_query_result_venue.reply_markup.to_dict()) + assert (inline_query_result_venue_dict['thumb_width'] + == inline_query_result_venue.thumb_width) + assert (inline_query_result_venue_dict['thumb_height'] + == inline_query_result_venue.thumb_height) + assert (inline_query_result_venue_dict['input_message_content'] + == inline_query_result_venue.input_message_content.to_dict()) + assert (inline_query_result_venue_dict['reply_markup'] + == inline_query_result_venue.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultVenue(self.id, self.longitude, self.latitude, self.title, diff --git a/tests/test_inlinequeryresultvideo.py b/tests/test_inlinequeryresultvideo.py index 9a8afc431..f2b957bbe 100644 --- a/tests/test_inlinequeryresultvideo.py +++ b/tests/test_inlinequeryresultvideo.py @@ -70,8 +70,8 @@ class TestInlineQueryResultVideo(object): assert inline_query_result_video.description == self.description assert inline_query_result_video.caption == self.caption assert inline_query_result_video.parse_mode == self.parse_mode - assert (inline_query_result_video.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_video.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_video.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_video): @@ -82,22 +82,22 @@ class TestInlineQueryResultVideo(object): assert inline_query_result_video_dict['id'] == inline_query_result_video.id assert inline_query_result_video_dict['video_url'] == inline_query_result_video.video_url assert inline_query_result_video_dict['mime_type'] == inline_query_result_video.mime_type - assert (inline_query_result_video_dict['video_width'] == - inline_query_result_video.video_width) - assert (inline_query_result_video_dict['video_height'] == - inline_query_result_video.video_height) - assert (inline_query_result_video_dict['video_duration'] == - inline_query_result_video.video_duration) + assert (inline_query_result_video_dict['video_width'] + == inline_query_result_video.video_width) + assert (inline_query_result_video_dict['video_height'] + == inline_query_result_video.video_height) + assert (inline_query_result_video_dict['video_duration'] + == inline_query_result_video.video_duration) assert inline_query_result_video_dict['thumb_url'] == inline_query_result_video.thumb_url assert inline_query_result_video_dict['title'] == inline_query_result_video.title - assert (inline_query_result_video_dict['description'] == - inline_query_result_video.description) + assert (inline_query_result_video_dict['description'] + == inline_query_result_video.description) assert inline_query_result_video_dict['caption'] == inline_query_result_video.caption assert inline_query_result_video_dict['parse_mode'] == inline_query_result_video.parse_mode - assert (inline_query_result_video_dict['input_message_content'] == - inline_query_result_video.input_message_content.to_dict()) - assert (inline_query_result_video_dict['reply_markup'] == - inline_query_result_video.reply_markup.to_dict()) + assert (inline_query_result_video_dict['input_message_content'] + == inline_query_result_video.input_message_content.to_dict()) + assert (inline_query_result_video_dict['reply_markup'] + == inline_query_result_video.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultVideo(self.id, self.video_url, self.mime_type, diff --git a/tests/test_inlinequeryresultvoice.py b/tests/test_inlinequeryresultvoice.py index 718ffd4f7..ea04dd984 100644 --- a/tests/test_inlinequeryresultvoice.py +++ b/tests/test_inlinequeryresultvoice.py @@ -56,8 +56,8 @@ class TestInlineQueryResultVoice(object): assert inline_query_result_voice.voice_duration == self.voice_duration assert inline_query_result_voice.caption == self.caption assert inline_query_result_voice.parse_mode == self.parse_mode - assert (inline_query_result_voice.input_message_content.to_dict() == - self.input_message_content.to_dict()) + assert (inline_query_result_voice.input_message_content.to_dict() + == self.input_message_content.to_dict()) assert inline_query_result_voice.reply_markup.to_dict() == self.reply_markup.to_dict() def test_to_dict(self, inline_query_result_voice): @@ -68,14 +68,14 @@ class TestInlineQueryResultVoice(object): assert inline_query_result_voice_dict['id'] == inline_query_result_voice.id assert inline_query_result_voice_dict['voice_url'] == inline_query_result_voice.voice_url assert inline_query_result_voice_dict['title'] == inline_query_result_voice.title - assert (inline_query_result_voice_dict['voice_duration'] == - inline_query_result_voice.voice_duration) + assert (inline_query_result_voice_dict['voice_duration'] + == inline_query_result_voice.voice_duration) assert inline_query_result_voice_dict['caption'] == inline_query_result_voice.caption assert inline_query_result_voice_dict['parse_mode'] == inline_query_result_voice.parse_mode - assert (inline_query_result_voice_dict['input_message_content'] == - inline_query_result_voice.input_message_content.to_dict()) - assert (inline_query_result_voice_dict['reply_markup'] == - inline_query_result_voice.reply_markup.to_dict()) + assert (inline_query_result_voice_dict['input_message_content'] + == inline_query_result_voice.input_message_content.to_dict()) + assert (inline_query_result_voice_dict['reply_markup'] + == inline_query_result_voice.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultVoice(self.id, self.voice_url, self.title) diff --git a/tests/test_inputcontactmessagecontent.py b/tests/test_inputcontactmessagecontent.py index 6bed2f10f..dfe5cd593 100644 --- a/tests/test_inputcontactmessagecontent.py +++ b/tests/test_inputcontactmessagecontent.py @@ -43,9 +43,9 @@ class TestInputContactMessageContent(object): input_contact_message_content_dict = input_contact_message_content.to_dict() assert isinstance(input_contact_message_content_dict, dict) - assert (input_contact_message_content_dict['phone_number'] == - input_contact_message_content.phone_number) - assert (input_contact_message_content_dict['first_name'] == - input_contact_message_content.first_name) - assert (input_contact_message_content_dict['last_name'] == - input_contact_message_content.last_name) + assert (input_contact_message_content_dict['phone_number'] + == input_contact_message_content.phone_number) + assert (input_contact_message_content_dict['first_name'] + == input_contact_message_content.first_name) + assert (input_contact_message_content_dict['last_name'] + == input_contact_message_content.last_name) diff --git a/tests/test_inputfile.py b/tests/test_inputfile.py index 1c667d3df..6a94d1890 100644 --- a/tests/test_inputfile.py +++ b/tests/test_inputfile.py @@ -60,8 +60,8 @@ class TestInputFile(object): assert InputFile(BytesIO(b'blah'), filename='tg.mp3').mimetype == 'audio/mpeg' # Test fallback - assert (InputFile(BytesIO(b'blah'), filename='tg.notaproperext').mimetype == - 'application/octet-stream') + assert (InputFile(BytesIO(b'blah'), filename='tg.notaproperext').mimetype + == 'application/octet-stream') assert InputFile(BytesIO(b'blah')).mimetype == 'application/octet-stream' def test_filenames(self): @@ -89,7 +89,8 @@ class TestInputFile(object): filename='blah').filename == 'blah' assert InputFile(MockedFileobject('tests/data/telegram.jpg'), filename='blah.jpg').filename == 'blah.jpg' - assert InputFile(MockedFileobject('tests/data/telegram')).filename == 'application.octet-stream' # flake8: noqa + assert InputFile( + MockedFileobject('tests/data/telegram')).filename == 'application.octet-stream' assert InputFile(MockedFileobject('tests/data/telegram'), filename='blah').filename == 'blah' assert InputFile(MockedFileobject('tests/data/telegram'), diff --git a/tests/test_inputlocationmessagecontent.py b/tests/test_inputlocationmessagecontent.py index 4f87e1a82..f9b551752 100644 --- a/tests/test_inputlocationmessagecontent.py +++ b/tests/test_inputlocationmessagecontent.py @@ -43,9 +43,9 @@ class TestInputLocationMessageContent(object): input_location_message_content_dict = input_location_message_content.to_dict() assert isinstance(input_location_message_content_dict, dict) - assert (input_location_message_content_dict['latitude'] == - input_location_message_content.latitude) - assert (input_location_message_content_dict['longitude'] == - input_location_message_content.longitude) - assert (input_location_message_content_dict['live_period'] == - input_location_message_content.live_period) + assert (input_location_message_content_dict['latitude'] + == input_location_message_content.latitude) + assert (input_location_message_content_dict['longitude'] + == input_location_message_content.longitude) + assert (input_location_message_content_dict['live_period'] + == input_location_message_content.live_period) diff --git a/tests/test_inputtextmessagecontent.py b/tests/test_inputtextmessagecontent.py index 8a07d6046..477ea1967 100644 --- a/tests/test_inputtextmessagecontent.py +++ b/tests/test_inputtextmessagecontent.py @@ -44,9 +44,9 @@ class TestInputTextMessageContent(object): input_text_message_content_dict = input_text_message_content.to_dict() assert isinstance(input_text_message_content_dict, dict) - assert (input_text_message_content_dict['message_text'] == - input_text_message_content.message_text) - assert (input_text_message_content_dict['parse_mode'] == - input_text_message_content.parse_mode) - assert (input_text_message_content_dict['disable_web_page_preview'] == - input_text_message_content.disable_web_page_preview) + assert (input_text_message_content_dict['message_text'] + == input_text_message_content.message_text) + assert (input_text_message_content_dict['parse_mode'] + == input_text_message_content.parse_mode) + assert (input_text_message_content_dict['disable_web_page_preview'] + == input_text_message_content.disable_web_page_preview) diff --git a/tests/test_inputvenuemessagecontent.py b/tests/test_inputvenuemessagecontent.py index b3766d85c..34f456964 100644 --- a/tests/test_inputvenuemessagecontent.py +++ b/tests/test_inputvenuemessagecontent.py @@ -52,13 +52,13 @@ class TestInputVenueMessageContent(object): input_venue_message_content_dict = input_venue_message_content.to_dict() assert isinstance(input_venue_message_content_dict, dict) - assert (input_venue_message_content_dict['latitude'] == - input_venue_message_content.latitude) - assert (input_venue_message_content_dict['longitude'] == - input_venue_message_content.longitude) + assert (input_venue_message_content_dict['latitude'] + == input_venue_message_content.latitude) + assert (input_venue_message_content_dict['longitude'] + == input_venue_message_content.longitude) assert input_venue_message_content_dict['title'] == input_venue_message_content.title assert input_venue_message_content_dict['address'] == input_venue_message_content.address - assert (input_venue_message_content_dict['foursquare_id'] == - input_venue_message_content.foursquare_id) - assert (input_venue_message_content_dict['foursquare_type'] == - input_venue_message_content.foursquare_type) + assert (input_venue_message_content_dict['foursquare_id'] + == input_venue_message_content.foursquare_id) + assert (input_venue_message_content_dict['foursquare_type'] + == input_venue_message_content.foursquare_type) diff --git a/tests/test_invoice.py b/tests/test_invoice.py index 1db049c8c..5722e852c 100644 --- a/tests/test_invoice.py +++ b/tests/test_invoice.py @@ -112,8 +112,8 @@ class TestInvoice(object): def test_send_object_as_provider_data(self, monkeypatch, bot, chat_id, provider_token): def test(_, url, data, **kwargs): - return (data['provider_data'] == '{"test_data": 123456789}' or # Depends if using - data['provider_data'] == '{"test_data":123456789}') # ujson or not + return (data['provider_data'] == '{"test_data": 123456789}' # Depends if using + or data['provider_data'] == '{"test_data":123456789}') # ujson or not monkeypatch.setattr('telegram.utils.request.Request.post', test) diff --git a/tests/test_message.py b/tests/test_message.py index 202897758..a0544dca5 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -115,7 +115,7 @@ class TestMessage(object): {'length': 4, 'offset': 25, 'type': 'code'}, {'length': 5, 'offset': 31, 'type': 'text_link', 'url': 'http://github.com/'}, {'length': 12, 'offset': 38, 'type': 'text_mention', - 'user': User(123456789, 'mentioned user', False)}, + 'user': User(123456789, 'mentioned user', False)}, {'length': 3, 'offset': 55, 'type': 'pre'}, {'length': 17, 'offset': 60, 'type': 'url'}] test_text = 'Test for