Spaces:
Running
Running
Download tests/test_converter_integration.py from u5ername/markdown2ppt-docker: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/u5ername/markdown2ppt-docker/resolve/main/tests/test_converter_integration.py
- Command line
-
hf download hf://spaces/u5ername/markdown2ppt-docker/tests/test_converter_integration.py
-
curl -L -o test_converter_integration.py https://huggingface.co/spaces/u5ername/markdown2ppt-docker/resolve/main/tests/test_converter_integration.py
1.26 kB
| import os | |
| import shutil | |
| import tempfile | |
| import unittest | |
| from services.converter import convert_markdown_to_ppt | |
| PROJECT_ROOT = os.path.dirname(os.path.dirname(__file__)) | |
| class ConverterIntegrationTests(unittest.TestCase): | |
| def test_markdown_upload_to_pptx_pdf_and_preview(self): | |
| with tempfile.NamedTemporaryFile("w", suffix=".md", encoding="utf-8", delete=False) as source: | |
| source.write("% 測試簡報\n\n# 第一頁\n\n- 項目一\n- 項目二\n") | |
| source_path = source.name | |
| output_pptx, output_pdf, preview, status = convert_markdown_to_ppt( | |
| source_path, | |
| None, | |
| "Upload Markdown File", | |
| os.path.join(PROJECT_ROOT, "template.pptx"), | |
| ) | |
| self.assertTrue(output_pptx and os.path.isfile(output_pptx), status) | |
| self.assertTrue(output_pdf and os.path.isfile(output_pdf), status) | |
| self.assertTrue(preview and all(os.path.isfile(item[0]) for item in preview), status) | |
| self.assertNotIn("Error:", status) | |
| if __name__ == "__main__": | |
| unittest.main() | |