diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-03-30 09:08:29 +0000 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-03-30 09:08:29 +0000 |
| commit | eb163f37cb62268443d592f8ce08bd8a0ab9631d (patch) | |
| tree | a373546137a3833d476b207d6490bd39c1e51a81 /docs | |
| parent | 9383a2761c67d588378f3679cc6c8ea3651a73c8 (diff) | |
Use the class decorator syntax available in Python >= 2.6. Refs #17965.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17829 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/testing.txt | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt index 829e059181..39f07708ff 100644 --- a/docs/topics/testing.txt +++ b/docs/topics/testing.txt @@ -1450,14 +1450,13 @@ The decorator can also be applied to test case classes:: from django.test import TestCase from django.test.utils import override_settings + @override_settings(LOGIN_URL='/other/login/') class LoginTestCase(TestCase): def test_login(self): response = self.client.get('/sekrit/') self.assertRedirects(response, '/other/login/?next=/sekrit/') - LoginTestCase = override_settings(LOGIN_URL='/other/login/')(LoginTestCase) - .. note:: When given a class, the decorator modifies the class directly and @@ -1467,19 +1466,6 @@ The decorator can also be applied to test case classes:: the original ``LoginTestCase`` is still equally affected by the decorator. -On Python 2.6 and higher you can also use the well known decorator syntax to -decorate the class:: - - from django.test import TestCase - from django.test.utils import override_settings - - @override_settings(LOGIN_URL='/other/login/') - class LoginTestCase(TestCase): - - def test_login(self): - response = self.client.get('/sekrit/') - self.assertRedirects(response, '/other/login/?next=/sekrit/') - .. note:: When overriding settings, make sure to handle the cases in which your app's |
