(self)
| 390 | ) |
| 391 | |
| 392 | def test_upsert_uuid_standard(self): |
| 393 | options = CodecOptions(uuid_representation=UuidRepresentation.STANDARD) |
| 394 | coll = self.coll.with_options(codec_options=options) |
| 395 | uuids = [uuid.uuid4() for _ in range(3)] |
| 396 | result = coll.bulk_write( |
| 397 | [ |
| 398 | UpdateOne({"_id": uuids[0]}, {"$set": {"a": 0}}, upsert=True), |
| 399 | ReplaceOne({"a": 1}, {"_id": uuids[1]}, upsert=True), |
| 400 | # This is just here to make the counts right in all cases. |
| 401 | ReplaceOne({"_id": uuids[2]}, {"_id": uuids[2]}, upsert=True), |
| 402 | ] |
| 403 | ) |
| 404 | self.assertEqualResponse( |
| 405 | { |
| 406 | "nMatched": 0, |
| 407 | "nModified": 0, |
| 408 | "nUpserted": 3, |
| 409 | "nInserted": 0, |
| 410 | "nRemoved": 0, |
| 411 | "upserted": [ |
| 412 | {"index": 0, "_id": uuids[0]}, |
| 413 | {"index": 1, "_id": uuids[1]}, |
| 414 | {"index": 2, "_id": uuids[2]}, |
| 415 | ], |
| 416 | }, |
| 417 | result.bulk_api_result, |
| 418 | ) |
| 419 | |
| 420 | def test_upsert_uuid_unspecified(self): |
| 421 | options = CodecOptions(uuid_representation=UuidRepresentation.UNSPECIFIED) |
nothing calls this directly
no test coverage detected