(self)
| 418 | ) |
| 419 | |
| 420 | def test_upsert_uuid_unspecified(self): |
| 421 | options = CodecOptions(uuid_representation=UuidRepresentation.UNSPECIFIED) |
| 422 | coll = self.coll.with_options(codec_options=options) |
| 423 | uuids = [Binary.from_uuid(uuid.uuid4()) for _ in range(3)] |
| 424 | result = coll.bulk_write( |
| 425 | [ |
| 426 | UpdateOne({"_id": uuids[0]}, {"$set": {"a": 0}}, upsert=True), |
| 427 | ReplaceOne({"a": 1}, {"_id": uuids[1]}, upsert=True), |
| 428 | # This is just here to make the counts right in all cases. |
| 429 | ReplaceOne({"_id": uuids[2]}, {"_id": uuids[2]}, upsert=True), |
| 430 | ] |
| 431 | ) |
| 432 | self.assertEqualResponse( |
| 433 | { |
| 434 | "nMatched": 0, |
| 435 | "nModified": 0, |
| 436 | "nUpserted": 3, |
| 437 | "nInserted": 0, |
| 438 | "nRemoved": 0, |
| 439 | "upserted": [ |
| 440 | {"index": 0, "_id": uuids[0]}, |
| 441 | {"index": 1, "_id": uuids[1]}, |
| 442 | {"index": 2, "_id": uuids[2]}, |
| 443 | ], |
| 444 | }, |
| 445 | result.bulk_api_result, |
| 446 | ) |
| 447 | |
| 448 | def test_upsert_uuid_standard_subdocuments(self): |
| 449 | options = CodecOptions(uuid_representation=UuidRepresentation.STANDARD) |
nothing calls this directly
no test coverage detected