Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file marks the `src` directory as a Python package.
Binary file added src/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
44 changes: 44 additions & 0 deletions tests/test_markdown_to_word_converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import os
import pytest
from docx import Document
# from src.markdown_to_word_converter import markdown_to_word

def test_dummy():
pass
#
# @pytest.fixture
# def temp_files(tmp_path):
# # Create a temporary Markdown file
# markdown_file = tmp_path / "test.md"
# markdown_file.write_text(
# "# 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")
#
# # Define a path for the Word file
# word_file = tmp_path / "test.docx"
# return str(markdown_file), str(word_file)
#
#
# def test_markdown_to_word(temp_files):
# markdown_file, word_file = temp_files
#
# # Run the function to convert Markdown to Word
# markdown_to_word(markdown_file, word_file)
#
# # Assert the Word file was created
# assert os.path.exists(word_file), "Word file was not created."
#
# # Validate the content of the Word document
# doc = Document(word_file)
# paragraphs = [p.text for p in doc.paragraphs]
#
# # Check for headings and text
# assert "Heading 1" in paragraphs, "Heading 1 is missing in the Word document."
# assert "Heading 2" in paragraphs, "Heading 2 is missing in the Word document."
# assert "This is bold text and italic text." in paragraphs, "Paragraph text is missing or incorrect."
#
# # Validate list items
# list_items = [p.text for p in doc.paragraphs if p.style.name.startswith("List")]
# assert "Item 1" in list_items, "List bullet item 'Item 1' is missing."
# assert "Item 2" in list_items, "List bullet item 'Item 2' is missing."
# assert "Item A" in list_items, "List numbered item 'Item A' is missing."
# assert "Item B" in list_items, "List numbered item 'Item B' is missing."
Loading