Skip to content

Commit 160cecd

Browse files
committed
add docstrings
1 parent b1d2fdf commit 160cecd

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

tests/commands/test_video_transcription.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55

66
def test_video_transcription(mocker, videos_ids, videos_urls, tmp_path):
7+
"""
8+
Test the video transcription command.
9+
10+
This test verifies the functionality of the VideoTranscription.execute method.
11+
It mocks the YouTube API to simulate fetching transcriptions for given video IDs or URLs.
12+
Transcriptions are expected to be saved in VTT format in the specified temporary directory.
13+
"""
714
youtube_mock = mocker.patch("youtool.commands.video_transcription.YouTube")
815

916
language_code = "pt_br"
@@ -27,6 +34,13 @@ def test_video_transcription(mocker, videos_ids, videos_urls, tmp_path):
2734

2835

2936
def test_video_transcription_input_from_file(mocker, videos_ids, tmp_path):
37+
"""Test the video transcription command with input from a CSV file.
38+
39+
This test verifies the functionality of the VideoTranscription.execute method when
40+
video IDs are provided via a CSV file. It mocks the YouTube API to simulate fetching
41+
transcriptions for the listed video IDs. Transcriptions are expected to be saved in
42+
VTT format in the specified temporary directory.
43+
"""
3044
youtube_mock = mocker.patch("youtool.commands.video_transcription.YouTube")
3145

3246
language_code = "pt_br"

youtool/commands/video_transcription.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@ class VideoTranscription(Command):
2525

2626
@classmethod
2727
def execute(cls, **kwargs) -> str:
28-
"""
29-
Execute the video-transcription command to download transcriptions of videos based on IDs or URLs and save them to files.
28+
"""Execute the video-transcription command to download transcriptions of videos based on IDs or URLs and save them to files.
3029
3130
Args:
32-
ids: A list of YouTube video IDs.
33-
urls: A list of YouTube video URLs.
34-
input_file_path: Path to a CSV file containing YouTube video IDs or URLs.
35-
output_dir: Directory path to save the transcription files.
36-
language_code: Language code for the transcription language.
37-
api_key: The API key to authenticate with the YouTube Data API.
31+
ids (List[str]): A list of YouTube video IDs.
32+
urls (List[str]): A list of YouTube video URLs.
33+
input_file_path (str): Path to a CSV file containing YouTube video IDs or URLs.
34+
output_dir (str): Directory path to save the transcription files.
35+
language_code (str): Language code for the transcription language.
36+
api_key (str): The API key to authenticate with the YouTube Data API.
37+
url_column_name (str, optional): Column name for URLs in the CSV input file. Defaults to "video_url".
38+
id_column_name (str, optional): Column name for IDs in the CSV output file. Defaults to "video_id".
3839
3940
Returns:
40-
A message indicating the result of the command. Reports success or failure for each video transcription download.
41+
str: A message indicating the result of the command. Reports success or failure for each video transcription download.
4142
"""
4243
ids = kwargs.get("ids") or []
4344
urls = kwargs.get("urls") or []

0 commit comments

Comments
 (0)