-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement fix_subtitles_path function and add tests
- Loading branch information
Showing
2 changed files
with
38 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" | ||
Tests transcribe_anything | ||
""" | ||
|
||
import os | ||
import platform | ||
import unittest | ||
|
||
from transcribe_anything.api import fix_subtitles_path | ||
|
||
HERE = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
_IS_WINDOWS = platform.system() == "Windows" | ||
|
||
|
||
class FixSubtitlesTester(unittest.TestCase): | ||
"""Tester for transcribe anything.""" | ||
|
||
@unittest.skipIf(not _IS_WINDOWS, "Test only works on Windows") | ||
def test_local_file(self) -> None: | ||
"""Check that the command works on a local file.""" | ||
path = r"C:\Users\Toshiba\Pictures\test vcp\shopi.mp4" | ||
fixed_path = fix_subtitles_path(path) | ||
expected_path = r"C\\:/\Users/\Toshiba/\Pictures/\test vcp/\shopi.mp4" | ||
self.assertEqual(fixed_path, expected_path) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |