Files
procyon/deploy/test_pdf.py
2026-10-06 23:43:21 -07:00

25 lines
1.1 KiB
Python

import re
import db, tailor, resume_pdf
db.init_db()
db.set_setting('llm_timeout', '5') # force fallback so test is fast
import llm; llm.COOLDOWN = 5
for title, desc, track_expect in [
("DevOps Engineer", "Linux Docker Python Proxmox automation networking infrastructure", 'tech'),
("Head Grower", "hydroponic cultivation IPM greenhouse plant nutrition", 'hydro'),
("Delivery Driver", "route fleet logistics warehouse forklift", 'driving'),
]:
job = {"title": title, "company": "TestCo", "description": desc}
track = tailor.classify_track(job)
structured = tailor.structured_resume(job)
text = tailor.structured_to_text(structured)
pdf_path = resume_pdf.render(structured, out_path=f"/opt/procyon/data/resumes/test_{track}.pdf")
raw = open(pdf_path, 'rb').read()
m = re.search(rb'/Count (\d+)', raw)
pages = int(m.group(1)) if m else -1
print(f"[{track}] title={title!r} -> pages={pages}, skills={len(structured['skills'])}, "
f"exp={len(structured.get('experience',[]))}, projects={'projects' in structured}, "
f"pdf={len(raw)} bytes")
print("PDF_TEST_DONE")