From be2b71c235e005170b413318d2cd65f7bbd6445e Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Mon, 29 Jun 2026 14:48:46 +0000 Subject: [PATCH] =?UTF-8?q?Strip=20trailing=20.0=20from=20historic=20EPC?= =?UTF-8?q?=20UPRN=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- .../test_historic_epc_s3_repository.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/repositories/historic_epc/test_historic_epc_s3_repository.py b/tests/repositories/historic_epc/test_historic_epc_s3_repository.py index 509fcf0fd..96187181d 100644 --- a/tests/repositories/historic_epc/test_historic_epc_s3_repository.py +++ b/tests/repositories/historic_epc/test_historic_epc_s3_repository.py @@ -128,3 +128,17 @@ def test_invalid_postcode_raises_postcode_not_found(): with patch.object(AddressMatch, "is_valid_postcode", return_value=False): with pytest.raises(PostcodeNotFound): repo.get_for_postcode("NONSENSE") + + +def test_uprn_trailing_dot_zero_is_stripped(): + # Arrange — pandas reads an integer UPRN column as float, so the CSV cell + # arrives as "151020766.0"; the domain UPRN must be the bare integer string. + df = _df([_row("47 GORDON ROAD", "151020766.0")]) + repo = HistoricEpcS3Repository(read_csv_gz=lambda bucket, key: df) + + # Act + with _valid_postcode(): + records = repo.get_for_postcode("AB33 8AL") + + # Assert + assert records[0].uprn == "151020766"