import pytest import os import tempfile import xml.etree.ElementTree as ET FACTURA_XML = ''' F001-00005103 01 20549758054 IGV ''' CREDIT_NOTE_XML = ''' B001-00001234 07 20123456789 ''' CDR_XML = ''' R-2025-00000123 20549758054 ''' RECIBO_XML = ''' R001-00000456 02 10456789012 RET 4TA ''' @pytest.fixture def temp_dir(): with tempfile.TemporaryDirectory() as tmpdir: yield tmpdir @pytest.fixture def factura_xml_path(temp_dir): path = os.path.join(temp_dir, "F001-00005103.xml") with open(path, "w", encoding="utf-8") as f: f.write(FACTURA_XML) return path @pytest.fixture def credito_xml_path(temp_dir): path = os.path.join(temp_dir, "B001-00001234.xml") with open(path, "w", encoding="utf-8") as f: f.write(CREDIT_NOTE_XML) return path @pytest.fixture def cdr_xml_path(temp_dir): path = os.path.join(temp_dir, "R-2025-00000123.xml") with open(path, "w", encoding="utf-8") as f: f.write(CDR_XML) return path @pytest.fixture def recibo_xml_path(temp_dir): path = os.path.join(temp_dir, "R001-00000456.xml") with open(path, "w", encoding="utf-8") as f: f.write(RECIBO_XML) return path