From 4f8866818e2cf967d22e24ae2297c062e4780dff Mon Sep 17 00:00:00 2001 From: anonymousdouble <112695649+anonymousdouble@users.noreply.github.com> Date: Tue, 19 Dec 2023 14:15:22 +1100 Subject: [PATCH] Update test_telebot.py refactor with With statement to open file to make code more Pythonic --- tests/test_telebot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_telebot.py b/tests/test_telebot.py index 0caff9e86..280a19f7c 100644 --- a/tests/test_telebot.py +++ b/tests/test_telebot.py @@ -175,10 +175,10 @@ def test_send_video(self): assert ret_msg.message_id def test_send_video_dis_noti(self): - file_data = open('./test_data/test_video.mp4', 'rb') - tb = telebot.TeleBot(TOKEN) - ret_msg = tb.send_video(CHAT_ID, file_data, disable_notification=True) - assert ret_msg.message_id + with open('./test_data/test_video.mp4', 'rb') as file_data: + tb = telebot.TeleBot(TOKEN) + ret_msg = tb.send_video(CHAT_ID, file_data, disable_notification=True) + assert ret_msg.message_id def test_send_video_more_params(self): file_data = open('./test_data/test_video.mp4', 'rb')