Skip to content

Conversation

@github-actions
Copy link

Ref: #893

jtrobles-cdd and others added 11 commits September 10, 2025 21:20
Refactor several test files for enum and constant classes to improve
maintainability, consistency, and clarity. The main changes involve
shifting from direct imports and usage of module-level constants/enums
to storing them as class variables set up in `setUpClass()`, and enhancing
the tests to check type consistency and equality for enum members.

Key improvements include:

- Consistent use of `setUpClass` to initialize class variables for
  constants and enums.
- Enhanced type and equality checks for enum members in test cases.
- Refactoring tests to use class variables instead of direct imports or
  module references.

The most important changes are:

**Test structure and setup improvements:**

- Refactored all test classes in `test_dte_constants.py`,
  `test_rcv_constants.py`, `test_rtc_constants.py`, and
  `test_rut_constants.py` to use `setUpClass()` and store constants/enums
  as class variables, promoting consistency and easier maintenance.

**Enum and constant validation enhancements:**

- Updated enum tests to include checks for member value types
  (e.g., ensuring all values are of type `int` or `str`) and to verify
  that enum members are equal to their values or names where appropriate.
- Improved tests for enums with integer values
  (like `TipoDte` and `RcvTipoDocto`) to confirm that enum members are
  also instances of `int`, and that casting their values to `int` yields
  the member itself.
- For enums with string values, added checks to ensure that member values
  match their names.

**Test code simplification:**

- Replaced repetitive direct constant access in test methods with class
  variables, simplifying test code and reducing import clutter.

**Documentation and clarity:**

- Added docstrings and comments to clarify test purposes, such as in
  `TipoDteCediblesTest` for `TIPO_DTE_CEDIBLES`.

These changes collectively make the test suite more robust, readable,
and maintainable.
…ests

tests: Refactor and improve constants tests
- Implemented `parse_taxpayer_provided_info` to parse taxpayer-provided information from CTE HTML.
- Added `TaxpayerProvidedInfo` and `LegalRepresentative` data models.
- Created tests to validate parser functionality with sample HTML input.

Ref: https://app.shortcut.com/cordada/story/16535/
…provista-por-el-contribuyente-cte

cte: Add parser for "Carpeta Tributaria Electrónica"
- Updated `iva_no_retenido` to be optional in `RcDetalleEntry` and its variants.
- Adjusted CSV parser to handle cases where `iva_no_retenido` is missing or `None`.
- Updated tests to reflect changes in `iva_no_retenido` handling.

Ref: https://app.shortcut.com/cordada/story/16600/
…for-RcRegistroDetalleEntry

rcv: Make `iva_no_retenido` optional in data models and parsers
- Updated `RcvCompraReclamadoCsvRowSchema.preprocess` workaround for `Fecha Reclamo` to check if variable is already `None`
- Implemented test `test_parse_rcv_compra_reclamado_csv_file` to check multiple use cases for parser `RcvCompraReclamadoCsvRowSchema`

Ref: https://app.shortcut.com/cordada/story/16601/
…-of-type-nonetype-is-not-iterable

rcv: Improve checks for RCV Reclamado parser workaround
@github-actions github-actions bot added task Task or chore kind: deploy Deployment labels Sep 15, 2025
@svillegas-cdd svillegas-cdd marked this pull request as ready for review September 15, 2025 17:19
@svillegas-cdd svillegas-cdd requested a review from a team as a code owner September 15, 2025 17:20
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
6.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@svillegas-cdd svillegas-cdd merged commit 9d52432 into master Sep 15, 2025
24 of 25 checks passed
@svillegas-cdd svillegas-cdd deleted the deploy/v0.57.0 branch September 15, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: deploy Deployment task Task or chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants