Beispiel #1
0
 def test_tell(self):
     rat = MsgTraceNPC("rat", "n", "rodent")
     self.assertTrue(rat._init_called,
                     "init() must be called from __init__")
     julie = MsgTraceNPC("julie", "f", "human")
     hall = Location("hall")
     hall.livings = [rat, julie]
     hall.tell("roommsg")
     self.assertEqual(["roommsg"], rat.messages)
     self.assertEqual(["roommsg"], julie.messages)
     rat.clearmessages()
     julie.clearmessages()
     hall.tell("roommsg", rat, [julie], "juliemsg")
     self.assertEqual([], rat.messages)
     self.assertEqual(["juliemsg"], julie.messages)
Beispiel #2
0
 def test_others(self):
     attic = Location("Attic", "A dark attic.")
     player = Player("merlin", "m")
     player.title = "wizard Merlin"
     julie = MsgTraceNPC("julie", "f", "human")
     fritz = MsgTraceNPC("fritz", "m", "human")
     julie.move(attic, silent=True)
     fritz.move(attic, silent=True)
     player.move(attic, silent=True)
     player.tell_others("one", "two", "three")
     self.assertEqual([], player.test_get_output_paragraphs())
     self.assertEqual(["one", "two", "three"], fritz.messages)
     self.assertEqual(["one", "two", "three"], julie.messages)
     fritz.clearmessages()
     julie.clearmessages()
     player.tell_others("{title} and {Title}")
     self.assertEqual(["wizard Merlin and Wizard Merlin"], fritz.messages)