From 3748241216b6e8ab4c67b826a930c67416459997 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Tue, 4 Feb 2025 18:42:13 +0100 Subject: [PATCH] =?UTF-8?q?refactor(Validata):=20Achats:=20Re-modifie=20le?= =?UTF-8?q?=20sch=C3=A9ma=20pour=20accepter=20des=20decimal=20avec=20virgu?= =?UTF-8?q?le=20(et=20sans=20limites=20de=20chiffres=20apr=C3=A8s=20la=20v?= =?UTF-8?q?irgule)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/tests/test_import_purchases.py | 4 ++-- data/schemas/imports/achats.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/tests/test_import_purchases.py b/api/tests/test_import_purchases.py index ae635ce19..5243223bb 100644 --- a/api/tests/test_import_purchases.py +++ b/api/tests/test_import_purchases.py @@ -26,9 +26,9 @@ def setUpTestData(cls): def test_prix_ht_decimal(self): field_index = next((i for i, f in enumerate(self.schema["fields"]) if f["name"] == "prix_ht"), None) pattern = self.schema["fields"][field_index]["constraints"]["pattern"] - for VALUE_OK in ["1234", "1234.0", "1234.99", "1234,0", "1234,99"]: + for VALUE_OK in ["1234", "1234.0", "1234.99", "1234.99999", "1234,0", "1234,99", "1234,99999"]: self.assertTrue(re.match(pattern, VALUE_OK)) - for VALUE_NOT_OK in ["", " ", "TEST", "1234.999", "1234.99.99", "1234,999", "1234,99,99"]: + for VALUE_NOT_OK in ["", " ", "TEST", "1234.99.99", "1234,99,99"]: self.assertFalse(re.match(pattern, VALUE_NOT_OK)) def test_famille_produits_regex(self): diff --git a/data/schemas/imports/achats.json b/data/schemas/imports/achats.json index 48ea6bb76..f495c51f8 100644 --- a/data/schemas/imports/achats.json +++ b/data/schemas/imports/achats.json @@ -49,7 +49,7 @@ }, { "constraints": { - "pattern": "^\\d+([.,]\\d{1,2})?$", + "pattern": "^\\d+([.,]\\d+)?$", "required": true }, "description": "",