|
5 | 5 |
|
6 | 6 | import cl_sii.rcv.constants
|
7 | 7 | from cl_sii.base.constants import SII_OFFICIAL_TZ
|
| 8 | +from cl_sii.libs.tz_utils import convert_naive_dt_to_tz_aware |
8 | 9 | from cl_sii.rcv.data_models import (
|
9 | 10 | RcNoIncluirDetalleEntry,
|
10 | 11 | RcPendienteDetalleEntry,
|
@@ -399,8 +400,70 @@ def test_parse_rcv_compra_pendiente_row(self) -> None:
|
399 | 400 |
|
400 | 401 | class FunctionsTest(unittest.TestCase):
|
401 | 402 | def test_parse_rcv_venta_csv_file(self) -> None:
|
402 |
| - # TODO: implement for 'parse_rcv_venta_csv_file'. |
403 |
| - pass |
| 403 | + rcv_file_path = get_test_file_path( |
| 404 | + 'test_data/sii-rcv/RCV-venta-rz_leading_trailing_whitespace.csv', |
| 405 | + ) |
| 406 | + |
| 407 | + items = parse_rcv_venta_csv_file( |
| 408 | + rut=Rut('1-9'), |
| 409 | + input_file_path=rcv_file_path, |
| 410 | + n_rows_offset=0, |
| 411 | + max_n_rows=None, |
| 412 | + ) |
| 413 | + |
| 414 | + expected_entry_struct = RvDetalleEntry( |
| 415 | + emisor_rut=Rut('1-9'), |
| 416 | + tipo_docto=cl_sii.rcv.constants.RcvTipoDocto.FACTURA_ELECTRONICA, |
| 417 | + folio=506, |
| 418 | + fecha_emision_date=datetime.date(2019, 6, 4), |
| 419 | + receptor_rut=Rut('12345678-5'), |
| 420 | + monto_total=2082715, |
| 421 | + fecha_recepcion_dt=convert_naive_dt_to_tz_aware( |
| 422 | + dt=datetime.datetime(2019, 6, 18, 17, 1, 6), |
| 423 | + tz=SII_OFFICIAL_TZ, |
| 424 | + ), |
| 425 | + tipo_venta='DEL_GIRO', |
| 426 | + receptor_razon_social='Fake Company S.A.', |
| 427 | + fecha_acuse_dt=None, |
| 428 | + fecha_reclamo_dt=None, |
| 429 | + monto_exento=0, |
| 430 | + monto_neto=1750181, |
| 431 | + monto_iva=332534, |
| 432 | + iva_retenido_total=0, |
| 433 | + iva_retenido_parcial=0, |
| 434 | + iva_no_retenido=0, |
| 435 | + iva_propio=0, |
| 436 | + iva_terceros=0, |
| 437 | + liquidacion_factura_emisor_rut=None, |
| 438 | + neto_comision_liquidacion_factura=0, |
| 439 | + exento_comision_liquidacion_factura=0, |
| 440 | + iva_comision_liquidacion_factura=0, |
| 441 | + iva_fuera_de_plazo=0, |
| 442 | + tipo_documento_referencia=None, |
| 443 | + folio_documento_referencia=None, |
| 444 | + num_ident_receptor_extranjero=None, |
| 445 | + nacionalidad_receptor_extranjero=None, |
| 446 | + credito_empresa_constructora=0, |
| 447 | + impuesto_zona_franca_ley_18211=None, |
| 448 | + garantia_dep_envases=0, |
| 449 | + indicador_venta_sin_costo=2, |
| 450 | + indicador_servicio_periodico=0, |
| 451 | + monto_no_facturable=0, |
| 452 | + total_monto_periodo=0, |
| 453 | + venta_pasajes_transporte_nacional=None, |
| 454 | + venta_pasajes_transporte_internacional=None, |
| 455 | + numero_interno=None, |
| 456 | + codigo_sucursal='0', |
| 457 | + nce_o_nde_sobre_factura_de_compra=None, |
| 458 | + codigo_otro_imp=None, |
| 459 | + valor_otro_imp=None, |
| 460 | + tasa_otro_imp=None, |
| 461 | + ) |
| 462 | + # First row: |
| 463 | + entry_struct, row_ix, row_data, row_parsing_errors = next(items) |
| 464 | + self.assertEqual(row_ix, 1) |
| 465 | + self.assertEqual(row_data['Razon Social'], 'Fake Company S.A. ') |
| 466 | + self.assertEqual(entry_struct, expected_entry_struct) |
404 | 467 |
|
405 | 468 | def test_parse_rcv_venta_csv_file_receptor_rz_leading_trailing_whitespace(self) -> None:
|
406 | 469 | rcv_file_path = get_test_file_path(
|
|
0 commit comments