Skip to content

Commit

Permalink
Add tests for CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
TDHM committed May 16, 2023
1 parent 9ec297f commit 8906bad
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from __future__ import annotations

import subprocess as sp


def test_translate_subtitles_cli():
sp.run(
[
"python",
"subtitles_translator/cli.py",
"-i",
"tests/test_cli.srt",
"-o",
"tests/test_translated.srt",
"-s",
"en",
"-t",
"fr",
]
)
with open("tests/test_translated.srt", encoding="utf-8") as file:
content = file.read().splitlines()
assert content[2] == "Bonjour le monde!"
4 changes: 4 additions & 0 deletions tests/test_cli.srt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1
00:00:00,498 --> 00:00:02,827
Hello world!

0 comments on commit 8906bad

Please sign in to comment.