Exemple #1
0
    def test_rendering_partial(self):
        view = TemplatePartial()
        view.template = '{{>inner_partial}}'
        self.assertEquals(view.render(), 'Again, Welcome!')

        view.template = '{{#looping}}{{>inner_partial}} {{/looping}}'
        self.assertEquals(view.render(), '''Again, Welcome! Again, Welcome! Again, Welcome! ''')
    def test_template_partial_extension(self):
        view = TemplatePartial()
        view.template_extension = 'txt'
        assert_strings(self, view.render(), u"""Welcome
-------

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

## Again, Welcome! ##""")
Exemple #4
0
    def test_template_partial_extension(self):
        view = TemplatePartial()
        view.template_extension = 'txt'
        self.assertEquals(view.render(), """Welcome
-------

Again, Welcome!
""")
    def test_template_partial_extension(self):
        view = TemplatePartial()
        view.template_extension = 'txt'
        self.assertEquals(view.render(), """Welcome
-------

Again, Welcome!
""")
    def test_partial_in_partial_has_access_to_grand_parent_context(self):
        view = TemplatePartial(context = {'prop': 'derp'})
        view.template = '''{{>partial_in_partial}}'''
        self.assertEquals(view.render(), 'Hi derp!')

	def test_existential_list(self):
		self.assertEquals(MaybeEmpty([{"name":"this"},{"name":"that"}]).render(), "<h1>Things</h1><ul><li>this</li><li>that</li></ul>")
		self.assertEquals(MaybeEmpty([]).render(), "")
Exemple #7
0
    def test_template_partial_extension(self):
        view = TemplatePartial()
        view.template_extension = "txt"
        self.assertEquals(
            view.render(),
            """Welcome
-------

## Again, Welcome! ##

""",
        )
Exemple #8
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_partial_in_partial_has_access_to_grand_parent_context(self):
     view = TemplatePartial(context = {'prop': 'derp'})
     view.template = '''{{>partial_in_partial}}'''
     self.assertEquals(view.render(), 'Hi derp!')
 def test_partial_in_partial_has_access_to_grand_parent_context(self):
     view = TemplatePartial(context={"prop": "derp"})
     view.template = """{{>partial_in_partial}}"""
     self.assertEquals(view.render(), "Hi derp!")
Exemple #11
0
 def test_partial_in_partial_has_access_to_grand_parent_context(self):
     view = TemplatePartial(context = {'prop': 'derp'})
     view.template = '''{{>partial_in_partial}}'''
     self.assertEquals(view.render(), 'Hi derp!')