diff --git a/scripts/normalize_legacy.py b/scripts/normalize_legacy.py index f4016cb..e8bb1b3 100644 --- a/scripts/normalize_legacy.py +++ b/scripts/normalize_legacy.py @@ -312,7 +312,7 @@ def main() -> None: json.dumps(report, ensure_ascii=False, indent=2) + "\n", encoding="utf-8", ) - print(json.dumps(report, ensure_ascii=False, indent=2)) + print("Legacy normalization completed; details are available in the report.") if __name__ == "__main__": diff --git a/tests/test_integrity.py b/tests/test_integrity.py index 0b1af41..46f88e9 100644 --- a/tests/test_integrity.py +++ b/tests/test_integrity.py @@ -1,6 +1,7 @@ from __future__ import annotations import json +import subprocess import sys import tempfile import unittest @@ -196,6 +197,33 @@ def test_source_checksum_gate_rejects_modified_input(self) -> None: istat_path=DEFAULT_ISTAT, ) + def test_legacy_normalization_does_not_log_report_data(self) -> None: + with tempfile.TemporaryDirectory() as directory: + output = Path(directory) / "normalized.csv" + report = Path(directory) / "report.json" + result = subprocess.run( + [ + sys.executable, + str(ROOT / "scripts" / "normalize_legacy.py"), + "--output", + str(output), + "--report", + str(report), + ], + check=True, + capture_output=True, + text=True, + ) + self.assertEqual( + result.stdout, + "Legacy normalization completed; " + "details are available in the report.\n", + ) + self.assertTrue(output.is_file()) + self.assertTrue(report.is_file()) + self.assertNotIn("legacy_uuid", result.stdout) + self.assertNotIn("corrections", result.stdout) + if __name__ == "__main__": unittest.main()