diff options
author | Simon Charette <charette.s@gmail.com> | 2018-11-23 20:59:38 -0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-11-27 09:35:17 -0500 |
commit | 84e7a9f4a7bb3cad2bffae97baaae99de152c451 (patch) | |
tree | c81eeb6edf47ce0abdb7551cd28a3de354dfd20f /tests/custom_columns | |
parent | 9a7d336c3866c5226ed11868be0234c7e2fa47fa (diff) | |
download | django-84e7a9f4a7bb3cad2bffae97baaae99de152c451.tar.gz |
Switched setUp() to setUpTestData() where possible in Django's tests.
Diffstat (limited to 'tests/custom_columns')
-rw-r--r-- | tests/custom_columns/tests.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/custom_columns/tests.py b/tests/custom_columns/tests.py index f5dfd9c0cd..874b024050 100644 --- a/tests/custom_columns/tests.py +++ b/tests/custom_columns/tests.py @@ -6,13 +6,14 @@ from .models import Article, Author class CustomColumnsTests(TestCase): - def setUp(self): - self.a1 = Author.objects.create(first_name="John", last_name="Smith") - self.a2 = Author.objects.create(first_name="Peter", last_name="Jones") - self.authors = [self.a1, self.a2] - - self.article = Article.objects.create(headline="Django lets you build Web apps easily", primary_author=self.a1) - self.article.authors.set(self.authors) + @classmethod + def setUpTestData(cls): + cls.a1 = Author.objects.create(first_name="John", last_name="Smith") + cls.a2 = Author.objects.create(first_name="Peter", last_name="Jones") + cls.authors = [cls.a1, cls.a2] + + cls.article = Article.objects.create(headline="Django lets you build Web apps easily", primary_author=cls.a1) + cls.article.authors.set(cls.authors) def test_query_all_available_authors(self): self.assertQuerysetEqual( |