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
def test__load_value_error(): primitive = discovery._load('invalid.primitive', ['a', 'b']) assert primitive is None