"""The party-ceiling roof reclassify corrects only the mis-read rows, to the guard's member, and is idempotent (#1376).""" from __future__ import annotations from scripts.reclassify_party_ceiling_roofs import party_ceiling_corrections def test_only_misclassified_party_ceiling_rows_are_corrected() -> None: # Arrange — a party ceiling mis-read as an external pitched roof (the bug), # one already on the correct member, and a genuine pitched roof. stored = [ ("another dwelling above: 100mm", "Pitched, 100 mm loft insulation"), ("another dwelling above: unknown", "(another dwelling above)"), ("pitched, normal loft access: 150mm", "Pitched, 150 mm loft insulation"), ] # Act corrections = party_ceiling_corrections(stored) # Assert — only the mis-read party ceiling is corrected, to its member value; # the already-correct row and the genuine pitched roof are left alone. assert corrections == { "another dwelling above: 100mm": "(another dwelling above)" } def test_already_corrected_data_yields_no_further_corrections() -> None: # Arrange — a re-run over data the first pass already fixed. stored = [("another dwelling above: 100mm", "(another dwelling above)")] # Act / Assert — idempotent: nothing left to change. assert party_ceiling_corrections(stored) == {}