def get_function_set(cursor, *args): id = first(args) try: return helpers.get_function_set(cursor, id) except helpers.NoSuchFunctionSetError: add_function_set(cursor, *args) return helpers.get_function_set(cursor, id)
def test_get_function_set_2(conn): clear_database(conn) with closing(conn.cursor()) as cursor: entitytype = get_dummy_entitytype(cursor, 42, "dummy_type") src_datasource = get_dummy_datasource(cursor, 3, "dummy-src-1") dst_datasource = get_dummy_datasource(cursor, 4, "dummy-src-2") args = 14, "test_set", [1, 2, 3], [3], 42, 900, 4, entitytype.id, 900, None, [] add_function_set(cursor, *args) function_set = get_function_set(cursor, 14) eq_(function_set.name, 'test_set')
def test_get_function_set_1(conn): clear_database(conn) with closing(conn.cursor()) as cursor: get_function_set(cursor, 12)