Beispiel #1
0
 def test_story_verify(self):
     s = StoryBase()
     with self.assertRaises(StoryConfigError):
         s._verify(FakeDriver())
     s.config.name = "dummy"
     s._verify(FakeDriver())
     s.config = 1234
     with self.assertRaises(StoryConfigError):
         s._verify(FakeDriver())
Beispiel #2
0
 def test_complete_one(self):
     player = Player("fritz", "m")
     driver = FakeDriver()
     conn = PlayerConnection(player)
     io = IoAdapterBase(conn)
     conn.io = io
     self.assertEqual(["criticize"], io.tab_complete("critic", driver))
Beispiel #3
0
 def test_complete_c(self):
     player = Player("fritz", "m")
     driver = FakeDriver()
     conn = PlayerConnection(player)
     io = IoAdapterBase(conn)
     conn.io = io
     result = io.tab_complete("c", driver)
     self.assertGreater(len(result), 20)
     self.assertTrue("cackle" in result)
     self.assertTrue("criticize" in result)
     result = io.tab_complete("h", driver)
     self.assertGreater(len(result), 10)
     self.assertTrue("hiss" in result)
Beispiel #4
0
 def testCallable(self):
     def scoped_function():
         pass
     t = Thing()
     due = datetime.datetime.now()
     d = tale.driver.Deferred(due, t.append, [42], None)
     ctx = tale.util.Context(driver=FakeDriver(), clock=None, config=None, player_connection=None)
     d(ctx=ctx)
     self.assertEqual([42], t.x)
     d = tale.driver.Deferred(due, module_level_func, [], None)
     d(ctx=ctx)
     d = tale.driver.Deferred(due, module_level_func_without_ctx, [], None)
     d(ctx=ctx)
     with self.assertRaises(ValueError):
         tale.driver.Deferred(due, scoped_function, [], None)
     with self.assertRaises(ValueError):
         d = tale.driver.Deferred(due, lambda a, ctx=None: 1, [42], None)
Beispiel #5
0
 def setUp(self):
     mud_context.driver = FakeDriver()
     mud_context.config = StoryConfig()
     mud_context.resources = mud_context.driver.resources
     self.actor = player.Player("julie", "f")
Beispiel #6
0
 def setUp(self):
     mud_context.driver = FakeDriver()
     mud_context.config = StoryConfig()
     mud_context.resources = mud_context.driver.resources
Beispiel #7
0
 def setUp(self):
     tale.mud_context.driver = FakeDriver()
     tale.mud_context.config = StoryConfig()
     tale.mud_context.config.server_mode = GameMode.IF
     tale.mud_context.resources = tale.mud_context.driver.resources
Beispiel #8
0
 def setUp(self):
     mud_context.driver = FakeDriver()
     mud_context.config = DemoStory().config
     mud_context.resources = mud_context.driver.resources
Beispiel #9
0
 def setUp(self):
     self.verbs = tale.verbdefs.VERBS.copy()
     sys.path.insert(0, str(self.directory))
     mud_context.driver = FakeDriver()
     mud_context.config = StoryConfig()
     mud_context.resources = mud_context.driver.resources
Beispiel #10
0
 def test_story(self):
     import tale.demo.story
     s = tale.demo.story.Story()
     s._verify(FakeDriver())
     self.assertEqual("Tale demo story", s.config.name)