Skip to content

Commit

Permalink
Process top level directories in order sample/secret/invalid_{output/…
Browse files Browse the repository at this point in the history
…answer/input}
  • Loading branch information
RagnarGrootKoerkamp authored and thorehusfeldt committed Mar 9, 2024
1 parent d74ee53 commit 074bc71
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion bin/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,26 @@ def parse(key, name, yaml, parent):
for key in dictionary:
check_type('Testcase/directory name', key, [type(None), str], d.path)

for child_key, child_yaml in sorted(dictionary.items()):
# Process named children alphabetically, but not in the root directory.
# There, process in the 'natural order'.
order = [
'sample',
'secret',
'invalid_outputs',
'invalid_answers',
'invalid_inputs',
]
keys = dictionary.keys()
if isinstance(parent, RootDirectory):
keys = sorted(
keys,
key=lambda k: (order.index(k), k) if k in order else (999, k),
)
else:
keys = sorted(keys)

for child_key in keys:
child_yaml = dictionary[child_key]
if d.numbered:
if is_directory(child_yaml):
testgroup_id += 1
Expand Down

0 comments on commit 074bc71

Please sign in to comment.