def step_impl(context: Context): names = parse_list(context.table) assert_that(len(names), is_(less_than_or_equal_to(context.THREAD_POOL_SIZE))) with ThreadPoolExecutor(max_workers=context.THREAD_POOL_SIZE) as executor: for name in names: executor.submit(partial(context.client.databases().create, name))
def step_impl(context: Context): database_names = parse_list(context.table) assert_that(context.sessions_parallel, has_length(equal_to(len(database_names)))) future_session_iter = iter(context.sessions_parallel) for name in database_names: assert_that(next(future_session_iter).result().database(), is_(name))
def step_impl(context: Context, type_label: str): owner_labels = parse_list(context.table) attribute_type = context.tx().concepts().get_attribute_type(type_label) actuals = list( map(lambda tt: tt.get_label(), attribute_type.as_remote(context.tx()).get_owners(only_key=False))) for owner_label in owner_labels: assert_that(actuals, not_(has_item(owner_label)))
def step_impl(context: Context, root_label: RootLabel, type_label: str): role_labels = [parse_label(s) for s in parse_list(context.table)] actuals = [ t.get_label() for t in context.get_thing_type( root_label, type_label).as_remote(context.tx()).get_plays() ] for role_label in role_labels: assert_that(role_label, not_(is_in(actuals)))
def step_impl(context: Context, root_label: RootLabel, type_label: str): attribute_labels = [parse_label(s) for s in parse_list(context.table)] actuals = [ t.get_label() for t in context.get_thing_type( root_label, type_label).as_remote(context.tx()).get_owns() ] for attribute_label in attribute_labels: assert_that(actuals, not_(has_item(attribute_label)))
def step_impl(context: Context, root_label: RootLabel, type_label: str): sub_labels = [parse_label(s) for s in parse_list(context.table)] actuals = [ t.get_label() for t in context.get_thing_type( root_label, type_label).as_remote(context.tx()).get_subtypes() ] for sub_label in sub_labels: assert_that(actuals, has_item(sub_label))
def step_impl(context: Context): types = list(map(parse_transaction_type, parse_list(context.table))) for session in context.sessions: future_transactions = context.sessions_to_transactions_parallel[session] assert_that(future_transactions, has_length(len(types))) future_transactions_iter = iter(future_transactions) for type_ in types: assert_that(next(future_transactions_iter).result().transaction_type(), is_(type_))
def step_impl(context: Context): types = list(map(parse_transaction_type, parse_list(context.table))) assert_that(len(types), is_(less_than_or_equal_to(context.THREAD_POOL_SIZE))) with ThreadPoolExecutor(max_workers=context.THREAD_POOL_SIZE) as executor: for session in context.sessions: context.sessions_to_transactions_parallel[session] = [] for type_ in types: context.sessions_to_transactions_parallel[session].append(executor.submit(partial(session.transaction, type_)))
def step_impl(context: Context, type_label: str, value_type: str): sub_labels = parse_list(context.table) attribute_type = attribute_type_as_value_type(context, type_label, parse_value_type(value_type)) actuals = list( map(lambda tt: tt.get_label(), attribute_type.as_remote(context.tx()).get_subtypes())) for sub_label in sub_labels: assert_that(sub_label, is_in(actuals))
def step_impl(context: Context): sub_labels = [parse_label(s) for s in parse_list(context.table)] actuals = [ t.get_label() for t in context.tx().concepts().get_root_thing_type().as_remote( context.tx()).get_subtypes() ] for sub_label in sub_labels: assert_that(sub_label, not_(is_in(actuals)))
def step_impl(context: Context, root_label: RootLabel, type_label: str): role_labels = parse_list(context.table) actuals = list( map( lambda t: t.get_scoped_label(), context.get_thing_type(root_label, type_label).as_remote( context.tx()).get_plays())) for role_label in role_labels: assert_that(role_label, not_(is_in(actuals)))
def step_impl(context: Context): super_labels = parse_list(context.table) actuals = list( map( lambda t: t.get_label(), context.tx().concepts().get_root_thing_type().as_remote( context.tx()).get_subtypes())) for super_label in super_labels: assert_that(super_label, not_(is_in(actuals)))
def step_impl(context: Context, root_label: RootLabel, type_label: str): sub_labels = parse_list(context.table) actuals = list( map( lambda t: t.get_label(), context.get_thing_type(root_label, type_label).as_remote( context.tx()).get_subtypes())) for sub_label in sub_labels: assert_that(sub_label, is_in(actuals))
def step_impl(context: Context, root_label: RootLabel, type_label: str): attribute_labels = parse_list(context.table) actuals = list( map( lambda t: t.get_label(), context.get_thing_type(root_label, type_label).as_remote( context.tx()).get_owns())) for attribute_label in attribute_labels: assert_that(attribute_label, not_(is_in(actuals)))
def step_impl(context: Context): names = parse_list(context.table) assert_that(len(names), is_(less_than_or_equal_to(context.THREAD_POOL_SIZE))) with ThreadPoolExecutor(max_workers=context.THREAD_POOL_SIZE) as executor: for name in names: context.sessions_parallel.append( executor.submit( partial(context.client.session, name, SessionType.DATA)))
def step_impl(context: Context, relation_label: str, role_label: str): sub_labels = [parse_label(s) for s in parse_list(context.table)] actuals = get_actual_related_role_subtypes_scoped_labels( context, relation_label, role_label) for sub_label in sub_labels: assert_that(actuals, not_(has_item(sub_label)))
def step_impl(context: Context, relation_label: str, role_label: str): player_labels = [parse_label(s) for s in parse_list(context.table)] actuals = get_actual_related_role_players_scoped_labels( context, relation_label, role_label) for player_label in player_labels: assert_that(actuals, has_item(player_label))
def step_impl(context: Context): open_transactions_of_type_throws_exception(context, list(map(lambda raw_type: parse_transaction_type(raw_type), parse_list(context.table))))
def step_impl(context: Context): transaction_types = list(map(parse_transaction_type, parse_list(context.table))) for_each_session_open_transaction_of_type(context, transaction_types)
def step_impl(context: Context): does_not_have_databases(context, names=parse_list(context.table))
def step_impl(context: Context, relation_label: str, role_label: str): super_labels = parse_list(context.table) actuals = get_actual_related_role_supertypes_scoped_labels( context, relation_label, role_label) for super_label in super_labels: assert_that(actuals, has_item(super_label))
def step_impl(context: Context): database_names = parse_list(context.table) sessions_have_databases(context, database_names)
def step_impl(context: Context): names = parse_list(context.table) create_databases(context, names)
def step_impl(context: Context): delete_databases(context, names=parse_list(context.table))
def step_impl(context: Context): delete_databases_throws_exception(context, names=parse_list(context.table))
def step_impl(context: Context): names = parse_list(context.table) open_sessions_for_databases(context, names, DATA)
def step_impl(context: Context, relation_label: str): role_labels = parse_list(context.table) actuals = get_actual_related_role_scoped_labels(context, relation_label) for role_label in role_labels: assert_that(actuals, not_(has_item(role_label)))