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

Method test_replace_one

test/test_bulk.py:213–230  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

211 self._test_update_one([{"$set": {"foo": "bar"}}])
212
213 def test_replace_one(self):
214 expected = {
215 "nMatched": 1,
216 "nModified": 1,
217 "nUpserted": 0,
218 "nInserted": 0,
219 "nRemoved": 0,
220 "upserted": [],
221 "writeErrors": [],
222 "writeConcernErrors": [],
223 }
224
225 self.coll.insert_many([{}, {}])
226
227 result = self.coll.bulk_write([ReplaceOne({}, {"foo": "bar"})])
228 self.assertEqualResponse(expected, result.bulk_api_result)
229 self.assertEqual(1, result.matched_count)
230 self.assertIn(result.modified_count, (1, None))
231
232 def test_remove(self):
233 # Test removing all documents, ordered.

Callers

nothing calls this directly

Calls 4

ReplaceOneClass · 0.85
insert_manyMethod · 0.45
bulk_writeMethod · 0.45
assertEqualResponseMethod · 0.45

Tested by

no test coverage detected