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", )
opal.getVerbDobj = takeOpalFunc bench = Surface(game, "bench") bench.can_contain_sitting_player = True bench.can_contain_standing_player = True bench.invItem = False bench.description = "A rough wooden bench sits against the wall. " bench.x_description = ( "The wooden bench is splintering, and faded grey. It looks very old. ") bench.moveTo(startroom) underbench = UnderSpace(game, "space") underbench.contains_preposition = "in" bench.addComposite(underbench) # UnderSpaces that are components of another item are not described if their "description" # attribute is None # This also means that we cannot see what's underneath # Set description to an empty string so we can show what's underneath without # having to print an actual description of the UnderSpace underbench.description = "" underbench.full_name = "space under the bench" box = Container(game, "box") box.giveLid() box.moveTo(underbench) opal.moveTo(box) boxlock = Lock(game, True, silverkey)