Skip to content
Merged
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
24 changes: 23 additions & 1 deletion tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,29 @@
"""
import pandas as pd

from python_rap_demo.report import generate_markdown_report
from python_rap_demo.report import format_month_section, generate_markdown_report


def test_format_month_section():
# Define the variable month used in format_month_section
month = "January"
# Create the dataframe month_df used in format_month_section
month_df = pd.DataFrame({
"diagnosis": ["A", "B"],
"case_count": [10, 20],
"total": [20, 50],
})
# Calculate the prevalence rate
month_df["prevalence_rate"] = month_df["case_count"] / month_df["total"]
# Define the expected output of format_month_section
expected_output = (
"## Month: January\n"
"- A: 50.00% (10 cases)\n"
"- B: 40.00% (20 cases)\n"
)
result = format_month_section(month, month_df)
# Check that the output from format_month_section matches the expected output
assert result.strip() == expected_output.strip()


def test_generate_markdown_report(tmp_path):
Expand Down