style(test_form_xml): Formateado PEP8
This commit is contained in:
		| @@ -6,13 +6,13 @@ | |||||||
| """Tests for `facho` package.""" | """Tests for `facho` package.""" | ||||||
|  |  | ||||||
| import pytest | import pytest | ||||||
| from datetime import datetime | # from datetime import datetime | ||||||
| import copy | import copy | ||||||
|  |  | ||||||
| from facho.fe import form | from facho.fe import form | ||||||
| from facho.fe import form_xml | from facho.fe import form_xml | ||||||
|  | # from fixtures import * | ||||||
|  |  | ||||||
| from fixtures import * |  | ||||||
|  |  | ||||||
| def test_import_DIANInvoiceXML(): | def test_import_DIANInvoiceXML(): | ||||||
|     try: |     try: | ||||||
| @@ -27,12 +27,14 @@ def test_import_DIANDebitNoteXML(): | |||||||
|     except AttributeError: |     except AttributeError: | ||||||
|         pytest.fail("unexpected not found") |         pytest.fail("unexpected not found") | ||||||
|  |  | ||||||
|  |  | ||||||
| def test_import_DIANCreditNoteXML(): | def test_import_DIANCreditNoteXML(): | ||||||
|     try: |     try: | ||||||
|         form_xml.DIANCreditNoteXML |         form_xml.DIANCreditNoteXML | ||||||
|     except AttributeError: |     except AttributeError: | ||||||
|         pytest.fail("unexpected not found") |         pytest.fail("unexpected not found") | ||||||
|  |  | ||||||
|  |  | ||||||
| def test_allowance_charge_in_invoice(simple_invoice_without_lines): | def test_allowance_charge_in_invoice(simple_invoice_without_lines): | ||||||
|     inv = copy.copy(simple_invoice_without_lines) |     inv = copy.copy(simple_invoice_without_lines) | ||||||
|     inv.add_invoice_line(form.InvoiceLine( |     inv.add_invoice_line(form.InvoiceLine( | ||||||
| @@ -48,18 +50,22 @@ def test_allowance_charge_in_invoice(simple_invoice_without_lines): | |||||||
|             subtotals=[ |             subtotals=[ | ||||||
|                 form.TaxSubTotal( |                 form.TaxSubTotal( | ||||||
|                     percent=19.0, |                     percent=19.0, | ||||||
|                 ) |                 )] | ||||||
|             ] |  | ||||||
|         ) |         ) | ||||||
|     )) |     )) | ||||||
|  |  | ||||||
|     inv.add_allowance_charge(form.AllowanceCharge(amount=form.Amount(19.0))) |     inv.add_allowance_charge(form.AllowanceCharge(amount=form.Amount(19.0))) | ||||||
|     inv.calculate() |     inv.calculate() | ||||||
|  |  | ||||||
|     xml = form_xml.DIANInvoiceXML(inv) |     xml = form_xml.DIANInvoiceXML(inv) | ||||||
|     assert xml.get_element_text('./cac:AllowanceCharge/cbc:ID') == '1' |     assert xml.get_element_text('./cac:AllowanceCharge/cbc:ID') == '1' | ||||||
|     assert xml.get_element_text('./cac:AllowanceCharge/cbc:ChargeIndicator') == 'true' |     assert xml.get_element_text( | ||||||
|     assert xml.get_element_text('./cac:AllowanceCharge/cbc:Amount') == '19.0' |         './cac:AllowanceCharge/cbc:ChargeIndicator') == 'true' | ||||||
|     assert xml.get_element_text('./cac:AllowanceCharge/cbc:BaseAmount') == '100.0' |     assert xml.get_element_text( | ||||||
|  |         './cac:AllowanceCharge/cbc:Amount') == '19.0' | ||||||
|  |     assert xml.get_element_text( | ||||||
|  |         './cac:AllowanceCharge/cbc:BaseAmount') == '100.0' | ||||||
|  |  | ||||||
|  |  | ||||||
| def test_allowance_charge_in_invoice_line(simple_invoice_without_lines): | def test_allowance_charge_in_invoice_line(simple_invoice_without_lines): | ||||||
|     inv = copy.copy(simple_invoice_without_lines) |     inv = copy.copy(simple_invoice_without_lines) | ||||||
| @@ -76,8 +82,7 @@ def test_allowance_charge_in_invoice_line(simple_invoice_without_lines): | |||||||
|             subtotals=[ |             subtotals=[ | ||||||
|                 form.TaxSubTotal( |                 form.TaxSubTotal( | ||||||
|                     percent=19.0, |                     percent=19.0, | ||||||
|                 ) |                 )] | ||||||
|             ] |  | ||||||
|         ), |         ), | ||||||
|         allowance_charge=[ |         allowance_charge=[ | ||||||
|             form.AllowanceChargeAsDiscount(amount=form.Amount(10.0)) |             form.AllowanceChargeAsDiscount(amount=form.Amount(10.0)) | ||||||
| @@ -86,11 +91,16 @@ def test_allowance_charge_in_invoice_line(simple_invoice_without_lines): | |||||||
|     inv.calculate() |     inv.calculate() | ||||||
|  |  | ||||||
|     # se aplico descuento |     # se aplico descuento | ||||||
|     assert inv.invoice_legal_monetary_total.line_extension_amount == form.Amount(90.0) |     assert inv.invoice_legal_monetary_total.line_extension_amount == ( | ||||||
|  |         form.Amount(90.0)) | ||||||
|  |  | ||||||
|     xml = form_xml.DIANInvoiceXML(inv) |     xml = form_xml.DIANInvoiceXML(inv) | ||||||
|  |  | ||||||
|     with pytest.raises(AttributeError): |     with pytest.raises(AttributeError): | ||||||
|         assert xml.get_element_text('/fe:Invoice/cac:AllowanceCharge/cbc:ID') == '1' |         assert xml.get_element_text( | ||||||
|     xml.get_element_text('/fe:Invoice/cac:InvoiceLine/cac:AllowanceCharge/cbc:ID') == '1' |             '/fe:Invoice/cac:AllowanceCharge/cbc:ID') == '1' | ||||||
|     xml.get_element_text('/fe:Invoice/cac:InvoiceLine/cac:AllowanceCharge/cbc:BaseAmount') == '100.0' |     xml.get_element_text( | ||||||
|  |         '/fe:Invoice/cac:InvoiceLine/cac:AllowanceCharge/cbc:ID') == '1' | ||||||
|  |     xml.get_element_text( | ||||||
|  |         '/fe:Invoice/cac:InvoiceLine/cac:AllowanceCharge/cbc:BaseAmount' | ||||||
|  |     ) == '100.0' | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user