def test_template_partial_extension(self):
        view = TemplatePartial()
        view.template_extension = 'txt'
        assert_strings(self, view.render(), u"""Welcome
-------

## Again, Welcome! ##""")
    def test_delimiters(self):
        assert_strings(
            self,
            Delimiters().render(), """* It worked the first time.
* And it worked the second time.
* Then, surprisingly, it worked the third time.
""")
    def test_template_partial_extension(self):
        view = TemplatePartial()
        view.template_extension = 'txt'
        assert_strings(self, view.render(), u"""Welcome
-------

## Again, Welcome! ##""")
    def _assert_render(self, expected, template, *context, **kwargs):
        """
        Test rendering the given template using the given context.

        """
        partials = kwargs.get('partials')
        engine = kwargs.get('engine', self._engine())

        if partials is not None:
            engine.load_partial = lambda key: unicode(partials[key])

        context = Context(*context)

        actual = engine.render(template, context)

        assert_strings(test_case=self, actual=actual, expected=expected)
    def _assert_render(self, expected, template, *context, **kwargs):
        """
        Test rendering the given template using the given context.

        """
        partials = kwargs.get('partials')
        engine = kwargs.get('engine', self._engine())

        if partials is not None:
            engine.load_partial = lambda key: unicode(partials[key])

        context = Context(*context)

        actual = engine.render(template, context)

        assert_strings(test_case=self, actual=actual, expected=expected)
Exemple #6
0
    def test_template_partial_extension(self):
        """
        Side note:

        From the spec--

            Partial tags SHOULD be treated as standalone when appropriate.

        In particular, this means that trailing newlines should be removed.

        """
        view = TemplatePartial()
        view.template_extension = 'txt'
        assert_strings(self, view.render(), u"""Welcome
-------

## Again, Welcome! ##""")
    def test_delimiters(self):
        assert_strings(self, Delimiters().render(), """* It worked the first time.
* And it worked the second time.
* Then, surprisingly, it worked the third time.
""")