unitests: remove docstrings & prints - not needed with nosetests

This commit is contained in:
Noam Meltzer 2016-02-24 00:45:49 +02:00
parent df8e388189
commit d5b35e7e1d
21 changed files with 1 additions and 368 deletions

View file

@ -55,9 +55,6 @@ class AudioTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_audio_required_args_only(self):
"""Test telegram.Bot sendAudio method"""
print('Testing bot.sendAudio - With required arguments only')
message = self._bot.sendAudio(self._chat_id,
self.audio_file)
@ -74,9 +71,6 @@ class AudioTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_audio_all_args(self):
"""Test telegram.Bot sendAudio method"""
print('Testing bot.sendAudio - With all arguments')
message = self._bot.sendAudio(self._chat_id,
self.audio_file,
duration=self.duration,
@ -98,9 +92,6 @@ class AudioTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_audio_mp3_file(self):
"""Test telegram.Bot sendAudio method"""
print('Testing bot.sendAudio - MP3 File')
message = self._bot.sendAudio(chat_id=self._chat_id,
audio=self.audio_file,
duration=self.duration,
@ -120,9 +111,6 @@ class AudioTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_audio_mp3_file_custom_filename(self):
"""Test telegram.Bot sendAudio method"""
print('Testing bot.sendAudio - MP3 File with custom filename')
message = self._bot.sendAudio(chat_id=self._chat_id,
audio=self.audio_file,
duration=self.duration,
@ -143,9 +131,6 @@ class AudioTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_audio_mp3_url_file(self):
"""Test telegram.Bot sendAudio method"""
print('Testing bot.sendAudio - MP3 File by URL')
message = self._bot.sendAudio(chat_id=self._chat_id,
audio=self.audio_file_url,
duration=self.duration,
@ -165,9 +150,6 @@ class AudioTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_audio_resend(self):
"""Test telegram.Bot sendAudio method"""
print('Testing bot.sendAudio - Resend by file_id')
message = self._bot.sendAudio(chat_id=self._chat_id,
audio=self.audio_file_id,
duration=self.duration,
@ -183,9 +165,6 @@ class AudioTest(BaseTest, unittest.TestCase):
self.assertEqual(audio.mime_type, self.mime_type)
def test_audio_de_json(self):
"""Test Audio.de_json() method"""
print('Testing Audio.de_json()')
audio = telegram.Audio.de_json(self.json_dict)
self.assertEqual(audio.file_id, self.audio_file_id)
@ -196,17 +175,11 @@ class AudioTest(BaseTest, unittest.TestCase):
self.assertEqual(audio.file_size, self.file_size)
def test_audio_to_json(self):
"""Test Audio.to_json() method"""
print('Testing Audio.to_json()')
audio = telegram.Audio.de_json(self.json_dict)
self.assertTrue(self.is_json(audio.to_json()))
def test_audio_to_dict(self):
"""Test Audio.to_dict() method"""
print('Testing Audio.to_dict()')
audio = telegram.Audio.de_json(self.json_dict)
self.assertTrue(self.is_dict(audio.to_dict()))
@ -220,8 +193,6 @@ class AudioTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_audio_empty_file(self):
print('Testing bot.sendAudio - Null file')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -234,8 +205,6 @@ class AudioTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_audio_empty_file_id(self):
print('Testing bot.sendAudio - Empty file_id')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -248,8 +217,6 @@ class AudioTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_audio_without_required_args(self):
print('Testing bot.sendAudio - Without required arguments')
json_dict = self.json_dict
del(json_dict['file_id'])

View file

@ -42,8 +42,6 @@ class BotTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def testGetMe(self):
'''Test the telegram.Bot getMe method'''
print('Testing getMe')
bot = self._bot.getMe()
self.assertTrue(self.is_json(bot.to_json()))
@ -56,8 +54,6 @@ class BotTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def testSendMessage(self):
'''Test the telegram.Bot sendMessage method'''
print('Testing sendMessage')
message = self._bot.sendMessage(chat_id=self._chat_id,
text='Моё судно на воздушной подушке полно угрей')
@ -68,8 +64,6 @@ class BotTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def testGetUpdates(self):
'''Test the telegram.Bot getUpdates method'''
print('Testing getUpdates')
updates = self._bot.getUpdates()
if updates:
@ -79,8 +73,6 @@ class BotTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def testForwardMessage(self):
'''Test the telegram.Bot forwardMessage method'''
print('Testing forwardMessage')
message = self._bot.forwardMessage(chat_id=self._chat_id,
from_chat_id=self._chat_id,
message_id=2398)
@ -93,8 +85,6 @@ class BotTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def testSendPhoto(self):
'''Test the telegram.Bot sendPhoto method'''
print('Testing sendPhoto - File')
message = self._bot.sendPhoto(photo=open('tests/data/telegram.png', 'rb'),
caption='testSendPhoto',
chat_id=self._chat_id)
@ -106,8 +96,6 @@ class BotTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def testResendPhoto(self):
'''Test the telegram.Bot sendPhoto method'''
print('Testing sendPhoto - Resend')
message = self._bot.sendPhoto(photo='AgADAQADyKcxGx8j9Qdp6d-gpUsw4Gja1i8ABEVJsVqQk8LfJ3wAAgI',
chat_id=self._chat_id)
@ -117,8 +105,6 @@ class BotTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def testSendJPGURLPhoto(self):
'''Test the telegram.Bot sendPhoto method'''
print('Testing testSendJPGURLPhoto - URL')
message = self._bot.sendPhoto(photo='http://dummyimage.com/600x400/000/fff.jpg&text=telegram',
chat_id=self._chat_id)
@ -128,8 +114,6 @@ class BotTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def testSendPNGURLPhoto(self):
'''Test the telegram.Bot sendPhoto method'''
print('Testing testSendPNGURLPhoto - URL')
message = self._bot.sendPhoto(photo='http://dummyimage.com/600x400/000/fff.png&text=telegram',
chat_id=self._chat_id)
@ -139,8 +123,6 @@ class BotTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def testSendGIFURLPhoto(self):
'''Test the telegram.Bot sendPhoto method'''
print('Testing testSendGIFURLPhoto - URL')
message = self._bot.sendPhoto(photo='http://dummyimage.com/600x400/000/fff.gif&text=telegram',
chat_id=self._chat_id)
@ -150,24 +132,18 @@ class BotTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def testSendChatAction(self):
'''Test the telegram.Bot sendChatAction method'''
print('Testing sendChatAction - ChatAction.TYPING')
self._bot.sendChatAction(action=telegram.ChatAction.TYPING,
chat_id=self._chat_id)
@flaky(3, 1)
@timeout(10)
def testGetUserProfilePhotos(self):
'''Test the telegram.Bot getUserProfilePhotos method'''
print('Testing getUserProfilePhotos')
upf = self._bot.getUserProfilePhotos(user_id=self._chat_id)
self.assertTrue(self.is_json(upf.to_json()))
self.assertEqual(upf.photos[0][0].file_size, 12421)
def _test_invalid_token(self, token):
print('Testing invalid token: {0}'.format(token))
self.assertRaisesRegexp(telegram.error.InvalidToken, 'Invalid token', telegram.Bot, token)
def testInvalidToken1(self):
@ -180,13 +156,11 @@ class BotTest(BaseTest, unittest.TestCase):
self._test_invalid_token('12:')
def testUnauthToken(self):
print('Testing unauthorized token')
with self.assertRaisesRegexp(telegram.error.Unauthorized, 'Unauthorized'):
bot = telegram.Bot('1234:abcd1234')
bot.getMe()
def testInvalidSrvResp(self):
print('Testing invalid server response')
with self.assertRaisesRegexp(telegram.TelegramError, 'Invalid server response'):
# bypass the valid token check
bot_cls = type('bot_cls', (telegram.Bot, ), {'_valid_token': lambda self, token: token})

View file

@ -27,16 +27,12 @@ class BotanTest(BaseTest, unittest.TestCase):
token = os.environ.get('BOTAN_TOKEN')
def test_track(self):
"""Test sending event to botan"""
print('Test sending event to botan')
botan = Botan(self.token)
message = MessageMock(self._chat_id)
result = botan.track(message, 'named event')
self.assertTrue(result)
def test_track_fail(self):
"""Test fail when sending event to botan"""
print('Test fail when sending event to botan')
botan = Botan(self.token)
botan.url_template = 'https://api.botan.io/traccc?token={token}&uid={uid}&name={name}'
message = MessageMock(self._chat_id)
@ -44,8 +40,6 @@ class BotanTest(BaseTest, unittest.TestCase):
self.assertFalse(result)
def test_wrong_message(self):
"""Test sending wrong message"""
print('Test sending wrong message')
botan = Botan(self.token)
message = MessageMock(self._chat_id)
message = delattr(message, 'chat_id')
@ -53,8 +47,6 @@ class BotanTest(BaseTest, unittest.TestCase):
self.assertFalse(result)
def test_wrong_endpoint(self):
"""Test wrong endpoint"""
print('Test wrong endpoint')
botan = Botan(self.token)
botan.url_template = 'https://api.botaaaaan.io/traccc?token={token}&uid={uid}&name={name}'
message = MessageMock(self._chat_id)

View file

@ -43,17 +43,11 @@ class ChatTest(BaseTest, unittest.TestCase):
}
def test_group_chat_de_json_empty_json(self):
"""Test Chat.de_json() method"""
print('Testing Chat.de_json() - Empty JSON')
group_chat = telegram.Chat.de_json({})
self.assertEqual(group_chat, None)
def test_group_chat_de_json(self):
"""Test Chat.de_json() method"""
print('Testing Chat.de_json()')
group_chat = telegram.Chat.de_json(self.json_dict)
self.assertEqual(group_chat.id, self.id)
@ -61,17 +55,11 @@ class ChatTest(BaseTest, unittest.TestCase):
self.assertEqual(group_chat.type, self.type)
def test_group_chat_to_json(self):
"""Test Chat.to_json() method"""
print('Testing Chat.to_json()')
group_chat = telegram.Chat.de_json(self.json_dict)
self.assertTrue(self.is_json(group_chat.to_json()))
def test_group_chat_to_dict(self):
"""Test Chat.to_dict() method"""
print('Testing Chat.to_dict()')
group_chat = telegram.Chat.de_json(self.json_dict)
self.assertTrue(self.is_dict(group_chat.to_dict()))

View file

@ -45,9 +45,6 @@ class ContactTest(BaseTest, unittest.TestCase):
}
def test_contact_de_json(self):
"""Test Contact.de_json() method"""
print('Testing Contact.de_json()')
contact = telegram.Contact.de_json(self.json_dict)
self.assertEqual(contact.phone_number, self.phone_number)
@ -56,17 +53,11 @@ class ContactTest(BaseTest, unittest.TestCase):
self.assertEqual(contact.user_id, self.user_id)
def test_contact_to_json(self):
"""Test Contact.to_json() method"""
print('Testing Contact.to_json()')
contact = telegram.Contact.de_json(self.json_dict)
self.assertTrue(self.is_json(contact.to_json()))
def test_contact_to_dict(self):
"""Test Contact.to_dict() method"""
print('Testing Contact.to_dict()')
contact = telegram.Contact.de_json(self.json_dict)
self.assertTrue(self.is_dict(contact.to_dict()))

View file

@ -56,9 +56,6 @@ class DocumentTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_document_png_file(self):
"""Test telegram.Bot sendDocument method"""
print('Testing bot.sendDocument - PNG File')
message = self._bot.sendDocument(self._chat_id,
self.document_file)
@ -74,9 +71,6 @@ class DocumentTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_document_png_file_with_custom_file_name(self):
"""Test telegram.Bot sendDocument method"""
print('Testing bot.sendDocument - PNG File with custom filename')
message = self._bot.sendDocument(self._chat_id,
self.document_file,
filename='telegram_custom.png')
@ -93,9 +87,6 @@ class DocumentTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_document_url_gif_file(self):
"""Test telegram.Bot sendDocument method"""
print('Testing bot.sendDocument - GIF File by URL')
message = self._bot.sendDocument(self._chat_id,
self.document_file_url)
@ -111,9 +102,6 @@ class DocumentTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_document_resend(self):
"""Test telegram.Bot sendDocument method"""
print('Testing bot.sendDocument - Resend by file_id')
message = self._bot.sendDocument(chat_id=self._chat_id,
document=self.document_file_id)
@ -125,9 +113,6 @@ class DocumentTest(BaseTest, unittest.TestCase):
self.assertEqual(document.mime_type, self.mime_type)
def test_document_de_json(self):
"""Test Document.de_json() method"""
print('Testing Document.de_json()')
document = telegram.Document.de_json(self.json_dict)
self.assertEqual(document.file_id, self.document_file_id)
@ -137,17 +122,11 @@ class DocumentTest(BaseTest, unittest.TestCase):
self.assertEqual(document.file_size, self.file_size)
def test_document_to_json(self):
"""Test Document.to_json() method"""
print('Testing Document.to_json()')
document = telegram.Document.de_json(self.json_dict)
self.assertTrue(self.is_json(document.to_json()))
def test_document_to_dict(self):
"""Test Document.to_dict() method"""
print('Testing Document.to_dict()')
document = telegram.Document.de_json(self.json_dict)
self.assertTrue(self.is_dict(document.to_dict()))
@ -160,8 +139,6 @@ class DocumentTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_document_empty_file(self):
print('Testing bot.sendDocument - Null file')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -174,8 +151,6 @@ class DocumentTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_document_empty_file_id(self):
print('Testing bot.sendDocument - Empty file_id')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -188,8 +163,6 @@ class DocumentTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_document_without_required_args(self):
print('Testing bot.sendDocument - Without required arguments')
json_dict = self.json_dict
del(json_dict['file_id'])

View file

@ -33,9 +33,6 @@ class EmojiTest(BaseTest, unittest.TestCase):
"""This object represents Tests for Telegram Emoji."""
def test_emoji(self):
"""Test Emoji class"""
print('Testing Emoji class')
for attr in dir(Emoji):
if attr[0] != '_': # TODO: dirty way to filter out functions
self.assertTrue(type(getattr(Emoji, attr)) is str)

View file

@ -46,9 +46,6 @@ class FileTest(BaseTest, unittest.TestCase):
}
def test_get_and_download_file_audio(self):
"""Test telegram.Bot getFile method - Audio"""
print('Testing bot.getFile - With Audio.file_id')
newFile = self._bot.getFile(self.audio_file_id)
self.assertEqual(newFile.file_size, 28232)
@ -60,9 +57,6 @@ class FileTest(BaseTest, unittest.TestCase):
self.assertTrue(os.path.isfile('telegram.mp3'))
def test_get_and_download_file_document(self):
"""Test telegram.Bot getFile method - Document"""
print('Testing bot.getFile - With Document.file_id')
newFile = self._bot.getFile(self.document_file_id)
self.assertEqual(newFile.file_size, 12948)
@ -74,9 +68,6 @@ class FileTest(BaseTest, unittest.TestCase):
self.assertTrue(os.path.isfile('telegram.png'))
def test_get_and_download_file_sticker(self):
"""Test telegram.Bot getFile method - Sticker"""
print('Testing bot.getFile - With Sticker.file_id')
newFile = self._bot.getFile(self.sticker_file_id)
self.assertEqual(newFile.file_size, 39518)
@ -88,9 +79,6 @@ class FileTest(BaseTest, unittest.TestCase):
self.assertTrue(os.path.isfile('telegram.webp'))
def test_get_and_download_file_video(self):
"""Test telegram.Bot getFile method - Video"""
print('Testing bot.getFile - With Video.file_id')
newFile = self._bot.getFile(self.video_file_id)
self.assertEqual(newFile.file_size, 326534)
@ -102,9 +90,6 @@ class FileTest(BaseTest, unittest.TestCase):
self.assertTrue(os.path.isfile('telegram.mp4'))
def test_get_and_download_file_voice(self):
"""Test telegram.Bot getFile method - Voice"""
print('Testing bot.getFile - With Voice.file_id')
newFile = self._bot.getFile(self.voice_file_id)
self.assertEqual(newFile.file_size, 9199)
@ -116,9 +101,6 @@ class FileTest(BaseTest, unittest.TestCase):
self.assertTrue(os.path.isfile('telegram.ogg'))
def test_file_de_json(self):
"""Test File.de_json() method"""
print('Testing File.de_json()')
newFile = telegram.File.de_json(self.json_dict)
self.assertEqual(newFile.file_id, self.json_dict['file_id'])
@ -126,17 +108,11 @@ class FileTest(BaseTest, unittest.TestCase):
self.assertEqual(newFile.file_size, self.json_dict['file_size'])
def test_file_to_json(self):
"""Test File.to_json() method"""
print('Testing File.to_json()')
newFile = telegram.File.de_json(self.json_dict)
self.assertTrue(self.is_json(newFile.to_json()))
def test_file_to_dict(self):
"""Test File.to_dict() method"""
print('Testing File.to_dict()')
newFile = telegram.File.de_json(self.json_dict)
self.assertTrue(self.is_dict(newFile.to_dict()))
@ -145,10 +121,7 @@ class FileTest(BaseTest, unittest.TestCase):
self.assertEqual(newFile['file_size'], self.json_dict['file_size'])
def test_error_get_empty_file_id(self):
print('Testing bot.getFile - Null file_id')
json_dict = self.json_dict
json_dict['file_id'] = ''
del(json_dict['file_path'])
del(json_dict['file_size'])
@ -157,8 +130,6 @@ class FileTest(BaseTest, unittest.TestCase):
lambda: self._bot.getFile(**json_dict))
def test_error_file_without_required_args(self):
print('Testing bot.getFile - Without required arguments')
json_dict = self.json_dict
del(json_dict['file_id'])

View file

@ -41,9 +41,6 @@ class ForceReplyTest(BaseTest, unittest.TestCase):
}
def test_send_message_with_force_reply(self):
"""Test telegram.Bot sendMessage method with ForceReply"""
print('Testing bot.sendMessage - with ForceReply')
message = self._bot.sendMessage(self._chat_id,
'Моё судно на воздушной подушке полно угрей',
reply_markup=telegram.ForceReply.de_json(self.json_dict))
@ -52,26 +49,17 @@ class ForceReplyTest(BaseTest, unittest.TestCase):
self.assertEqual(message.text, u'Моё судно на воздушной подушке полно угрей')
def test_force_reply_de_json(self):
"""Test ForceReply.de_json() method"""
print('Testing ForceReply.de_json()')
force_reply = telegram.ForceReply.de_json(self.json_dict)
self.assertEqual(force_reply.force_reply, self.force_reply)
self.assertEqual(force_reply.selective, self.selective)
def test_force_reply_to_json(self):
"""Test ForceReply.to_json() method"""
print('Testing ForceReply.to_json()')
force_reply = telegram.ForceReply.de_json(self.json_dict)
self.assertTrue(self.is_json(force_reply.to_json()))
def test_force_reply_to_dict(self):
"""Test ForceReply.to_dict() method"""
print('Testing ForceReply.to_dict()')
force_reply = telegram.ForceReply.de_json(self.json_dict)
self.assertEqual(force_reply['force_reply'], self.force_reply)

View file

@ -72,19 +72,16 @@ class JobQueueTest(BaseTest, unittest.TestCase):
raise Exception("Test Error")
def test_basic(self):
print('Testing basic job queue function')
self.jq.put(self.job1, 0.1)
sleep(1.5)
self.assertGreaterEqual(self.result, 10)
def test_noRepeat(self):
print('Testing job queue without repeat')
self.jq.put(self.job1, 0.1, repeat=False)
sleep(0.5)
self.assertEqual(1, self.result)
def test_nextT(self):
print('Testing job queue with a set next_t value')
self.jq.put(self.job1, 0.1, next_t=0.5)
sleep(0.45)
self.assertEqual(0, self.result)
@ -92,7 +89,6 @@ class JobQueueTest(BaseTest, unittest.TestCase):
self.assertEqual(1, self.result)
def test_multiple(self):
print('Testing job queue with multiple jobs')
self.jq.put(self.job1, 0.1, repeat=False)
self.jq.put(self.job1, 0.2, repeat=False)
self.jq.put(self.job1, 0.4)
@ -100,7 +96,6 @@ class JobQueueTest(BaseTest, unittest.TestCase):
self.assertEqual(4, self.result)
def test_error(self):
print('Testing job queue starting twice with an erroneous job')
self.jq.put(self.job2, 0.1)
self.jq.put(self.job1, 0.2)
self.jq.start()
@ -108,7 +103,6 @@ class JobQueueTest(BaseTest, unittest.TestCase):
self.assertEqual(1, self.result)
def test_inUpdater(self):
print('Testing job queue created by updater')
u = Updater(bot="MockBot", job_queue_tick_interval=0.005)
u.job_queue.put(self.job1, 0.1)
sleep(0.15)

View file

@ -41,9 +41,6 @@ class LocationTest(BaseTest, unittest.TestCase):
}
def test_send_location_implicit_args(self):
"""Test telegram.Bot sendLocation method"""
print('Testing bot.sendLocation - Implicit arguments')
message = self._bot.sendLocation(self._chat_id,
self.latitude,
self.longitude)
@ -54,9 +51,6 @@ class LocationTest(BaseTest, unittest.TestCase):
self.assertEqual(location.longitude, self.longitude)
def test_send_location_explicit_args(self):
"""Test telegram.Bot sendLocation method"""
print('Testing bot.sendLocation - Explicit arguments')
message = self._bot.sendLocation(chat_id=self._chat_id,
latitude=self.latitude,
longitude=self.longitude)
@ -67,34 +61,23 @@ class LocationTest(BaseTest, unittest.TestCase):
self.assertEqual(location.longitude, self.longitude)
def test_location_de_json(self):
"""Test Location.de_json() method"""
print('Testing Location.de_json()')
location = telegram.Location.de_json(self.json_dict)
self.assertEqual(location.latitude, self.latitude)
self.assertEqual(location.longitude, self.longitude)
def test_location_to_json(self):
"""Test Location.to_json() method"""
print('Testing Location.to_json()')
location = telegram.Location.de_json(self.json_dict)
self.assertTrue(self.is_json(location.to_json()))
def test_location_to_dict(self):
"""Test Location.to_dict() method"""
print('Testing Location.to_dict()')
location = telegram.Location.de_json(self.json_dict)
self.assertEqual(location['latitude'], self.latitude)
self.assertEqual(location['longitude'], self.longitude)
def test_error_send_location_empty_args(self):
print('Testing bot.sendLocation - Empty arguments')
json_dict = self.json_dict
json_dict['latitude'] = ''
@ -105,8 +88,6 @@ class LocationTest(BaseTest, unittest.TestCase):
**json_dict))
def test_error_location_without_required_args(self):
print('Testing bot.sendLocation - Without required arguments')
json_dict = self.json_dict
del(json_dict['latitude'])

View file

@ -36,8 +36,6 @@ class ParseMode(BaseTest, unittest.TestCase):
self.formatted_text_formatted = u'bold italic link.'
def test_send_message_with_parse_mode_markdown(self):
'''Test the telegram.Bot sendMessage method with markdown parse mode'''
print('Testing sendMessage - with markdown parsemode')
message = self._bot.sendMessage(chat_id=self._chat_id,
text=self.markdown_text,
parse_mode=telegram.ParseMode.MARKDOWN)
@ -46,8 +44,6 @@ class ParseMode(BaseTest, unittest.TestCase):
self.assertEqual(message.text, self.formatted_text_formatted)
def test_send_message_with_parse_mode_html(self):
'''Test the telegram.Bot sendMessage method with html parse mode'''
print('Testing sendMessage - with html parse mode')
message = self._bot.sendMessage(chat_id=self._chat_id,
text=self.html_text,
parse_mode=telegram.ParseMode.HTML)
@ -56,4 +52,4 @@ class ParseMode(BaseTest, unittest.TestCase):
self.assertEqual(message.text, self.formatted_text_formatted)
if __name__ == '__main__':
unittest.main()
unittest.main()

View file

@ -58,9 +58,6 @@ class PhotoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_sendphotoo_all_args(self):
"""Test telegram.Bot sendAudio method"""
print('Testing bot.sendPhoto - With all arguments')
message = self._bot.sendPhoto(self._chat_id,
self.photo_file,
caption=self.caption)
@ -86,9 +83,6 @@ class PhotoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_photo_jpg_file(self):
"""Test telegram.Bot sendPhoto method"""
print('Testing bot.sendPhoto - JPG File')
message = self._bot.sendPhoto(self._chat_id,
self.photo_file)
@ -111,9 +105,6 @@ class PhotoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_photo_url_jpg_file(self):
"""Test telegram.Bot sendPhoto method"""
print('Testing bot.sendPhoto - JPG File by URL')
message = self._bot.sendPhoto(self._chat_id,
self.photo_file_url)
@ -136,9 +127,6 @@ class PhotoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_photo_resend(self):
"""Test telegram.Bot sendPhoto method"""
print('Testing bot.sendPhoto - Resend by file_id')
message = self._bot.sendPhoto(chat_id=self._chat_id,
photo=self.photo_file_id)
@ -155,9 +143,6 @@ class PhotoTest(BaseTest, unittest.TestCase):
self.assertEqual(photo.height, self.height)
def test_photo_de_json(self):
"""Test Photo.de_json() method"""
print('Testing Photo.de_json()')
photo = telegram.PhotoSize.de_json(self.json_dict)
self.assertEqual(photo.file_id, self.photo_file_id)
@ -167,17 +152,11 @@ class PhotoTest(BaseTest, unittest.TestCase):
self.assertEqual(photo.file_size, self.file_size)
def test_photo_to_json(self):
"""Test Photo.to_json() method"""
print('Testing Photo.to_json()')
photo = telegram.PhotoSize.de_json(self.json_dict)
self.assertTrue(self.is_json(photo.to_json()))
def test_photo_to_dict(self):
"""Test Photo.to_dict() method"""
print('Testing Photo.to_dict()')
photo = telegram.PhotoSize.de_json(self.json_dict)
self.assertTrue(self.is_dict(photo.to_dict()))
@ -190,8 +169,6 @@ class PhotoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_photo_empty_file(self):
print('Testing bot.sendPhoto - Null file')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -204,8 +181,6 @@ class PhotoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_photo_empty_file_id(self):
print('Testing bot.sendPhoto - Empty file_id')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -218,8 +193,6 @@ class PhotoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_photo_without_required_args(self):
print('Testing bot.sendPhoto - Without required arguments')
json_dict = self.json_dict
del(json_dict['file_id'])

View file

@ -41,9 +41,6 @@ class ReplyKeyboardHideTest(BaseTest, unittest.TestCase):
}
def test_send_message_with_reply_keyboard_hide(self):
"""Test telegram.Bot sendMessage method with ReplyKeyboardHide"""
print('Testing bot.sendMessage - with ReplyKeyboardHide')
message = self._bot.sendMessage(self._chat_id,
'Моё судно на воздушной подушке полно угрей',
reply_markup=telegram.ReplyKeyboardHide.de_json(self.json_dict))
@ -52,26 +49,17 @@ class ReplyKeyboardHideTest(BaseTest, unittest.TestCase):
self.assertEqual(message.text, u'Моё судно на воздушной подушке полно угрей')
def test_reply_keyboard_hide_de_json(self):
"""Test ReplyKeboardHide.de_json() method"""
print('Testing ReplyKeyboardHide.de_json()')
reply_keyboard_hide = telegram.ReplyKeyboardHide.de_json(self.json_dict)
self.assertEqual(reply_keyboard_hide.hide_keyboard, self.hide_keyboard)
self.assertEqual(reply_keyboard_hide.selective, self.selective)
def test_reply_keyboard_hide_to_json(self):
"""Test ReplyKeyboardHide.to_json() method"""
print('Testing ReplyKeyboardHide.to_json()')
reply_keyboard_hide = telegram.ReplyKeyboardHide.de_json(self.json_dict)
self.assertTrue(self.is_json(reply_keyboard_hide.to_json()))
def test_reply_keyboard_hide_to_dict(self):
"""Test ReplyKeyboardHide.to_dict() method"""
print('Testing ReplyKeyboardHide.to_dict()')
reply_keyboard_hide = telegram.ReplyKeyboardHide.de_json(self.json_dict)
self.assertEqual(reply_keyboard_hide['hide_keyboard'], self.hide_keyboard)

View file

@ -45,9 +45,6 @@ class ReplyKeyboardMarkupTest(BaseTest, unittest.TestCase):
}
def test_send_message_with_reply_keyboard_markup(self):
"""Test telegram.Bot sendMessage method with ReplyKeyboardMarkup"""
print('Testing bot.sendMessage - with ReplyKeyboardMarkup')
message = self._bot.sendMessage(self._chat_id,
'Моё судно на воздушной подушке полно угрей',
reply_markup=telegram.ReplyKeyboardMarkup.de_json(self.json_dict))
@ -56,9 +53,6 @@ class ReplyKeyboardMarkupTest(BaseTest, unittest.TestCase):
self.assertEqual(message.text, u'Моё судно на воздушной подушке полно угрей')
def test_reply_keyboard_markup_de_json(self):
"""Test ReplyKeboardMarkup.de_json() method"""
print('Testing ReplyKeyboardMarkup.de_json()')
reply_keyboard_markup = telegram.ReplyKeyboardMarkup.de_json(self.json_dict)
self.assertEqual(reply_keyboard_markup.keyboard, self.keyboard)
@ -67,17 +61,11 @@ class ReplyKeyboardMarkupTest(BaseTest, unittest.TestCase):
self.assertEqual(reply_keyboard_markup.selective, self.selective)
def test_reply_keyboard_markup_to_json(self):
"""Test ReplyKeyboardMarkup.to_json() method"""
print('Testing ReplyKeyboardMarkup.to_json()')
reply_keyboard_markup = telegram.ReplyKeyboardMarkup.de_json(self.json_dict)
self.assertTrue(self.is_json(reply_keyboard_markup.to_json()))
def test_reply_keyboard_markup_to_dict(self):
"""Test ReplyKeyboardMarkup.to_dict() method"""
print('Testing ReplyKeyboardMarkup.to_dict()')
reply_keyboard_markup = telegram.ReplyKeyboardMarkup.de_json(self.json_dict)
self.assertEqual(reply_keyboard_markup['keyboard'], self.keyboard)

View file

@ -59,9 +59,6 @@ class StickerTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_sticker_resend(self):
"""Test telegram.Bot sendSticker method"""
print('Testing bot.sendSticker - Resend by file_id')
message = self._bot.sendSticker(chat_id=self._chat_id,
sticker=self.sticker_file_id)
@ -74,9 +71,6 @@ class StickerTest(BaseTest, unittest.TestCase):
self.assertEqual(sticker.file_size, self.file_size)
def test_sticker_de_json(self):
"""Test Sticker.de_json() method"""
print('Testing Sticker.de_json()')
sticker = telegram.Sticker.de_json(self.json_dict)
self.assertEqual(sticker.file_id, self.sticker_file_id)
@ -86,17 +80,11 @@ class StickerTest(BaseTest, unittest.TestCase):
self.assertEqual(sticker.file_size, self.file_size)
def test_sticker_to_json(self):
"""Test Sticker.to_json() method"""
print('Testing Sticker.to_json()')
sticker = telegram.Sticker.de_json(self.json_dict)
self.assertTrue(self.is_json(sticker.to_json()))
def test_sticker_to_dict(self):
"""Test Sticker.to_dict() method"""
print('Testing Sticker.to_dict()')
sticker = telegram.Sticker.de_json(self.json_dict)
self.assertEqual(sticker['file_id'], self.sticker_file_id)
@ -108,8 +96,6 @@ class StickerTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_sticker_empty_file(self):
print('Testing bot.sendSticker - Null file')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -122,8 +108,6 @@ class StickerTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_sticker_empty_file_id(self):
print('Testing bot.sendSticker - Empty file_id')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -136,8 +120,6 @@ class StickerTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_sticker_without_required_args(self):
print('Testing bot.sendSticker - Without required arguments')
json_dict = self.json_dict
del(json_dict['file_id'])

View file

@ -52,26 +52,17 @@ class UpdateTest(BaseTest, unittest.TestCase):
}
def test_update_de_json(self):
"""Test Update.de_json() method"""
print('Testing Update.de_json()')
update = telegram.Update.de_json(self.json_dict)
self.assertEqual(update.update_id, self.update_id)
self.assertTrue(isinstance(update.message, telegram.Message))
def test_update_to_json(self):
"""Test Update.to_json() method"""
print('Testing Update.to_json()')
update = telegram.Update.de_json(self.json_dict)
self.assertTrue(self.is_json(update.to_json()))
def test_update_to_dict(self):
"""Test Update.to_dict() method"""
print('Testing Update.to_dict()')
update = telegram.Update.de_json(self.json_dict)
self.assertTrue(self.is_dict(update.to_dict()))

View file

@ -136,7 +136,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.message_count += 1
def test_addRemoveTelegramMessageHandler(self):
print('Testing add/removeTelegramMessageHandler')
self._setup_updater('Test')
d = self.updater.dispatcher
d.addTelegramMessageHandler(
@ -154,7 +153,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertTrue(None is self.received_message)
def test_addTelegramMessageHandlerMultipleMessages(self):
print('Testing addTelegramMessageHandler and send 100 messages...')
self._setup_updater('Multiple', 100)
self.updater.dispatcher.addTelegramMessageHandler(
self.telegramHandlerTest)
@ -164,7 +162,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertEqual(self.message_count, 100)
def test_addRemoveTelegramRegexHandler(self):
print('Testing add/removeStringRegexHandler')
self._setup_updater('Test2')
d = self.updater.dispatcher
regobj = re.compile('Te.*')
@ -183,7 +180,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertTrue(None is self.received_message)
def test_addRemoveTelegramCommandHandler(self):
print('Testing add/removeTelegramCommandHandler')
self._setup_updater('/test')
d = self.updater.dispatcher
self.updater.dispatcher.addTelegramCommandHandler(
@ -201,7 +197,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertTrue(None is self.received_message)
def test_addRemoveUnknownTelegramCommandHandler(self):
print('Testing add/removeUnknownTelegramCommandHandler')
self._setup_updater('/test2')
d = self.updater.dispatcher
self.updater.dispatcher.addUnknownTelegramCommandHandler(
@ -219,7 +214,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertTrue(None is self.received_message)
def test_addRemoveStringRegexHandler(self):
print('Testing add/removeStringRegexHandler')
self._setup_updater('', messages=0)
d = self.updater.dispatcher
d.addStringRegexHandler('Te.*', self.stringHandlerTest)
@ -237,7 +231,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertTrue(None is self.received_message)
def test_addRemoveStringCommandHandler(self):
print('Testing add/removeStringCommandHandler')
self._setup_updater('', messages=0)
d = self.updater.dispatcher
d.addStringCommandHandler(
@ -257,7 +250,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertTrue(None is self.received_message)
def test_addRemoveUnknownStringCommandHandler(self):
print('Testing add/removeUnknownStringCommandHandler')
self._setup_updater('/test')
d = self.updater.dispatcher
d.addUnknownStringCommandHandler(
@ -276,7 +268,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertTrue(None is self.received_message)
def test_addRemoveErrorHandler(self):
print('Testing add/removeErrorHandler')
self._setup_updater('', messages=0)
d = self.updater.dispatcher
d.addErrorHandler(self.errorHandlerTest)
@ -295,7 +286,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertTrue(None is self.received_message)
def test_errorInHandler(self):
print('Testing error in Handler')
self._setup_updater('', messages=0)
d = self.updater.dispatcher
d.addStringRegexHandler('.*',
@ -308,7 +298,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertEqual(self.received_message, 'Test Error 1')
def test_errorOnGetUpdates(self):
print('Testing error on getUpdates')
self._setup_updater('', raise_error=True)
d = self.updater.dispatcher
d.addErrorHandler(self.errorHandlerTest)
@ -317,7 +306,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertEqual(self.received_message, "Test Error 2")
def test_addRemoveTypeHandler(self):
print('Testing add/removeTypeHandler')
self._setup_updater('', messages=0)
d = self.updater.dispatcher
d.addTypeHandler(dict, self.stringHandlerTest)
@ -336,7 +324,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertTrue(None is self.received_message)
def test_runAsync(self):
print('Testing @run_async')
self._setup_updater('Test5', messages=2)
d = self.updater.dispatcher
d.addTelegramMessageHandler(
@ -347,7 +334,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertEqual(self.message_count, 2)
def test_additionalArgs(self):
print('Testing additional arguments for handlers')
self._setup_updater('', messages=0)
self.updater.dispatcher.addStringCommandHandler(
'test5', self.additionalArgsTest)
@ -359,7 +345,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertEqual(self.message_count, 2)
def test_context(self):
print('Testing context for handlers')
context = "context_data"
self._setup_updater('', messages=0)
self.updater.dispatcher.addStringCommandHandler(
@ -373,7 +358,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertEqual(self.context, context)
def test_regexGroupHandler(self):
print('Testing optional groups and groupdict parameters')
self._setup_updater('', messages=0)
d = self.updater.dispatcher
d.addStringRegexHandler('^(This).*?(?P<testgroup>regex group).*',
@ -386,7 +370,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
def test_runAsyncWithAdditionalArgs(self):
print('Testing @run_async with additional parameters')
self._setup_updater('Test6', messages=2)
d = self.updater.dispatcher
d.addTelegramMessageHandler(
@ -397,7 +380,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertEqual(self.message_count, 2)
def test_webhook(self):
print('Testing Webhook')
self._setup_updater('', messages=0)
d = self.updater.dispatcher
d.addTelegramMessageHandler(
@ -443,7 +425,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
self.assertTrue(True)
def test_webhook_no_ssl(self):
print('Testing Webhook without SSL')
self._setup_updater('', messages=0)
d = self.updater.dispatcher
d.addTelegramMessageHandler(
@ -539,7 +520,6 @@ class UpdaterTest(BaseTest, unittest.TestCase):
os.kill(os.getpid(), signal.SIGTERM)
def test_idle(self):
print('Testing idle')
self._setup_updater('Test6', messages=0)
self.updater.start_polling(poll_interval=0.01)
Thread(target=self.signalsender).start()

View file

@ -47,9 +47,6 @@ class UserTest(BaseTest, unittest.TestCase):
}
def test_user_de_json(self):
"""Test User.de_json() method"""
print('Testing User.de_json()')
user = telegram.User.de_json(self.json_dict)
self.assertEqual(user.id, self.id)
@ -61,9 +58,6 @@ class UserTest(BaseTest, unittest.TestCase):
self.assertEqual(user.name, '@leandrotoledo')
def test_user_de_json_without_username(self):
"""Test User.de_json() method"""
print('Testing User.de_json() - Without username')
json_dict = self.json_dict
del(json_dict['username'])
@ -79,9 +73,6 @@ class UserTest(BaseTest, unittest.TestCase):
def test_user_de_json_without_username_and_lastname(self):
"""Test User.de_json() method"""
print('Testing User.de_json() - Without username and last_name')
json_dict = self.json_dict
del(json_dict['username'])
@ -95,17 +86,11 @@ class UserTest(BaseTest, unittest.TestCase):
self.assertEqual(user.name, self.first_name)
def test_user_to_json(self):
"""Test User.to_json() method"""
print('Testing User.to_json()')
user = telegram.User.de_json(self.json_dict)
self.assertTrue(self.is_json(user.to_json()))
def test_user_to_dict(self):
"""Test User.to_dict() method"""
print('Testing User.to_dict()')
user = telegram.User.de_json(self.json_dict)
self.assertTrue(self.is_dict(user.to_dict()))

View file

@ -60,9 +60,6 @@ class VideoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_video_required_args_only(self):
"""Test telegram.Bot sendVideo method"""
print('Testing bot.sendVideo - With required arguments only')
message = self._bot.sendVideo(self._chat_id,
self.video_file)
@ -80,9 +77,6 @@ class VideoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_video_all_args(self):
"""Test telegram.Bot sendAudio method"""
print('Testing bot.sendVideo - With all arguments')
message = self._bot.sendVideo(self._chat_id,
self.video_file,
duration=self.duration,
@ -104,9 +98,6 @@ class VideoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_video_mp4_file(self):
"""Test telegram.Bot sendVideo method"""
print('Testing bot.sendVideo - MP4 File')
message = self._bot.sendVideo(chat_id=self._chat_id,
video=self.video_file,
duration=self.duration,
@ -128,9 +119,6 @@ class VideoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_video_mp4_file_with_custom_filename(self):
"""Test telegram.Bot sendVideo method"""
print('Testing bot.sendVideo - MP4 File with custom filename')
message = self._bot.sendVideo(chat_id=self._chat_id,
video=self.video_file,
duration=self.duration,
@ -153,9 +141,6 @@ class VideoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_video_mp4_file_url(self):
"""Test telegram.Bot sendVideo method"""
print('Testing bot.sendVideo - MP4 File by URL')
message = self._bot.sendVideo(chat_id=self._chat_id,
video=self.video_file_url,
duration=self.duration,
@ -177,9 +162,6 @@ class VideoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_video_resend(self):
"""Test telegram.Bot sendVideo method"""
print('Testing bot.sendVideo - Resend by file_id')
message = self._bot.sendVideo(chat_id=self._chat_id,
video=self.video_file_id,
duration=self.duration,
@ -195,9 +177,6 @@ class VideoTest(BaseTest, unittest.TestCase):
self.assertEqual(message.caption, self.caption)
def test_video_de_json(self):
"""Test Video.de_json() method"""
print('Testing Video.de_json()')
video = telegram.Video.de_json(self.json_dict)
self.assertEqual(video.file_id, self.video_file_id)
@ -209,17 +188,11 @@ class VideoTest(BaseTest, unittest.TestCase):
self.assertEqual(video.file_size, self.file_size)
def test_video_to_json(self):
"""Test Video.to_json() method"""
print('Testing Video.to_json()')
video = telegram.Video.de_json(self.json_dict)
self.assertTrue(self.is_json(video.to_json()))
def test_video_to_dict(self):
"""Test Video.to_dict() method"""
print('Testing Video.to_dict()')
video = telegram.Video.de_json(self.json_dict)
self.assertTrue(self.is_dict(video.to_dict()))
@ -233,8 +206,6 @@ class VideoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_video_empty_file(self):
print('Testing bot.sendVideo - Null file')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -247,8 +218,6 @@ class VideoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_video_empty_file_id(self):
print('Testing bot.sendVideo - Empty file_id')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -261,8 +230,6 @@ class VideoTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_video_without_required_args(self):
print('Testing bot.sendVideo - Without required arguments')
json_dict = self.json_dict
del(json_dict['file_id'])

View file

@ -51,9 +51,6 @@ class VoiceTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_voice_required_args_only(self):
"""Test telegram.Bot sendVoice method"""
print('Testing bot.sendVoice - With required arguments only')
message = self._bot.sendVoice(self._chat_id,
self.voice_file)
@ -68,9 +65,6 @@ class VoiceTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_voice_all_args(self):
"""Test telegram.Bot sendAudio method"""
print('Testing bot.sendVoice - With all arguments')
message = self._bot.sendVoice(self._chat_id,
self.voice_file,
self.duration,
@ -88,9 +82,6 @@ class VoiceTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_voice_ogg_file(self):
"""Test telegram.Bot sendVoice method"""
print('Testing bot.sendVoice - Ogg File')
message = self._bot.sendVoice(chat_id=self._chat_id,
voice=self.voice_file,
duration=self.duration)
@ -106,9 +97,6 @@ class VoiceTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_voice_ogg_file_with_custom_filename(self):
"""Test telegram.Bot sendVoice method"""
print('Testing bot.sendVoice - Ogg File with custom filename')
message = self._bot.sendVoice(chat_id=self._chat_id,
voice=self.voice_file,
duration=self.duration,
@ -125,9 +113,6 @@ class VoiceTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_voice_ogg_url_file(self):
"""Test telegram.Bot sendVoice method"""
print('Testing bot.sendVoice - Ogg File by URL')
message = self._bot.sendVoice(chat_id=self._chat_id,
voice=self.voice_file_url,
duration=self.duration)
@ -143,9 +128,6 @@ class VoiceTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_send_voice_resend(self):
"""Test telegram.Bot sendVoice method"""
print('Testing bot.sendVoice - Resend by file_id')
message = self._bot.sendVoice(chat_id=self._chat_id,
voice=self.voice_file_id,
duration=self.duration)
@ -157,9 +139,6 @@ class VoiceTest(BaseTest, unittest.TestCase):
self.assertEqual(voice.mime_type, self.mime_type)
def test_voice_de_json(self):
"""Test Voice.de_json() method"""
print('Testing Voice.de_json()')
voice = telegram.Voice.de_json(self.json_dict)
self.assertEqual(voice.file_id, self.voice_file_id)
@ -168,17 +147,11 @@ class VoiceTest(BaseTest, unittest.TestCase):
self.assertEqual(voice.file_size, self.file_size)
def test_voice_to_json(self):
"""Test Voice.to_json() method"""
print('Testing Voice.to_json()')
voice = telegram.Voice.de_json(self.json_dict)
self.assertTrue(self.is_json(voice.to_json()))
def test_voice_to_dict(self):
"""Test Voice.to_dict() method"""
print('Testing Voice.to_dict()')
voice = telegram.Voice.de_json(self.json_dict)
self.assertTrue(self.is_dict(voice.to_dict()))
@ -190,8 +163,6 @@ class VoiceTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_voice_empty_file(self):
print('Testing bot.sendVoice - Null file')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -204,8 +175,6 @@ class VoiceTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_send_voice_empty_file_id(self):
print('Testing bot.sendVoice - Empty file_id')
json_dict = self.json_dict
del(json_dict['file_id'])
@ -218,8 +187,6 @@ class VoiceTest(BaseTest, unittest.TestCase):
@flaky(3, 1)
@timeout(10)
def test_error_voice_without_required_args(self):
print('Testing bot.sendVoice - Without required arguments')
json_dict = self.json_dict
del(json_dict['file_id'])