mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Format code with black, autopep8 and isort
This commit fixes the style issues introduced indd50a9baccording to the output from black, autopep8 and isort. Details:4e472085-2e87-4f61-b7a1-ed208506962f/
This commit is contained in:
parent
dd50a9b13e
commit
af4ceef153
28 changed files with 1214 additions and 720 deletions
|
|
@ -16,14 +16,14 @@ def test_export():
|
|||
def test_file_name():
|
||||
if not isinstance(animation.file_name, str):
|
||||
raise AssertionError
|
||||
if animation.file_name != ANIMATION['file_name']:
|
||||
if animation.file_name != ANIMATION["file_name"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_mime_type():
|
||||
if not isinstance(animation.mime_type, str):
|
||||
raise AssertionError
|
||||
if animation.mime_type != ANIMATION['mime_type']:
|
||||
if animation.mime_type != ANIMATION["mime_type"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
|
|
@ -31,25 +31,25 @@ def test_file_id():
|
|||
if not isinstance(animation.file_id, str):
|
||||
raise AssertionError
|
||||
# assert hash(animation) == ANIMATION['file_id']
|
||||
if animation.file_id != ANIMATION['file_id']:
|
||||
if animation.file_id != ANIMATION["file_id"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_file_size():
|
||||
if not isinstance(animation.file_size, int):
|
||||
raise AssertionError
|
||||
if animation.file_size != ANIMATION['file_size']:
|
||||
if animation.file_size != ANIMATION["file_size"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_thumb():
|
||||
if not isinstance(animation.thumb, types.PhotoSize):
|
||||
raise AssertionError
|
||||
if animation.thumb.file_id != ANIMATION['thumb']['file_id']:
|
||||
if animation.thumb.file_id != ANIMATION["thumb"]["file_id"]:
|
||||
raise AssertionError
|
||||
if animation.thumb.width != ANIMATION['thumb']['width']:
|
||||
if animation.thumb.width != ANIMATION["thumb"]["width"]:
|
||||
raise AssertionError
|
||||
if animation.thumb.height != ANIMATION['thumb']['height']:
|
||||
if animation.thumb.height != ANIMATION["thumb"]["height"]:
|
||||
raise AssertionError
|
||||
if animation.thumb.file_size != ANIMATION['thumb']['file_size']:
|
||||
if animation.thumb.file_size != ANIMATION["thumb"]["file_size"]:
|
||||
raise AssertionError
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ def test_export():
|
|||
def test_id():
|
||||
if not isinstance(chat.id, int):
|
||||
raise AssertionError
|
||||
if chat.id != CHAT['id']:
|
||||
if chat.id != CHAT["id"]:
|
||||
raise AssertionError
|
||||
# assert hash(chat) == CHAT['id']
|
||||
|
||||
|
|
@ -24,40 +24,41 @@ def test_id():
|
|||
def test_name():
|
||||
if not isinstance(chat.first_name, str):
|
||||
raise AssertionError
|
||||
if chat.first_name != CHAT['first_name']:
|
||||
if chat.first_name != CHAT["first_name"]:
|
||||
raise AssertionError
|
||||
|
||||
if not isinstance(chat.last_name, str):
|
||||
raise AssertionError
|
||||
if chat.last_name != CHAT['last_name']:
|
||||
if chat.last_name != CHAT["last_name"]:
|
||||
raise AssertionError
|
||||
|
||||
if not isinstance(chat.username, str):
|
||||
raise AssertionError
|
||||
if chat.username != CHAT['username']:
|
||||
if chat.username != CHAT["username"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_type():
|
||||
if not isinstance(chat.type, str):
|
||||
raise AssertionError
|
||||
if chat.type != CHAT['type']:
|
||||
if chat.type != CHAT["type"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_chat_types():
|
||||
if types.ChatType.PRIVATE != 'private':
|
||||
if types.ChatType.PRIVATE != "private":
|
||||
raise AssertionError
|
||||
if types.ChatType.GROUP != 'group':
|
||||
if types.ChatType.GROUP != "group":
|
||||
raise AssertionError
|
||||
if types.ChatType.SUPER_GROUP != 'supergroup':
|
||||
if types.ChatType.SUPER_GROUP != "supergroup":
|
||||
raise AssertionError
|
||||
if types.ChatType.CHANNEL != 'channel':
|
||||
if types.ChatType.CHANNEL != "channel":
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_chat_type_filters():
|
||||
from . import test_message
|
||||
|
||||
if not types.ChatType.is_private(test_message.message):
|
||||
raise AssertionError
|
||||
if types.ChatType.is_group(test_message.message):
|
||||
|
|
@ -71,23 +72,23 @@ def test_chat_type_filters():
|
|||
|
||||
|
||||
def test_chat_actions():
|
||||
if types.ChatActions.TYPING != 'typing':
|
||||
if types.ChatActions.TYPING != "typing":
|
||||
raise AssertionError
|
||||
if types.ChatActions.UPLOAD_PHOTO != 'upload_photo':
|
||||
if types.ChatActions.UPLOAD_PHOTO != "upload_photo":
|
||||
raise AssertionError
|
||||
if types.ChatActions.RECORD_VIDEO != 'record_video':
|
||||
if types.ChatActions.RECORD_VIDEO != "record_video":
|
||||
raise AssertionError
|
||||
if types.ChatActions.UPLOAD_VIDEO != 'upload_video':
|
||||
if types.ChatActions.UPLOAD_VIDEO != "upload_video":
|
||||
raise AssertionError
|
||||
if types.ChatActions.RECORD_AUDIO != 'record_audio':
|
||||
if types.ChatActions.RECORD_AUDIO != "record_audio":
|
||||
raise AssertionError
|
||||
if types.ChatActions.UPLOAD_AUDIO != 'upload_audio':
|
||||
if types.ChatActions.UPLOAD_AUDIO != "upload_audio":
|
||||
raise AssertionError
|
||||
if types.ChatActions.UPLOAD_DOCUMENT != 'upload_document':
|
||||
if types.ChatActions.UPLOAD_DOCUMENT != "upload_document":
|
||||
raise AssertionError
|
||||
if types.ChatActions.FIND_LOCATION != 'find_location':
|
||||
if types.ChatActions.FIND_LOCATION != "find_location":
|
||||
raise AssertionError
|
||||
if types.ChatActions.RECORD_VIDEO_NOTE != 'record_video_note':
|
||||
if types.ChatActions.RECORD_VIDEO_NOTE != "record_video_note":
|
||||
raise AssertionError
|
||||
if types.ChatActions.UPLOAD_VIDEO_NOTE != 'upload_video_note':
|
||||
if types.ChatActions.UPLOAD_VIDEO_NOTE != "upload_video_note":
|
||||
raise AssertionError
|
||||
|
|
|
|||
|
|
@ -21,44 +21,44 @@ def test_user():
|
|||
def test_status():
|
||||
if not isinstance(chat_member.status, str):
|
||||
raise AssertionError
|
||||
if chat_member.status != CHAT_MEMBER['status']:
|
||||
if chat_member.status != CHAT_MEMBER["status"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_privileges():
|
||||
if not isinstance(chat_member.can_be_edited, bool):
|
||||
raise AssertionError
|
||||
if chat_member.can_be_edited != CHAT_MEMBER['can_be_edited']:
|
||||
if chat_member.can_be_edited != CHAT_MEMBER["can_be_edited"]:
|
||||
raise AssertionError
|
||||
|
||||
if not isinstance(chat_member.can_change_info, bool):
|
||||
raise AssertionError
|
||||
if chat_member.can_change_info != CHAT_MEMBER['can_change_info']:
|
||||
if chat_member.can_change_info != CHAT_MEMBER["can_change_info"]:
|
||||
raise AssertionError
|
||||
|
||||
if not isinstance(chat_member.can_delete_messages, bool):
|
||||
raise AssertionError
|
||||
if chat_member.can_delete_messages != CHAT_MEMBER['can_delete_messages']:
|
||||
if chat_member.can_delete_messages != CHAT_MEMBER["can_delete_messages"]:
|
||||
raise AssertionError
|
||||
|
||||
if not isinstance(chat_member.can_invite_users, bool):
|
||||
raise AssertionError
|
||||
if chat_member.can_invite_users != CHAT_MEMBER['can_invite_users']:
|
||||
if chat_member.can_invite_users != CHAT_MEMBER["can_invite_users"]:
|
||||
raise AssertionError
|
||||
|
||||
if not isinstance(chat_member.can_restrict_members, bool):
|
||||
raise AssertionError
|
||||
if chat_member.can_restrict_members != CHAT_MEMBER['can_restrict_members']:
|
||||
if chat_member.can_restrict_members != CHAT_MEMBER["can_restrict_members"]:
|
||||
raise AssertionError
|
||||
|
||||
if not isinstance(chat_member.can_pin_messages, bool):
|
||||
raise AssertionError
|
||||
if chat_member.can_pin_messages != CHAT_MEMBER['can_pin_messages']:
|
||||
if chat_member.can_pin_messages != CHAT_MEMBER["can_pin_messages"]:
|
||||
raise AssertionError
|
||||
|
||||
if not isinstance(chat_member.can_promote_members, bool):
|
||||
raise AssertionError
|
||||
if chat_member.can_promote_members != CHAT_MEMBER['can_promote_members']:
|
||||
if chat_member.can_promote_members != CHAT_MEMBER["can_promote_members"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
|
|
@ -70,17 +70,17 @@ def test_int():
|
|||
|
||||
|
||||
def test_chat_member_status():
|
||||
if types.ChatMemberStatus.CREATOR != 'creator':
|
||||
if types.ChatMemberStatus.CREATOR != "creator":
|
||||
raise AssertionError
|
||||
if types.ChatMemberStatus.ADMINISTRATOR != 'administrator':
|
||||
if types.ChatMemberStatus.ADMINISTRATOR != "administrator":
|
||||
raise AssertionError
|
||||
if types.ChatMemberStatus.MEMBER != 'member':
|
||||
if types.ChatMemberStatus.MEMBER != "member":
|
||||
raise AssertionError
|
||||
if types.ChatMemberStatus.RESTRICTED != 'restricted':
|
||||
if types.ChatMemberStatus.RESTRICTED != "restricted":
|
||||
raise AssertionError
|
||||
if types.ChatMemberStatus.LEFT != 'left':
|
||||
if types.ChatMemberStatus.LEFT != "left":
|
||||
raise AssertionError
|
||||
if types.ChatMemberStatus.KICKED != 'kicked':
|
||||
if types.ChatMemberStatus.KICKED != "kicked":
|
||||
raise AssertionError
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ def test_export():
|
|||
def test_file_name():
|
||||
if not isinstance(document.file_name, str):
|
||||
raise AssertionError
|
||||
if document.file_name != DOCUMENT['file_name']:
|
||||
if document.file_name != DOCUMENT["file_name"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_mime_type():
|
||||
if not isinstance(document.mime_type, str):
|
||||
raise AssertionError
|
||||
if document.mime_type != DOCUMENT['mime_type']:
|
||||
if document.mime_type != DOCUMENT["mime_type"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
|
|
@ -31,14 +31,14 @@ def test_file_id():
|
|||
if not isinstance(document.file_id, str):
|
||||
raise AssertionError
|
||||
# assert hash(document) == DOCUMENT['file_id']
|
||||
if document.file_id != DOCUMENT['file_id']:
|
||||
if document.file_id != DOCUMENT["file_id"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_file_size():
|
||||
if not isinstance(document.file_size, int):
|
||||
raise AssertionError
|
||||
if document.file_size != DOCUMENT['file_size']:
|
||||
if document.file_size != DOCUMENT["file_size"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,21 +16,21 @@ def test_export():
|
|||
def test_title():
|
||||
if not isinstance(game.title, str):
|
||||
raise AssertionError
|
||||
if game.title != GAME['title']:
|
||||
if game.title != GAME["title"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_description():
|
||||
if not isinstance(game.description, str):
|
||||
raise AssertionError
|
||||
if game.description != GAME['description']:
|
||||
if game.description != GAME["description"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_photo():
|
||||
if not isinstance(game.photo, list):
|
||||
raise AssertionError
|
||||
if len(game.photo) != len(GAME['photo']):
|
||||
if len(game.photo) != len(GAME["photo"]):
|
||||
raise AssertionError
|
||||
if not all(map(lambda t: isinstance(t, types.PhotoSize), game.photo)):
|
||||
raise AssertionError
|
||||
|
|
|
|||
|
|
@ -2,19 +2,14 @@ from aiogram import types
|
|||
|
||||
from .dataset import ANIMATION, AUDIO, DOCUMENT, PHOTO, VIDEO
|
||||
|
||||
WIDTH = 'width'
|
||||
HEIGHT = 'height'
|
||||
WIDTH = "width"
|
||||
HEIGHT = "height"
|
||||
|
||||
input_media_audio = types.InputMediaAudio(
|
||||
types.Audio(**AUDIO))
|
||||
input_media_animation = types.InputMediaAnimation(
|
||||
types.Animation(**ANIMATION))
|
||||
input_media_document = types.InputMediaDocument(
|
||||
types.Document(**DOCUMENT))
|
||||
input_media_video = types.InputMediaVideo(
|
||||
types.Video(**VIDEO))
|
||||
input_media_photo = types.InputMediaPhoto(
|
||||
types.PhotoSize(**PHOTO))
|
||||
input_media_audio = types.InputMediaAudio(types.Audio(**AUDIO))
|
||||
input_media_animation = types.InputMediaAnimation(types.Animation(**ANIMATION))
|
||||
input_media_document = types.InputMediaDocument(types.Document(**DOCUMENT))
|
||||
input_media_video = types.InputMediaVideo(types.Video(**VIDEO))
|
||||
input_media_photo = types.InputMediaPhoto(types.PhotoSize(**PHOTO))
|
||||
|
||||
|
||||
def test_field_width():
|
||||
|
|
|
|||
|
|
@ -17,37 +17,37 @@ def test_export():
|
|||
|
||||
def test_message_id():
|
||||
# assert hash(message) == MESSAGE['message_id']
|
||||
if message.message_id != MESSAGE['message_id']:
|
||||
if message.message_id != MESSAGE["message_id"]:
|
||||
raise AssertionError
|
||||
if message['message_id'] != MESSAGE['message_id']:
|
||||
if message["message_id"] != MESSAGE["message_id"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_from():
|
||||
if not isinstance(message.from_user, types.User):
|
||||
raise AssertionError
|
||||
if message.from_user != message['from']:
|
||||
if message.from_user != message["from"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_chat():
|
||||
if not isinstance(message.chat, types.Chat):
|
||||
raise AssertionError
|
||||
if message.chat != message['chat']:
|
||||
if message.chat != message["chat"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_date():
|
||||
if not isinstance(message.date, datetime.datetime):
|
||||
raise AssertionError
|
||||
if int(message.date.timestamp()) != MESSAGE['date']:
|
||||
if int(message.date.timestamp()) != MESSAGE["date"]:
|
||||
raise AssertionError
|
||||
if message.date != message['date']:
|
||||
if message.date != message["date"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_text():
|
||||
if message.text != MESSAGE['text']:
|
||||
if message.text != MESSAGE["text"]:
|
||||
raise AssertionError
|
||||
if message['text'] != MESSAGE['text']:
|
||||
if message["text"] != MESSAGE["text"]:
|
||||
raise AssertionError
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ def test_export():
|
|||
def test_file_id():
|
||||
if not isinstance(photo.file_id, str):
|
||||
raise AssertionError
|
||||
if photo.file_id != PHOTO['file_id']:
|
||||
if photo.file_id != PHOTO["file_id"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_file_size():
|
||||
if not isinstance(photo.file_size, int):
|
||||
raise AssertionError
|
||||
if photo.file_size != PHOTO['file_size']:
|
||||
if photo.file_size != PHOTO["file_size"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ def test_size():
|
|||
raise AssertionError
|
||||
if not isinstance(photo.height, int):
|
||||
raise AssertionError
|
||||
if photo.width != PHOTO['width']:
|
||||
if photo.width != PHOTO["width"]:
|
||||
raise AssertionError
|
||||
if photo.height != PHOTO['height']:
|
||||
if photo.height != PHOTO["height"]:
|
||||
raise AssertionError
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ def test_update_id():
|
|||
if not isinstance(update.update_id, int):
|
||||
raise AssertionError
|
||||
# assert hash(update) == UPDATE['update_id']
|
||||
if update.update_id != UPDATE['update_id']:
|
||||
if update.update_id != UPDATE["update_id"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ def test_export():
|
|||
def test_id():
|
||||
if not isinstance(user.id, int):
|
||||
raise AssertionError
|
||||
if user.id != USER['id']:
|
||||
if user.id != USER["id"]:
|
||||
raise AssertionError
|
||||
# assert hash(user) == USER['id']
|
||||
|
||||
|
|
@ -26,23 +26,23 @@ def test_id():
|
|||
def test_bot():
|
||||
if not isinstance(user.is_bot, bool):
|
||||
raise AssertionError
|
||||
if user.is_bot != USER['is_bot']:
|
||||
if user.is_bot != USER["is_bot"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_name():
|
||||
if user.first_name != USER['first_name']:
|
||||
if user.first_name != USER["first_name"]:
|
||||
raise AssertionError
|
||||
if user.last_name != USER['last_name']:
|
||||
if user.last_name != USER["last_name"]:
|
||||
raise AssertionError
|
||||
if user.username != USER['username']:
|
||||
if user.username != USER["username"]:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def test_language_code():
|
||||
if user.language_code != USER['language_code']:
|
||||
if user.language_code != USER["language_code"]:
|
||||
raise AssertionError
|
||||
if user.locale != Locale.parse(USER['language_code'], sep='-'):
|
||||
if user.locale != Locale.parse(USER["language_code"], sep="-"):
|
||||
raise AssertionError
|
||||
|
||||
|
||||
|
|
@ -54,9 +54,12 @@ def test_full_name():
|
|||
def test_mention():
|
||||
if user.mention != f"@{USER['username']}":
|
||||
raise AssertionError
|
||||
if user.get_mention('foo', as_html=False) != f"[foo](tg://user?id={USER['id']})":
|
||||
if user.get_mention("foo", as_html=False) != f"[foo](tg://user?id={USER['id']})":
|
||||
raise AssertionError
|
||||
if user.get_mention('foo', as_html=True) != f"<a href=\"tg://user?id={USER['id']}\">foo</a>":
|
||||
if (
|
||||
user.get_mention("foo", as_html=True)
|
||||
!= f"<a href=\"tg://user?id={USER['id']}\">foo</a>"
|
||||
):
|
||||
raise AssertionError
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue