~exarkun/divmod.org/remove-nevow

« back to all changes in this revision

Viewing changes to Imaginary/ExampleGame/examplegame/test/test_mice.py

Display the contents of different kinds of containers differently.

This introduces the `ConceptTemplate` helper for which different kinds of containers
may supply different template strings.  This allows the expression of the contents of
different containers to result in different text.

This change introduces templates for several common container types already supported
in Imaginary: locations, actors, and box-style things.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
    def setUp(self):
15
15
        self.store = store.Store()
16
16
 
17
 
        self.location = objects.Thing(store=self.store, name=u"Place")
18
 
        self.locationContainer = objects.Container.createFor(self.location, capacity=1000)
 
17
        self.locationContainer = commandutils.createLocation(
 
18
            self.store, u"Place", None)
 
19
        self.location = self.locationContainer.thing
19
20
 
20
21
        self.alice = objects.Thing(store=self.store, name=u"Alice")
21
22
        self.actor = objects.Actor.createFor(self.alice)
136
137
        intelligence = iimaginary.IActor(mouse).getIntelligence()
137
138
        intelligence._callLater = clock.callLater
138
139
 
139
 
        elsewhere = objects.Thing(store=self.store, name=u"Mouse Hole")
140
 
        objects.Container.createFor(elsewhere, capacity=1000)
 
140
        elsewhere = commandutils.createLocation(
 
141
            self.store, u"Mouse Hole", None).thing
141
142
 
142
143
        objects.Exit.link(self.location, elsewhere, u"south")
143
144
 
147
148
            "south",
148
149
            [commandutils.E("[ Mouse Hole ]"),
149
150
             commandutils.E("( north )"),
150
 
             commandutils.E("a squeaker")],
 
151
             commandutils.E("Here, you see a squeaker.")],
151
152
            ['Test Player leaves south.'])
152
153
 
153
154
        clock.advance(0)