test(pdf_writer): added tests

This commit is contained in:
wakonig_k 2024-02-20 20:43:48 +01:00
parent fb7c84fcc6
commit f64bdea797
2 changed files with 22 additions and 1 deletions

View File

@ -70,7 +70,7 @@ class PDFWriter:
self._pdf.output(self.file, "F")
if __name__ == "__main__":
if __name__ == "__main__": # pragma: no cover
header = (
" \n" * 3
+ " ::: ::: ::: ::: :::: ::: ::::::::::: \n"

View File

@ -0,0 +1,21 @@
import os
from bec_lib.pdf_writer import PDFWriter
def test_pdf_writer():
with PDFWriter("test_output.pdf") as file:
file.write("Hello World")
assert os.path.exists("test_output.pdf")
os.remove("test_output.pdf")
def test_pdf_writer_with_title():
with PDFWriter("test_output.pdf", title="title") as file:
file.write("Hello World")
assert os.path.exists("test_output.pdf")
os.remove("test_output.pdf")