def test_list_functions(db: RunDBInterface): name = "fn" fn1 = new_func({"l1": "v1", "l2": "v2"}, x=1) db.store_function(fn1, name) fn2 = new_func({"l2": "v2", "l3": "v3"}, x=2) db.store_function(fn2, name, tag="t1") fn3 = new_func({"l3": "v3"}, x=3) db.store_function(fn3, name, tag="t2") funcs = db.list_functions(name, labels={"l2": "v2"}) assert 2 == len(funcs), "num of funcs" assert {1, 2} == {fn["x"] for fn in funcs}, "xs"
def test_list_functions(db: RunDBInterface): name = 'fn' fn1 = new_func({'l1': 'v1', 'l2': 'v2'}, x=1) db.store_function(fn1, name) fn2 = new_func({'l2': 'v2', 'l3': 'v3'}, x=2) db.store_function(fn2, name, tag='t1') fn3 = new_func({'l3': 'v3'}, x=3) db.store_function(fn3, name, tag='t2') funcs = db.list_functions(name, labels={'l2': 'v2'}) assert 2 == len(funcs), 'num of funcs' assert {1, 2} == {fn['x'] for fn in funcs}, 'xs'