A comprehensive Python library for programmatically creating and manipulating Markdown files with support for headers, tables, lists, images, links, and text formatting.
80
Build a Python module that generates a simple project status report in Markdown format.
Create a module that provides a function generate_report(project_name, status, findings) which:
{project_name}_report.md (where {project_name} is the project name with spaces replaced by underscores and converted to lowercase)The function should also provide a way to preview the report content without creating a file by implementing preview_report(project_name, status, findings) which returns the markdown content as a string.
@test
# test_report_generator.py
from report_generator import generate_report
import os
def test_basic_report_generation():
"""Test that a report file is created with correct content"""
project = "Test Project"
status = "On Track"
findings = ["All tests passing", "Code coverage above 80%", "No critical bugs"]
filepath = generate_report(project, status, findings)
# Verify file was created
assert os.path.exists(filepath)
assert filepath == "test_project_report.md"
# Verify content structure
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
assert "Test Project" in content
assert "Status" in content
assert "On Track" in content
assert "Key Findings" in content
assert "- All tests passing" in content
assert "- Code coverage above 80%" in content
assert "- No critical bugs" in content
# Cleanup
os.remove(filepath)@test
# test_report_generator.py
from report_generator import preview_report
def test_report_preview():
"""Test that preview returns markdown content without creating file"""
project = "Preview Test"
status = "Delayed"
findings = ["Resource constraints", "Pending approvals"]
content = preview_report(project, status, findings)
# Verify content is a string with expected elements
assert isinstance(content, str)
assert "Preview Test" in content
assert "Status" in content
assert "Delayed" in content
assert "Key Findings" in content
assert "- Resource constraints" in content
assert "- Pending approvals" in content@generates
def generate_report(project_name: str, status: str, findings: list[str]) -> str:
"""
Generate a project status report as a Markdown file.
Args:
project_name: The name of the project
status: The current status of the project
findings: A list of key findings to include
Returns:
The filepath of the created Markdown file
"""
pass
def preview_report(project_name: str, status: str, findings: list[str]) -> str:
"""
Preview a project status report without creating a file.
Args:
project_name: The name of the project
status: The current status of the project
findings: A list of key findings to include
Returns:
The markdown content as a string
"""
passProvides markdown file generation support.
Install with Tessl CLI
npx tessl i tessl/pypi-mdutilsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10