Commit 9f52fe86 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Update tests

parent f60f0562
......@@ -111,6 +111,23 @@ def schema_siret():
}
@pytest.fixture
def schema_opening_hours():
return {
"$schema": "https://frictionlessdata.io/schemas/table-schema.json",
"fields": [
{
"name": "horaires_ouverture",
"title": "Horaires d'ouverture",
"type": "string",
},
],
"custom_checks": [
{"name": "opening-hours-value", "params": {"column": "horaires_ouverture"}}
],
}
@pytest.fixture
def schema_year_interval():
return {
......@@ -338,6 +355,26 @@ def test_invalid_custom_check_siret(schema_siret):
assert report["tasks"][0]["errors"][0]["code"] == "french-siret-value"
def test_valid_opening_hours_24_7(schema_opening_hours):
source = [["horaires_ouverture"], ["24/7"]]
report = validate(source, schema_opening_hours)
assert report.valid
def test_valid_opening_hours_Monday_to_Friday(schema_opening_hours):
source = [["horaires_ouverture"], ["Mo-Fr"]]
report = validate(source, schema_opening_hours)
assert report.valid
def test_invalid_opening_hours(schema_opening_hours):
source = [["horaires_ouverture"], ["Lu-Ve"]]
report = validate(source, schema_opening_hours)
assert len(report["tasks"][0]["errors"]) == 1
assert report["tasks"][0]["errors"][0]["code"] == "opening-hours-value"
print(report["tasks"][0]["errors"][0])
def test_valid_custom_check_year_interval_1(schema_year_interval):
source = [["projet", "annee"], ["Validata", "2018/2020"]]
report = validate(source, schema_year_interval)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment