1import sys, json, pathlib2sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1] / "src"))3import pytest, pymupdf45@pytest.fixture6def synthetic_pdf(tmp_path):7 """A small synthetic 'article' PDF (NOT a corpus document) laid out like the JoF template."""8 doc = pymupdf.open(); p = doc.new_page(width=486, height=720)9 p.insert_text((65, 46), "THE JOURNAL OF FINANCE • VOL. XCIX, NO. 1 • JANUARY 2099", fontsize=6)10 p.insert_text((129, 95), "A Synthetic Test Article", fontsize=13.9, fontname="hebo")11 p.insert_text((182, 124), "JANE DOE", fontsize=9)12 p.insert_text((218, 152), "ABSTRACT", fontsize=9, fontname="hebo")13 y = 16714 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."]:15 p.insert_text((89, y), line, fontsize=8); y += 1016 y = 29217 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."]:18 p.insert_text((65, y), line, fontsize=10); y += 1219 p.insert_text((142, 400), "I. Data and Methods", fontsize=10, fontname="hebo")20 p.insert_text((65, 420), "We use 1,234 observations from 2090 to 2095.", fontsize=10)21 p.insert_text((200, 440), "y = a + b x", fontsize=10, fontname="heit"); p.insert_text((408, 440), "(1)", fontsize=10)22 p.insert_text((226, 470), "Table I", fontsize=8, fontname="hebo"); p.insert_text((133, 482), "Summary Statistics", fontsize=10, fontname="hebo")23 p.insert_text((65, 495), "This table reports means. Standard errors are clustered by firm.", fontsize=8)24 p.insert_text((174, 530), "II. Conclusion", fontsize=10, fontname="hebo"); p.insert_text((65, 550), "We conclude that fixtures work.", fontsize=10)25 p.insert_text((207, 580), "REFERENCES", fontsize=10, fontname="hebo")26 p.insert_text((65, 596), "Doe, Jane, 2098, A prior paper, Journal of Finance 1, 1-2.", fontsize=8)27 p.insert_text((65, 606), "Roe, Richard, 2097, Another paper, Journal of Finance 2, 3-4.", fontsize=8)28 p.insert_text((65, 640), "DOI: 10.1111/jofi.99999", fontsize=8)29 out = tmp_path / "synthetic.pdf"; doc.save(out); doc.close(); return out3031@pytest.fixture32def synthetic_manuscript(tmp_path):33 d = tmp_path / "paper"; (d / "sections").mkdir(parents=True)34 (d / "main.tex").write_text(r"""\documentclass{article}\usepackage{natbib}35\newcommand{\WPtitle}{A Synthetic Manuscript}\newcommand{\WPabstract}{We estimate an effect of 3.2 percent using 1,000 firms.}36\begin{document}\input{sections/intro}\input{sections/results}37\begin{table}\caption{Main results}\label{tab:main}\begin{tabular}{lr}Effect & 3.2 \\ N & 1000\end{tabular}\end{table}38\begin{equation}\label{eq:main} y = \alpha + \beta x \end{equation}39\bibliography{references}\end{document}""")40 (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}.")41 (d / "sections" / "results.tex").write_text(r"\section{Results} The effect is 3.2 percent with 1,000 firms. Missing cite \citet{nothere2099}.")42 (d / "references.bib").write_text("@article{doe2098, title={A prior paper}, author={Doe, Jane}, year={2098}, journal={J}, doi={10.1111/jofi.12589}}\n")43 return d44