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

Class Insert

test/test_threads.py:60–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59
60class Insert(threading.Thread):
61 def __init__(self, collection, n, expect_exception):
62 threading.Thread.__init__(self)
63 self.collection = collection
64 self.n = n
65 self.expect_exception = expect_exception
66 self.daemon = True
67
68 def run(self):
69 for _ in range(self.n):
70 error = True
71
72 try:
73 self.collection.insert_one({"test": "insert"})
74 error = False
75 except:
76 if not self.expect_exception:
77 raise
78
79 if self.expect_exception:
80 assert error
81
82
83class Update(threading.Thread):

Callers 1

test_safe_insertMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_safe_insertMethod · 0.68