MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _test_update_many

Method _test_update_many

test/test_bulk.py:147–163  ·  view source on GitHub ↗
(self, update)

Source from the content-addressed store, hash-verified

145 self.assertEqual(1, self.coll.count_documents({}))
146
147 def _test_update_many(self, update):
148 expected = {
149 "nMatched": 2,
150 "nModified": 2,
151 "nUpserted": 0,
152 "nInserted": 0,
153 "nRemoved": 0,
154 "upserted": [],
155 "writeErrors": [],
156 "writeConcernErrors": [],
157 }
158 self.coll.insert_many([{}, {}])
159
160 result = self.coll.bulk_write([UpdateMany({}, update)])
161 self.assertEqualResponse(expected, result.bulk_api_result)
162 self.assertEqual(2, result.matched_count)
163 self.assertIn(result.modified_count, (2, None))
164
165 def test_update_many(self):
166 self._test_update_many({"$set": {"foo": "bar"}})

Callers 2

test_update_manyMethod · 0.95

Calls 4

UpdateManyClass · 0.85
insert_manyMethod · 0.45
bulk_writeMethod · 0.45
assertEqualResponseMethod · 0.45

Tested by

no test coverage detected