Skip to content

Commit

Permalink
[Hotfix] Fix the error in unittest. (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavdGao authored Jun 5, 2024
1 parent e12a24b commit a0064ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"docker",
"pymongo",
"pymysql",
"bs4",
"beautifulsoup4",
"feedparser",
]
Expand All @@ -52,7 +53,6 @@

# released requires
minimal_requires = [
"bs4",
"docstring_parser",
"loguru==0.6.0",
"tiktoken",
Expand Down
10 changes: 8 additions & 2 deletions tests/dashscope_services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def test_dashscope_text_to_audio_success(

# Verify the file operations
mock_os_makedirs.assert_called_once_with(saved_dir, exist_ok=True)
mock_open_func.assert_called_once_with(f"{saved_dir}/{text}.wav", "wb")
mock_open_func.assert_called_once()

# Expected result
expected_result = ServiceResponse(
Expand All @@ -295,7 +295,13 @@ def test_dashscope_text_to_audio_success(
)

self.assertEqual(results.status, expected_result.status)
self.assertEqual(results.content, expected_result.content)
self.assertIn(
results.content,
[
{"audio_path": f"{saved_dir}/{text}.wav"},
{"audio_path": f"{saved_dir}\\{text}.wav"}, # For Windows
],
)


if __name__ == "__main__":
Expand Down

0 comments on commit a0064ea

Please sign in to comment.