mirror of https://github.com/django/django.git
[2.2.x] Used QuerySet.bulk_create() in a couple of postgres tests.
Follow up to0ce2ad9ca4
. Backport of2aaabe2004
from master.
This commit is contained in:
parent
bca600339e
commit
8cff329802
|
@ -95,19 +95,19 @@ class TestSaveLoad(PostgreSQLTestCase):
|
|||
class TestQuerying(PostgreSQLTestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
cls.objs = [
|
||||
JSONModel.objects.create(field=None),
|
||||
JSONModel.objects.create(field=True),
|
||||
JSONModel.objects.create(field=False),
|
||||
JSONModel.objects.create(field='yes'),
|
||||
JSONModel.objects.create(field=7),
|
||||
JSONModel.objects.create(field=[]),
|
||||
JSONModel.objects.create(field={}),
|
||||
JSONModel.objects.create(field={
|
||||
cls.objs = JSONModel.objects.bulk_create([
|
||||
JSONModel(field=None),
|
||||
JSONModel(field=True),
|
||||
JSONModel(field=False),
|
||||
JSONModel(field='yes'),
|
||||
JSONModel(field=7),
|
||||
JSONModel(field=[]),
|
||||
JSONModel(field={}),
|
||||
JSONModel(field={
|
||||
'a': 'b',
|
||||
'c': 1,
|
||||
}),
|
||||
JSONModel.objects.create(field={
|
||||
JSONModel(field={
|
||||
'a': 'b',
|
||||
'c': 1,
|
||||
'd': ['e', {'f': 'g'}],
|
||||
|
@ -116,13 +116,13 @@ class TestQuerying(PostgreSQLTestCase):
|
|||
'j': None,
|
||||
'k': {'l': 'm'},
|
||||
}),
|
||||
JSONModel.objects.create(field=[1, [2]]),
|
||||
JSONModel.objects.create(field={
|
||||
JSONModel(field=[1, [2]]),
|
||||
JSONModel(field={
|
||||
'k': True,
|
||||
'l': False,
|
||||
}),
|
||||
JSONModel.objects.create(field={'foo': 'bar'}),
|
||||
]
|
||||
JSONModel(field={'foo': 'bar'}),
|
||||
])
|
||||
|
||||
def test_exact(self):
|
||||
self.assertSequenceEqual(
|
||||
|
|
|
@ -167,13 +167,13 @@ class TestQuerying(PostgreSQLTestCase):
|
|||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
cls.objs = [
|
||||
RangesModel.objects.create(ints=NumericRange(0, 10)),
|
||||
RangesModel.objects.create(ints=NumericRange(5, 15)),
|
||||
RangesModel.objects.create(ints=NumericRange(None, 0)),
|
||||
RangesModel.objects.create(ints=NumericRange(empty=True)),
|
||||
RangesModel.objects.create(ints=None),
|
||||
]
|
||||
cls.objs = RangesModel.objects.bulk_create([
|
||||
RangesModel(ints=NumericRange(0, 10)),
|
||||
RangesModel(ints=NumericRange(5, 15)),
|
||||
RangesModel(ints=NumericRange(None, 0)),
|
||||
RangesModel(ints=NumericRange(empty=True)),
|
||||
RangesModel(ints=None),
|
||||
])
|
||||
|
||||
def test_exact(self):
|
||||
self.assertSequenceEqual(
|
||||
|
|
Loading…
Reference in New Issue