Skip to content

Commit 2a0bb11

Browse files
ledmJavier Vegas-Regidor
and
Javier Vegas-Regidor
authored
Sort missing years in "No input data available for years" message (#1225)
* added a sorted print statement. * Update esmvalcore/_recipe_checks.py * Update esmvalcore/_recipe_checks.py Co-authored-by: Javier Vegas-Regidor <javier.vegas@bsc.es> * Fix failing test Co-authored-by: Javier Vegas-Regidor <javier.vegas@bsc.es>
1 parent 62b4c75 commit 2a0bb11

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

esmvalcore/_recipe_checks.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ def data_availability(input_files, var, dirnames, filenames):
142142
if missing_years:
143143
raise RecipeError(
144144
"No input data available for years {} in files {}".format(
145-
", ".join(str(year) for year in missing_years), input_files))
145+
", ".join(str(year) for year in sorted(missing_years)),
146+
input_files))
146147

147148

148149
def tasks_valid(tasks):

tests/integration/test_recipe_checks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
(FILES[:-1], dict(VAR), ERR_RANGE.format('2025', FILES[:-1])),
4141
(FILES[:-2], dict(VAR), ERR_RANGE.format('2024, 2025', FILES[:-2])),
4242
([FILES[1]] + [FILES[3]], dict(VAR),
43-
ERR_RANGE.format('2024, 2025, 2020, 2022', [FILES[1]] + [FILES[3]])),
43+
ERR_RANGE.format('2020, 2022, 2024, 2025', [FILES[1]] + [FILES[3]])),
4444
]
4545

4646

0 commit comments

Comments
 (0)