# tests/test_pdf_generation.py """Test PDF generation from Markdown input (markdown-pdf).""" from pathlib import Path from tools.pdf import markdown_to_pdf _DIR = Path(__file__).resolve().parent MD_INPUT_PATH = _DIR / "ai_synthesis_response.md" PDF_OUTPUT_PATH = _DIR / "ai_synthesis_response.pdf" def test_generates_pdf_from_markdown_locally(): """Generate a PDF from markdown input and verify it is written locally.""" md_input = MD_INPUT_PATH.read_text(encoding="utf-8") buffer = markdown_to_pdf(md_input) PDF_OUTPUT_PATH.write_bytes(buffer.getvalue()) assert PDF_OUTPUT_PATH.exists() assert PDF_OUTPUT_PATH.stat().st_size > 0 assert PDF_OUTPUT_PATH.read_bytes()[:4] == b"%PDF"