Improving addListOfRows guessing style when first row has None values. Now it iterates until the first not None value#202
Merged
turulomio merged 7 commits intoJun 7, 2026
Conversation
The style guessing logic now iterates through all rows of a column until it finds a non-None value to determine the appropriate style. Previously, it only checked the first row, which led to incorrect styling (e.g., 'Normal' instead of 'Float2') if the first row had a null value in that column.
- Se han añadido los imports necesarios (datetime, Currency, Percentage).
- Se ha actualizado test_block_from_lod_with_null_first_row para que compruebe todos los tipos soportados, asegurando que el estilo se adivina
correctamente aunque la primera fila tenga valores nulos.
- Se ha incluido una columna (all_null) que verifica que el estilo por defecto se aplica correctamente si toda la columna es nula.
1. Detección de estilos mejorada en unogenerator/unogenerator.py:
* Se han actualizado tanto addListOfRowsWithStyle como addListOfColumnsWithStyle para que iteren a través de las filas/columnas hasta encontrar el
primer valor no nulo (not None). Esto garantiza que el estilo se detecte correctamente incluso si la primera entrada es nula.
* Se ha incluido documentación breve en el código explicando esta lógica de iteración.
2. Alineación de Strings:
* Se ha confirmado que tanto en ODS (estilo Default) como en ODS_Standard (estilo Normal), la alineación predeterminada es a la izquierda, por lo
que al detectar correctamente el estilo de un string, este queda alineado a la izquierda automáticamente según el template.
3. Tests Integrados y Exhaustivos:
* Se ha actualizado test_block_from_lod_with_null_first_row en tests/test_helpers.py para incluir todos los tipos de datos soportados (int,
timedelta, currency, percentage, datetime, date, time, bool, float, string) y una columna con valores totalmente nulos.
* El test verifica que todos estos tipos se detectan y estilizan correctamente (incluyendo la alineación a la izquierda para strings mediante el
estilo Normal).
* Se han limpiado los archivos temporales de prueba.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.