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

Method _test_update_one

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

Source from the content-addressed store, hash-verified

185 coll.bulk_write([update_many])
186
187 def _test_update_one(self, update):
188 expected = {
189 "nMatched": 1,
190 "nModified": 1,
191 "nUpserted": 0,
192 "nInserted": 0,
193 "nRemoved": 0,
194 "upserted": [],
195 "writeErrors": [],
196 "writeConcernErrors": [],
197 }
198
199 self.coll.insert_many([{}, {}])
200
201 result = self.coll.bulk_write([UpdateOne({}, update)])
202 self.assertEqualResponse(expected, result.bulk_api_result)
203 self.assertEqual(1, result.matched_count)
204 self.assertIn(result.modified_count, (1, None))
205
206 def test_update_one(self):
207 self._test_update_one({"$set": {"foo": "bar"}})

Callers 2

test_update_oneMethod · 0.95

Calls 4

UpdateOneClass · 0.85
insert_manyMethod · 0.45
bulk_writeMethod · 0.45
assertEqualResponseMethod · 0.45

Tested by

no test coverage detected