コード例 #1
0
    def testStringSyntax(self):
        data = (
            dict(name=u'jim', age=39),
            dict(name=u'kak', age=29),
            dict(name=u'will', age=8),
            dict(name=u'andrew', age=5),
            dict(name=u'chessie',age=2),
            )
        s = u"""
%(in data mapping)[
   %(name)s, %(age)s
%(in)]
"""
        expected = u"""
   jim, 39
   kak, 29
   will, 8
   andrew, 5
   chessie, 2
"""
        result = String(s)(data=data)
        self.assertEqual(result, expected)
コード例 #2
0
    def testStringSyntax(self):
        data = (
            dict(name=u'jim', age=39),
            dict(name=u'kak', age=29),
            dict(name=u'will', age=8),
            dict(name=u'andrew', age=5),
            dict(name=u'chessie',age=2),
            )
        s = u"""
%(in data mapping)[
   %(name)s, %(age)s
%(in)]
"""
        expected = u"""
   jim, 39
   kak, 29
   will, 8
   andrew, 5
   chessie, 2
"""
        result = String(s)(data=data)
        self.assertEqual(result, expected)
コード例 #3
0
    def testMapping(self):
        data = (
            dict(name=u'jim', age=39),
            dict(name=u'kak', age=29),
            dict(name=u'will', age=8),
            dict(name=u'andrew', age=5),
            dict(name=u'chessie',age=2),
            )

        html=u"""
<dtml-in data mapping>
   <dtml-var name>, <dtml-var age>
</dtml-in>
"""
        expected = u"""
   jim, 39
   kak, 29
   will, 8
   andrew, 5
   chessie, 2
"""
        result = self.doc_class(html)(data=data)
        self.assertEqual(result, expected)
コード例 #4
0
    def testMapping(self):
        data = (
            dict(name=u'jim', age=39),
            dict(name=u'kak', age=29),
            dict(name=u'will', age=8),
            dict(name=u'andrew', age=5),
            dict(name=u'chessie',age=2),
            )

        html=u"""
<dtml-in data mapping>
   <dtml-var name>, <dtml-var age>
</dtml-in>
"""
        expected = u"""
   jim, 39
   kak, 29
   will, 8
   andrew, 5
   chessie, 2
"""
        result = self.doc_class(html)(data=data)
        self.assertEqual(result, expected)