import json
from pathlib import Path


def load_test_data(filename: str) -> list:
    """Utility function to load JSON files from 'test_data'"""

    json_file_path = (
        Path(__file__).parent.joinpath("test_data").joinpath(filename).resolve()
    )
    if not json_file_path.exists():
        raise RuntimeError(f"Could not find {filename!r} in 'tests.models.test_data'")

    with open(json_file_path, "r") as handle:
        data = json.load(handle)

    return data