mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Co-authored-by: Belavin Denis <belavin.d.andreevich@yandex.ru>
This commit is contained in:
parent
a8dfe86358
commit
1389ca5874
2 changed files with 44 additions and 5 deletions
|
|
@ -137,8 +137,6 @@ class InputMediaAudio(InputMedia):
|
|||
https://core.telegram.org/bots/api#inputmediaanimation
|
||||
"""
|
||||
|
||||
width: base.Integer = fields.Field()
|
||||
height: base.Integer = fields.Field()
|
||||
duration: base.Integer = fields.Field()
|
||||
performer: base.String = fields.Field()
|
||||
title: base.String = fields.Field()
|
||||
|
|
@ -146,13 +144,12 @@ class InputMediaAudio(InputMedia):
|
|||
def __init__(self, media: base.InputFile,
|
||||
thumb: typing.Union[base.InputFile, base.String] = None,
|
||||
caption: base.String = None,
|
||||
width: base.Integer = None, height: base.Integer = None,
|
||||
duration: base.Integer = None,
|
||||
performer: base.String = None,
|
||||
title: base.String = None,
|
||||
parse_mode: base.String = None, **kwargs):
|
||||
super(InputMediaAudio, self).__init__(type='audio', media=media, thumb=thumb, caption=caption,
|
||||
width=width, height=height, duration=duration,
|
||||
super(InputMediaAudio, self).__init__(type='audio', media=media, thumb=thumb,
|
||||
caption=caption, duration=duration,
|
||||
performer=performer, title=title,
|
||||
parse_mode=parse_mode, conf=kwargs)
|
||||
|
||||
|
|
|
|||
42
tests/types/test_input_media.py
Normal file
42
tests/types/test_input_media.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
from aiogram import types
|
||||
from .dataset import AUDIO, ANIMATION, \
|
||||
DOCUMENT, PHOTO, VIDEO
|
||||
|
||||
|
||||
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))
|
||||
|
||||
|
||||
def test_field_width():
|
||||
"""
|
||||
https://core.telegram.org/bots/api#inputmedia
|
||||
"""
|
||||
assert not hasattr(input_media_audio, WIDTH)
|
||||
assert not hasattr(input_media_document, WIDTH)
|
||||
assert not hasattr(input_media_photo, WIDTH)
|
||||
|
||||
assert hasattr(input_media_animation, WIDTH)
|
||||
assert hasattr(input_media_video, WIDTH)
|
||||
|
||||
|
||||
def test_field_height():
|
||||
"""
|
||||
https://core.telegram.org/bots/api#inputmedia
|
||||
"""
|
||||
assert not hasattr(input_media_audio, HEIGHT)
|
||||
assert not hasattr(input_media_document, HEIGHT)
|
||||
assert not hasattr(input_media_photo, HEIGHT)
|
||||
|
||||
assert hasattr(input_media_animation, HEIGHT)
|
||||
assert hasattr(input_media_video, HEIGHT)
|
||||
Loading…
Add table
Add a link
Reference in a new issue