Esempio n. 1
0
    def test_look_under(self):
        parent = UnderSpace(self.game, "table")
        child = Thing(self.game, "penny")
        parent.addThing(child)
        parent.moveTo(self.start_room)

        self.game.turnMain("look under table")

        look_under_desc = self.app.print_stack.pop()

        self.assertEqual(
            look_under_desc,
            parent.contains_desc,
            f"Contains desc printed incorrectly. Expected {parent.contains_desc} got "
            f"{look_under_desc}",
        )
Esempio n. 2
0
    def test_composite_object_redirection(self):
        bench = Surface(self.game, "bench")
        self.start_room.addThing(bench)
        underbench = UnderSpace(self.game, "space")
        bench.addComposite(underbench)

        widget = Thing(self.game, "widget")
        underbench.addThing(widget)

        self.game.turnMain("look under bench")
        msg = self.app.print_stack.pop()

        self.assertIn(
            widget.verbose_name,
            msg,
            "Unexpected response attempting to use a component redirection",
        )