PageRenderTime 81ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 37ms app.codeStats 0ms

/tests/regressiontests/templates/context.py

https://code.google.com/p/mango-py/
Python | 16 lines | 13 code | 2 blank | 1 comment | 0 complexity | 56e40a459382b60c45398af3799a073c MD5 | raw file
 1# coding: utf-8
 2from django.template import Context
 3from django.utils.unittest import TestCase
 4
 5
 6class ContextTests(TestCase):
 7    def test_context(self):
 8        c = Context({"a": 1, "b": "xyzzy"})
 9        self.assertEqual(c["a"], 1)
10        self.assertEqual(c.push(), {})
11        c["a"] = 2
12        self.assertEqual(c["a"], 2)
13        self.assertEqual(c.get("a"), 2)
14        self.assertEqual(c.pop(), {"a": 2})
15        self.assertEqual(c["a"], 1)
16        self.assertEqual(c.get("foo", 42), 42)