fix(core): preserve data integrity and bound shared UI and response work
Module Package Release / publish-packages (push) Successful in 13s

Release v0.1.46. Coordinated integrity review: GovOPlaN/govoplan-core#298.
This commit is contained in:
2026-09-08 12:30:38 +02:00
parent dc1f244f17
commit 6591aaa3fd
33 changed files with 1889 additions and 114 deletions
+23
View File
@@ -178,6 +178,29 @@ class TabularSourceContractTests(unittest.TestCase):
with self.assertRaises(TabularSourceValidationError):
parse_tabular_csv("id,name\n1,Ada,extra\n")
def test_text_csv_mode_preserves_lexical_values_and_explicit_empty_records(self) -> None:
source = 'id,value\r\n9007199254740993," keep me "\r\ntrue,0.123456789012345678901234567890\r\n" ",""\r\n'
self.assertEqual(
(
{"id": "9007199254740993", "value": " keep me "},
{"id": "true", "value": "0.123456789012345678901234567890"},
{"id": " ", "value": ""},
),
parse_tabular_csv(source, value_mode="text"),
)
self.assertEqual(({"value": " "},), parse_tabular_csv('value\n" "\n', value_mode="text"))
def test_text_csv_mode_rejects_shape_loss_and_applies_input_and_row_bounds(self) -> None:
for source in ('id,name\n1\n', 'id,name\n1,Ada,\n'):
with self.subTest(source=source), self.assertRaises(TabularSourceValidationError):
parse_tabular_csv(source, value_mode="text")
with self.assertRaises(TabularSourceValidationError):
parse_tabular_csv('value\n""\n""\n', value_mode="text", max_rows=1)
with self.assertRaises(TabularSourceValidationError):
parse_tabular_csv('value\nä\n', value_mode="text", max_bytes=8)
with self.assertRaises(TabularSourceValidationError):
parse_tabular_csv('value\nx\n', value_mode="unknown")
if __name__ == "__main__":
unittest.main()