def testSqueak(self): """ Test that when someone walks into a room with a mouse, the mouse squeaks and the person who walked in hears it. """ mouse = mice.createMouse(store=self.store, name=u"squeaker") clock = task.Clock() intelligence = iimaginary.IActor(mouse).getIntelligence() intelligence._callLater = clock.callLater elsewhere = objects.Thing(store=self.store, name=u"Mouse Hole") objects.Container.createFor(elsewhere, capacity=1000) objects.Exit.link(self.location, elsewhere, u"south") mouse.moveTo(elsewhere) self._test( "south", [commandutils.E("[ Mouse Hole ]"), commandutils.E("( north )"), commandutils.E("a squeaker")], ['Test Player leaves south.']) clock.advance(0) self._test(None, ["SQUEAK!"])
def testSqueak(self): """ Test that when someone walks into a room with a mouse, the mouse squeaks and the person who walked in hears it. """ mouse = mice.createMouse(store=self.store, name=u"squeaker") clock = task.Clock() intelligence = iimaginary.IActor(mouse).getIntelligence() intelligence._callLater = clock.callLater elsewhere = commandutils.createLocation( self.store, u"Mouse Hole", None).thing objects.Exit.link(self.location, elsewhere, u"south") mouse.moveTo(elsewhere) self._test( "south", [commandutils.E("[ Mouse Hole ]"), commandutils.E("( north )"), commandutils.E("Here, you see a squeaker.")], ['Test Player leaves south.']) clock.advance(0) self._test(None, ["SQUEAK!"])
def setUp(self): self.store = store.Store() self.clock = objects.Thing(store=self.store, name=u"Clock") self.clockContainer = objects.Container.createFor(self.clock, capacity=10) self.mouse = mice.createMouse(store=self.store, name=u"Squeaker McSqueakenson") self.mouseActor = iimaginary.IActor(self.mouse) self.mousehood = self.mouseActor.getIntelligence() self.mouse.moveTo(self.clock) self.player = objects.Thing(store=self.store, name=u"Mean Old Man") self.playerActor = objects.Actor.createFor(self.player) self.playerIntelligence = commandutils.MockIntelligence( store=self.store) self.playerActor.setEnduringIntelligence(self.playerIntelligence) self.player.moveTo(self.clock)