"""Tests para pdf_create.""" import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__))) sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "python", "types", "infra")) from pdf_create import pdf_create from pdf_doc import PDFDoc def test_crear_documento_con_titulo_y_autor(): doc = pdf_create(title="Test Title", author="Test Author") assert isinstance(doc, PDFDoc) assert doc.title == "Test Title" assert doc.author == "Test Author" assert doc.fpdf is not None def test_margenes_personalizados_aplicados(): doc = pdf_create(margin_left=15.0, margin_right=15.0, margin_top=25.0, margin_bottom=25.0) assert doc.margin_left == 15.0 assert doc.margin_right == 15.0 assert doc.margin_top == 25.0 assert doc.margin_bottom == 25.0 # Verificar que fpdf tiene los margenes aplicados assert abs(doc.fpdf.l_margin - 15.0) < 0.1 assert abs(doc.fpdf.r_margin - 15.0) < 0.1