Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions tests/utils/test_subtitle_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,29 @@ def test_clean_vtt_removes_metadata_and_timestamps():
"""
result = SubtitleProcessor.clean_vtt(vtt_content)
assert result == "Hello Hello world"

def test_format_as_markdown_edge_cases():
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test appears to be the normal/happy-path case (metadata fully populated) rather than an edge case. Renaming it to something like test_format_as_markdown_with_metadata would make the intent clearer and help future readers quickly find true edge-case coverage.

Suggested change
def test_format_as_markdown_edge_cases():
def test_format_as_markdown_with_metadata():

Copilot uses AI. Check for mistakes.
text = "Sentence one. Sentence two! Sentence three? Sentence four."
metadata = {
"title": "Test Video",
"channel": "Test Channel",
"url": "https://example.com/video",
"date": "2023-01-01"
}

md = SubtitleProcessor.format_as_markdown(text, metadata)
assert "Test Video" in md
assert "Test Channel" in md
assert "https://example.com/video" in md
assert "2023-01-01" in md
assert "Sentence one. Sentence two! Sentence three? Sentence four." in md

def test_format_as_markdown_missing_metadata():
text = "Just some text."
metadata = {}

md = SubtitleProcessor.format_as_markdown(text, metadata)
assert "Unknown Title" in md
assert "Unknown Channel" in md
assert "**Source:** \n" in md
assert "**Date:** \n" in md
Comment on lines +41 to +42
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These assertions are fairly brittle because they depend on an exact newline/whitespace sequence. If format_as_markdown changes formatting slightly (extra spaces, \\r\\n, additional text after the label), the test will fail despite correct behavior. Prefer asserting on the presence/structure more flexibly (e.g., checking that the labels exist, or normalizing line endings/whitespace before asserting, or using a regex that allows optional whitespace).

Suggested change
assert "**Source:** \n" in md
assert "**Date:** \n" in md
assert "**Source:**" in md
assert "**Date:**" in md

Copilot uses AI. Check for mistakes.
Loading