MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / Update

Class Update

test/test_threads.py:83–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82
83class Update(threading.Thread):
84 def __init__(self, collection, n, expect_exception):
85 threading.Thread.__init__(self)
86 self.collection = collection
87 self.n = n
88 self.expect_exception = expect_exception
89 self.daemon = True
90
91 def run(self):
92 for _ in range(self.n):
93 error = True
94
95 try:
96 self.collection.update_one({"test": "unique"}, {"$set": {"test": "update"}})
97 error = False
98 except:
99 if not self.expect_exception:
100 raise
101
102 if self.expect_exception:
103 assert error
104
105
106class TestThreads(IntegrationTest):

Callers 1

test_safe_updateMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_safe_updateMethod · 0.68