Fixed #21765 -- Added support for comparing Context instances

This commit is contained in:
Marek Wywiał 2014-02-15 13:45:52 +01:00 committed by Baptiste Mispelon
parent 985ae732b2
commit d97bf2e9c8
3 changed files with 28 additions and 0 deletions

View file

@ -1928,6 +1928,19 @@ class RequestContextTests(unittest.TestCase):
# [builtins, supplied context, context processor]
self.assertEqual(len(ctx.dicts), 3)
@override_settings(TEMPLATE_CONTEXT_PROCESSORS=())
def test_context_comparable(self):
test_data = {'x': 'y', 'v': 'z', 'd': {'o': object, 'a': 'b'}}
# test comparing RequestContext to prevent problems if somebody
# adds __eq__ in the future
request = RequestFactory().get('/')
self.assertEquals(
RequestContext(request, dict_=test_data),
RequestContext(request, dict_=test_data)
)
class SSITests(TestCase):
def setUp(self):