Skip to content

Commit

Permalink
Merge pull request #402 from GermanZero-de/fix_create_expectations
Browse files Browse the repository at this point in the history
fix create_expectation
  • Loading branch information
Jeniffere authored Jul 23, 2024
2 parents 03738d6 + 6c80285 commit d1b1cf6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 9 additions & 1 deletion commands/cmd_test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,15 @@ def cmd_test_end_to_end_update_expectations(args: Any):


def cmd_test_end_to_end_create_expectation(args: Any):
filename = "production_" + args.ags + "_" + str(args.year_target) + ".json"
filename = (
"production_"
+ args.ags
+ "_"
+ str(args.year_baseline)
+ "_"
+ str(args.year_target)
+ ".json"
)
for year_ref in [2018, 2021]:
filepath = os.path.join(test_dir, f"{year_ref}", filename)
update_expectation(
Expand Down
9 changes: 3 additions & 6 deletions tests/end_to_end_expected/README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
End to end test expected results
================================

This directory contains one file per ags it ran for. Those are encoded in the filename: `production_<ags>.json`
This directory contains one file per ags and year combination it ran for. Those are encoded in the filename: `production_<ags>_<year_baseline>_<year_target>.json`
The year of the reference data is encoded in the foldername.

If you want to generate a fresh version of all expected results call 'python devtool.py test_end_to_end update_expectations'.
If you want to create a new expectation file for a new ags call 'python devtool.py test_end_to_end create_expectation -ags <ags>'.

TODO: This currently doesn't handle any other inputs (e.g. year=...) or any of the others
and indeed just adding those to the filename will eventually not scale anymore ;-) But
again a problem for another day.
If you want to create a new expectation file for a new ags call 'python devtool.py test_end_to_end create_expectation -ags <ags> -year_baseline <year_baseline> -year_target <year_target>'.

0 comments on commit d1b1cf6

Please sign in to comment.