示例#1
0
def create_space(exec_key):
    space = Space("test space", exec_key=exec_key)
    newton = create_newton()
    space += newton
    space += create_hardy()
    space += create_leibniz()
    return space, newton
示例#2
0
 def test_location(self):
     """
     Test that an added agent has a location.
     """
     n = create_newton()
     self.space += n
     self.assertTrue(self.space.get_agent_at(n.pos[X], n.pos[Y]) == n)
示例#3
0
 def test_tcall(self):
     # need special env for this one
     env = Env("Test env",
               members=[create_newton()],
               exec_key=self.exec_key)
     acts = run(self.test_user, test_run=True)
     self.assertEqual(acts, DEF_STEPS)
示例#4
0
 def setUp(self):
     self.exec_key = get_exec_key()
     self.hardy = create_hardy()
     self.newton = create_newton()
     self.calc = create_calcguys(self.exec_key, members=[self.newton, create_leibniz()])
     self.camb = create_cambguys(self.exec_key)
     self.mathgrp = create_mathgrp(self.exec_key, members=[self.calc,
                                                           self.camb])
示例#5
0
 def setUp(self):
     self.exec_key = get_exec_key()
     self.newton = create_newton()
     self.calcs = create_calcguys(self.exec_key, [])
     self.cambs = create_cambguys(self.exec_key)
     self.pop_hist = PopHist()
     self.model = Model(exec_key=self.exec_key)
     self.env = self.model.env
     self.env.action = env_action
示例#6
0
 def test_iadd(self):
     # let's make sure set union does not dupe members:
     self.camb += self.camb
     self.assertEqual(create_mem_str(self.camb), HR)
     # now test adding new members:
     self.camb += create_cambguys2()
     self.assertEqual(create_mem_str(self.camb), HR + LR)
     # now test adding an atomic entity:
     self.camb += create_newton()
     self.assertEqual(create_mem_str(self.camb), HR + LR + N)
示例#7
0
def create_teeny_space(exec_key):
    """
    This space should be full!
    """
    space = Space("test space", 2, 2, exec_key=exec_key)
    space += create_newton()
    space += create_hardy()
    space += create_leibniz()
    space += create_ramanujan()
    return space