def test_install_latex_restore():
    HERE = pathlib.Path(__file__).resolve().parent
    TEMPLATES = HERE.parent / "handcalcs" / "templates"
    MAIN_TEMPLATE = TEMPLATES / "latex" / 't-makaro_classic_romanoutput_noinput.tplx'
    NBCONVERT_TEMPLATES_DIR = pathlib.Path(
        nbconvert.__file__).resolve().parent / "templates" / "latex"
    install_latex(restore=True)
    assert not filecmp.cmp(MAIN_TEMPLATE,
                           NBCONVERT_TEMPLATES_DIR / "article.tplx")
def test_install_latex(capsys):
    HERE = pathlib.Path(__file__).resolve().parent
    TEMPLATES = HERE.parent / "handcalcs" / "templates"
    MAIN_TEMPLATE = TEMPLATES / "latex" / 't-makaro_classic_romanoutput_noinput.tplx'
    NBCONVERT_TEMPLATES_DIR = pathlib.Path(
        nbconvert.__file__).resolve().parent / "templates" / "latex"

    install_latex()
    captured = capsys.readouterr()
    assert captured.out == "Available templates: \n ['t-makaro_classic_romanoutput_noinput.tplx']\n"
    install_latex(swap_in='t-makaro_classic_romanoutput_noinput.tplx')
    assert filecmp.cmp(MAIN_TEMPLATE, NBCONVERT_TEMPLATES_DIR / "article.tplx")