Skip to content

testing/__init__

Full documentation pages are generated for docstring reference only and may contain symbols imported from other modules. Imported symbols are not distinguished from locally defined symbols and will appear in any module that they are imported into. For better information on where symbols should be imported from, review the sourcecode on the github.

FoSpy._dev.testing

REGISTRY module-attribute

REGISTRY = {(t.__name__): t for t, _ in (TESTS.values())}

REV_REGISTRY module-attribute

REV_REGISTRY = {v: k for k, v in (REGISTRY.items())}

TESTS module-attribute

TESTS = {
    "Validate a Synthesis File": (
        load_test,
        {"Open Results?": ("open_result", False)},
    ),
    "Map a JSON to A Synthesis and Validate": (
        map_test,
        {
            "Open Results?": ("open_result", False),
            "Change Map Name": ("map_name", "default"),
            "Add New Map?": ("make_new", False),
            "Include Missing Values?": (
                "new_missing",
                False,
            ),
            "Set New Map As Default?": (
                "new_default",
                False,
            ),
        },
    ),
}

main

main(test=None, **args)
Source code in FoSpy/_dev/testing/__init__.py
def main(test=None, **args):
    from .ui import get_test, get_options

    if test is None:
        while get_test(**args):
            pass
        return False

    else:
        test = REGISTRY.get(test, None)
        if test is None:
            raise ValueError(f"Unknown test name {test}")

        for name, (t, options) in TESTS.items():
            if test == t:
                if not args:
                    args = get_options(options, name)
                    if args is None:
                        return True
                    elif not args:
                        return False

                return test.run(**args)

        raise ValueError(f"Could not find arguments for {test.__name__}")