CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-mdutils

A comprehensive Python library for programmatically creating and manipulating Markdown files with support for headers, tables, lists, images, links, and text formatting.

80

1.90x
Overview
Eval results
Files

task.mdevals/scenario-3/

Project Report Generator

Build a Python module that generates a simple project status report in Markdown format.

Requirements

Create a module that provides a function generate_report(project_name, status, findings) which:

  1. Creates a Markdown file named {project_name}_report.md (where {project_name} is the project name with spaces replaced by underscores and converted to lowercase)
  2. Includes a document title matching the project name
  3. Adds a "Status" section with the status text
  4. Adds a "Key Findings" section with the findings as an unordered list
  5. Returns the file path of the created report

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 Cases

Test Case 1: Basic Report Generation

@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 Case 2: Report Preview

@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

Implementation

@generates

API

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
    """
    pass

Dependencies { .dependencies }

mdutils { .dependency }

Provides markdown file generation support.

Install with Tessl CLI

npx tessl i tessl/pypi-mdutils

tile.json