def step_impl(context: Context, var: str, type_label: str, key_type: str, key_value: str): context.put( var, next((owner for owner in context.tx().concepts().get_attribute_type( key_type).as_string().as_remote(context.tx()).get( key_value).as_remote(context.tx()).get_owners() if owner.get_type().get_label() == Label.of(type_label)), None))
def step_impl(context: Context, var: str, type_label: str, key_type: str, key_value: str): key = context.tx().concepts().get_attribute_type( key_type).as_string().as_remote(context.tx()).put(key_value) relation = context.tx().concepts().get_relation_type(type_label).as_remote( context.tx()).create() relation.as_remote(context.tx()).set_has(key) context.put(var, relation)
def before_scenario(context: Context, scenario): for database in context.client.databases().all(): database.delete() context.sessions = [] context.sessions_to_transactions = {} context.sessions_parallel = [] context.sessions_to_transactions_parallel = {} context.sessions_parallel_to_transactions_parallel = {} context.tx = lambda: context.sessions_to_transactions[context.sessions[0]][0] context.things = {} context.get = lambda var: context.things[var] context.put = lambda var, thing: _put_impl(context, var, thing) context.get_thing_type = lambda root_label, type_label: _get_thing_type_impl(context, root_label, type_label) context.clear_answers = lambda: _clear_answers_impl(context)
def before_scenario(context: Context, scenario): for tag in IGNORE_TAGS: if tag in scenario.effective_tags: scenario.skip("tagged with @" + tag) return for database in context.client.databases().all(): context.client.databases().delete(database) context.sessions = [] context.sessions_to_transactions = {} context.sessions_parallel = [] context.sessions_to_transactions_parallel = {} context.sessions_parallel_to_transactions_parallel = {} context.tx = lambda: context.sessions_to_transactions[context.sessions[0]][0] context.things = {} context.get = lambda var: context.things[var] context.put = lambda var, thing: _put_impl(context, var, thing) context.get_thing_type = lambda root_label, type_label: _get_thing_type_impl(context, root_label, type_label) context.clear_answers = lambda: _clear_answers_impl(context)
def before_scenario(context: Context, scenario): for database in context.client.databases().all(): database.delete() context.sessions = [] context.sessions_to_transactions = {} context.sessions_parallel = [] context.sessions_to_transactions_parallel = {} context.sessions_parallel_to_transactions_parallel = {} context.tx = lambda: context.sessions_to_transactions[context.sessions[0]][ 0] context.things = {} context.get = lambda var: context.things[var] context.put = lambda var, thing: _put_impl(context, var, thing) context.get_thing_type = lambda root_label, type_label: _get_thing_type_impl( context, root_label, type_label) context.clear_answers = lambda: _clear_answers_impl(context) context.option_setters = { "session-idle-timeout-millis": lambda option, value: option.set_session_idle_timeout_millis(int(value) ), "transaction-timeout-millis": lambda option, value: option.set_transaction_timeout_millis(int(value) ), }
def step_impl(context: Context, var: str, type_label: str): context.put( var, context.tx().concepts().get_relation_type(type_label).as_remote( context.tx()).create())
def step_impl(context: Context, var: str, type_label: str, value: str): context.put(var, context.tx().concepts().get_attribute_type(type_label).as_remote(context.tx()).as_string().put(value))