def actor(): # Reset the counter global COUNTER COUNTER = 0 # Construct the actor a = Actor() a.knows(call_interaction, wait, wait_on_question) return a
def on(actor, question, **q_args): validate_question(question) on_actor = Actor() on_actor.knows(actor, call_interaction, to, to_condition) on_actor.knows(on_question=question, on_question_args=q_args) return on_actor
def wait(actor, timeout=30, interval=1): wait_actor = Actor() wait_actor.knows(actor, call_interaction, on, on_question) wait_actor.knows(timeout=timeout, interval=interval) return wait_actor
def test_initial_actor_knows_another_actor(actor): other = Actor() other.knows(be_cool, go_super_saiyan, be, contain, do_it, whip_it_good, try_things, shout) actor = Actor(other) assert_all_functions(actor)
def test_initial_actor_knows_module(actor): actor = Actor(sys.modules[__name__]) assert_all_functions(actor)
def test_initial_actor_knows_multiples(): actor = Actor(be_cool, go_super_saiyan, be, contain, do_it, whip_it_good, try_things, shout) assert_all_functions(actor)
def test_initial_actor_knows_sayings(): actor = Actor(try_things) assert len(actor.sayings) == 1 assert actor.sayings['try_things'] == try_things
def test_initial_actor_knows_interactions(): actor = Actor(do_it) assert len(actor.interactions) == 1 assert actor.interactions['do_it'] == do_it
def test_initial_actor_knows_conditions(): actor = Actor(be) assert len(actor.conditions) == 1 assert actor.conditions['be'] == be
def test_initial_actor_knows_abilities(): actor = Actor(be_cool) assert len(actor.abilities) == 1 assert actor.abilities['be_cool'] == be_cool
def test_initial_actor_knows_traits(): actor = Actor(a=1, b=2) assert len(actor.traits) == 2 assert actor.traits['a'] == 1 assert actor.traits['b'] == 2
def actor(): """Creates an Actor instance with an empty context.""" return Actor()
def init_actor(): return Actor(call_ability, ask_question, call_interaction, traditional_screenplay)