mirror of
https://github.com/django/django.git
synced 2025-12-04 00:55:36 +00:00
Switched setUp() to setUpTestData() where possible in Django's tests.
This commit is contained in:
parent
9a7d336c38
commit
84e7a9f4a7
49 changed files with 421 additions and 334 deletions
|
|
@ -372,15 +372,16 @@ class ModelTest(TestCase):
|
|||
|
||||
|
||||
class ModelLookupTest(TestCase):
|
||||
def setUp(self):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
# Create an Article.
|
||||
self.a = Article(
|
||||
cls.a = Article(
|
||||
id=None,
|
||||
headline='Swallow programs in Python',
|
||||
pub_date=datetime(2005, 7, 28),
|
||||
)
|
||||
# Save it into the database. You have to call save() explicitly.
|
||||
self.a.save()
|
||||
cls.a.save()
|
||||
|
||||
def test_all_lookup(self):
|
||||
# Change values by changing the attributes, then calling save().
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue