Skip to content

Commit 0e1d061

Browse files
authored
Merge pull request #12 from shloktech/shloktech-patch-3
Create python-package.yml
2 parents 5775768 + 5e71d13 commit 0e1d061

7 files changed

Lines changed: 88 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.9", "3.10", "3.11"]
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install flake8 pytest
31+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32+
- name: Lint with flake8
33+
run: |
34+
# stop the build if there are Python syntax errors or undefined names
35+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38+
- name: Test with pytest
39+
run: |
40+
pytest

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# This file marks the `src` directory as a Python package.
136 Bytes
Binary file not shown.
1.28 KB
Binary file not shown.
Binary file not shown.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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

Comments
 (0)