Bopytex/test/test_tasks.py

42 lines
1.1 KiB
Python
Raw Normal View History

2022-04-09 04:58:44 +00:00
from bopytex.tasks import activate_corr_on, clean, compile_pdf, generate, join_pdfs
2022-04-08 17:34:38 +00:00
def test_build_task_generate():
template = "tpl_source.tex"
2022-04-09 04:32:56 +00:00
task = generate(template, {"subject": "01"}, output="source.tex")
2022-04-08 17:34:38 +00:00
assert task.action == "GENERATE"
assert task.args == {"subject": "01"}
assert task.deps == [template]
def test_build_task_activate_corr_on():
src = "source.tex"
task = activate_corr_on(src, meta={}, output="corr_source.tex")
2022-04-08 17:34:38 +00:00
assert task.action == "ACTIVATE_CORR"
assert task.args == {}
assert task.deps == [src]
def test_build_task_compile():
src = "source.tex"
2022-04-09 04:32:56 +00:00
task = compile_pdf(src, output="source.pdf")
2022-04-08 17:34:38 +00:00
assert task.action == "COMPILE"
assert task.args == {}
assert task.deps == [src]
def test_build_task_join():
pdfs = [f"{i}_source.pdf" for i in range(3)]
2022-04-09 04:32:56 +00:00
task = join_pdfs(pdfs, output="joined.pdf")
2022-04-08 17:34:38 +00:00
assert task.action == "JOIN"
assert task.args == {}
assert task.deps == pdfs
2022-04-09 04:32:56 +00:00
def test_build_task_clean():
2022-04-08 17:34:38 +00:00
files = ["source.aux", "source.log"]
task = clean(files)
assert task.action == "CLEAN"
assert task.args == {}
assert task.deps == files