mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-23 06:50:29 +01:00
test_video.py: adapt to latest changes in the API
This commit is contained in:
parent
ca8404adb7
commit
ec8cd37345
2 changed files with 31 additions and 20 deletions
|
@ -53,6 +53,14 @@ class PhotoSize(TelegramObject):
|
||||||
# Optionals
|
# Optionals
|
||||||
self.file_size = int(kwargs.get('file_size', 0))
|
self.file_size = int(kwargs.get('file_size', 0))
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if not isinstance(other, self.__class__):
|
||||||
|
return False
|
||||||
|
return (self.file_id == other.file_id and
|
||||||
|
self.width == other.width and
|
||||||
|
self.height == other.height and
|
||||||
|
self.file_size == other.file_size)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data):
|
def de_json(data):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -39,8 +39,12 @@ class VideoTest(BaseTest, unittest.TestCase):
|
||||||
self.video_file_url = 'https://raw.githubusercontent.com/python-telegram-bot/python-telegram-bot/master/tests/data/telegram.mp4'
|
self.video_file_url = 'https://raw.githubusercontent.com/python-telegram-bot/python-telegram-bot/master/tests/data/telegram.mp4'
|
||||||
self.width = 360
|
self.width = 360
|
||||||
self.height = 640
|
self.height = 640
|
||||||
self.duration = 4
|
self.duration = 5
|
||||||
self.thumb = telegram.PhotoSize.de_json({})
|
self.thumb = telegram.PhotoSize.de_json(
|
||||||
|
{'file_id': 'AAQBABOMsecvAAQqqoY1Pee_MqcyAAIC',
|
||||||
|
'file_size': 645,
|
||||||
|
'height': 90,
|
||||||
|
'width': 51})
|
||||||
self.mime_type = 'video/mp4'
|
self.mime_type = 'video/mp4'
|
||||||
self.file_size = 326534
|
self.file_size = 326534
|
||||||
|
|
||||||
|
@ -52,7 +56,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
||||||
'width': self.width,
|
'width': self.width,
|
||||||
'height': self.height,
|
'height': self.height,
|
||||||
'duration': self.duration,
|
'duration': self.duration,
|
||||||
'thumb': self.thumb,
|
'thumb': self.thumb.to_dict(),
|
||||||
'mime_type': self.mime_type,
|
'mime_type': self.mime_type,
|
||||||
'file_size': self.file_size
|
'file_size': self.file_size
|
||||||
}
|
}
|
||||||
|
@ -67,10 +71,10 @@ class VideoTest(BaseTest, unittest.TestCase):
|
||||||
|
|
||||||
self.assertTrue(isinstance(video.file_id, str))
|
self.assertTrue(isinstance(video.file_id, str))
|
||||||
self.assertNotEqual(video.file_id, '')
|
self.assertNotEqual(video.file_id, '')
|
||||||
self.assertEqual(video.width, 0)
|
self.assertEqual(video.width, self.width)
|
||||||
self.assertEqual(video.height, 0)
|
self.assertEqual(video.height, self.height)
|
||||||
self.assertEqual(video.duration, 0)
|
self.assertEqual(video.duration, self.duration)
|
||||||
self.assertEqual(video.thumb, None)
|
self.assertEqual(video.thumb, self.thumb)
|
||||||
self.assertEqual(video.mime_type, '')
|
self.assertEqual(video.mime_type, '')
|
||||||
self.assertEqual(video.file_size, self.file_size)
|
self.assertEqual(video.file_size, self.file_size)
|
||||||
|
|
||||||
|
@ -86,10 +90,10 @@ class VideoTest(BaseTest, unittest.TestCase):
|
||||||
|
|
||||||
self.assertTrue(isinstance(video.file_id, str))
|
self.assertTrue(isinstance(video.file_id, str))
|
||||||
self.assertNotEqual(video.file_id, '')
|
self.assertNotEqual(video.file_id, '')
|
||||||
self.assertEqual(video.width, 0)
|
self.assertEqual(video.width, self.width)
|
||||||
self.assertEqual(video.height, 0)
|
self.assertEqual(video.height, self.height)
|
||||||
self.assertEqual(video.duration, self.duration)
|
self.assertEqual(video.duration, self.duration)
|
||||||
self.assertEqual(video.thumb, None)
|
self.assertEqual(video.thumb, self.thumb)
|
||||||
self.assertEqual(video.mime_type, '')
|
self.assertEqual(video.mime_type, '')
|
||||||
self.assertEqual(video.file_size, self.file_size)
|
self.assertEqual(video.file_size, self.file_size)
|
||||||
|
|
||||||
|
@ -107,10 +111,10 @@ class VideoTest(BaseTest, unittest.TestCase):
|
||||||
|
|
||||||
self.assertTrue(isinstance(video.file_id, str))
|
self.assertTrue(isinstance(video.file_id, str))
|
||||||
self.assertNotEqual(video.file_id, '')
|
self.assertNotEqual(video.file_id, '')
|
||||||
self.assertEqual(video.width, 0)
|
self.assertEqual(video.width, self.width)
|
||||||
self.assertEqual(video.height, 0)
|
self.assertEqual(video.height, self.height)
|
||||||
self.assertEqual(video.duration, self.duration)
|
self.assertEqual(video.duration, self.duration)
|
||||||
self.assertEqual(video.thumb, None)
|
self.assertEqual(video.thumb, self.thumb)
|
||||||
self.assertEqual(video.mime_type, '')
|
self.assertEqual(video.mime_type, '')
|
||||||
self.assertEqual(video.file_size, self.file_size)
|
self.assertEqual(video.file_size, self.file_size)
|
||||||
|
|
||||||
|
@ -129,10 +133,10 @@ class VideoTest(BaseTest, unittest.TestCase):
|
||||||
|
|
||||||
self.assertTrue(isinstance(video.file_id, str))
|
self.assertTrue(isinstance(video.file_id, str))
|
||||||
self.assertNotEqual(video.file_id, '')
|
self.assertNotEqual(video.file_id, '')
|
||||||
self.assertEqual(video.width, 0)
|
self.assertEqual(video.width, self.width)
|
||||||
self.assertEqual(video.height, 0)
|
self.assertEqual(video.height, self.height)
|
||||||
self.assertEqual(video.duration, self.duration)
|
self.assertEqual(video.duration, self.duration)
|
||||||
self.assertEqual(video.thumb, None)
|
self.assertEqual(video.thumb, self.thumb)
|
||||||
self.assertEqual(video.mime_type, '')
|
self.assertEqual(video.mime_type, '')
|
||||||
self.assertEqual(video.file_size, self.file_size)
|
self.assertEqual(video.file_size, self.file_size)
|
||||||
|
|
||||||
|
@ -150,10 +154,9 @@ class VideoTest(BaseTest, unittest.TestCase):
|
||||||
|
|
||||||
self.assertTrue(isinstance(video.file_id, str))
|
self.assertTrue(isinstance(video.file_id, str))
|
||||||
self.assertNotEqual(video.file_id, '')
|
self.assertNotEqual(video.file_id, '')
|
||||||
self.assertEqual(video.width, 0)
|
self.assertEqual(video.height, self.height)
|
||||||
self.assertEqual(video.height, 0)
|
|
||||||
self.assertEqual(video.duration, self.duration)
|
self.assertEqual(video.duration, self.duration)
|
||||||
self.assertEqual(video.thumb, None)
|
self.assertEqual(video.thumb, self.thumb)
|
||||||
self.assertEqual(video.mime_type, '')
|
self.assertEqual(video.mime_type, '')
|
||||||
self.assertEqual(video.file_size, self.file_size)
|
self.assertEqual(video.file_size, self.file_size)
|
||||||
|
|
||||||
|
@ -183,7 +186,7 @@ class VideoTest(BaseTest, unittest.TestCase):
|
||||||
self.assertEqual(video.width, self.width)
|
self.assertEqual(video.width, self.width)
|
||||||
self.assertEqual(video.height, self.height)
|
self.assertEqual(video.height, self.height)
|
||||||
self.assertEqual(video.duration, self.duration)
|
self.assertEqual(video.duration, self.duration)
|
||||||
self.assertEqual(video.thumb, None)
|
self.assertEqual(video.thumb, self.thumb)
|
||||||
self.assertEqual(video.mime_type, self.mime_type)
|
self.assertEqual(video.mime_type, self.mime_type)
|
||||||
self.assertEqual(video.file_size, self.file_size)
|
self.assertEqual(video.file_size, self.file_size)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue