コード例 #1
0
    def test_3(self):
        self.folder.laf.write(util.read_input('teeshoplaf.html'))

        t = self.folder.t
        t.write(util.read_input('teeshop1.html'))
        expect = util.read_output('teeshop1.html')
        out = t(laf = self.folder.laf, getProducts = self.getProducts)
        util.check_html(expect, out)
コード例 #2
0
    def test_3(self):
        self.folder.laf.write(util.read_input('teeshoplaf.html'))

        t = self.folder.t
        t.write(util.read_input('teeshop1.html'))
        expect = util.read_output('teeshop1.html')
        out = t(laf=self.folder.laf, getProducts=self.getProducts)
        util.check_html(expect, out)
コード例 #3
0
    def test_translation(self):
        from zope.i18nmessageid import MessageFactory
        _ = MessageFactory('pttest')
        msg = _("Translate this!")

        t = self.folder.t
        t.write(util.read_input('translation.html'))
        expect = util.read_output('translation.html')
        out = t(msg=msg)
        util.check_html(expect, out)
コード例 #4
0
    def test_translation(self):
        from zope.i18nmessageid import MessageFactory
        _ = MessageFactory('pttest')
        msg = _("Translate this!")

        t = self.folder.t
        t.write(util.read_input('translation.html'))
        expect = util.read_output('translation.html')
        out = t(msg=msg)
        util.check_html(expect, out)
コード例 #5
0
 def test_recursion(self):
     t = self.folder.t
     t.write(util.read_input('recursive.html'))
     expect = util.read_output('recursive.html')
     context = dict(name='root',
                    children=[dict(name='first', children=[]),
                              dict(name='second', children=[])])
     namespace = dict(template=t, options={}, args=(),
                      nothing=None, context=context)
     out = t.pt_render(namespace)
     # crude way of normalizing whitespace
     expect = expect.replace(' ', '').replace('\n\n', '\n')
     out = out.replace(' ', '').replace('\n\n', '\n')
     util.check_html(expect, out)
     # https://bugs.launchpad.net/zope.pagetemplate/+bug/732972
     errors = t.pt_errors(namespace, check_macro_expansion=False)
     self.assertFalse(errors)
コード例 #6
0
 def test_recursion(self):
     t = self.folder.t
     t.write(util.read_input('recursive.html'))
     expect = util.read_output('recursive.html')
     context = dict(name='root',
                    children=[
                        dict(name='first', children=[]),
                        dict(name='second', children=[])
                    ])
     namespace = dict(template=t,
                      options={},
                      args=(),
                      nothing=None,
                      context=context)
     out = t.pt_render(namespace)
     # crude way of normalizing whitespace
     expect = expect.replace(' ', '').replace('\n\n', '\n')
     out = out.replace(' ', '').replace('\n\n', '\n')
     util.check_html(expect, out)
     # https://bugs.launchpad.net/zope.pagetemplate/+bug/732972
     errors = t.pt_errors(namespace, check_macro_expansion=False)
     self.assertFalse(errors)
コード例 #7
0
 def test_ReplaceWithNothing(self):
     t = self.folder.t
     t.write(util.read_input('checknothing.html'))
     expect = util.read_output('checknothing.html')
     out = t()
     util.check_html(expect, out)
コード例 #8
0
 def test_1(self):
     laf = self.folder.laf
     laf.write(util.read_input('teeshoplaf.html'))
     expect = util.read_output('teeshoplaf.html')
     util.check_html(expect, laf())
コード例 #9
0
 def test_PathAlt(self):
     t = self.folder.t
     t.write(util.read_input('checkpathalt.html'))
     expect = util.read_output('checkpathalt.html')
     out = t()
     util.check_html(expect, out)
コード例 #10
0
 def test_NotExpression(self):
     t = self.folder.t
     t.write(util.read_input('checknotexpression.html'))
     expect = util.read_output('checknotexpression.html')
     out = t()
     util.check_html(expect, out)
コード例 #11
0
 def test_PathAlt(self):
     t = self.folder.t
     t.write(util.read_input('checkpathalt.html'))
     expect = util.read_output('checkpathalt.html')
     out = t()
     util.check_html(expect, out)
コード例 #12
0
 def test_StringExpressions(self):
     t = self.folder.t
     t.write(util.read_input('stringexpression.html'))
     expect = util.read_output('stringexpression.html')
     out = t()
     util.check_html(expect, out)
コード例 #13
0
 def test_NotExpression(self):
     t = self.folder.t
     t.write(util.read_input('checknotexpression.html'))
     expect = util.read_output('checknotexpression.html')
     out = t()
     util.check_html(expect, out)
コード例 #14
0
 def test_SimpleLoop(self):
     t = self.folder.t
     t.write(util.read_input('loop1.html'))
     expect = util.read_output('loop1.html')
     out = t()
     util.check_html(expect, out)
コード例 #15
0
 def test_StringExpressions(self):
     t = self.folder.t
     t.write(util.read_input('stringexpression.html'))
     expect = util.read_output('stringexpression.html')
     out = t()
     util.check_html(expect, out)
コード例 #16
0
 def test_GlobalsShadowLocals(self):
     t = self.folder.t
     t.write(util.read_input('globalsshadowlocals.html'))
     expect = util.read_output('globalsshadowlocals.html')
     out = t()
     util.check_html(expect, out)
コード例 #17
0
 def test_SimpleLoop(self):
     t = self.folder.t
     t.write(util.read_input('loop1.html'))
     expect = util.read_output('loop1.html')
     out = t()
     util.check_html(expect, out)
コード例 #18
0
 def test_1(self):
     laf = self.folder.laf
     laf.write(util.read_input('teeshoplaf.html'))
     expect = util.read_output('teeshoplaf.html')
     util.check_html(expect, laf())
コード例 #19
0
 def test_GlobalsShadowLocals(self):
     t = self.folder.t
     t.write(util.read_input('globalsshadowlocals.html'))
     expect = util.read_output('globalsshadowlocals.html')
     out = t()
     util.check_html(expect, out)
コード例 #20
0
 def test_WithXMLHeader(self):
     t = self.folder.t
     t.write(util.read_input('checkwithxmlheader.html'))
     expect = util.read_output('checkwithxmlheader.html')
     out = t()
     util.check_html(expect, out)
コード例 #21
0
 def test_ReplaceWithNothing(self):
     t = self.folder.t
     t.write(util.read_input('checknothing.html'))
     expect = util.read_output('checknothing.html')
     out = t()
     util.check_html(expect, out)
コード例 #22
0
 def test_WithXMLHeader(self):
     t = self.folder.t
     t.write(util.read_input('checkwithxmlheader.html'))
     expect = util.read_output('checkwithxmlheader.html')
     out = t()
     util.check_html(expect, out)