Esempio n. 1
0
    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!"])
Esempio n. 2
0
    def test_oneManEnters(self):
        """
        Test that when a fellow jaunts into a venue inhabited by a mouse of the
        Nipponese persuasion, a hiragana allocution follows.
        """
        clock = task.Clock()

        closetContainer = commandutils.createLocation(self.store, u"Closet",
                                                      None)
        closet = closetContainer.thing

        mouse = mice.createHiraganaMouse(store=self.store,
                                         name=self.mouseName,
                                         proper=True)
        mouseActor = iimaginary.IActor(mouse)
        mousehood = mouseActor.getIntelligence()
        mousehood._callLater = clock.callLater
        mouse.moveTo(closet)

        objects.Exit.link(self.location, closet, u"north")

        self._test("north", [
            commandutils.E("[ Closet ]"),
            commandutils.E("( south )"),
            commandutils.E(u"Here, you see " + self.mouseName + u".")
        ], ["Test Player leaves north."])

        clock.advance(mousehood.challengeInterval)

        self._test(None, [self.speechPattern])
Esempio n. 3
0
    def test_oneManEnters(self):
        """
        Test that when a fellow jaunts into a venue inhabited by a mouse of the
        Nipponese persuasion, a hiragana allocution follows.
        """
        clock = task.Clock()

        closetContainer = commandutils.createLocation(
            self.store, u"Closet", None)
        closet = closetContainer.thing

        mouse = mice.createHiraganaMouse(
            store=self.store,
            name=self.mouseName,
            proper=True)
        mouseActor = iimaginary.IActor(mouse)
        mousehood = mouseActor.getIntelligence()
        mousehood._callLater = clock.callLater
        mouse.moveTo(closet)

        objects.Exit.link(self.location, closet, u"north")

        self._test(
            "north",
            [commandutils.E("[ Closet ]"),
             commandutils.E("( south )"),
             commandutils.E(u"Here, you see " + self.mouseName + u".")],
            ["Test Player leaves north."])

        clock.advance(mousehood.challengeInterval)

        self._test(None, [self.speechPattern])
Esempio n. 4
0
 def setUp(self):
     """
     Create a container, C{self.box} that is large enough to stand in.
     """
     CommandTestCaseMixin.setUp(self)
     self.container = createLocation(self.store, u"box", None)
     self.box = self.container.thing
     self.box.proper = False
     self.box.moveTo(self.location)
Esempio n. 5
0
 def setUp(self):
     """
     Create a container, C{self.box} that is large enough to stand in.
     """
     CommandTestCaseMixin.setUp(self)
     self.container = createLocation(self.store, u"box", None)
     self.box = self.container.thing
     self.box.proper = False
     self.box.moveTo(self.location)
Esempio n. 6
0
    def __init__(self):
        self.store = store.Store()

        locContainer = createLocation(
            self.store, name=u"Test Location",
            description=u"Location for testing.")
        self.location = locContainer.thing

        self.world = ImaginaryWorld(store=self.store)
        self.player = self.world.create(u"Test Player", gender=language.Gender.FEMALE)
        locContainer.add(self.player)
        self.actor = iimaginary.IActor(self.player)
        self.actor.setEphemeralIntelligence(TestIntelligence())
Esempio n. 7
0
    def __init__(self):
        self.store = store.Store()

        locContainer = createLocation(self.store,
                                      name=u"Test Location",
                                      description=u"Location for testing.")
        self.location = locContainer.thing

        self.world = ImaginaryWorld(store=self.store)
        self.player = self.world.create(u"Test Player",
                                        gender=language.Gender.FEMALE)
        locContainer.add(self.player)
        self.actor = iimaginary.IActor(self.player)
        self.actor.setEphemeralIntelligence(TestIntelligence())
Esempio n. 8
0
 def test_moveWhenSitting(self):
     """
     A player who is sitting shouldn't be able to move without standing up
     first.
     """
     self.test_sitDown()
     otherRoom = createLocation(self.store, u"elsewhere", None).thing
     Exit.link(self.location, otherRoom, u'north')
     self.assertCommandOutput(
         "go north",
         ["You can't do that while sitting down."])
     self.assertCommandOutput(
         "go south",
         ["You can't go that way."])
Esempio n. 9
0
    def setUp(self):
        self.store = store.Store()

        self.locationContainer = commandutils.createLocation(
            self.store, u"Place", None)
        self.location = self.locationContainer.thing

        self.alice = objects.Thing(store=self.store, name=u"Alice")
        self.actor = objects.Actor.createFor(self.alice)

        self.alice.moveTo(self.location)

        self.intelligence = commandutils.MockIntelligence(store=self.store)
        self.actor.setEnduringIntelligence(self.intelligence)