mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix review issues from PR #1761
- Remove stray '-' artifact from GameHighScore docstring and butcher schema - Fix Makefile reformat target scope inconsistency (ruff check --fix) - Fix ButtonStyle enum source URL (#chat -> #inlinekeyboardbutton) - Add User.get_profile_audios() shortcut method (parallel to get_profile_photos) - Test ChatOwnerLeft with new_owner=None (edge case) - Add VideoQuality type and Video.qualities nesting tests - Add User.get_profile_audios() test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8783c4922e
commit
2184e98988
9 changed files with 102 additions and 12 deletions
|
|
@ -258,9 +258,7 @@ TEST_MESSAGE_LEFT_CHAT_MEMBER = Message(
|
|||
TEST_MESSAGE_CHAT_OWNER_LEFT = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
chat_owner_left=ChatOwnerLeft(
|
||||
new_owner=User(id=43, is_bot=False, first_name="NewOwner"),
|
||||
),
|
||||
chat_owner_left=ChatOwnerLeft(),
|
||||
chat=Chat(id=42, type="private"),
|
||||
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -56,3 +56,9 @@ class TestUser:
|
|||
|
||||
method = user.get_profile_photos(description="test")
|
||||
assert method.user_id == user.id
|
||||
|
||||
def test_get_profile_audios(self):
|
||||
user = User(id=42, is_bot=False, first_name="Test", last_name="User")
|
||||
|
||||
method = user.get_profile_audios(description="test")
|
||||
assert method.user_id == user.id
|
||||
|
|
|
|||
59
tests/test_api/test_types/test_video_quality.py
Normal file
59
tests/test_api/test_types/test_video_quality.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
from aiogram.types import Video, VideoQuality
|
||||
|
||||
|
||||
class TestVideoQuality:
|
||||
def test_instantiation(self):
|
||||
vq = VideoQuality(
|
||||
file_id="abc123",
|
||||
file_unique_id="unique123",
|
||||
width=1920,
|
||||
height=1080,
|
||||
codec="h264",
|
||||
)
|
||||
assert vq.file_id == "abc123"
|
||||
assert vq.file_unique_id == "unique123"
|
||||
assert vq.width == 1920
|
||||
assert vq.height == 1080
|
||||
assert vq.codec == "h264"
|
||||
assert vq.file_size is None
|
||||
|
||||
def test_instantiation_with_file_size(self):
|
||||
vq = VideoQuality(
|
||||
file_id="abc123",
|
||||
file_unique_id="unique123",
|
||||
width=1920,
|
||||
height=1080,
|
||||
codec="h265",
|
||||
file_size=1048576,
|
||||
)
|
||||
assert vq.file_size == 1048576
|
||||
|
||||
def test_video_with_qualities(self):
|
||||
video = Video(
|
||||
file_id="video123",
|
||||
file_unique_id="unique_video123",
|
||||
width=1920,
|
||||
height=1080,
|
||||
duration=120,
|
||||
qualities=[
|
||||
VideoQuality(
|
||||
file_id="q1",
|
||||
file_unique_id="uq1",
|
||||
width=1920,
|
||||
height=1080,
|
||||
codec="h264",
|
||||
),
|
||||
VideoQuality(
|
||||
file_id="q2",
|
||||
file_unique_id="uq2",
|
||||
width=1280,
|
||||
height=720,
|
||||
codec="h264",
|
||||
file_size=524288,
|
||||
),
|
||||
],
|
||||
)
|
||||
assert video.qualities is not None
|
||||
assert len(video.qualities) == 2
|
||||
assert video.qualities[0].width == 1920
|
||||
assert video.qualities[1].file_size == 524288
|
||||
Loading…
Add table
Add a link
Reference in a new issue