summaryrefslogtreecommitdiff
path: root/tests/bulk_create
diff options
context:
space:
mode:
authorDaniyal <abbasi.daniyal98@gmail.com>2021-03-24 11:15:08 +0530
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-07-15 11:43:33 +0200
commitf479df7f8d03ab767bb5e5d655243191087d6432 (patch)
treebf6f248ad7938a0d9f77ea616a59fba2d5a8befb /tests/bulk_create
parent08f077888548a951f01b454d0db08d9407f7f0aa (diff)
Refs #32508 -- Raised Type/ValueError instead of using "assert" in django.db.models.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'tests/bulk_create')
-rw-r--r--tests/bulk_create/tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/bulk_create/tests.py b/tests/bulk_create/tests.py
index df764f945f..2ee54c382f 100644
--- a/tests/bulk_create/tests.py
+++ b/tests/bulk_create/tests.py
@@ -347,3 +347,8 @@ class BulkCreateTests(TestCase):
)
with self.assertRaisesMessage(ValueError, msg):
NullableFields.objects.bulk_create([NullableFields(auto_field=parent)])
+
+ def test_invalid_batch_size_exception(self):
+ msg = 'Batch size must be a positive integer.'
+ with self.assertRaisesMessage(ValueError, msg):
+ Country.objects.bulk_create([], batch_size=-1)