Skip to content

Commit 52d230b

Browse files
authored
Improving addListOfRows guessing style when first row has None values. Now it iterates until the first not None value (#202)
* - Modified addListOfRowsWithStyle in unogenerator/unogenerator.py: 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. * - tests/test_helpers.py: - 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. * Resumen de cambios: 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. * Trying * Trying * Updated dependencies * Updated dependencies
1 parent 7004a64 commit 52d230b

6 files changed

Lines changed: 323 additions & 216 deletions

File tree

.github/workflows/python-app.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
41
name: Python application
52

63
on:
@@ -24,12 +21,12 @@ jobs:
2421
- name: Install LibreOffice and uno dependencies
2522
run: |
2623
sudo apt-get update
27-
sudo apt-get install -y libreoffice python3-uno imagemagick gettext # Removed explicit python3.10 and python3.10-venv
24+
sudo apt-get install -y libreoffice python3-uno imagemagick gettext
2825
- name: Install python environment
2926
run: |
30-
python -m venv .venv --system-site-packages # Use 'python' and remove 'sudo'
31-
.venv/bin/pip install . # Remove 'sudo'
32-
.venv/bin/pip install pytest # Remove 'sudo'
27+
python -m venv .venv --system-site-packages
28+
.venv/bin/pip install .
29+
.venv/bin/pip install pytest envwrap # Added envwrap to satisfy tqdm optional dependency and avoid uno import hook failure
3330
- name: Run Tests
3431
run: |
3532
.venv/bin/pytest -v # Correct venv path and remove 'sudo'

0 commit comments

Comments
 (0)