Skip to content

Commit

Permalink
Update test_blueprints.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinHeist committed Oct 8, 2023
1 parent 55bf8eb commit 1031cf3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/tests/test_blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,23 @@
# Non-tests

def read_blueprints() -> Iterator[tuple[Path, str, dict]]:
"""
Iterate through and read all defined blueprints.
>>> next(read_blueprints())
(Path('./blueprints/A/Attack on Titan (2013)'), 0, {"series": ...})
Yields:
Tuple of the Path to the series subfolder, the blueprint ID, and
the blueprint JSON (as a dictionary).
"""

# Read all subfolder blueprint files
for blueprint_file in BLUEPRINT_FOLDER.glob('*/*/*/blueprint.json'):
blueprint_id = blueprint_file.parent
series_subfolder = blueprint_file.parent.parent

# Open this Blueprint file, yield objects
with blueprint_file.open('r') as file_handle:
blueprint = json_load(file_handle)
yield series_subfolder, blueprint_id, blueprint
Expand Down

0 comments on commit 1031cf3

Please sign in to comment.