-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #753 from MTES-MCT/feat-airflow-unit-test
Ajout de tests unitaires à airflow
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import json | ||
|
||
|
||
def test_ocsge_source_json_is_properly_formatted(): | ||
file_path = "include/ocsge/sources.json" | ||
data: dict = json.load(open(file_path)) | ||
|
||
for source in data.values(): | ||
assert isinstance(source, dict) | ||
source_keys = source.keys() | ||
assert "difference" in source_keys | ||
assert "occupation_du_sol_et_zone_construite" in source_keys | ||
|
||
# Récupérer les années (ex: 2019, 2022) | ||
occupation_du_sol_et_zone_construite_keys = source["occupation_du_sol_et_zone_construite"].keys() | ||
|
||
# Vérifie que la différence est présente pour chaque duo d'année | ||
# TODO : mettre à jour cette logique lorsqu'il y aura plus de 2 années | ||
expected_difference_key = "_".join(sorted(occupation_du_sol_et_zone_construite_keys)) | ||
|
||
assert expected_difference_key in source["difference"].keys() |