Skip to content

Commit

Permalink
✨ feat(tests): add test_function.py with test cases for subtitle_utils
Browse files Browse the repository at this point in the history
The commit adds a new file, test_function.py, which contains test cases for the functions in the subtitle_utils module. The tests include checking the show list and the srt2ass method.
  • Loading branch information
sudoskys committed Jan 18, 2024
1 parent 25975db commit 8f2d157
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 164 deletions.
164 changes: 0 additions & 164 deletions subtitle_utils/__init__.py

This file was deleted.

21 changes: 21 additions & 0 deletions tests/test_function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from subtitle_utils import show_available, get_method


def get_test_subtitle(pre, aft):
with open(f"test.{pre}", "r") as f:
pre_content = f.read()
with open(f"test.{aft}", "r") as f:
aft_content = f.read()
return pre_content, aft_content


def test_show_available():
assert isinstance(show_available()[0], str), "Error Checking show list"


def test_srt2ass():
with open("test.bcc", "r") as f:
bcc_exp = f.read()
with open("test.srt", 'r') as file_io:
test_result = get_method(method="srt2ass")(content=file_io)
assert test_result == bcc_exp, f"Error Checking srt2ass \n{test_result}"

0 comments on commit 8f2d157

Please sign in to comment.