mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-16 14:33:12 +01:00
Simple assertions in setUpClass
Py2 does not implement TestCase's assertions until setUp() is done. Hence we need simple assertions in the setUpClass
This commit is contained in:
parent
4fe805ee0c
commit
e7b839b69e
3 changed files with 12 additions and 9 deletions
|
@ -45,9 +45,10 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
cls.video = video
|
||||
|
||||
# Make sure file has been uploaded.
|
||||
cls.assertIsInstance(cls(), cls.video, telegram.Video)
|
||||
cls.assertIsInstance(cls(), cls.video.file_id, str)
|
||||
cls.assertNotEqual(cls(), cls.video.file_id, '')
|
||||
# Simple assertions PY2 Only
|
||||
assert isinstance(cls.video, telegram.Video)
|
||||
assert isinstance(cls.video.file_id, str)
|
||||
assert cls.video.file_id is not ''
|
||||
|
||||
def setUp(self):
|
||||
self.video_file = open('tests/data/telegram.mp4', 'rb')
|
||||
|
|
|
@ -42,9 +42,10 @@ class VideoNoteTest(BaseTest, unittest.TestCase):
|
|||
cls.videonote = video_note
|
||||
|
||||
# Make sure file has been uploaded.
|
||||
cls.assertIsInstance(cls(), cls.videonote, telegram.VideoNote)
|
||||
cls.assertIsInstance(cls(), cls.videonote.file_id, str)
|
||||
cls.assertNotEqual(cls(), cls.videonote.file_id, '')
|
||||
# Simple assertions PY2 Only
|
||||
assert isinstance(cls.videonote, telegram.VideoNote)
|
||||
assert isinstance(cls.videonote.file_id, str)
|
||||
assert cls.videonote.file_id is not ''
|
||||
|
||||
def setUp(self):
|
||||
self.videonote_file = open('tests/data/telegram2.mp4', 'rb')
|
||||
|
|
|
@ -45,9 +45,10 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
cls.voice = voice
|
||||
|
||||
# Make sure file has been uploaded.
|
||||
cls.assertIsInstance(cls(), cls.voice, telegram.Voice)
|
||||
cls.assertIsInstance(cls(), cls.voice.file_id, str)
|
||||
cls.assertNotEqual(cls(), cls.voice.file_id, '')
|
||||
# Simple assertions PY2 Only
|
||||
assert isinstance(cls.voice, telegram.Voice)
|
||||
assert isinstance(cls.voice.file_id, str)
|
||||
assert cls.voice.file_id is not ''
|
||||
|
||||
def setUp(self):
|
||||
self.voice_file = open('tests/data/telegram.ogg', 'rb')
|
||||
|
|
Loading…
Reference in a new issue