|
| 1 | +import os |
| 2 | +import pytest |
| 3 | +from docx import Document |
| 4 | +# from src.markdown_to_word_converter import markdown_to_word |
| 5 | + |
| 6 | +def test_dummy(): |
| 7 | + pass |
| 8 | +# |
| 9 | +# @pytest.fixture |
| 10 | +# def temp_files(tmp_path): |
| 11 | +# # Create a temporary Markdown file |
| 12 | +# markdown_file = tmp_path / "test.md" |
| 13 | +# markdown_file.write_text( |
| 14 | +# "# Heading 1\n\n## Heading 2\n\nThis is **bold** text and *italic* text.\n\n- Item 1\n- Item 2\n\n1. Item A\n2. Item B") |
| 15 | +# |
| 16 | +# # Define a path for the Word file |
| 17 | +# word_file = tmp_path / "test.docx" |
| 18 | +# return str(markdown_file), str(word_file) |
| 19 | +# |
| 20 | +# |
| 21 | +# def test_markdown_to_word(temp_files): |
| 22 | +# markdown_file, word_file = temp_files |
| 23 | +# |
| 24 | +# # Run the function to convert Markdown to Word |
| 25 | +# markdown_to_word(markdown_file, word_file) |
| 26 | +# |
| 27 | +# # Assert the Word file was created |
| 28 | +# assert os.path.exists(word_file), "Word file was not created." |
| 29 | +# |
| 30 | +# # Validate the content of the Word document |
| 31 | +# doc = Document(word_file) |
| 32 | +# paragraphs = [p.text for p in doc.paragraphs] |
| 33 | +# |
| 34 | +# # Check for headings and text |
| 35 | +# assert "Heading 1" in paragraphs, "Heading 1 is missing in the Word document." |
| 36 | +# assert "Heading 2" in paragraphs, "Heading 2 is missing in the Word document." |
| 37 | +# assert "This is bold text and italic text." in paragraphs, "Paragraph text is missing or incorrect." |
| 38 | +# |
| 39 | +# # Validate list items |
| 40 | +# list_items = [p.text for p in doc.paragraphs if p.style.name.startswith("List")] |
| 41 | +# assert "Item 1" in list_items, "List bullet item 'Item 1' is missing." |
| 42 | +# assert "Item 2" in list_items, "List bullet item 'Item 2' is missing." |
| 43 | +# assert "Item A" in list_items, "List numbered item 'Item A' is missing." |
| 44 | +# assert "Item B" in list_items, "List numbered item 'Item B' is missing." |
0 commit comments