Skip to content

fix(output): preserve explicit empty string fields during TSV conversion#30

Merged
HenningTimm merged 2 commits intoHenningTimm:mainfrom
Athemis:fix-empty-string-watermark-tsv
Mar 11, 2026
Merged

fix(output): preserve explicit empty string fields during TSV conversion#30
HenningTimm merged 2 commits intoHenningTimm:mainfrom
Athemis:fix-empty-string-watermark-tsv

Conversation

@Athemis
Copy link
Contributor

@Athemis Athemis commented Mar 4, 2026

Summary

This PR fixes #29 a TSV conversion bug where explicit empty strings in YAML (for example watermark: "") were treated as invalid entries.

Before this change, convert printed Invalid entry '' and could shift subsequent fields in affected TSV rows.

Root Cause

In yml2block/output.py, explicit empty strings ("") were not handled as valid values.
They fell through to the error branch instead of being written as an empty TSV cell.

Changes

  • Fix: Treat value == "" as a valid empty output cell during TSV writing.
  • Test: Added regression coverage for this behavior in integration tests.
  • Fixture: Added tests/valid/explicit_empty_string_watermark.yml to match existing test data conventions.

Files Changed

  • yml2block/output.py
  • tests/integration_tests.py
  • tests/valid/explicit_empty_string_watermark.yml

Verification

Ran:

poetry run pytest -q tests/unit_tests.py tests/integration_tests.py

Result:

  • 19 passed

Additionally re-ran conversion on the reported real-world input:

  • No more Invalid entry '' messages
  • No column shifts in the previously affected rows

@HenningTimm
Copy link
Owner

Thank you! Both for the fix and the extensive documentation :)

@HenningTimm HenningTimm merged commit 7abc12b into HenningTimm:main Mar 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explicit empty strings ("") trigger Invalid entry '' and shift TSV columns

2 participants