summaryrefslogtreecommitdiff
path: root/tests/get_or_create
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2018-11-23 20:59:38 -0500
committerTim Graham <timograham@gmail.com>2018-11-27 09:35:17 -0500
commit84e7a9f4a7bb3cad2bffae97baaae99de152c451 (patch)
treec81eeb6edf47ce0abdb7551cd28a3de354dfd20f /tests/get_or_create
parent9a7d336c3866c5226ed11868be0234c7e2fa47fa (diff)
downloaddjango-84e7a9f4a7bb3cad2bffae97baaae99de152c451.tar.gz
Switched setUp() to setUpTestData() where possible in Django's tests.
Diffstat (limited to 'tests/get_or_create')
-rw-r--r--tests/get_or_create/tests.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/get_or_create/tests.py b/tests/get_or_create/tests.py
index 194d4159b6..ea9f137d7d 100644
--- a/tests/get_or_create/tests.py
+++ b/tests/get_or_create/tests.py
@@ -16,8 +16,9 @@ from .models import (
class GetOrCreateTests(TestCase):
- def setUp(self):
- self.lennon = Person.objects.create(
+ @classmethod
+ def setUpTestData(cls):
+ Person.objects.create(
first_name='John', last_name='Lennon', birthday=date(1940, 10, 9)
)
@@ -189,8 +190,9 @@ class GetOrCreateTests(TestCase):
class GetOrCreateTestsWithManualPKs(TestCase):
- def setUp(self):
- self.first_pk = ManualPrimaryKeyTest.objects.create(id=1, data="Original")
+ @classmethod
+ def setUpTestData(cls):
+ ManualPrimaryKeyTest.objects.create(id=1, data="Original")
def test_create_with_duplicate_primary_key(self):
"""