Ticket #17778: 17778-testcase.patch
File 17778-testcase.patch, 1.0 KB (added by , 13 years ago) |
---|
-
tests/regressiontests/templates/context.py
1 1 # coding: utf-8 2 from django.template import Context 2 from django.template import Context, Variable, VariableDoesNotExist 3 3 from django.utils.unittest import TestCase 4 4 5 5 6 6 class ContextTests(TestCase): 7 7 8 def test_context(self): 8 9 c = Context({"a": 1, "b": "xyzzy"}) 9 10 self.assertEqual(c["a"], 1) … … 14 15 self.assertEqual(c.pop(), {"a": 2}) 15 16 self.assertEqual(c["a"], 1) 16 17 self.assertEqual(c.get("foo", 42), 42) 18 19 def test_resolve_on_context_method(self): 20 # Regression test for #17778 21 empty_context = Context() 22 self.assertRaises(VariableDoesNotExist, 23 Variable('no_such_variable').resolve, empty_context) 24 self.assertRaises(VariableDoesNotExist, 25 Variable('new').resolve, empty_context) 26