From 2b76cf6a104c8a4da39553c975ad1a411b71213a Mon Sep 17 00:00:00 2001 From: bit4bit Date: Thu, 4 Nov 2021 00:30:18 +0000 Subject: [PATCH] se adiciona NIE069 y NIE070 FossilOrigin-Name: e907e9c9bd118f8a86ca5a27ce283b2d5a4fedcf55f8a850b588480cbf793a79 --- facho/facho.py | 1 + facho/fe/__init__.py | 1 + tests/test_nomina.py | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/test_nomina.py diff --git a/facho/facho.py b/facho/facho.py index 649dc0e..5035050 100644 --- a/facho/facho.py +++ b/facho/facho.py @@ -275,6 +275,7 @@ class FachoXML: """ xpath = self._path_xpath_for(xpath) elem = self.get_element(xpath) + for k, v in attrs.items(): self.builder.set_attribute(elem, k, v) return self diff --git a/facho/fe/__init__.py b/facho/fe/__init__.py index 072d3c3..11adce3 100644 --- a/facho/fe/__init__.py +++ b/facho/fe/__init__.py @@ -12,3 +12,4 @@ from .fe import DianZIP from .fe import AMBIENTE_PRUEBAS from .fe import AMBIENTE_PRODUCCION from . import form_xml +from . import nomina diff --git a/tests/test_nomina.py b/tests/test_nomina.py new file mode 100644 index 0000000..1aef5ac --- /dev/null +++ b/tests/test_nomina.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# This file is part of facho. The COPYRIGHT file at the top level of +# this repository contains the full copyright notices and license terms. + +"""Tests for `facho` package.""" + +import pytest + +from facho import fe + +def test_adicionar_devengado_Basico(): + nomina = fe.nomina.DIANNominaIndividual() + + nomina.adicionar_devengado(fe.nomina.DevengadoBasico( + dias_trabajados = 30, + sueldo_trabajado = fe.nomina.Amount(1_000_000) + )) + + xml = nomina.toFachoXML() + assert xml.get_element_attribute('/fe:NominaIndividual/Devengados/Basico', 'DiasTrabajados') == '30' + assert xml.get_element_attribute('/fe:NominaIndividual/Devengados/Basico', 'SueldoTrabajado') == '1000000.0'