diff options
| author | Simon Charette <charette.s@gmail.com> | 2018-11-24 06:28:28 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-11-27 09:48:22 -0500 |
| commit | 7f63b894c02effb09c15ab0b40d28b89553b8e37 (patch) | |
| tree | 03802b01266db92834562ae80cf73c97b0cb8f5a /tests/m2o_recursive | |
| parent | 84e7a9f4a7bb3cad2bffae97baaae99de152c451 (diff) | |
Adjusted code style of a few test data setup methods.
Thanks Mariusz for suggesting it.
Diffstat (limited to 'tests/m2o_recursive')
| -rw-r--r-- | tests/m2o_recursive/tests.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/m2o_recursive/tests.py b/tests/m2o_recursive/tests.py index 309b61f260..95b60a8e49 100644 --- a/tests/m2o_recursive/tests.py +++ b/tests/m2o_recursive/tests.py @@ -7,10 +7,8 @@ class ManyToOneRecursiveTests(TestCase): @classmethod def setUpTestData(cls): - cls.r = Category(id=None, name='Root category', parent=None) - cls.r.save() - cls.c = Category(id=None, name='Child category', parent=cls.r) - cls.c.save() + cls.r = Category.objects.create(id=None, name='Root category', parent=None) + cls.c = Category.objects.create(id=None, name='Child category', parent=cls.r) def test_m2o_recursive(self): self.assertQuerysetEqual(self.r.child_set.all(), @@ -25,12 +23,9 @@ class MultipleManyToOneRecursiveTests(TestCase): @classmethod def setUpTestData(cls): - cls.dad = Person(full_name='John Smith Senior', mother=None, father=None) - cls.dad.save() - cls.mom = Person(full_name='Jane Smith', mother=None, father=None) - cls.mom.save() - cls.kid = Person(full_name='John Smith Junior', mother=cls.mom, father=cls.dad) - cls.kid.save() + cls.dad = Person.objects.create(full_name='John Smith Senior', mother=None, father=None) + cls.mom = Person.objects.create(full_name='Jane Smith', mother=None, father=None) + cls.kid = Person.objects.create(full_name='John Smith Junior', mother=cls.mom, father=cls.dad) def test_m2o_recursive2(self): self.assertEqual(self.kid.mother.id, self.mom.id) |
