(self)
| 744 | self.assertEqual(6, self.coll.count_documents({})) |
| 745 | |
| 746 | def test_large_inserts_unordered(self): |
| 747 | big = "x" * client_context.max_bson_size |
| 748 | requests = [ |
| 749 | InsertOne({"b": 1, "a": 1}), |
| 750 | InsertOne({"big": big}), |
| 751 | InsertOne({"b": 2, "a": 2}), |
| 752 | ] |
| 753 | |
| 754 | try: |
| 755 | self.coll.bulk_write(requests, ordered=False) |
| 756 | except BulkWriteError as exc: |
| 757 | details = exc.details |
| 758 | self.assertEqual(exc.code, 65) |
| 759 | else: |
| 760 | self.fail("Error not raised") |
| 761 | |
| 762 | self.assertEqual(2, details["nInserted"]) |
| 763 | |
| 764 | self.coll.delete_many({}) |
| 765 | |
| 766 | big = "x" * (1024 * 1024 * 4) |
| 767 | result = self.coll.bulk_write( |
| 768 | [ |
| 769 | InsertOne({"a": 1, "big": big}), |
| 770 | InsertOne({"a": 2, "big": big}), |
| 771 | InsertOne({"a": 3, "big": big}), |
| 772 | InsertOne({"a": 4, "big": big}), |
| 773 | InsertOne({"a": 5, "big": big}), |
| 774 | InsertOne({"a": 6, "big": big}), |
| 775 | ], |
| 776 | ordered=False, |
| 777 | ) |
| 778 | |
| 779 | self.assertEqual(6, result.inserted_count) |
| 780 | self.assertEqual(6, self.coll.count_documents({})) |
| 781 | |
| 782 | |
| 783 | class BulkAuthorizationTestBase(BulkTestBase): |
nothing calls this directly
no test coverage detected