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())
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))
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)
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)
def setUp(self): mud_context.driver = FakeDriver() mud_context.config = StoryConfig() mud_context.resources = mud_context.driver.resources self.actor = player.Player("julie", "f")
def setUp(self): mud_context.driver = FakeDriver() mud_context.config = StoryConfig() mud_context.resources = mud_context.driver.resources
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
def setUp(self): mud_context.driver = FakeDriver() mud_context.config = DemoStory().config mud_context.resources = mud_context.driver.resources
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
def test_story(self): import tale.demo.story s = tale.demo.story.Story() s._verify(FakeDriver()) self.assertEqual("Tale demo story", s.config.name)