From eb163f37cb62268443d592f8ce08bd8a0ab9631d Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Fri, 30 Mar 2012 09:08:29 +0000 Subject: 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 --- docs/topics/testing.txt | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'docs') 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 -- cgit v1.3