X Tutup
Skip to content

Commit e7b839b

Browse files
committed
Simple assertions in setUpClass
Py2 does not implement TestCase's assertions until setUp() is done. Hence we need simple assertions in the setUpClass
1 parent 4fe805e commit e7b839b

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

tests/test_video.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ def setUpClass(cls):
4545
cls.video = video
4646

4747
# Make sure file has been uploaded.
48-
cls.assertIsInstance(cls(), cls.video, telegram.Video)
49-
cls.assertIsInstance(cls(), cls.video.file_id, str)
50-
cls.assertNotEqual(cls(), cls.video.file_id, '')
48+
# Simple assertions PY2 Only
49+
assert isinstance(cls.video, telegram.Video)
50+
assert isinstance(cls.video.file_id, str)
51+
assert cls.video.file_id is not ''
5152

5253
def setUp(self):
5354
self.video_file = open('tests/data/telegram.mp4', 'rb')

tests/test_videonote.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ def setUpClass(cls):
4242
cls.videonote = video_note
4343

4444
# Make sure file has been uploaded.
45-
cls.assertIsInstance(cls(), cls.videonote, telegram.VideoNote)
46-
cls.assertIsInstance(cls(), cls.videonote.file_id, str)
47-
cls.assertNotEqual(cls(), cls.videonote.file_id, '')
45+
# Simple assertions PY2 Only
46+
assert isinstance(cls.videonote, telegram.VideoNote)
47+
assert isinstance(cls.videonote.file_id, str)
48+
assert cls.videonote.file_id is not ''
4849

4950
def setUp(self):
5051
self.videonote_file = open('tests/data/telegram2.mp4', 'rb')

tests/test_voice.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ def setUpClass(cls):
4545
cls.voice = voice
4646

4747
# Make sure file has been uploaded.
48-
cls.assertIsInstance(cls(), cls.voice, telegram.Voice)
49-
cls.assertIsInstance(cls(), cls.voice.file_id, str)
50-
cls.assertNotEqual(cls(), cls.voice.file_id, '')
48+
# Simple assertions PY2 Only
49+
assert isinstance(cls.voice, telegram.Voice)
50+
assert isinstance(cls.voice.file_id, str)
51+
assert cls.voice.file_id is not ''
5152

5253
def setUp(self):
5354
self.voice_file = open('tests/data/telegram.ogg', 'rb')

0 commit comments

Comments
 (0)
X Tutup