Skip to content

Commit 67f1734

Browse files
committed
test: add cascade-failure test for nicediff comparison
1 parent 66f057a commit 67f1734

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/test_test/test_diff.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,21 @@ def test_if_full_diff_download(self):
7979
obtained_tr_count = obtained_diff.count("</tr>")
8080

8181
self.assertGreater(obtained_tr_count, limit_tr_count)
82+
83+
def test_cascade_failure_missing_entry(self):
84+
"""Test cascade-failure when subtitle entries are missing."""
85+
expected_sub = [
86+
'1\n', '00:00:01,000 --> 00:00:02,000\n', 'First line\n',
87+
'2\n', '00:00:03,000 --> 00:00:04,000\n', 'Second line\n'
88+
]
89+
obtained_sub = [
90+
'1\n', '00:00:01,000 --> 00:00:02,000\n', 'First line\n',
91+
'3\n', '00:00:05,000 --> 00:00:06,000\n', 'Third line\n'
92+
]
93+
94+
diff_html = get_html_diff(expected_sub, obtained_sub)
95+
96+
self.assertIn('Third', diff_html)
97+
self.assertIn('Second', diff_html)
98+
self.assertIn('05', diff_html)
99+
self.assertIn('03', diff_html)

0 commit comments

Comments
 (0)