from pathlib import Path
import textwrap


def out_dir(tmpdir):
    """Construct some fake PythonTeX .out files."""
    (Path(tmpdir) / "py_basic_default.out").open("w").write(
        textwrap.dedent(
            r"""
            =>PYTHONTEX:STDOUT#0CC#code#
            =>PYTHONTEX:STDOUT#0#i#
            \input{pythontex-files-example/test-5.40x5.40.pgf}
            =>PYTHONTEX:STDOUT#1#i#
            \input{pythontex-files-example/test-2.43x1.50.pgf}
            =>PYTHONTEX:STDOUT#2#i#
            \input{pythontex-files-example/test-2.43x2.43.pgf}
            =>PYTHONTEX:DEPENDENCIES#
            /Users/Matthew/Code/Uni/latex-python-figures/pythontexfigures/pythontexfigures.py
            scripts/test.py
            scripts/test.py
            scripts/test.py
            =>PYTHONTEX:CREATED#
            pythontex-files-example/test-5.40x5.40.pgf
            pythontex-files-example/test-2.43x1.50.pgf
            pythontex-files-example/test-2.43x2.43.pgf
            """
        )
    )
    (Path(tmpdir) / "py_subfiles_default.out").open("w").write(
        textwrap.dedent(
            r"""
            =>PYTHONTEX:STDOUT#0CC#code#
            =>PYTHONTEX:STDOUT#0#i#
            \input{pythontex-files-example-with-subfiles/poynomial-2-0-0-5.40x5.40.pgf}
            =>PYTHONTEX:STDOUT#1#i#
            \input{pythontex-files-example-with-subfiles/poynomial-2-0-0-0-5.40x5.40.pgf}
            =>PYTHONTEX:DEPENDENCIES#
            /Users/Matthew/Code/Uni/latex-python-figures/pythontexfigures/pythontexfigures.py
            scripts/polynomial.py
            scripts/polynomial.py
            =>PYTHONTEX:CREATED#
            pythontex-files-example-with-subfiles/poynomial-2-0-0-5.40x5.40.pgf
            pythontex-files-example-with-subfiles/poynomial-2-0-0-0-5.40x5.40.pgf
            """
        )
    )
    return tmpdir