Feat: code planners and tests
This commit is contained in:
0
test/__init__.py
Normal file
0
test/__init__.py
Normal file
46
test/test_planner.py
Normal file
46
test/test_planner.py
Normal file
@@ -0,0 +1,46 @@
|
||||
from bopytex.planner import activate_corr_on, clean, compile_pdf, generate, join_pdfs
|
||||
|
||||
|
||||
def test_build_task_generate():
|
||||
template = "tpl_source.tex"
|
||||
task = generate(template, {"subject": "01"})
|
||||
assert task.action == "GENERATE"
|
||||
assert task.args == {"subject": "01"}
|
||||
assert task.deps == [template]
|
||||
assert task.output == "01_source.tex"
|
||||
|
||||
|
||||
def test_build_task_activate_corr_on():
|
||||
src = "source.tex"
|
||||
task = activate_corr_on(src)
|
||||
assert task.action == "ACTIVATE_CORR"
|
||||
assert task.args == {}
|
||||
assert task.deps == [src]
|
||||
assert task.output == "corr_source.tex"
|
||||
|
||||
|
||||
def test_build_task_compile():
|
||||
src = "source.tex"
|
||||
task = compile_pdf(src)
|
||||
assert task.action == "COMPILE"
|
||||
assert task.args == {}
|
||||
assert task.deps == [src]
|
||||
assert task.output == "source.pdf"
|
||||
|
||||
|
||||
def test_build_task_join():
|
||||
pdfs = [f"{i}_source.pdf" for i in range(3)]
|
||||
task = join_pdfs(pdfs)
|
||||
assert task.action == "JOIN"
|
||||
assert task.args == {}
|
||||
assert task.deps == pdfs
|
||||
assert task.output == "joined.pdf"
|
||||
|
||||
|
||||
def test_build_task_compile():
|
||||
files = ["source.aux", "source.log"]
|
||||
task = clean(files)
|
||||
assert task.action == "CLEAN"
|
||||
assert task.args == {}
|
||||
assert task.deps == files
|
||||
assert task.output is None
|
||||
Reference in New Issue
Block a user