def new_agent(currentAgent, stepInitFn=None, traceFn=None): """initialize a new agent. if the step init functions are passed in, the debugger will also be initialized.""" if currentAgent is not None: currentAgent.stop_executor() get_step_controller().step() #to break the step lock agent = Agent("A") # Keep a reference to this agent for ease of debugging global _AGENT _AGENT = agent agent.start_executor() if stepInitFn and traceFn: init_trace(agent, stepInitFn, traceFn) else: if not (not stepInitFn and not traceFn): raise AssertionError, \ "new_agent: Either zero or both of stepInitFn and traceFn must be specified" return agent
def new_agent(currentAgent, stepInitFn=None, traceFn=None): """initialize a new agent. if the step init functions are passed in, the debugger will also be initialized.""" if currentAgent is not None: currentAgent.stop_executor() get_step_controller().step() # to break the step lock agent = Agent("A") # Keep a reference to this agent for ease of debugging global _AGENT _AGENT = agent agent.start_executor() if stepInitFn and traceFn: init_trace(agent, stepInitFn, traceFn) else: if not (not stepInitFn and not traceFn): raise AssertionError, "new_agent: Either zero or both of stepInitFn and traceFn must be specified" return agent
#*****************************************************************************# #* "$Revision:: 26 $" *# #* "$HeadURL:: https://svn.ai.sri.com/projects/spark/trunk/spark/src/spar#$" *# #*****************************************************************************# import unittest import sys import setrootlevel setrootlevel.setrootlevel(2) from spark.internal.version import * from spark.internal.exception import Error, FailFailure, TestFailure from spark.internal.engine.agent import Agent, SUCCESS agent = Agent("Test") agent.start_executor() class PredExprsTestCase(unittest.TestCase): def runTest(self): self.testSimple() self.testPredClosure() self.testTask() def eval_eq(self, str1, str2): modname = "spark.tests.test_predexprs" val1 = agent.eval(str1, modname) val2 = agent.eval(str2, modname) self.failUnlessEqual(val1, val2) def invalid_val(self, valexpr, class_):
def new_agent(): """starts up the SPARK agent that we use to parse the modules""" global testagent testagent = Agent("A")
#*****************************************************************************# #* "$Revision:: 26 $" *# #* "$HeadURL:: https://svn.ai.sri.com/projects/spark/trunk/spark/src/spar#$" *# #*****************************************************************************# import unittest import sys import setrootlevel setrootlevel.setrootlevel(2) from spark.internal.version import * from spark.internal.exception import Error, FailFailure, TestFailure from spark.internal.engine.agent import Agent, SUCCESS agent = Agent("Test") agent.start_executor() class PredExprsTestCase(unittest.TestCase): def runTest(self): self.testSimple() self.testPredClosure() self.testTask() def eval_eq(self, str1, str2): modname = "spark.tests.test_predexprs" val1 = agent.eval(str1, modname) val2 = agent.eval(str2, modname) self.failUnlessEqual(val1, val2)