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

Method test_collection_helpers

test/test_comment.py:118–155  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

116
117 @client_context.require_version_min(4, 7, -1)
118 def test_collection_helpers(self):
119 listener = OvertCommandListener()
120 db = (self.rs_or_single_client(event_listeners=[listener]))[self.db.name]
121 coll = db.get_collection("test")
122
123 helpers = [
124 (coll.list_indexes, []),
125 (coll.drop, []),
126 (coll.index_information, []),
127 (coll.options, []),
128 (coll.aggregate, [[{"$set": {"x": 1}}]]),
129 (coll.aggregate_raw_batches, [[{"$set": {"x": 1}}]]),
130 (coll.rename, ["temp_temp_temp"]),
131 (coll.distinct, ["_id"]),
132 (coll.find_one_and_delete, [{}]),
133 (coll.find_one_and_replace, [{}, {}]),
134 (coll.find_one_and_update, [{}, {"$set": {"a": 1}}]),
135 (coll.estimated_document_count, []),
136 (coll.count_documents, [{}]),
137 (coll.create_indexes, [[IndexModel("a")]]),
138 (coll.create_index, ["a"]),
139 (coll.drop_index, [[("a", 1)]]),
140 (coll.drop_indexes, []),
141 ]
142 already_supported = [
143 coll.estimated_document_count,
144 coll.count_documents,
145 coll.create_indexes,
146 coll.drop_indexes,
147 coll.options,
148 coll.find_one_and_replace,
149 coll.drop_index,
150 coll.rename,
151 coll.distinct,
152 coll.find_one_and_delete,
153 coll.find_one_and_update,
154 ]
155 self._test_ops(helpers, already_supported, listener)
156
157
158if __name__ == "__main__":

Callers

nothing calls this directly

Calls 5

_test_opsMethod · 0.95
IndexModelClass · 0.90
rs_or_single_clientMethod · 0.80
get_collectionMethod · 0.45

Tested by

no test coverage detected