From 8641b542103adb72532aa3760270b1b4e7c3d04f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 09:50:54 +0000 Subject: [PATCH 1/4] chore(deps): Bump the github-actions-production group with 2 updates Bumps the github-actions-production group with 2 updates: [actions/cache](https://github.com/actions/cache) and [actions/upload-artifact](https://github.com/actions/upload-artifact). Updates `actions/cache` from 5.0.4 to 5.0.5 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v5.0.4...v5.0.5) Updates `actions/upload-artifact` from 7.0.0 to 7.0.1 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v7.0.0...v7.0.1) --- updated-dependencies: - dependency-name: actions/cache dependency-version: 5.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions-production - dependency-name: actions/upload-artifact dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions-production ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yaml | 6 +++--- .github/workflows/deploy.yaml | 2 +- .github/workflows/release.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9fb17858..bc819610 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,7 +52,7 @@ jobs: run: make python-virtualenv PYTHON_VIRTUALENV_DIR="venv" - name: Restoring/Saving Cache - uses: actions/cache@v5.0.4 + uses: actions/cache@v5.0.5 with: path: | .tox @@ -107,7 +107,7 @@ jobs: check-latest: true - name: Restoring/Saving Cache - uses: actions/cache@v5.0.4 + uses: actions/cache@v5.0.5 with: path: | .tox @@ -163,7 +163,7 @@ jobs: - name: Store Artifacts if: ${{ always() }} - uses: actions/upload-artifact@v7.0.0 + uses: actions/upload-artifact@v7.0.1 with: name: test_reports_${{ matrix.python_version }} path: test-reports/ diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index c9b422f1..f2b595b4 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -48,7 +48,7 @@ jobs: check-latest: true - name: Restoring/Saving Cache - uses: actions/cache@v5.0.4 + uses: actions/cache@v5.0.5 with: path: "venv" key: py-v1-deps-${{ runner.os }}-${{ steps.set_up_python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'requirements-dev.txt', 'Makefile', 'make/**.mk') }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4da728da..5582e186 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -48,7 +48,7 @@ jobs: run: make python-virtualenv PYTHON_VIRTUALENV_DIR="venv" - name: Restoring/Saving Cache - uses: actions/cache@v5.0.4 + uses: actions/cache@v5.0.5 with: path: "venv" key: py-v1-deps-${{ runner.os }}-${{ steps.set_up_python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'requirements-dev.txt', 'Makefile', 'make/**.mk') }} @@ -69,7 +69,7 @@ jobs: make dist - name: Store Artifacts - uses: actions/upload-artifact@v7.0.0 + uses: actions/upload-artifact@v7.0.1 with: name: release path: ${{ env.ARTIFACTS_PATH }}/ From 2f2162fdd6c566afc3a8ca2f993e389e74604a78 Mon Sep 17 00:00:00 2001 From: Samuel Villegas Date: Wed, 27 May 2026 17:58:41 -0400 Subject: [PATCH 2/4] fix(rcv): Enhance parsing and validation for DocumentoReferencias - Updated data models to support `folio_documento_referencia` as `int | str`. - Added validation logic for handling alphanumeric and non-numeric folio values. - Fixed edge cases and adjusted tests to reflect changes in parsing and validation. Ref: https://app.shortcut.com/cordada/story/20539/ --- src/cl_sii/rcv/data_models.py | 46 ++- src/cl_sii/rcv/parse_csv.py | 8 +- .../sii-rcv/RCV-venta-validation-errors.csv | 2 + src/tests/test_rcv_data_models.py | 2 +- src/tests/test_rcv_parse_csv.py | 290 ++++++++++++++++-- 5 files changed, 307 insertions(+), 41 deletions(-) diff --git a/src/cl_sii/rcv/data_models.py b/src/cl_sii/rcv/data_models.py index 35435b8d..0e260a9a 100644 --- a/src/cl_sii/rcv/data_models.py +++ b/src/cl_sii/rcv/data_models.py @@ -121,17 +121,45 @@ class OtrosImpuestos(TypedDict): """ -class DocumentoReferencia(TypedDict): +@pydantic.dataclasses.dataclass( + frozen=True, +) +class DocumentoReferencia: tipo_documento_referencia: int """ Tipo Docto. Referencia """ - folio_documento_referencia: int + folio_documento_referencia: int | str """ Folio Docto. Referencia """ + @pydantic.field_validator('folio_documento_referencia') + @classmethod + def validate_folio_documento_referencia(cls, v: int | str) -> int | str: + if isinstance(v, int): + try: + cl_sii.dte.data_models.validate_dte_folio(v) + except ValueError: + # If value is numeric but not a valid DTE folio, + # assume that the value represents some other kind of number + # (e.g. a purchase order number) and convert it to a string. + v = str(v) + elif isinstance(v, str): + if v.strip().isdecimal(): + numeric_v = int(v) + try: + cl_sii.dte.data_models.validate_dte_folio(numeric_v) + except ValueError: + # If value is numeric but not a valid DTE folio, + # assume that the value represents some other kind of number + # (e.g. a purchase order number) and leave it as a string. + pass + else: + v = numeric_v + return v + @pydantic.dataclasses.dataclass( frozen=True, @@ -513,8 +541,8 @@ def get_documento_referencia_dte_natural_keys( documento_referencia_natural_keys = [] for documento_referencia in self.documento_referencias: - tipo_documento_referencia = documento_referencia['tipo_documento_referencia'] - folio_documento_referencia = documento_referencia['folio_documento_referencia'] + tipo_documento_referencia = documento_referencia.tipo_documento_referencia + folio_documento_referencia = documento_referencia.folio_documento_referencia try: tipo_documento_referencia = RcvTipoDocto(tipo_documento_referencia) @@ -524,16 +552,16 @@ def get_documento_referencia_dte_natural_keys( tipo_dte_referencia = cl_sii.dte.constants.TipoDte(tipo_documento_referencia) except ValueError: # Not a DTE. - return None + continue else: try: tipo_dte_referencia = tipo_documento_referencia.as_tipo_dte() except ValueError: # Not a DTE. - return None + continue - if folio_documento_referencia == 0: - return None + if isinstance(folio_documento_referencia, str): + continue documento_referencia_natural_keys.append( cl_sii.dte.data_models.DteNaturalKey( @@ -543,7 +571,7 @@ def get_documento_referencia_dte_natural_keys( ) ) - return documento_referencia_natural_keys + return documento_referencia_natural_keys or None ########################################################################### # Validators diff --git a/src/cl_sii/rcv/parse_csv.py b/src/cl_sii/rcv/parse_csv.py index 20f7612b..208ea548 100644 --- a/src/cl_sii/rcv/parse_csv.py +++ b/src/cl_sii/rcv/parse_csv.py @@ -1764,7 +1764,7 @@ def _parse_rv_documento_referencias( Document type. Accepts string or integer. Empty values: None, "", "0". folio_documento_referencia : Optional[str] Folio number(s). Single folio ("10370") or hyphen-separated multiple - folios ("10370-10371"). Empty values: None, "", "0". + folios ("10370-10371"). Empty values: None, "". Returns ------- @@ -1782,14 +1782,12 @@ def _parse_rv_documento_referencias( if tipo_documento_referencia in (None, '', '0') and folio_documento_referencia in ( None, '', - '0', ): return None if tipo_documento_referencia in (None, '', '0') or folio_documento_referencia in ( None, '', - '0', ): raise ValueError( f"Both 'tipo_documento_referencia' ({tipo_documento_referencia}) " @@ -1803,14 +1801,14 @@ def _parse_rv_documento_referencias( folios = folio_documento_referencia.split('-') for folio in folios: folio = folio.strip() - if not folio.isdigit(): + if not folio: raise ValueError( f"Invalid 'folio_documento_referencia': ({folio_documento_referencia})." ) documento_referencias.append( { 'tipo_documento_referencia': tipo_documento_referencia, - 'folio_documento_referencia': int(folio), + 'folio_documento_referencia': folio, } ) else: diff --git a/src/tests/test_data/sii-rcv/RCV-venta-validation-errors.csv b/src/tests/test_data/sii-rcv/RCV-venta-validation-errors.csv index 277a7ef3..97c4991a 100644 --- a/src/tests/test_data/sii-rcv/RCV-venta-validation-errors.csv +++ b/src/tests/test_data/sii-rcv/RCV-venta-validation-errors.csv @@ -4,4 +4,6 @@ Nro;Tipo Doc;Tipo Venta;Rut cliente;Razon Social;Folio;Fecha Docto;Fecha Recepci 2;33;Del Giro;81859341-4;POLAR S.A.;14395;07/01/2026;07/01/2026 13:18:20;08/01/2026 15:48:09;;0;1646350;312807;1959157;0;0;0;0;0;-;0;0;0;0;52;10489 ;;;0;;0;2;0;0;0;;;;0;;;;; 3;33;Del Giro;81859341-4;POLAR S.A.;14396;07/01/2026;07/01/2026 13:18:20;08/01/2026 15:48:09;;0;1646350;312807;1959157;0;0;0;0;0;-;0;0;0;0;52;;;;0;;0;2;0;0;0;;;;0;;;;; 4;33;Del Giro;81859341-4;POLAR S.A.;14397;07/01/2026;07/01/2026 13:18:20;08/01/2026 15:48:09;;0;1646350;312807;1959157;0;0;0;0;0;-;0;0;0;0;52;1057539-304-SE26;;;0;;0;2;0;0;0;;;;0;;;;; +5;33;Del Giro;81859341-4;POLAR S.A.;10258123456;07/01/2026;07/01/2026 13:18:20;08/01/2026 15:48:09;;0;1646350;312807;1959157;0;0;0;0;0;-;0;0;0;0;52;1057539;;;0;;0;2;0;0;0;;;;0;;;;; +6;33;Del Giro;81859341-4;POLAR S.A.;14398;07/01/2026;07/01/2026 13:18:20;08/01/2026 15:48:09;;0;1646350;312807;1959157;0;0;0;0;0;-;0;0;0;0;52;45000105543;;;0;;0;2;0;0;0;;;;0;;;;; diff --git a/src/tests/test_rcv_data_models.py b/src/tests/test_rcv_data_models.py index 62f2e65d..8baf510e 100644 --- a/src/tests/test_rcv_data_models.py +++ b/src/tests/test_rcv_data_models.py @@ -464,7 +464,7 @@ def test_get_documento_referencia_dte_natural_keys(self) -> None: ) with self.assertRaisesRegex(ValueError, r'^52 is not a valid RcvTipoDocto$'): RcvTipoDocto( - rv_detalle_entry_with_non_rcv_doc_ref.documento_referencias[0]['tipo_documento_referencia'] # type: ignore[index] # noqa: E501 + rv_detalle_entry_with_non_rcv_doc_ref.documento_referencias[0].tipo_documento_referencia # type: ignore[index] # noqa: E501 ) expected_doc_ref_dte_natural_key = [ diff --git a/src/tests/test_rcv_parse_csv.py b/src/tests/test_rcv_parse_csv.py index 1eba3cfc..0aa4ce65 100644 --- a/src/tests/test_rcv_parse_csv.py +++ b/src/tests/test_rcv_parse_csv.py @@ -1601,11 +1601,11 @@ def test_parse_rcv_venta_csv_file_multiple_dte_referencias(self) -> None: 'Documento Referencias': [ { 'tipo_documento_referencia': 52, - 'folio_documento_referencia': 10370, + 'folio_documento_referencia': '10370', }, { 'tipo_documento_referencia': 52, - 'folio_documento_referencia': 10371, + 'folio_documento_referencia': '10371', }, ], 'Otros Impuestos': None, @@ -1728,15 +1728,15 @@ def test_parse_rcv_venta_csv_file_multiple_dte_referencias(self) -> None: 'Documento Referencias': [ { 'tipo_documento_referencia': 33, - 'folio_documento_referencia': 200, + 'folio_documento_referencia': '200', }, { 'tipo_documento_referencia': 33, - 'folio_documento_referencia': 300, + 'folio_documento_referencia': '300', }, { 'tipo_documento_referencia': 33, - 'folio_documento_referencia': 400, + 'folio_documento_referencia': '400', }, ], 'Otros Impuestos': [ @@ -1899,15 +1899,15 @@ def test_parse_rcv_venta_csv_file_validation_errors(self) -> None: 'Documento Referencias': [ { 'tipo_documento_referencia': 33, - 'folio_documento_referencia': 200, + 'folio_documento_referencia': '200', }, { 'tipo_documento_referencia': 33, - 'folio_documento_referencia': 300, + 'folio_documento_referencia': '300', }, { 'tipo_documento_referencia': 33, - 'folio_documento_referencia': 400, + 'folio_documento_referencia': '400', }, ], 'contribuyente_rut': Rut('1-9'), @@ -1996,7 +1996,7 @@ def test_parse_rcv_venta_csv_file_validation_errors(self) -> None: 'Documento Referencias': [ { 'tipo_documento_referencia': 52, - 'folio_documento_referencia': 10489, + 'folio_documento_referencia': '10489', } ], 'Num. Ident. Receptor Extranjero': None, @@ -2072,7 +2072,67 @@ def test_parse_rcv_venta_csv_file_validation_errors(self) -> None: }, ), ( - None, + RvDetalleEntry( + contribuyente_rut=Rut('1-9'), + tipo_docto=cl_sii.rcv.constants.RcvTipoDocto.FACTURA_ELECTRONICA, + folio=14397, + fecha_emision_date=datetime.date(2026, 1, 7), + monto_total=1959157, + fecha_recepcion_dt=convert_naive_dt_to_tz_aware( + dt=datetime.datetime(2026, 1, 7, 13, 18, 20), + tz=SII_OFFICIAL_TZ, + ), + cliente_rut=Rut('81859341-4'), + tipo_venta='DEL_GIRO', + cliente_razon_social='POLAR S.A.', + fecha_acuse_dt=convert_naive_dt_to_tz_aware( + dt=datetime.datetime(2026, 1, 8, 15, 48, 9), + tz=SII_OFFICIAL_TZ, + ), + fecha_reclamo_dt=None, + monto_exento=0, + monto_neto=1646350, + monto_iva=312807, + iva_retenido_total=0, + iva_retenido_parcial=0, + iva_no_retenido=0, + iva_propio=0, + iva_terceros=0, + liquidacion_factura_emisor_rut=None, + neto_comision_liquidacion_factura=0, + exento_comision_liquidacion_factura=0, + iva_comision_liquidacion_factura=0, + iva_fuera_de_plazo=0, + documento_referencias=[ + DocumentoReferencia( + tipo_documento_referencia=52, + folio_documento_referencia=1057539, + ), + DocumentoReferencia( + tipo_documento_referencia=52, + folio_documento_referencia=304, + ), + DocumentoReferencia( + tipo_documento_referencia=52, + folio_documento_referencia='SE26', + ), + ], + num_ident_receptor_extranjero=None, + nacionalidad_receptor_extranjero=None, + credito_empresa_constructora=0, + impuesto_zona_franca_ley_18211=None, + garantia_dep_envases=0, + indicador_venta_sin_costo=2, + indicador_servicio_periodico=0, + monto_no_facturable=0, + total_monto_periodo=0, + venta_pasajes_transporte_nacional=None, + venta_pasajes_transporte_internacional=None, + numero_interno=None, + codigo_sucursal='0', + nce_o_nde_sobre_factura_de_compra=None, + otros_impuestos=None, + ), 5, { 'Tipo Doc': '33', @@ -2098,6 +2158,20 @@ def test_parse_rcv_venta_csv_file_validation_errors(self) -> None: 'Exento Comision Liquid. Factura': '0', 'IVA Comision Liquid. Factura': '0', 'IVA fuera de plazo': '0', + 'Documento Referencias': [ + { + 'tipo_documento_referencia': 52, + 'folio_documento_referencia': '1057539', + }, + { + 'tipo_documento_referencia': 52, + 'folio_documento_referencia': '304', + }, + { + 'tipo_documento_referencia': 52, + 'folio_documento_referencia': 'SE26', + }, + ], 'Num. Ident. Receptor Extranjero': None, 'Nacionalidad Receptor Extranjero': None, 'Credito empresa constructora': '0', @@ -2115,13 +2189,172 @@ def test_parse_rcv_venta_csv_file_validation_errors(self) -> None: 'Otros Impuestos': None, 'contribuyente_rut': Rut('1-9'), }, + {}, + ), + ( + None, + 6, { - 'validation': { - "Documento Referencias": ( - "Invalid 'folio_documento_referencia': (1057539-304-SE26)." + 'Tipo Doc': '33', + 'Tipo Venta': 'DEL_GIRO', + 'Rut cliente': '81859341-4', + 'Razon Social': 'POLAR S.A.', + 'Folio': '10258123456', + 'Fecha Docto': '07/01/2026', + 'Fecha Recepcion': '07/01/2026 13:18:20', + 'Fecha Acuse Recibo': '08/01/2026 15:48:09', + 'Fecha Reclamo': None, + 'Monto Exento': '0', + 'Monto Neto': '1646350', + 'Monto IVA': '312807', + 'Monto total': '1959157', + 'IVA Retenido Total': '0', + 'IVA Retenido Parcial': '0', + 'IVA no retenido': '0', + 'IVA propio': '0', + 'IVA Terceros': '0', + 'RUT Emisor Liquid. Factura': None, + 'Neto Comision Liquid. Factura': '0', + 'Exento Comision Liquid. Factura': '0', + 'IVA Comision Liquid. Factura': '0', + 'IVA fuera de plazo': '0', + 'Documento Referencias': [ + { + 'tipo_documento_referencia': 52, + 'folio_documento_referencia': '1057539', + } + ], + 'Num. Ident. Receptor Extranjero': None, + 'Nacionalidad Receptor Extranjero': None, + 'Credito empresa constructora': '0', + 'Impto. Zona Franca (Ley 18211)': None, + 'Garantia Dep. Envases': '0', + 'Indicador Venta sin Costo': '2', + 'Indicador Servicio Periodico': '0', + 'Monto No facturable': '0', + 'Total Monto Periodo': '0', + 'Venta Pasajes Transporte Nacional': None, + 'Venta Pasajes Transporte Internacional': None, + 'Numero Interno': None, + 'Codigo Sucursal': '0', + 'NCE o NDE sobre Fact. de Compra': None, + 'Otros Impuestos': None, + 'contribuyente_rut': Rut('1-9'), + }, + { + 'conversion_errors': ( + "1 validation error for RvDetalleEntry\n" + "folio\n" + " Value error, Value is out of the valid range for 'folio'." + " [type=value_error, input_value=10258123456, input_type=int]\n" + " For further information visit" + " https://errors.pydantic.dev/2.12/v/value_error" + ) + }, + ), + ( + RvDetalleEntry( + contribuyente_rut=Rut('1-9'), + tipo_docto=cl_sii.rcv.constants.RcvTipoDocto.FACTURA_ELECTRONICA, + folio=14398, + fecha_emision_date=datetime.date(2026, 1, 7), + monto_total=1959157, + fecha_recepcion_dt=convert_naive_dt_to_tz_aware( + dt=datetime.datetime(2026, 1, 7, 13, 18, 20), + tz=SII_OFFICIAL_TZ, + ), + cliente_rut=Rut('81859341-4'), + tipo_venta='DEL_GIRO', + cliente_razon_social='POLAR S.A.', + fecha_acuse_dt=convert_naive_dt_to_tz_aware( + dt=datetime.datetime(2026, 1, 8, 15, 48, 9), + tz=SII_OFFICIAL_TZ, + ), + fecha_reclamo_dt=None, + monto_exento=0, + monto_neto=1646350, + monto_iva=312807, + iva_retenido_total=0, + iva_retenido_parcial=0, + iva_no_retenido=0, + iva_propio=0, + iva_terceros=0, + liquidacion_factura_emisor_rut=None, + neto_comision_liquidacion_factura=0, + exento_comision_liquidacion_factura=0, + iva_comision_liquidacion_factura=0, + iva_fuera_de_plazo=0, + documento_referencias=[ + DocumentoReferencia( + tipo_documento_referencia=52, + folio_documento_referencia='45000105543', ) - } + ], + num_ident_receptor_extranjero=None, + nacionalidad_receptor_extranjero=None, + credito_empresa_constructora=0, + impuesto_zona_franca_ley_18211=None, + garantia_dep_envases=0, + indicador_venta_sin_costo=2, + indicador_servicio_periodico=0, + monto_no_facturable=0, + total_monto_periodo=0, + venta_pasajes_transporte_nacional=None, + venta_pasajes_transporte_internacional=None, + numero_interno=None, + codigo_sucursal='0', + nce_o_nde_sobre_factura_de_compra=None, + otros_impuestos=None, + ), + 7, + { + 'Tipo Doc': '33', + 'Tipo Venta': 'DEL_GIRO', + 'Rut cliente': '81859341-4', + 'Razon Social': 'POLAR S.A.', + 'Folio': '14398', + 'Fecha Docto': '07/01/2026', + 'Fecha Recepcion': '07/01/2026 13:18:20', + 'Fecha Acuse Recibo': '08/01/2026 15:48:09', + 'Fecha Reclamo': None, + 'Monto Exento': '0', + 'Monto Neto': '1646350', + 'Monto IVA': '312807', + 'Monto total': '1959157', + 'IVA Retenido Total': '0', + 'IVA Retenido Parcial': '0', + 'IVA no retenido': '0', + 'IVA propio': '0', + 'IVA Terceros': '0', + 'RUT Emisor Liquid. Factura': None, + 'Neto Comision Liquid. Factura': '0', + 'Exento Comision Liquid. Factura': '0', + 'IVA Comision Liquid. Factura': '0', + 'IVA fuera de plazo': '0', + 'Documento Referencias': [ + { + 'tipo_documento_referencia': 52, + 'folio_documento_referencia': '45000105543', + } + ], + 'Num. Ident. Receptor Extranjero': None, + 'Nacionalidad Receptor Extranjero': None, + 'Credito empresa constructora': '0', + 'Impto. Zona Franca (Ley 18211)': None, + 'Garantia Dep. Envases': '0', + 'Indicador Venta sin Costo': '2', + 'Indicador Servicio Periodico': '0', + 'Monto No facturable': '0', + 'Total Monto Periodo': '0', + 'Venta Pasajes Transporte Nacional': None, + 'Venta Pasajes Transporte Internacional': None, + 'Numero Interno': None, + 'Codigo Sucursal': '0', + 'NCE o NDE sobre Fact. de Compra': None, + 'Otros Impuestos': None, + 'contribuyente_rut': Rut('1-9'), }, + {}, ), ] self.assertEqual(items_list, expected_entries_list) @@ -2536,8 +2769,11 @@ def test__parse_rv_documento_referencias(self) -> None: with self.assertRaises(ValueError): _parse_rv_documento_referencias(33, "") - with self.assertRaises(ValueError): - _parse_rv_documento_referencias("33", "0") + result = _parse_rv_documento_referencias("33", "0") + self.assertEqual( + result, + [{'tipo_documento_referencia': 33, 'folio_documento_referencia': '0'}], + ) # Test case 4: Only folio provided (tipo empty) - should raise ValueError with self.subTest("Only folio provided"): @@ -2557,7 +2793,7 @@ def test__parse_rv_documento_referencias(self) -> None: expected = [ { 'tipo_documento_referencia': 33, - 'folio_documento_referencia': 12345, + 'folio_documento_referencia': '12345', } ] self.assertEqual(result, expected) @@ -2568,7 +2804,7 @@ def test__parse_rv_documento_referencias(self) -> None: expected = [ { 'tipo_documento_referencia': 52, - 'folio_documento_referencia': 67890, + 'folio_documento_referencia': '67890', } ] self.assertEqual(result, expected) @@ -2579,24 +2815,26 @@ def test__parse_rv_documento_referencias(self) -> None: expected = [ { 'tipo_documento_referencia': 33, - 'folio_documento_referencia': 200, + 'folio_documento_referencia': '200', }, { 'tipo_documento_referencia': 33, - 'folio_documento_referencia': 300, + 'folio_documento_referencia': '300', }, { 'tipo_documento_referencia': 33, - 'folio_documento_referencia': 400, + 'folio_documento_referencia': '400', }, ] self.assertEqual(result, expected) - # Test case 8: Invalid folio - non-numeric - with self.subTest("Invalid folio - non-numeric"): - with self.assertRaises(ValueError) as cm: - _parse_rv_documento_referencias("33", "abc") - self.assertIn("Invalid 'folio_documento_referencia'", str(cm.exception)) + # Test case 8: Alphanumeric folio - valid + with self.subTest("Valid alphanumeric folio"): + result = _parse_rv_documento_referencias("33", "abc") + self.assertEqual( + result, + [{'tipo_documento_referencia': 33, 'folio_documento_referencia': 'abc'}], + ) # Test case 9: Non-string folio parameter (should work for integer) with self.subTest("Non-string folio"): From 2f8a7e92dad8b9acd361f1038dcf1dbde3f5cadc Mon Sep 17 00:00:00 2001 From: Samuel Villegas Date: Thu, 28 May 2026 11:04:40 -0400 Subject: [PATCH 3/4] chore: Update history for new version --- HISTORY.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index 210703d4..2f1eca7f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,10 @@ # History +## 0.77.0 (2026-05-28) + +- (PR #1030, 2026-05-11) chore(deps): Bump the github-actions-production group with 2 updates +- (PR #1036, 2026-05-28) rcv: Enhance parsing and validation for DocumentoReferencias + ## 0.76.0 (2026-05-04) - (PR #1029, 2026-04-29) Drop support for Python 3.9 From 74c181d025c23b0a97badfd55fcff4d3b893a7fb Mon Sep 17 00:00:00 2001 From: Samuel Villegas Date: Thu, 28 May 2026 11:04:43 -0400 Subject: [PATCH 4/4] chore: Bump version from 0.76.0 to 0.77.0 --- .bumpversion.cfg | 2 +- src/cl_sii/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b08c4380..a532958d 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.76.0 +current_version = 0.77.0 commit = True tag = False message = chore: Bump version from {current_version} to {new_version} diff --git a/src/cl_sii/__init__.py b/src/cl_sii/__init__.py index 19b83fc9..c282f463 100644 --- a/src/cl_sii/__init__.py +++ b/src/cl_sii/__init__.py @@ -4,4 +4,4 @@ """ -__version__ = '0.76.0' +__version__ = '0.77.0'