diff options
| author | Carl Meyer <carl@oddbird.net> | 2012-01-31 19:23:09 +0000 |
|---|---|---|
| committer | Carl Meyer <carl@oddbird.net> | 2012-01-31 19:23:09 +0000 |
| commit | a678e9ea6589bd95d9d30e86a50d3694ebf60908 (patch) | |
| tree | 9d3506f01167332d8a2f81345f0ae3d9bd932a7f /docs/releases/1.4.txt | |
| parent | f1dc83cb9877d349df88674a0752ddf42657485b (diff) | |
Fixed #17604 - Added context-manager capability to assertTemplateUsed and assertTemplateNotUsed. Thanks Greg Müllegger.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17412 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/releases/1.4.txt')
| -rw-r--r-- | docs/releases/1.4.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt index 8a7bfb2011..f2c97f603a 100644 --- a/docs/releases/1.4.txt +++ b/docs/releases/1.4.txt @@ -946,6 +946,21 @@ apply URL escaping again. This is wrong for URLs whose unquoted form contains a ``%xx`` sequence, but such URLs are very unlikely to happen in the wild, since they would confuse browsers too. +``assertTemplateUsed`` and ``assertTemplateNotUsed`` as context manager +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +It is now possible to check whether a template was used or not in a block of +code with the :meth:`~django.test.testcase.TestCase.assertTemplateUsed` and +:meth:`~django.test.testcase.TestCase.assertTemplateNotUsed` assertions. They +can be used as a context manager:: + + with self.assertTemplateUsed('index.html'): + render_to_string('index.html') + with self.assertTemplateNotUsed('base.html'): + render_to_string('index.html') + +See the :ref:`assertion documentation<assertions>` for more information. + Database connections after running the test suite ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
