import sys, json, pathlib sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1] / "src")) import pytest, pymupdf @pytest.fixture def synthetic_pdf(tmp_path): """A small synthetic 'article' PDF (NOT a corpus document) laid out like the JoF template.""" doc = pymupdf.open(); p = doc.new_page(width=486, height=720) p.insert_text((65, 46), "THE JOURNAL OF FINANCE • VOL. XCIX, NO. 1 • JANUARY 2099", fontsize=6) p.insert_text((129, 95), "A Synthetic Test Article", fontsize=13.9, fontname="hebo") p.insert_text((182, 124), "JANE DOE", fontsize=9) p.insert_text((218, 152), "ABSTRACT", fontsize=9, fontname="hebo") y = 167 for line in ["We test whether synthetic fixtures parse. We find that they do, with 12.5% higher", "accuracy and 20 basis points lower error. This matters for reproducibility."]: p.insert_text((89, y), line, fontsize=8); y += 10 y = 292 for line in ["SYNTHETIC DATA ARE USEFUL for testing parsers (Doe (2098)). This paper", "contributes a fixture. The remainder of the paper proceeds as follows."]: p.insert_text((65, y), line, fontsize=10); y += 12 p.insert_text((142, 400), "I. Data and Methods", fontsize=10, fontname="hebo") p.insert_text((65, 420), "We use 1,234 observations from 2090 to 2095.", fontsize=10) p.insert_text((200, 440), "y = a + b x", fontsize=10, fontname="heit"); p.insert_text((408, 440), "(1)", fontsize=10) p.insert_text((226, 470), "Table I", fontsize=8, fontname="hebo"); p.insert_text((133, 482), "Summary Statistics", fontsize=10, fontname="hebo") p.insert_text((65, 495), "This table reports means. Standard errors are clustered by firm.", fontsize=8) p.insert_text((174, 530), "II. Conclusion", fontsize=10, fontname="hebo"); p.insert_text((65, 550), "We conclude that fixtures work.", fontsize=10) p.insert_text((207, 580), "REFERENCES", fontsize=10, fontname="hebo") p.insert_text((65, 596), "Doe, Jane, 2098, A prior paper, Journal of Finance 1, 1-2.", fontsize=8) p.insert_text((65, 606), "Roe, Richard, 2097, Another paper, Journal of Finance 2, 3-4.", fontsize=8) p.insert_text((65, 640), "DOI: 10.1111/jofi.99999", fontsize=8) out = tmp_path / "synthetic.pdf"; doc.save(out); doc.close(); return out @pytest.fixture def synthetic_manuscript(tmp_path): d = tmp_path / "paper"; (d / "sections").mkdir(parents=True) (d / "main.tex").write_text(r"""\documentclass{article}\usepackage{natbib} \newcommand{\WPtitle}{A Synthetic Manuscript}\newcommand{\WPabstract}{We estimate an effect of 3.2 percent using 1,000 firms.} \begin{document}\input{sections/intro}\input{sections/results} \begin{table}\caption{Main results}\label{tab:main}\begin{tabular}{lr}Effect & 3.2 \\ N & 1000\end{tabular}\end{table} \begin{equation}\label{eq:main} y = \alpha + \beta x \end{equation} \bibliography{references}\end{document}""") (d / "sections" / "intro.tex").write_text(r"\section{Introduction} Prior work \citep{doe2098} studies this. We find an effect of 3.2 percent (Table \ref{tab:main}). Leverage causes default. See equation \eqref{eq:main}.") (d / "sections" / "results.tex").write_text(r"\section{Results} The effect is 3.2 percent with 1,000 firms. Missing cite \citet{nothere2099}.") (d / "references.bib").write_text("@article{doe2098, title={A prior paper}, author={Doe, Jane}, year={2098}, journal={J}, doi={10.1111/jofi.12589}}\n") return d