From e92fb3d6a5d1bb47058a32cdd86f56be0b87ee84 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Thu, 7 Jan 2021 22:43:20 +0100 Subject: [PATCH 1/2] Add pyupgrade to pre-commit --- .pre-commit-config.yaml | 7 +++++++ examples/conversationbot.py | 1 - examples/conversationbot2.py | 1 - examples/deeplinking.py | 1 - examples/echobot.py | 1 - examples/errorhandlerbot.py | 1 - examples/inlinebot.py | 1 - examples/inlinekeyboard.py | 1 - examples/inlinekeyboard2.py | 1 - examples/nestedconversationbot.py | 1 - examples/passportbot.py | 1 - examples/paymentbot.py | 1 - examples/persistentconversationbot.py | 1 - examples/pollbot.py | 1 - examples/rawapibot.py | 1 - examples/timerbot.py | 1 - requirements-dev.txt | 1 + telegram/bot.py | 1 - telegram/ext/picklepersistence.py | 4 ++-- telegram/user.py | 2 +- telegram/utils/helpers.py | 4 ++-- telegram/utils/request.py | 6 +++--- tests/conftest.py | 7 +++---- tests/test_commandhandler.py | 1 - tests/test_dispatcher.py | 7 +++---- tests/test_file.py | 5 ++--- tests/test_inputfile.py | 3 +-- tests/test_messageid.py | 1 - tests/test_parsemode.py | 2 +- tests/test_passport.py | 2 +- tests/test_photo.py | 7 +++---- tests/test_poll.py | 1 - tests/test_sticker.py | 1 - tests/test_user.py | 18 +++++++++--------- tests/test_video.py | 2 +- tests/test_videonote.py | 2 +- tests/test_voice.py | 2 +- tests/test_webhookinfo.py | 2 +- 38 files changed, 43 insertions(+), 60 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 01bfd7fb5f9..9bf9e031119 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,3 +25,10 @@ repos: hooks: - id: mypy files: ^(telegram|examples)/.*\.py$ +- repo: https://github.com/asottile/pyupgrade + rev: v2.7.4 + hooks: + - id: pyupgrade + files: ^(telegram|examples|tests)/.*\.py$ + args: + - --py36-plus diff --git a/examples/conversationbot.py b/examples/conversationbot.py index 0837b94752d..d004cf18c5e 100644 --- a/examples/conversationbot.py +++ b/examples/conversationbot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/conversationbot2.py b/examples/conversationbot2.py index 49d0deea977..0fb8e43536c 100644 --- a/examples/conversationbot2.py +++ b/examples/conversationbot2.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/deeplinking.py b/examples/deeplinking.py index eb1cee13c1c..e0886b2e5f4 100644 --- a/examples/deeplinking.py +++ b/examples/deeplinking.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/echobot.py b/examples/echobot.py index c8a264584bd..43c40de6ce6 100644 --- a/examples/echobot.py +++ b/examples/echobot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/errorhandlerbot.py b/examples/errorhandlerbot.py index 3aa90d0df33..fcb51bc195a 100644 --- a/examples/errorhandlerbot.py +++ b/examples/errorhandlerbot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/inlinebot.py b/examples/inlinebot.py index 460e4c70ae8..a253614358a 100644 --- a/examples/inlinebot.py +++ b/examples/inlinebot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/inlinekeyboard.py b/examples/inlinekeyboard.py index 8158cc084a0..a4c45edd7e3 100644 --- a/examples/inlinekeyboard.py +++ b/examples/inlinekeyboard.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/inlinekeyboard2.py b/examples/inlinekeyboard2.py index 4d6092beca0..08090a3bd1d 100644 --- a/examples/inlinekeyboard2.py +++ b/examples/inlinekeyboard2.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/nestedconversationbot.py b/examples/nestedconversationbot.py index 9b91576dda9..b46fe96c181 100644 --- a/examples/nestedconversationbot.py +++ b/examples/nestedconversationbot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/passportbot.py b/examples/passportbot.py index 33372753e20..3721329afc1 100644 --- a/examples/passportbot.py +++ b/examples/passportbot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/paymentbot.py b/examples/paymentbot.py index 7080e30a73b..307681114b3 100644 --- a/examples/paymentbot.py +++ b/examples/paymentbot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/persistentconversationbot.py b/examples/persistentconversationbot.py index 492f202bb0b..ea29a2a5c18 100644 --- a/examples/persistentconversationbot.py +++ b/examples/persistentconversationbot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116, C0103 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/pollbot.py b/examples/pollbot.py index 4f604a9a5b3..075571b93da 100644 --- a/examples/pollbot.py +++ b/examples/pollbot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/examples/rawapibot.py b/examples/rawapibot.py index b25d72766c1..464c0b3367f 100644 --- a/examples/rawapibot.py +++ b/examples/rawapibot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0603 """Simple Bot to reply to Telegram messages. diff --git a/examples/timerbot.py b/examples/timerbot.py index 49967755968..ad57bfae914 100644 --- a/examples/timerbot.py +++ b/examples/timerbot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # This program is dedicated to the public domain under the CC0 license. diff --git a/requirements-dev.txt b/requirements-dev.txt index eec7eb8efe6..bf34254ae54 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,6 +4,7 @@ black==20.8b1 flake8==3.8.4 pylint==2.6.0 mypy==0.790 +pyupgrade==2.7.4 pytest==4.2.0 # Need older attrs version for pytest 4.2.0 diff --git a/telegram/bot.py b/telegram/bot.py index 04aaa49ac69..e69e3396892 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # pylint: disable=E0611,E0213,E1102,C0103,E1101,R0913,R0904 # # A library that provides a Python interface to the Telegram Bot API diff --git a/telegram/ext/picklepersistence.py b/telegram/ext/picklepersistence.py index df6e7598ff4..625de98508d 100644 --- a/telegram/ext/picklepersistence.py +++ b/telegram/ext/picklepersistence.py @@ -105,7 +105,7 @@ def load_singlefile(self) -> None: # For backwards compatibility with files not containing bot data self.bot_data = data.get('bot_data', {}) self.conversations = data['conversations'] - except IOError: + except OSError: self.conversations = dict() self.user_data = defaultdict(dict) self.chat_data = defaultdict(dict) @@ -120,7 +120,7 @@ def load_file(filename: str) -> Any: try: with open(filename, "rb") as file: return pickle.load(file) - except IOError: + except OSError: return None except pickle.UnpicklingError as exc: raise TypeError(f"File {filename} does not contain valid pickle data") from exc diff --git a/telegram/user.py b/telegram/user.py index 404b30026fb..e0e6642978e 100644 --- a/telegram/user.py +++ b/telegram/user.py @@ -135,7 +135,7 @@ def full_name(self) -> str: available) :attr:`last_name`.""" if self.last_name: - return u'{} {}'.format(self.first_name, self.last_name) + return f'{self.first_name} {self.last_name}' return self.first_name @property diff --git a/telegram/utils/helpers.py b/telegram/utils/helpers.py index 8e9a82c7975..ffe640b3d1a 100644 --- a/telegram/utils/helpers.py +++ b/telegram/utils/helpers.py @@ -317,7 +317,7 @@ def mention_html(user_id: Union[int, str], name: str) -> str: Returns: :obj:`str`: The inline mention for the user as html. """ - return u'{}'.format(user_id, escape(name)) + return '{}'.format(user_id, escape(name)) def mention_markdown(user_id: Union[int, str], name: str, version: int = 1) -> str: @@ -331,7 +331,7 @@ def mention_markdown(user_id: Union[int, str], name: str, version: int = 1) -> s Returns: :obj:`str`: The inline mention for the user as markdown. """ - return u'[{}](tg://user?id={})'.format(escape_markdown(name, version=version), user_id) + return '[{}](tg://user?id={})'.format(escape_markdown(name, version=version), user_id) def effective_message_type(entity: Union['Message', 'Update']) -> Optional[str]: diff --git a/telegram/utils/request.py b/telegram/utils/request.py index 6e959213985..9a846f46b95 100644 --- a/telegram/utils/request.py +++ b/telegram/utils/request.py @@ -78,9 +78,9 @@ def _render_part(self: RequestField, name: str, value: str) -> str: # pylint: d Content-Disposition headers since telegram servers don't understand it. Instead just escape \\ and " and replace any \n and \r with a space. """ - value = value.replace(u'\\', u'\\\\').replace(u'"', u'\\"') - value = value.replace(u'\r', u' ').replace(u'\n', u' ') - return u'{}="{}"'.format(name, value) + value = value.replace('\\', '\\\\').replace('"', '\\"') + value = value.replace('\r', ' ').replace('\n', ' ') + return f'{name}="{value}"' RequestField._render_part = _render_part # type: ignore # pylint: disable=W0212 diff --git a/tests/conftest.py b/tests/conftest.py index f773f69d467..28414d53a77 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -132,8 +132,7 @@ def create_dp(bot): @pytest.fixture(scope='session') def _dp(bot): - for dp in create_dp(bot): - yield dp + yield from create_dp(bot) @pytest.fixture(scope='function') @@ -177,14 +176,14 @@ def updater(bot): @pytest.fixture(scope='function') def thumb_file(): - f = open(u'tests/data/thumb.jpg', 'rb') + f = open('tests/data/thumb.jpg', 'rb') yield f f.close() @pytest.fixture(scope='class') def class_thumb_file(): - f = open(u'tests/data/thumb.jpg', 'rb') + f = open('tests/data/thumb.jpg', 'rb') yield f f.close() diff --git a/tests/test_commandhandler.py b/tests/test_commandhandler.py index 0ff37c406df..a2cd81ec2f2 100644 --- a/tests/test_commandhandler.py +++ b/tests/test_commandhandler.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 diff --git a/tests/test_dispatcher.py b/tests/test_dispatcher.py index fd639ff681c..41a6bbaffc2 100644 --- a/tests/test_dispatcher.py +++ b/tests/test_dispatcher.py @@ -42,8 +42,7 @@ @pytest.fixture(scope='function') def dp2(bot): - for dp in create_dp(bot): - yield dp + yield from create_dp(bot) class TestDispatcher: @@ -690,7 +689,7 @@ def test_non_context_deprecation(self, dp): def test_error_while_persisting(self, cdp, monkeypatch): class OwnPersistence(BasePersistence): def __init__(self): - super(OwnPersistence, self).__init__() + super().__init__() self.store_user_data = True self.store_chat_data = True self.store_bot_data = True @@ -750,7 +749,7 @@ def logger(message): def test_persisting_no_user_no_chat(self, cdp): class OwnPersistence(BasePersistence): def __init__(self): - super(OwnPersistence, self).__init__() + super().__init__() self.store_user_data = True self.store_chat_data = True self.store_bot_data = True diff --git a/tests/test_file.py b/tests/test_file.py index f122d995dc0..2aef3f2ed8a 100644 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 @@ -53,10 +52,10 @@ class TestFile: file_id = 'NOTVALIDDOESNOTMATTER' file_unique_id = 'adc3145fd2e84d95b64d68eaa22aa33e' file_path = ( - u'https://api.org/file/bot133505823:AAHZFMHno3mzVLErU5b5jJvaeG--qUyLyG0/document/file_3' + 'https://api.org/file/bot133505823:AAHZFMHno3mzVLErU5b5jJvaeG--qUyLyG0/document/file_3' ) file_size = 28232 - file_content = u'Saint-Saëns'.encode('utf-8') # Intentionally contains unicode chars. + file_content = 'Saint-Saëns'.encode() # Intentionally contains unicode chars. def test_de_json(self, bot): json_dict = { diff --git a/tests/test_inputfile.py b/tests/test_inputfile.py index d8cf7dcbd02..97368ae0da4 100644 --- a/tests/test_inputfile.py +++ b/tests/test_inputfile.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 @@ -68,7 +67,7 @@ def test_mimetypes(self, caplog): # Test string file with caplog.at_level(logging.DEBUG): - assert InputFile(open('tests/data/text_file.txt', 'r')).mimetype == 'text/plain' + assert InputFile(open('tests/data/text_file.txt')).mimetype == 'text/plain' assert len(caplog.records) == 1 assert caplog.records[0].getMessage().startswith('Could not parse file content') diff --git a/tests/test_messageid.py b/tests/test_messageid.py index 3f45c1cf3fd..770cb45192b 100644 --- a/tests/test_messageid.py +++ b/tests/test_messageid.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 # Leandro Toledo de Souza diff --git a/tests/test_parsemode.py b/tests/test_parsemode.py index b35171cd6d7..f205f9d7cbe 100644 --- a/tests/test_parsemode.py +++ b/tests/test_parsemode.py @@ -28,7 +28,7 @@ class TestParseMode: 'bold italic link ' 'name.' ) - formatted_text_formatted = u'bold italic link name.' + formatted_text_formatted = 'bold italic link name.' @flaky(3, 1) @pytest.mark.timeout(10) diff --git a/tests/test_passport.py b/tests/test_passport.py index e192710becf..f5099af739e 100644 --- a/tests/test_passport.py +++ b/tests/test_passport.py @@ -405,7 +405,7 @@ def test_all_types(self, passport_data, bot, all_passport_data): def test_bot_init_invalid_key(self, bot): with pytest.raises(TypeError): - Bot(bot.token, private_key=u'Invalid key!') + Bot(bot.token, private_key='Invalid key!') with pytest.raises(ValueError): Bot(bot.token, private_key=b'Invalid key!') diff --git a/tests/test_photo.py b/tests/test_photo.py index 72f98b98485..9969dc5f1cb 100644 --- a/tests/test_photo.py +++ b/tests/test_photo.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 # Leandro Toledo de Souza @@ -31,7 +30,7 @@ @pytest.fixture(scope='function') def photo_file(): - f = open(u'tests/data/telegram.jpg', 'rb') + f = open('tests/data/telegram.jpg', 'rb') yield f f.close() @@ -58,7 +57,7 @@ def photo(_photo): class TestPhoto: width = 800 height = 800 - caption = u'PhotoTest - *Caption*' + caption = 'PhotoTest - *Caption*' photo_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram_new.jpg' file_size = 29176 @@ -350,7 +349,7 @@ def test_send_file_unicode_filename(self, bot, chat_id): """ Regression test for https://github.com/python-telegram-bot/python-telegram-bot/issues/1202 """ - with open(u'tests/data/测试.png', 'rb') as f: + with open('tests/data/测试.png', 'rb') as f: message = bot.send_photo(photo=f, chat_id=chat_id) photo = message.photo[-1] diff --git a/tests/test_poll.py b/tests/test_poll.py index 4a16cc2d9c0..94114818ecd 100644 --- a/tests/test_poll.py +++ b/tests/test_poll.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 # Leandro Toledo de Souza diff --git a/tests/test_sticker.py b/tests/test_sticker.py index 0280f167a18..3d8e3abac63 100644 --- a/tests/test_sticker.py +++ b/tests/test_sticker.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 diff --git a/tests/test_user.py b/tests/test_user.py index e1003cfc127..ce18d2c01ca 100644 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -57,8 +57,8 @@ def user(bot): class TestUser: id_ = 1 is_bot = True - first_name = u'first\u2022name' - last_name = u'last\u2022name' + first_name = 'first\u2022name' + last_name = 'last\u2022name' username = 'username' language_code = 'en_us' can_join_groups = True @@ -112,16 +112,16 @@ def test_de_json_without_username_and_last_name(self, json_dict, bot): def test_name(self, user): assert user.name == '@username' user.username = None - assert user.name == u'first\u2022name last\u2022name' + assert user.name == 'first\u2022name last\u2022name' user.last_name = None - assert user.name == u'first\u2022name' + assert user.name == 'first\u2022name' user.username = self.username assert user.name == '@username' def test_full_name(self, user): - assert user.full_name == u'first\u2022name last\u2022name' + assert user.full_name == 'first\u2022name last\u2022name' user.last_name = None - assert user.full_name == u'first\u2022name' + assert user.full_name == 'first\u2022name' def test_link(self, user): assert user.link == f'https://t.me/{user.username}' @@ -505,7 +505,7 @@ def make_assertion(*_, **kwargs): assert user.copy_message(chat_id='chat_id', message_id='message_id') def test_mention_html(self, user): - expected = u'{}' + expected = '{}' assert user.mention_html() == expected.format(user.id, user.full_name) assert user.mention_html('thename\u2022') == expected.format( @@ -514,7 +514,7 @@ def test_mention_html(self, user): assert user.mention_html(user.username) == expected.format(user.id, user.username) def test_mention_markdown(self, user): - expected = u'[{}](tg://user?id={})' + expected = '[{}](tg://user?id={})' assert user.mention_markdown() == expected.format(user.full_name, user.id) assert user.mention_markdown('the_name*\u2022') == expected.format( @@ -526,7 +526,7 @@ def test_mention_markdown_v2(self, user): user.first_name = 'first{name' user.last_name = 'last_name' - expected = u'[{}](tg://user?id={})' + expected = '[{}](tg://user?id={})' assert user.mention_markdown_v2() == expected.format( escape_markdown(user.full_name, version=2), user.id diff --git a/tests/test_video.py b/tests/test_video.py index 6505ba51358..ec9f486a8d3 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -54,7 +54,7 @@ class TestVideo: thumb_height = 320 thumb_file_size = 1767 - caption = u'VideoTest - *Caption*' + caption = 'VideoTest - *Caption*' video_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram.mp4' video_file_id = '5a3128a4d2a04750b5b58397f3b5e812' diff --git a/tests/test_videonote.py b/tests/test_videonote.py index 8feee4edf4f..e93c3e879d1 100644 --- a/tests/test_videonote.py +++ b/tests/test_videonote.py @@ -49,7 +49,7 @@ class TestVideoNote: thumb_height = 240 thumb_file_size = 11547 - caption = u'VideoNoteTest - Caption' + caption = 'VideoNoteTest - Caption' videonote_file_id = '5a3128a4d2a04750b5b58397f3b5e812' videonote_file_unique_id = 'adc3145fd2e84d95b64d68eaa22aa33e' diff --git a/tests/test_voice.py b/tests/test_voice.py index cf2efc3dd65..6ff2bd269e5 100644 --- a/tests/test_voice.py +++ b/tests/test_voice.py @@ -46,7 +46,7 @@ class TestVoice: mime_type = 'audio/ogg' file_size = 9199 - caption = u'Test *voice*' + caption = 'Test *voice*' voice_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram.ogg' voice_file_id = '5a3128a4d2a04750b5b58397f3b5e812' diff --git a/tests/test_webhookinfo.py b/tests/test_webhookinfo.py index 08776b2a486..81eefa21bd0 100644 --- a/tests/test_webhookinfo.py +++ b/tests/test_webhookinfo.py @@ -36,7 +36,7 @@ def webhook_info(): ) -class TestWebhookInfo(object): +class TestWebhookInfo: url = "http://www.google.com" has_custom_certificate = False pending_update_count = 5 From fae407910801f56c90b7652e9ff7659636c0d5bf Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Sun, 10 Jan 2021 20:01:58 +0100 Subject: [PATCH 2/2] update test_chat --- tests/test_chat.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_chat.py b/tests/test_chat.py index 02453109203..e8e95748d05 100644 --- a/tests/test_chat.py +++ b/tests/test_chat.py @@ -114,11 +114,11 @@ def test_link(self, chat): def test_full_name(self): chat = Chat( - id=1, type=Chat.PRIVATE, first_name=u'first\u2022name', last_name=u'last\u2022name' + id=1, type=Chat.PRIVATE, first_name='first\u2022name', last_name='last\u2022name' ) - assert chat.full_name == u'first\u2022name last\u2022name' - chat = Chat(id=1, type=Chat.PRIVATE, first_name=u'first\u2022name') - assert chat.full_name == u'first\u2022name' + assert chat.full_name == 'first\u2022name last\u2022name' + chat = Chat(id=1, type=Chat.PRIVATE, first_name='first\u2022name') + assert chat.full_name == 'first\u2022name' chat = Chat( id=1, type=Chat.PRIVATE, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy