Skip to content

Commit a35cd2b

Browse files
committed
style: formatted with black .
1 parent a5b2ebf commit a35cd2b

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

Backend/note_generator/transcript_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ def get_transcript_with_diagnostics(
149149
error = NoTranscriptError()
150150
elif "yt-dlp failed" in error_str or "youtube" in error_str:
151151
# Audio download failed (likely YouTube blocking or video unavailable)
152-
error = YouTubeBlockedError("YouTube download failed - video may be restricted")
152+
error = YouTubeBlockedError(
153+
"YouTube download failed - video may be restricted"
154+
)
153155
else:
154156
# Generic error - still report as YouTube blocked since we can't fetch
155157
error = YouTubeBlockedError("Failed to fetch video")

tests/test_transcript_fail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def setUp(self):
2121
def test_transcript_missing_returns_502(self, _gen, _title, _transcript_diag):
2222
# Mock the function to return None transcript with error
2323
_transcript_diag.return_value = (None, NoTranscriptError())
24-
24+
2525
url = reverse("generate-notes")
2626
resp = self.client.post(
2727
url,

tests/test_transcript_reliability.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def setUp(self):
8585
self.client.login(username="testuser", password="testpass123")
8686
# Clear cache before each test to avoid interference
8787
from django.core.cache import cache
88+
8889
cache.clear()
8990

9091
def test_missing_youtube_link(self):
@@ -109,11 +110,16 @@ def test_invalid_url_format(self):
109110

110111
@patch("note_generator.transcript_utils.get_transcript_with_diagnostics")
111112
@patch("note_generator.views.yt_title")
112-
def test_transcript_fetch_403_blocked(self, mock_yt_title, mock_get_transcript_diag):
113+
def test_transcript_fetch_403_blocked(
114+
self, mock_yt_title, mock_get_transcript_diag
115+
):
113116
"""Simulate YouTube blocking with HTTP 403."""
114117
mock_yt_title.return_value = "Test Video"
115118
# Mock the diagnostics function to return error
116-
mock_get_transcript_diag.return_value = (None, YouTubeBlockedError("HTTP 403 Forbidden"))
119+
mock_get_transcript_diag.return_value = (
120+
None,
121+
YouTubeBlockedError("HTTP 403 Forbidden"),
122+
)
117123

118124
response = self.client.post(
119125
"/generate-notes",
@@ -133,7 +139,10 @@ def test_transcript_fetch_429_rate_limited(
133139
):
134140
"""Simulate rate limiting with HTTP 429."""
135141
mock_yt_title.return_value = "Test Video"
136-
mock_get_transcript_diag.return_value = (None, YouTubeBlockedError("HTTP 429 Too Many Requests"))
142+
mock_get_transcript_diag.return_value = (
143+
None,
144+
YouTubeBlockedError("HTTP 429 Too Many Requests"),
145+
)
137146

138147
response = self.client.post(
139148
"/generate-notes",

0 commit comments

Comments
 (0)