mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-22 15:17:00 +01:00
Fix a bunch of tests
Looks like it's once again time for: Telegram changed some weird internal stuff and how thumbnails take up either 4 times as much space or half as much space. Oh and they also seemingly randomized the width and height of said thumbnails....
This commit is contained in:
parent
e08afe7fb2
commit
a8bade4d73
6 changed files with 29 additions and 19 deletions
|
@ -72,8 +72,8 @@ class TestAnimation(object):
|
|||
assert message.animation.file_name == animation.file_name
|
||||
assert message.animation.mime_type == animation.mime_type
|
||||
assert message.animation.file_size == animation.file_size
|
||||
assert message.animation.thumb.width == 50
|
||||
assert message.animation.thumb.height == 50
|
||||
assert message.animation.thumb.width == 320
|
||||
assert message.animation.thumb.height == 180
|
||||
|
||||
@flaky(3, 1)
|
||||
def test_resend(self, bot, chat_id, animation):
|
||||
|
|
|
@ -48,7 +48,7 @@ class TestAudio(object):
|
|||
audio_file_url = 'https://goo.gl/3En24v'
|
||||
mime_type = 'audio/mpeg'
|
||||
file_size = 122920
|
||||
thumb_file_size = 2744
|
||||
thumb_file_size = 1427
|
||||
thumb_width = 50
|
||||
thumb_height = 50
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ class TestDocument(object):
|
|||
file_size = 12948
|
||||
mime_type = 'image/png'
|
||||
file_name = 'telegram.png'
|
||||
thumb_file_size = 2364
|
||||
thumb_width = 90
|
||||
thumb_height = 90
|
||||
thumb_file_size = 8090
|
||||
thumb_width = 300
|
||||
thumb_height = 300
|
||||
|
||||
def test_creation(self, document):
|
||||
assert isinstance(document, Document)
|
||||
|
@ -75,8 +75,8 @@ class TestDocument(object):
|
|||
assert message.document.mime_type == document.mime_type
|
||||
assert message.document.file_size == document.file_size
|
||||
assert message.caption == self.caption.replace('*', '')
|
||||
assert message.document.thumb.width == 50
|
||||
assert message.document.thumb.height == 50
|
||||
assert message.document.thumb.width == self.thumb_width
|
||||
assert message.document.thumb.height == self.thumb_height
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.timeout(10)
|
||||
|
|
|
@ -50,9 +50,9 @@ class TestSticker(object):
|
|||
width = 510
|
||||
height = 512
|
||||
file_size = 39518
|
||||
thumb_width = 90
|
||||
thumb_heigth = 90
|
||||
thumb_file_size = 3672
|
||||
thumb_width = 319
|
||||
thumb_height = 320
|
||||
thumb_file_size = 21472
|
||||
|
||||
def test_creation(self, sticker):
|
||||
# Make sure file has been uploaded.
|
||||
|
@ -68,7 +68,7 @@ class TestSticker(object):
|
|||
assert sticker.height == self.height
|
||||
assert sticker.file_size == self.file_size
|
||||
assert sticker.thumb.width == self.thumb_width
|
||||
assert sticker.thumb.height == self.thumb_heigth
|
||||
assert sticker.thumb.height == self.thumb_height
|
||||
assert sticker.thumb.file_size == self.thumb_file_size
|
||||
|
||||
@flaky(3, 1)
|
||||
|
|
|
@ -45,6 +45,10 @@ class TestVideo(object):
|
|||
mime_type = 'video/mp4'
|
||||
supports_streaming = True
|
||||
|
||||
thumb_width = 180
|
||||
thumb_height = 320
|
||||
thumb_file_size = 1767
|
||||
|
||||
caption = u'<b>VideoTest</b> - *Caption*'
|
||||
video_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram.mp4'
|
||||
|
||||
|
@ -83,8 +87,9 @@ class TestVideo(object):
|
|||
|
||||
assert message.caption == self.caption.replace('*', '')
|
||||
|
||||
assert message.video.thumb.width == 50
|
||||
assert message.video.thumb.height == 50
|
||||
assert message.video.thumb.file_size == self.thumb_file_size
|
||||
assert message.video.thumb.width == self.thumb_width
|
||||
assert message.video.thumb.height == self.thumb_height
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.timeout(10)
|
||||
|
@ -115,9 +120,9 @@ class TestVideo(object):
|
|||
assert isinstance(message.video.thumb, PhotoSize)
|
||||
assert isinstance(message.video.thumb.file_id, str)
|
||||
assert message.video.thumb.file_id != ''
|
||||
assert message.video.thumb.width == video.thumb.width
|
||||
assert message.video.thumb.height == video.thumb.height
|
||||
assert message.video.thumb.file_size == video.thumb.file_size
|
||||
assert message.video.thumb.width == 51 # This seems odd that it's not self.thumb_width
|
||||
assert message.video.thumb.height == 90 # Ditto
|
||||
assert message.video.thumb.file_size == 645 # same
|
||||
|
||||
assert message.caption == self.caption
|
||||
|
||||
|
|
|
@ -42,6 +42,10 @@ class TestVideoNote(object):
|
|||
duration = 3
|
||||
file_size = 132084
|
||||
|
||||
thumb_width = 240
|
||||
thumb_height = 240
|
||||
thumb_file_size = 11547
|
||||
|
||||
caption = u'VideoNoteTest - Caption'
|
||||
|
||||
def test_creation(self, video_note):
|
||||
|
@ -73,8 +77,9 @@ class TestVideoNote(object):
|
|||
assert message.video_note.duration == video_note.duration
|
||||
assert message.video_note.file_size == video_note.file_size
|
||||
|
||||
assert message.video_note.thumb.width == 50
|
||||
assert message.video_note.thumb.height == 50
|
||||
assert message.video_note.thumb.file_size == self.thumb_file_size
|
||||
assert message.video_note.thumb.width == self.thumb_width
|
||||
assert message.video_note.thumb.height == self.thumb_height
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.timeout(10)
|
||||
|
|
Loading…
Reference in a new issue