def challenge(self, character=None): """ Say only a single random hiragana character. """ if character is None: character = random.choice(japanese.hiragana.keys()) self._currentChallenge = character actor = self._actor() action.Say().do(actor, None, character)
def test_playerSaysCorrectThing(self): """ Test that when someone gives voice to the correct response to a mouse's current challenge, the mouse acknowledges this with a salute. """ self.mousehood.startChallenging() self.reactorTime.advance(self.mousehood.challengeInterval) action.Say().do( # http://divmod.org/trac/ticket/2917 iimaginary.IActor(self.player), None, japanese.hiragana[self.mousehood.getCurrentChallenge()]) self.assertIdentical(self.mousehood.getCurrentChallenge(), None) self.reactorTime.advance(0) self.assertEquals(len(self.playerIntelligence.concepts), 3) c = self.playerIntelligence.concepts[2] self.assertEquals(commandutils.flatten(c.plaintext(self.player)), u"%s salutes you!\n" % (self.mouseName, ))