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"