PageRenderTime 36ms CodeModel.GetById 12ms RepoModel.GetById 1ms 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
Possible License(s): BSD-3-Clause
  1. # coding: utf-8
  2. from django.template import Context
  3. from django.utils.unittest import TestCase
  4. class ContextTests(TestCase):
  5. def test_context(self):
  6. c = Context({"a": 1, "b": "xyzzy"})
  7. self.assertEqual(c["a"], 1)
  8. self.assertEqual(c.push(), {})
  9. c["a"] = 2
  10. self.assertEqual(c["a"], 2)
  11. self.assertEqual(c.get("a"), 2)
  12. self.assertEqual(c.pop(), {"a": 2})
  13. self.assertEqual(c["a"], 1)
  14. self.assertEqual(c.get("foo", 42), 42)