From b0015c0edf4ffe57c713fecf6ee4155d3ddeb1c0 Mon Sep 17 00:00:00 2001 From: Nicolas Oudard Date: Tue, 19 Nov 2024 15:56:04 +0100 Subject: [PATCH] Suppression de l'asterix sur le nom de la ville (#1053) --- dags/utils/base_utils.py | 2 ++ dags_unit_tests/dags/utils/test_base_utils.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/dags/utils/base_utils.py b/dags/utils/base_utils.py index 3510d10c8..57e804458 100755 --- a/dags/utils/base_utils.py +++ b/dags/utils/base_utils.py @@ -131,6 +131,8 @@ def _address_details_extract(address_str): if city: city = city.title() + city = city.replace("*", "").strip() + # Ajouter un zéro si le code postal a quatre chiffres if postal_code and len(postal_code) == 4: postal_code = "0" + postal_code diff --git a/dags_unit_tests/dags/utils/test_base_utils.py b/dags_unit_tests/dags/utils/test_base_utils.py index 7b3ffe6d3..f8b4077be 100644 --- a/dags_unit_tests/dags/utils/test_base_utils.py +++ b/dags_unit_tests/dags/utils/test_base_utils.py @@ -104,6 +104,11 @@ {"adresse_format_ban": 'RD 306, Lieudit "La Une" 77240 VERT SAINT DENIS'}, pd.Series(['RD 306, Lieudit "La Une"', "77240", "Vert Saint Denis"]), ), + # Lamballe* + ( + {"adresse_format_ban": "Lanjouan 22400 LAMBALLE*"}, + pd.Series(["Lanjouan", "22400", "Lamballe"]), + ), ], ) def test_extract_details(input_row, expected_output):