Skip to content

Commit 38072cf

Browse files
committed
TEST: validate tests
1 parent 2ebdf87 commit 38072cf

File tree

1 file changed

+190
-19
lines changed

1 file changed

+190
-19
lines changed

spec/serialization_spec.py

+190-19
Original file line numberDiff line numberDiff line change
@@ -929,22 +929,20 @@ def group_by_tax_rate(iva_values, in_invoice):
929929
['RegistroLRFacturasEmitidas']
930930
)
931931
with context('en los datos de abonadora'):
932-
with it('la FechaOperacion debe ser por factura original'):
933-
pass
934-
# expect(
935-
# self.fact_refund_emit['FacturaExpedida']['FechaOperacion']
936-
# ).to(equal('31-12-2016'))
932+
with it('la FechaOperacion NO debe ser informado'):
933+
expect(
934+
self.fact_refund_emit['FacturaExpedida'].get('FechaOperacion', False)
935+
).to(equal(False))
937936
with context('en los datos de rectificación'):
938937
with it('el TipoRectificativa debe ser por sustitución (S)'):
939938
expect(
940939
self.fact_rect_emit['FacturaExpedida']['TipoRectificativa']
941940
).to(equal('S'))
942941

943-
with it('la FechaOperacion debe ser por factura original'):
944-
pass
945-
# expect(
946-
# self.fact_rect_emit['FacturaExpedida']['FechaOperacion']
947-
# ).to(equal('31-12-2016'))
942+
with it('la FechaOperacion NO debe ser informado'):
943+
expect(
944+
self.fact_rect_emit['FacturaExpedida'].get('FechaOperacion', False)
945+
).to(equal(False))
948946

949947
with before.all:
950948
self.importe_rectificacion = (
@@ -992,6 +990,181 @@ def group_by_tax_rate(iva_values, in_invoice):
992990
self.out_refund.tax_line[0].tax_id.amount * 100
993991
))
994992

993+
with description('en los datos de una factura rectificativa emitida con IVA 5% fecha postrior vigencia'):
994+
with before.all:
995+
self.out_refund, self.out_b_inovice = self.data_gen.get_out_refund_invoice_iva5()
996+
self.out_refund_obj = SII(self.out_refund).generate_object()
997+
self.out_b_inovice_obj = SII(self.out_b_inovice).generate_object()
998+
self.fact_rect_emit = (
999+
self.out_refund_obj['SuministroLRFacturasEmitidas']
1000+
['RegistroLRFacturasEmitidas']
1001+
)
1002+
self.fact_refund_emit = (
1003+
self.out_b_inovice_obj['SuministroLRFacturasEmitidas']
1004+
['RegistroLRFacturasEmitidas']
1005+
)
1006+
with context('en los datos de abonadora'):
1007+
with it('la FechaOperacion debe ser por factura original'):
1008+
expect(
1009+
self.fact_refund_emit['FacturaExpedida']['FechaOperacion']
1010+
).to(equal('01-01-2023'))
1011+
with context('en los datos de rectificación'):
1012+
with it('el TipoRectificativa debe ser por sustitución (S)'):
1013+
expect(
1014+
self.fact_rect_emit['FacturaExpedida']['TipoRectificativa']
1015+
).to(equal('S'))
1016+
1017+
with it('la FechaOperacion debe ser por factura original'):
1018+
expect(
1019+
self.fact_rect_emit['FacturaExpedida']['FechaOperacion']
1020+
).to(equal('01-01-2023'))
1021+
1022+
with before.all:
1023+
self.importe_rectificacion = (
1024+
self.fact_rect_emit['FacturaExpedida']
1025+
['ImporteRectificacion']
1026+
)
1027+
1028+
with it('la BaseRectificada debe ser 0'):
1029+
expect(
1030+
self.importe_rectificacion['BaseRectificada']
1031+
).to(equal(0))
1032+
1033+
with it('la CuotaRectificada debe ser 0'):
1034+
expect(
1035+
self.importe_rectificacion['CuotaRectificada']
1036+
).to(equal(0))
1037+
1038+
with context('en los detalles del IVA'):
1039+
with before.all:
1040+
detalle_iva = (
1041+
self.fact_rect_emit['FacturaExpedida']['TipoDesglose']
1042+
['DesgloseFactura']['Sujeta']['NoExenta']['DesgloseIVA']
1043+
['DetalleIVA']
1044+
)
1045+
self.grouped_detalle_iva = group_by_tax_rate(
1046+
detalle_iva, in_invoice=False
1047+
)
1048+
1049+
with it('la BaseImponible debe ser la original'):
1050+
expect(
1051+
self.grouped_detalle_iva[5.0]['BaseImponible']
1052+
).to(equal(
1053+
self.out_refund.tax_line[0].base
1054+
))
1055+
with it('la CuotaRepercutida debe ser la original'):
1056+
expect(
1057+
self.grouped_detalle_iva[5.0]['CuotaRepercutida']
1058+
).to(equal(
1059+
-1 * abs(self.out_refund.tax_line[0].tax_amount)
1060+
))
1061+
with it('el TipoImpositivo debe ser la original'):
1062+
expect(
1063+
self.grouped_detalle_iva[5.0]['TipoImpositivo']
1064+
).to(equal(
1065+
self.out_refund.tax_line[0].tax_id.amount * 100
1066+
))
1067+
1068+
with description('en los datos de una factura rectificativa emitida con IVA 5% fecha en vigencia'):
1069+
with before.all:
1070+
self.out_refund, self.out_b_inovice = self.data_gen.get_out_refund_invoice_iva5(fecha_facturas_recti='2024-03-18')
1071+
self.out_refund_obj = SII(self.out_refund).generate_object()
1072+
self.out_b_inovice_obj = SII(self.out_b_inovice).generate_object()
1073+
self.fact_rect_emit = (
1074+
self.out_refund_obj['SuministroLRFacturasEmitidas']
1075+
['RegistroLRFacturasEmitidas']
1076+
)
1077+
self.fact_refund_emit = (
1078+
self.out_b_inovice_obj['SuministroLRFacturasEmitidas']
1079+
['RegistroLRFacturasEmitidas']
1080+
)
1081+
with context('en los datos de abonadora'):
1082+
with it('la FechaOperacion debe ser por factura original'):
1083+
expect(
1084+
self.fact_refund_emit['FacturaExpedida'].get(
1085+
'FechaOperacion', False)
1086+
).to(equal(False))
1087+
with context('en los datos de rectificación'):
1088+
with it('el TipoRectificativa debe ser por sustitución (S)'):
1089+
expect(
1090+
self.fact_rect_emit['FacturaExpedida']['TipoRectificativa']
1091+
).to(equal('S'))
1092+
1093+
with it('la FechaOperacion no debe existir'):
1094+
expect(
1095+
self.fact_rect_emit['FacturaExpedida'].get('FechaOperacion', False)
1096+
).to(equal(False))
1097+
1098+
with before.all:
1099+
self.importe_rectificacion = (
1100+
self.fact_rect_emit['FacturaExpedida']
1101+
['ImporteRectificacion']
1102+
)
1103+
1104+
with it('la BaseRectificada debe ser 0'):
1105+
expect(
1106+
self.importe_rectificacion['BaseRectificada']
1107+
).to(equal(0))
1108+
1109+
with it('la CuotaRectificada debe ser 0'):
1110+
expect(
1111+
self.importe_rectificacion['CuotaRectificada']
1112+
).to(equal(0))
1113+
1114+
with context('en los detalles del IVA'):
1115+
with before.all:
1116+
detalle_iva = (
1117+
self.fact_rect_emit['FacturaExpedida']['TipoDesglose']
1118+
['DesgloseFactura']['Sujeta']['NoExenta']['DesgloseIVA']
1119+
['DetalleIVA']
1120+
)
1121+
self.grouped_detalle_iva = group_by_tax_rate(
1122+
detalle_iva, in_invoice=False
1123+
)
1124+
1125+
with it('la BaseImponible debe ser la original'):
1126+
expect(
1127+
self.grouped_detalle_iva[5.0]['BaseImponible']
1128+
).to(equal(
1129+
self.out_refund.tax_line[0].base
1130+
))
1131+
with it('la CuotaRepercutida debe ser la original'):
1132+
expect(
1133+
self.grouped_detalle_iva[5.0]['CuotaRepercutida']
1134+
).to(equal(
1135+
-1 * abs(self.out_refund.tax_line[0].tax_amount)
1136+
))
1137+
with it('el TipoImpositivo debe ser la original'):
1138+
expect(
1139+
self.grouped_detalle_iva[5.0]['TipoImpositivo']
1140+
).to(equal(
1141+
self.out_refund.tax_line[0].tax_id.amount * 100
1142+
))
1143+
1144+
with description('en los datos de una factura rectificativa de una rectificativa emitida iva 5%'):
1145+
with before.all:
1146+
self.out_refund, self.out_b_inovice = self.data_gen.get_out_refund_invoice_iva5_multi()
1147+
self.out_refund_obj = SII(self.out_refund).generate_object()
1148+
self.out_b_inovice_obj = SII(self.out_b_inovice).generate_object()
1149+
self.fact_rect_emit = (
1150+
self.out_refund_obj['SuministroLRFacturasEmitidas']
1151+
['RegistroLRFacturasEmitidas']
1152+
)
1153+
self.fact_refund_emit = (
1154+
self.out_b_inovice_obj['SuministroLRFacturasEmitidas']
1155+
['RegistroLRFacturasEmitidas']
1156+
)
1157+
with context('en los datos de abonadora'):
1158+
with it('la FechaOperacion debe ser por factura original'):
1159+
expect(
1160+
self.fact_refund_emit['FacturaExpedida']['FechaOperacion']
1161+
).to(equal('01-01-2023'))
1162+
with context('en los datos de rectificación'):
1163+
with it('la FechaOperacion debe ser por factura original'):
1164+
expect(
1165+
self.fact_rect_emit['FacturaExpedida']['FechaOperacion']
1166+
).to(equal('01-01-2023'))
1167+
9951168
with description('en los datos de una factura rectificativa de una rectificativa emitida'):
9961169
with before.all:
9971170
self.out_refund, self.out_b_inovice = self.data_gen.get_out_refund_mulitple_invoice()
@@ -1007,16 +1180,14 @@ def group_by_tax_rate(iva_values, in_invoice):
10071180
)
10081181
with context('en los datos de abonadora'):
10091182
with it('la FechaOperacion debe ser por factura original'):
1010-
pass
1011-
# expect(
1012-
# self.fact_refund_emit['FacturaExpedida']['FechaOperacion']
1013-
# ).to(equal('07-12-2023'))
1183+
expect(
1184+
self.fact_refund_emit['FacturaExpedida'].get('FechaOperacion', False)
1185+
).to(equal(False))
10141186
with context('en los datos de rectificación'):
1015-
with it('la FechaOperacion debe ser por factura original'):
1016-
pass
1017-
# expect(
1018-
# self.fact_rect_emit['FacturaExpedida']['FechaOperacion']
1019-
# ).to(equal('07-12-2023'))
1187+
with it('la FechaOperacion NO debe existir'):
1188+
expect(
1189+
self.fact_rect_emit['FacturaExpedida'].get('FechaOperacion', False)
1190+
).to(equal(False))
10201191

10211192
with description('en los datos de una factura rectificativa recibida'):
10221193
with before.all:

0 commit comments

Comments
 (0)