mirror of
https://github.com/soulaklabs/bitoduc.fr.git
synced 2025-12-09 01:23:24 +00:00
déplacement des fichiers d'intégration continue dans un répertoire dédié
This commit is contained in:
1
vérifications/besoins.txt
Normal file
1
vérifications/besoins.txt
Normal file
@@ -0,0 +1 @@
|
||||
jsonschema==2.5.1
|
||||
38
vérifications/schéma.json
Normal file
38
vérifications/schéma.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{ "type": "object",
|
||||
"properties": {
|
||||
"faux mots": {
|
||||
"type": "array",
|
||||
"items": {"$ref": "#/definitions/mot"}
|
||||
},
|
||||
"vrais mots": {
|
||||
"type": "array",
|
||||
"items": {"$ref": "#/definitions/mot"}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"mot": {
|
||||
"type": "object",
|
||||
"properties":
|
||||
{
|
||||
"anglais": {"type": "string"},
|
||||
"français": {"type": "string"},
|
||||
"classe": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"adjectif",
|
||||
"groupe nominal",
|
||||
"groupe verbal",
|
||||
"proposition",
|
||||
"verbe"
|
||||
]
|
||||
},
|
||||
"genre": {
|
||||
"type": "string",
|
||||
"enum": ["f", "m"]
|
||||
},
|
||||
"pluriel": {"type": "boolean"}
|
||||
},
|
||||
"required": ["anglais", "français", "classe"]
|
||||
}
|
||||
}
|
||||
}
|
||||
25
vérifications/vérifie.py
Normal file
25
vérifications/vérifie.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import json
|
||||
from jsonschema import validate as valide
|
||||
|
||||
|
||||
def verifie_ordre(mots):
|
||||
for (a, b) in zip(mots, mots[1:]):
|
||||
mot_a = a['anglais'].lower()
|
||||
mot_b = b['anglais'].lower()
|
||||
msg = "%s et %s ne sont pas dans le bon ordre" % (mot_a, mot_b)
|
||||
assert mot_a < mot_b, msg
|
||||
|
||||
|
||||
def principal():
|
||||
with open('traductions.json') as f:
|
||||
d = json.load(f)
|
||||
with open('vérifications/schéma.json') as f:
|
||||
schema = json.load(f)
|
||||
valide(d, schema)
|
||||
verifie_ordre(d['faux mots'])
|
||||
verifie_ordre(d['vrais mots'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
principal()
|
||||
Reference in New Issue
Block a user