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

Method test_safe_insert

test/test_threads.py:123–139  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

121 joinall(threads)
122
123 def test_safe_insert(self):
124 self.db.drop_collection("test1")
125 self.db.test1.insert_one({"test": "insert"})
126 self.db.drop_collection("test2")
127 self.db.test2.insert_one({"test": "insert"})
128
129 self.db.test2.create_index("test", unique=True)
130 self.db.test2.find_one()
131
132 okay = Insert(self.db.test1, 2000, False)
133 error = Insert(self.db.test2, 2000, True)
134
135 error.start()
136 okay.start()
137
138 error.join()
139 okay.join()
140
141 def test_safe_update(self):
142 self.db.drop_collection("test1")

Callers

nothing calls this directly

Calls 7

InsertClass · 0.85
drop_collectionMethod · 0.45
insert_oneMethod · 0.45
create_indexMethod · 0.45
find_oneMethod · 0.45
startMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected