insert_many uses only one insert

This commit is contained in:
Erdenezul Batmunkh 2018-05-21 09:22:33 +08:00
parent 2adb640821
commit e4451ccaf8

View File

@ -845,11 +845,8 @@ class QuerySetTest(unittest.TestCase):
blogs.append(Blog(title="post %s" % i, posts=[post1, post2])) blogs.append(Blog(title="post %s" % i, posts=[post1, post2]))
Blog.objects.insert(blogs, load_bulk=False) Blog.objects.insert(blogs, load_bulk=False)
if mongodb_version < (2, 6):
self.assertEqual(q, 99)
else:
# profiling logs each doc now in the bulk op # profiling logs each doc now in the bulk op
self.assertEqual(q, 1) self.assertEqual(q, 99)
Blog.drop_collection() Blog.drop_collection()
Blog.ensure_indexes() Blog.ensure_indexes()
@ -861,8 +858,8 @@ class QuerySetTest(unittest.TestCase):
if mongodb_version < (2, 6): if mongodb_version < (2, 6):
self.assertEqual(q, 101) # 100 for insert, and 1 for in bulk fetch self.assertEqual(q, 101) # 100 for insert, and 1 for in bulk fetch
else: else:
# 99 for insert, and 1 for in bulk fetch # 1 for insert, and 1 for in bulk fetch
self.assertEqual(q, 100) self.assertEqual(q, 2)
Blog.drop_collection() Blog.drop_collection()