Skip to content

Commit

Permalink
refactor(Validata): Achats: Re-modifie le schéma pour accepter des de…
Browse files Browse the repository at this point in the history
…cimal avec virgule (et sans limites de chiffres après la virgule)
  • Loading branch information
raphodn committed Feb 4, 2025
1 parent 957ba8f commit 3748241
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/tests/test_import_purchases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion data/schemas/imports/achats.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
{
"constraints": {
"pattern": "^\\d+([.,]\\d{1,2})?$",
"pattern": "^\\d+([.,]\\d+)?$",
"required": true
},
"description": "",
Expand Down

0 comments on commit 3748241

Please sign in to comment.