diff --git a/telegram/bot.py b/telegram/bot.py index d1d214c24..a7b3f10e6 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -682,11 +682,13 @@ class Bot(TelegramObject): url = '{0}/sendVenue'.format(self.base_url) - data = {'chat_id': chat_id, - 'latitude': latitude, - 'longitude': longitude, - 'address': address, - 'title': title} + data = { + 'chat_id': chat_id, + 'latitude': latitude, + 'longitude': longitude, + 'address': address, + 'title': title + } if foursquare_id: data['foursquare_id'] = foursquare_id diff --git a/telegram/game.py b/telegram/game.py index d79f8570d..5b30e374d 100644 --- a/telegram/game.py +++ b/telegram/game.py @@ -140,5 +140,7 @@ class Game(TelegramObject): if types is None: types = MessageEntity.ALL_TYPES - return {entity: self.parse_text_entity(entity) - for entity in self.text_entities if entity.type in types} + return { + entity: self.parse_text_entity(entity) + for entity in self.text_entities if entity.type in types + } diff --git a/telegram/inlinekeyboardmarkup.py b/telegram/inlinekeyboardmarkup.py index 5a82d1b30..f9fa3263a 100644 --- a/telegram/inlinekeyboardmarkup.py +++ b/telegram/inlinekeyboardmarkup.py @@ -52,8 +52,10 @@ class InlineKeyboardMarkup(ReplyMarkup): if not data: return None - data['inline_keyboard'] = [InlineKeyboardButton.de_list(inline_keyboard, bot) - for inline_keyboard in data['inline_keyboard']] + data['inline_keyboard'] = [ + InlineKeyboardButton.de_list(inline_keyboard, bot) + for inline_keyboard in data['inline_keyboard'] + ] return InlineKeyboardMarkup(**data) diff --git a/telegram/message.py b/telegram/message.py index 9b8af15b0..e81425455 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -465,5 +465,7 @@ class Message(TelegramObject): if types is None: types = MessageEntity.ALL_TYPES - return {entity: self.parse_entity(entity) - for entity in self.entities if entity.type in types} + return { + entity: self.parse_entity(entity) + for entity in self.entities if entity.type in types + } diff --git a/telegram/messageentity.py b/telegram/messageentity.py index eb6a41248..f5bae748f 100644 --- a/telegram/messageentity.py +++ b/telegram/messageentity.py @@ -80,5 +80,6 @@ class MessageEntity(TelegramObject): PRE = 'pre' TEXT_LINK = 'text_link' TEXT_MENTION = 'text_mention' - ALL_TYPES = [MENTION, HASHTAG, BOT_COMMAND, URL, EMAIL, BOLD, ITALIC, CODE, PRE, TEXT_LINK, - TEXT_MENTION] + ALL_TYPES = [ + MENTION, HASHTAG, BOT_COMMAND, URL, EMAIL, BOLD, ITALIC, CODE, PRE, TEXT_LINK, TEXT_MENTION + ] diff --git a/tests/test_chat.py b/tests/test_chat.py index 6be5af390..15e95cd7c 100644 --- a/tests/test_chat.py +++ b/tests/test_chat.py @@ -38,10 +38,12 @@ class ChatTest(BaseTest, unittest.TestCase): self.type = 'group' self.all_members_are_admins = False - self.json_dict = {'id': self.id, - 'title': self.title, - 'type': self.type, - 'all_members_are_admins': self.all_members_are_admins} + self.json_dict = { + 'id': self.id, + 'title': self.title, + 'type': self.type, + 'all_members_are_admins': self.all_members_are_admins + } def test_group_chat_de_json_empty_json(self): group_chat = telegram.Chat.de_json({}, self._bot) diff --git a/tests/test_conversationhandler.py b/tests/test_conversationhandler.py index f9ee4623b..93123439a 100644 --- a/tests/test_conversationhandler.py +++ b/tests/test_conversationhandler.py @@ -66,14 +66,17 @@ class ConversationHandlerTest(BaseTest, unittest.TestCase): def setUp(self): self.current_state = dict() self.entry_points = [CommandHandler('start', self.start)] - self.states = {self.THIRSTY: [CommandHandler('brew', self.brew), - CommandHandler('wait', self.start)], - self.BREWING: [CommandHandler('pourCoffee', self.drink)], - self.DRINKING: [CommandHandler('startCoding', self.code), - CommandHandler('drinkMore', self.drink)], - self.CODING: [CommandHandler('keepCoding', self.code), - CommandHandler('gettingThirsty', self.start), - CommandHandler('drinkMore', self.drink)],} + self.states = { + self.THIRSTY: [CommandHandler('brew', self.brew), CommandHandler('wait', self.start)], + self.BREWING: [CommandHandler('pourCoffee', self.drink)], + self.DRINKING: + [CommandHandler('startCoding', self.code), CommandHandler('drinkMore', self.drink)], + self.CODING: [ + CommandHandler('keepCoding', self.code), + CommandHandler('gettingThirsty', self.start), + CommandHandler('drinkMore', self.drink) + ], + } self.fallbacks = [CommandHandler('eat', self.start)] def _setup_updater(self, *args, **kwargs): diff --git a/tests/test_document.py b/tests/test_document.py index 99139cdd5..220d7c062 100644 --- a/tests/test_document.py +++ b/tests/test_document.py @@ -37,10 +37,12 @@ class DocumentTest(BaseTest, unittest.TestCase): self.document_file = open('tests/data/telegram.png', 'rb') self.document_file_id = 'BQADAQADpAADHyP1B04ipZxJTe2BAg' self.document_file_url = 'https://raw.githubusercontent.com/python-telegram-bot/python-telegram-bot/master/tests/data/telegram.gif' - self.thumb = {'width': 90, - 'height': 90, - 'file_id': 'BQADAQADoQADHyP1B0mzJMVyzcB0Ag', - 'file_size': 2364} + self.thumb = { + 'width': 90, + 'height': 90, + 'file_id': 'BQADAQADoQADHyP1B0mzJMVyzcB0Ag', + 'file_size': 2364 + } self.file_name = 'telegram.png' self.mime_type = 'image/png' self.file_size = 12948 diff --git a/tests/test_forcereply.py b/tests/test_forcereply.py index 4d0cabb86..93804e8d0 100644 --- a/tests/test_forcereply.py +++ b/tests/test_forcereply.py @@ -35,8 +35,10 @@ class ForceReplyTest(BaseTest, unittest.TestCase): self.force_reply = True self.selective = True - self.json_dict = {'force_reply': self.force_reply, - 'selective': self.selective,} + self.json_dict = { + 'force_reply': self.force_reply, + 'selective': self.selective, + } def test_send_message_with_force_reply(self): message = self._bot.sendMessage( diff --git a/tests/test_game.py b/tests/test_game.py index b5c431d22..35a11e73a 100644 --- a/tests/test_game.py +++ b/tests/test_game.py @@ -96,8 +96,9 @@ class GameTest(BaseTest, unittest.TestCase): self.title, self.description, self.photo, text=text, text_entities=[entity_2, entity]) self.assertDictEqual( game.parse_text_entities(telegram.MessageEntity.URL), {entity: 'http://google.com'}) - self.assertDictEqual(game.parse_text_entities(), {entity: 'http://google.com', - entity_2: 'h'}) + self.assertDictEqual(game.parse_text_entities(), + {entity: 'http://google.com', + entity_2: 'h'}) class AnimationTest(BaseTest, unittest.TestCase): diff --git a/tests/test_inlinekeyboardmarkup.py b/tests/test_inlinekeyboardmarkup.py index 564f9c816..407cdaf49 100644 --- a/tests/test_inlinekeyboardmarkup.py +++ b/tests/test_inlinekeyboardmarkup.py @@ -32,13 +32,15 @@ class InlineKeyboardMarkupTest(BaseTest, unittest.TestCase): """This object represents Tests for Telegram KeyboardButton.""" def setUp(self): - self.inline_keyboard = [[telegram.InlineKeyboardButton( - text='button1', callback_data='data1'), telegram.InlineKeyboardButton( - text='button2', callback_data='data2')]] + self.inline_keyboard = [[ + telegram.InlineKeyboardButton( + text='button1', callback_data='data1'), telegram.InlineKeyboardButton( + text='button2', callback_data='data2') + ]] self.json_dict = { - 'inline_keyboard': [[self.inline_keyboard[0][0].to_dict(), - self.inline_keyboard[0][1].to_dict()]], + 'inline_keyboard': + [[self.inline_keyboard[0][0].to_dict(), self.inline_keyboard[0][1].to_dict()]], } def test_send_message_with_inline_keyboard_markup(self): diff --git a/tests/test_inlinequeryresultarticle.py b/tests/test_inlinequeryresultarticle.py index 44373c032..49aa58ec8 100644 --- a/tests/test_inlinequeryresultarticle.py +++ b/tests/test_inlinequeryresultarticle.py @@ -36,9 +36,8 @@ class InlineQueryResultArticleTest(BaseTest, unittest.TestCase): self.type = 'article' self.title = 'title' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.url = 'url' self.hide_url = True self.description = 'description' diff --git a/tests/test_inlinequeryresultaudio.py b/tests/test_inlinequeryresultaudio.py index cf923c86c..b6620e831 100644 --- a/tests/test_inlinequeryresultaudio.py +++ b/tests/test_inlinequeryresultaudio.py @@ -40,9 +40,8 @@ class InlineQueryResultAudioTest(BaseTest, unittest.TestCase): self.audio_duration = 'audio_duration' self.caption = 'caption' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultcachedaudio.py b/tests/test_inlinequeryresultcachedaudio.py index 150cc58b5..f105e7c18 100644 --- a/tests/test_inlinequeryresultcachedaudio.py +++ b/tests/test_inlinequeryresultcachedaudio.py @@ -38,9 +38,8 @@ class InlineQueryResultCachedAudioTest(BaseTest, unittest.TestCase): self.audio_file_id = 'audio file id' self.caption = 'caption' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultcacheddocument.py b/tests/test_inlinequeryresultcacheddocument.py index cde4bcc31..490c36c59 100644 --- a/tests/test_inlinequeryresultcacheddocument.py +++ b/tests/test_inlinequeryresultcacheddocument.py @@ -40,9 +40,8 @@ class InlineQueryResultCachedDocumentTest(BaseTest, unittest.TestCase): self.caption = 'caption' self.description = 'description' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'id': self.id, 'type': self.type, diff --git a/tests/test_inlinequeryresultcachedgif.py b/tests/test_inlinequeryresultcachedgif.py index a04e77e31..41bd17870 100644 --- a/tests/test_inlinequeryresultcachedgif.py +++ b/tests/test_inlinequeryresultcachedgif.py @@ -38,9 +38,8 @@ class InlineQueryResultCachedGifTest(BaseTest, unittest.TestCase): self.title = 'title' self.caption = 'caption' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultcachedmpeg4gif.py b/tests/test_inlinequeryresultcachedmpeg4gif.py index c8cb8fc32..7ab4aff8a 100644 --- a/tests/test_inlinequeryresultcachedmpeg4gif.py +++ b/tests/test_inlinequeryresultcachedmpeg4gif.py @@ -39,9 +39,8 @@ class InlineQueryResultCachedMpeg4GifTest(BaseTest, unittest.TestCase): self.title = 'title' self.caption = 'caption' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultcachedphoto.py b/tests/test_inlinequeryresultcachedphoto.py index cee484c02..6054920d8 100644 --- a/tests/test_inlinequeryresultcachedphoto.py +++ b/tests/test_inlinequeryresultcachedphoto.py @@ -40,9 +40,8 @@ class InlineQueryResultCachedPhotoTest(BaseTest, unittest.TestCase): self.description = 'description' self.caption = 'caption' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultcachedsticker.py b/tests/test_inlinequeryresultcachedsticker.py index bccec6b5f..2741c185b 100644 --- a/tests/test_inlinequeryresultcachedsticker.py +++ b/tests/test_inlinequeryresultcachedsticker.py @@ -37,9 +37,8 @@ class InlineQueryResultCachedStickerTest(BaseTest, unittest.TestCase): self.type = 'sticker' self.sticker_file_id = 'sticker file id' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultcachedvideo.py b/tests/test_inlinequeryresultcachedvideo.py index b78180056..4518e70b6 100644 --- a/tests/test_inlinequeryresultcachedvideo.py +++ b/tests/test_inlinequeryresultcachedvideo.py @@ -40,9 +40,8 @@ class InlineQueryResultCachedVideoTest(BaseTest, unittest.TestCase): self.caption = 'caption' self.description = 'description' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultcachedvoice.py b/tests/test_inlinequeryresultcachedvoice.py index d91eaad99..40ed187f2 100644 --- a/tests/test_inlinequeryresultcachedvoice.py +++ b/tests/test_inlinequeryresultcachedvoice.py @@ -39,9 +39,8 @@ class InlineQueryResultCachedVoiceTest(BaseTest, unittest.TestCase): self.title = 'title' self.caption = 'caption' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultcontact.py b/tests/test_inlinequeryresultcontact.py index 5187e8e85..ab2238d5f 100644 --- a/tests/test_inlinequeryresultcontact.py +++ b/tests/test_inlinequeryresultcontact.py @@ -41,9 +41,8 @@ class InlineQueryResultContactTest(BaseTest, unittest.TestCase): self.thumb_width = 10 self.thumb_height = 15 self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'id': self.id, 'type': self.type, diff --git a/tests/test_inlinequeryresultdocument.py b/tests/test_inlinequeryresultdocument.py index fee73e8ff..0243fc529 100644 --- a/tests/test_inlinequeryresultdocument.py +++ b/tests/test_inlinequeryresultdocument.py @@ -43,9 +43,8 @@ class InlineQueryResultDocumentTest(BaseTest, unittest.TestCase): self.thumb_width = 10 self.thumb_height = 15 self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'id': self.id, 'type': self.type, diff --git a/tests/test_inlinequeryresultgif.py b/tests/test_inlinequeryresultgif.py index 8e52e4680..76a90548a 100644 --- a/tests/test_inlinequeryresultgif.py +++ b/tests/test_inlinequeryresultgif.py @@ -41,9 +41,8 @@ class InlineQueryResultGifTest(BaseTest, unittest.TestCase): self.title = 'title' self.caption = 'caption' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultlocation.py b/tests/test_inlinequeryresultlocation.py index f47981a91..e65afb75c 100644 --- a/tests/test_inlinequeryresultlocation.py +++ b/tests/test_inlinequeryresultlocation.py @@ -41,9 +41,8 @@ class InlineQueryResultLocationTest(BaseTest, unittest.TestCase): self.thumb_width = 10 self.thumb_height = 15 self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'id': self.id, 'type': self.type, diff --git a/tests/test_inlinequeryresultmpeg4gif.py b/tests/test_inlinequeryresultmpeg4gif.py index 1a55db69d..7f86cb824 100644 --- a/tests/test_inlinequeryresultmpeg4gif.py +++ b/tests/test_inlinequeryresultmpeg4gif.py @@ -41,9 +41,8 @@ class InlineQueryResultMpeg4GifTest(BaseTest, unittest.TestCase): self.title = 'title' self.caption = 'caption' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultphoto.py b/tests/test_inlinequeryresultphoto.py index fd178ed5b..7157e2178 100644 --- a/tests/test_inlinequeryresultphoto.py +++ b/tests/test_inlinequeryresultphoto.py @@ -42,9 +42,8 @@ class InlineQueryResultPhotoTest(BaseTest, unittest.TestCase): self.description = 'description' self.caption = 'caption' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultvenue.py b/tests/test_inlinequeryresultvenue.py index a2620736a..095972df0 100644 --- a/tests/test_inlinequeryresultvenue.py +++ b/tests/test_inlinequeryresultvenue.py @@ -43,9 +43,8 @@ class InlineQueryResultVenueTest(BaseTest, unittest.TestCase): self.thumb_width = 10 self.thumb_height = 15 self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'id': self.id, 'type': self.type, diff --git a/tests/test_inlinequeryresultvideo.py b/tests/test_inlinequeryresultvideo.py index d14f0b0d2..1fe134008 100644 --- a/tests/test_inlinequeryresultvideo.py +++ b/tests/test_inlinequeryresultvideo.py @@ -44,9 +44,8 @@ class InlineQueryResultVideoTest(BaseTest, unittest.TestCase): self.caption = 'caption' self.description = 'description' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inlinequeryresultvoice.py b/tests/test_inlinequeryresultvoice.py index 069085a94..eecf2865e 100644 --- a/tests/test_inlinequeryresultvoice.py +++ b/tests/test_inlinequeryresultvoice.py @@ -39,9 +39,8 @@ class InlineQueryResultVoiceTest(BaseTest, unittest.TestCase): self.voice_duration = 'voice_duration' self.caption = 'caption' self.input_message_content = telegram.InputTextMessageContent('input_message_content') - self.reply_markup = telegram.InlineKeyboardMarkup([[ - telegram.InlineKeyboardButton('reply_markup') - ]]) + self.reply_markup = telegram.InlineKeyboardMarkup( + [[telegram.InlineKeyboardButton('reply_markup')]]) self.json_dict = { 'type': self.type, diff --git a/tests/test_inputlocationmessagecontent.py b/tests/test_inputlocationmessagecontent.py index b45a630b9..c74328729 100644 --- a/tests/test_inputlocationmessagecontent.py +++ b/tests/test_inputlocationmessagecontent.py @@ -35,8 +35,10 @@ class InputLocationMessageContentTest(BaseTest, unittest.TestCase): self.latitude = 1. self.longitude = 2. - self.json_dict = {'longitude': self.longitude, - 'latitude': self.latitude,} + self.json_dict = { + 'longitude': self.longitude, + 'latitude': self.latitude, + } def test_ilmc_de_json(self): ilmc = telegram.InputLocationMessageContent.de_json(self.json_dict, self._bot) diff --git a/tests/test_message.py b/tests/test_message.py index a036c9f0c..0e95f78e9 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -55,8 +55,9 @@ class MessageTest(BaseTest, unittest.TestCase): entities=[entity_2, entity]) self.assertDictEqual( message.parse_entities(telegram.MessageEntity.URL), {entity: 'http://google.com'}) - self.assertDictEqual(message.parse_entities(), {entity: 'http://google.com', - entity_2: 'h'}) + self.assertDictEqual(message.parse_entities(), + {entity: 'http://google.com', + entity_2: 'h'}) @flaky(3, 1) def test_reply_text(self): diff --git a/tests/test_replykeyboardhide.py b/tests/test_replykeyboardhide.py index 02a221fed..152af75e8 100644 --- a/tests/test_replykeyboardhide.py +++ b/tests/test_replykeyboardhide.py @@ -35,8 +35,10 @@ class ReplyKeyboardHideTest(BaseTest, unittest.TestCase): self.hide_keyboard = True self.selective = True - self.json_dict = {'hide_keyboard': self.hide_keyboard, - 'selective': self.selective,} + self.json_dict = { + 'hide_keyboard': self.hide_keyboard, + 'selective': self.selective, + } def test_send_message_with_reply_keyboard_hide(self): message = self._bot.sendMessage( diff --git a/tests/test_sticker.py b/tests/test_sticker.py index 9048511cc..8403ed85e 100644 --- a/tests/test_sticker.py +++ b/tests/test_sticker.py @@ -38,10 +38,12 @@ class StickerTest(BaseTest, unittest.TestCase): self.sticker_file_id = 'BQADAQADHAADyIsGAAFZfq1bphjqlgI' self.width = 510 self.height = 512 - self.thumb = {'width': 90, - 'height': 90, - 'file_id': 'BQADAQADoQADHyP1B0mzJMVyzcB0Ag', - 'file_size': 2364} + self.thumb = { + 'width': 90, + 'height': 90, + 'file_id': 'BQADAQADoQADHyP1B0mzJMVyzcB0Ag', + 'file_size': 2364 + } self.emoji = telegram.Emoji.FLEXED_BICEPS self.file_size = 39518 diff --git a/tests/test_update.py b/tests/test_update.py index f0ecd262e..11ef57e7e 100644 --- a/tests/test_update.py +++ b/tests/test_update.py @@ -32,18 +32,24 @@ class UpdateTest(BaseTest, unittest.TestCase): def setUp(self): self.update_id = 868573637 - self.message = {'message_id': 319, - 'from': {'id': 12173560, - 'first_name': "Leandro", - 'last_name': "S.", - 'username': "leandrotoledo"}, - 'chat': {'id': 12173560, - 'type': 'private', - 'first_name': "Leandro", - 'last_name': "S.", - 'username': "leandrotoledo"}, - 'date': 1441644592, - 'text': "Update Test"} + self.message = { + 'message_id': 319, + 'from': { + 'id': 12173560, + 'first_name': "Leandro", + 'last_name': "S.", + 'username': "leandrotoledo" + }, + 'chat': { + 'id': 12173560, + 'type': 'private', + 'first_name': "Leandro", + 'last_name': "S.", + 'username': "leandrotoledo" + }, + 'date': 1441644592, + 'text': "Update Test" + } self.json_dict = {'update_id': self.update_id, 'message': self.message} diff --git a/tests/test_updater.py b/tests/test_updater.py index 3f3d252c6..9f71b0bae 100644 --- a/tests/test_updater.py +++ b/tests/test_updater.py @@ -496,8 +496,9 @@ class UpdaterTest(BaseTest, unittest.TestCase): queue = self.updater.start_polling(0.01) queue.put('This is a test message for regex group matching.') sleep(.1) - self.assertEqual(self.received_message, (('This', 'regex group'), - {'testgroup': 'regex group'})) + self.assertEqual(self.received_message, (('This', 'regex group'), { + 'testgroup': 'regex group' + })) def test_regexGroupHandlerInlineQuery(self): self._setup_updater('', messages=0) @@ -516,8 +517,9 @@ class UpdaterTest(BaseTest, unittest.TestCase): 0, None, 'This is a test message for regex group matching.', None))) sleep(.1) - self.assertEqual(self.received_message, (('This', 'regex group'), - {'testgroup': 'regex group'})) + self.assertEqual(self.received_message, (('This', 'regex group'), { + 'testgroup': 'regex group' + })) def test_regexGroupHandlerCallbackQuery(self): self._setup_updater('', messages=0) @@ -536,8 +538,9 @@ class UpdaterTest(BaseTest, unittest.TestCase): 0, None, None, data='This is a test message for regex group matching.'))) sleep(.1) - self.assertEqual(self.received_message, (('This', 'regex group'), - {'testgroup': 'regex group'})) + self.assertEqual(self.received_message, (('This', 'regex group'), { + 'testgroup': 'regex group' + })) def test_runAsyncWithAdditionalArgs(self): self._setup_updater('Test6', messages=2) diff --git a/tests/test_video.py b/tests/test_video.py index 91bde390b..af589c1a1 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -40,15 +40,18 @@ class VideoTest(BaseTest, unittest.TestCase): self.width = 360 self.height = 640 self.duration = 5 - self.thumb = telegram.PhotoSize.de_json({'file_id': 'AAQBABOMsecvAAQqqoY1Pee_MqcyAAIC', - 'file_size': 645, - 'height': 90, - 'width': 51}, self._bot) - self.thumb_from_url = telegram.PhotoSize.de_json({'file_id': - 'AAQEABPZU2EZAAQ_tPcvcRTF4i1GAQABAg', - 'file_size': 645, - 'height': 90, - 'width': 51}, self._bot) + self.thumb = telegram.PhotoSize.de_json({ + 'file_id': 'AAQBABOMsecvAAQqqoY1Pee_MqcyAAIC', + 'file_size': 645, + 'height': 90, + 'width': 51 + }, self._bot) + self.thumb_from_url = telegram.PhotoSize.de_json({ + 'file_id': 'AAQEABPZU2EZAAQ_tPcvcRTF4i1GAQABAg', + 'file_size': 645, + 'height': 90, + 'width': 51 + }, self._bot) self.mime_type = 'video/mp4' self.file_size = 326534