コード例 #1
0
 def testExpressList(self):
     self.assertEquals(
         self.format(
             language.ExpressList([
                 language.ExpressString(u"foo"), u" ",
                 language.ExpressString(u"bar")
             ])), u"foo bar")
コード例 #2
0
 def do(self, player, line, name):
     srch = player.thing.search(2, iimaginary.IVisible, name)
     evt = events.Success(
         actor=player.thing,
         actorMessage=language.ExpressList(
             list(iterutils.interlace('\n',
                                      (o.visualize() for o in srch)))))
     evt.broadcast()
コード例 #3
0
 def testCapitalization(self):
     self.assertEquals(
         self.format(language.ExpressString(u"foo").capitalizeConcept()),
         u"Foo")
     self.assertEquals(
         self.format(
             language.ExpressList([[[[u"hi"]]]]).capitalizeConcept()),
         u"Hi")
     self.assertEquals(
         self.format(
             language.ItemizedList([u"foo", u"bar",
                                    u"baz"]).capitalizeConcept()),
         u"Foo, bar, and baz")
コード例 #4
0
def _exitAsConcept(exit):
    return language.ExpressList(
        [u'the exit to ', language.Noun(exit.toLocation).nounPhrase()])
コード例 #5
0
 def conceptualize(self):
     return language.ExpressList(
         [u'the exit to ',
          language.Noun(self.toLocation).nounPhrase()])