(self, update)
| 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"}}) |
no test coverage detected