from pathlib import Path
import json


def get_rule_tests(name: str) -> dict:
    """Load a set of JSON rule test assertions.

    # Arguments
    name (str): The name of the test JSON file to open, e.g. "commutative_property"

    # Returns
    (dict): A dictionary with "valid" and "invalid" keys that contain pairs of
    expected inputs and outputs.
    """
    rule_file = Path(__file__).parent / "rules" / f"{name}.test.json"
    if not rule_file.is_file() is True:
        raise ValueError(f"does not exist: {rule_file}")
    with open(rule_file, "r") as file:
        return json.load(file)