File: test_template_rendering.py

package info (click to toggle)
python-django-extensions 4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,820 kB
  • sloc: python: 18,601; javascript: 7,354; makefile: 108; xml: 17
file content (20 lines) | stat: -rw-r--r-- 537 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.template import Context, Template


class TemplateRenderingTests(TestCase):
    def setUp(self):
        self.ctx = Context(
            {
                "worldvar": "world",
            }
        )

    def test_simple_template(self):
        self.assertEqual(Template("hello world").render(self.ctx), "hello world")

    def test_simple_context(self):
        self.assertEqual(
            Template("hello {{ worldvar }}").render(self.ctx), "hello world"
        )