(self)
| 709 | ) |
| 710 | |
| 711 | def test_large_inserts_ordered(self): |
| 712 | big = "x" * client_context.max_bson_size |
| 713 | requests = [ |
| 714 | InsertOne({"b": 1, "a": 1}), |
| 715 | InsertOne({"big": big}), |
| 716 | InsertOne({"b": 2, "a": 2}), |
| 717 | ] |
| 718 | |
| 719 | try: |
| 720 | self.coll.bulk_write(requests) |
| 721 | except BulkWriteError as exc: |
| 722 | result = exc.details |
| 723 | self.assertEqual(exc.code, 65) |
| 724 | else: |
| 725 | self.fail("Error not raised") |
| 726 | |
| 727 | self.assertEqual(1, result["nInserted"]) |
| 728 | |
| 729 | self.coll.delete_many({}) |
| 730 | |
| 731 | big = "x" * (1024 * 1024 * 4) |
| 732 | write_result = self.coll.bulk_write( |
| 733 | [ |
| 734 | InsertOne({"a": 1, "big": big}), |
| 735 | InsertOne({"a": 2, "big": big}), |
| 736 | InsertOne({"a": 3, "big": big}), |
| 737 | InsertOne({"a": 4, "big": big}), |
| 738 | InsertOne({"a": 5, "big": big}), |
| 739 | InsertOne({"a": 6, "big": big}), |
| 740 | ] |
| 741 | ) |
| 742 | |
| 743 | self.assertEqual(6, write_result.inserted_count) |
| 744 | self.assertEqual(6, self.coll.count_documents({})) |
| 745 | |
| 746 | def test_large_inserts_unordered(self): |
| 747 | big = "x" * client_context.max_bson_size |
nothing calls this directly
no test coverage detected