Skip to content

Commit 7d706ff

Browse files
committed
Avoid logging legacy normalization report data
1 parent 537180a commit 7d706ff

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

scripts/normalize_legacy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def main() -> None:
312312
json.dumps(report, ensure_ascii=False, indent=2) + "\n",
313313
encoding="utf-8",
314314
)
315-
print(json.dumps(report, ensure_ascii=False, indent=2))
315+
print("Legacy normalization completed; details are available in the report.")
316316

317317

318318
if __name__ == "__main__":

tests/test_integrity.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import json
4+
import subprocess
45
import sys
56
import tempfile
67
import unittest
@@ -196,6 +197,33 @@ def test_source_checksum_gate_rejects_modified_input(self) -> None:
196197
istat_path=DEFAULT_ISTAT,
197198
)
198199

200+
def test_legacy_normalization_does_not_log_report_data(self) -> None:
201+
with tempfile.TemporaryDirectory() as directory:
202+
output = Path(directory) / "normalized.csv"
203+
report = Path(directory) / "report.json"
204+
result = subprocess.run(
205+
[
206+
sys.executable,
207+
str(ROOT / "scripts" / "normalize_legacy.py"),
208+
"--output",
209+
str(output),
210+
"--report",
211+
str(report),
212+
],
213+
check=True,
214+
capture_output=True,
215+
text=True,
216+
)
217+
self.assertEqual(
218+
result.stdout,
219+
"Legacy normalization completed; "
220+
"details are available in the report.\n",
221+
)
222+
self.assertTrue(output.is_file())
223+
self.assertTrue(report.is_file())
224+
self.assertNotIn("legacy_uuid", result.stdout)
225+
self.assertNotIn("corrections", result.stdout)
226+
199227

200228
if __name__ == "__main__":
201229
unittest.main()

0 commit comments

Comments
 (0)