mirror of
https://github.com/django/django.git
synced 2025-06-06 03:59:12 +00:00
Used bulk_create where possible in update tests.
This shaves off 21 INSERT queries. Thanks Clifford for the review.
This commit is contained in:
parent
2722cb61cc
commit
27ffccc96b
@ -25,8 +25,8 @@ class SimpleTest(TestCase):
|
|||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
cls.a1 = A.objects.create()
|
cls.a1 = A.objects.create()
|
||||||
cls.a2 = A.objects.create()
|
cls.a2 = A.objects.create()
|
||||||
|
B.objects.bulk_create(B(a=cls.a1) for _ in range(20))
|
||||||
for x in range(20):
|
for x in range(20):
|
||||||
B.objects.create(a=cls.a1)
|
|
||||||
D.objects.create(a=cls.a1)
|
D.objects.create(a=cls.a1)
|
||||||
|
|
||||||
def test_nonempty_update(self):
|
def test_nonempty_update(self):
|
||||||
@ -292,8 +292,9 @@ class MySQLUpdateOrderByTest(TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
UniqueNumber.objects.create(number=1)
|
UniqueNumber.objects.bulk_create(
|
||||||
UniqueNumber.objects.create(number=2)
|
[UniqueNumber(number=1), UniqueNumber(number=2)]
|
||||||
|
)
|
||||||
|
|
||||||
def test_order_by_update_on_unique_constraint(self):
|
def test_order_by_update_on_unique_constraint(self):
|
||||||
tests = [
|
tests = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user