How to use the mlblocks.discovery._load function in mlblocks

To help you get started, we’ve selected a few mlblocks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HDI-Project / MLBlocks / tests / test_discovery.py View on Github external
def test__load_success():
    primitive = {
        'name': 'temp.primitive',
        'primitive': 'temp.primitive'
    }

    with tempfile.TemporaryDirectory() as tempdir:
        paths = [tempdir]
        primitive_path = os.path.join(tempdir, 'temp.primitive.json')
        with open(primitive_path, 'w') as primitive_file:
            json.dump(primitive, primitive_file, indent=4)

        loaded = discovery._load('temp.primitive', paths)

        assert primitive == loaded
github HDI-Project / MLBlocks / tests / test_discovery.py View on Github external
def test__load_value_error():
    primitive = discovery._load('invalid.primitive', ['a', 'b'])

    assert primitive is None