PYTHON-2878 Allow passing dict to sort/create_index/hint performance … (#1396)

This commit is contained in:
Noah Stapp 2023-10-17 10:50:06 -07:00 committed by GitHub
parent fbf29374bc
commit 4fa6056e72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1837,26 +1837,16 @@ class TestClient(IntegrationTest):
)
def test_dict_hints(self):
c = rs_or_single_client()
try:
c.t.t.find(hint={"x": 1})
except Exception:
self.fail("passing a dictionary hint to find failed!")
self.db.t.find(hint={"x": 1})
def test_dict_hints_sort(self):
c = rs_or_single_client()
try:
result = c.t.t.find()
result.sort({"x": 1})
except Exception:
self.fail("passing a dictionary to sort failed!")
result = self.db.t.find()
result.sort({"x": 1})
self.db.t.find(sort={"x": 1})
def test_dict_hints_create_index(self):
c = rs_or_single_client()
try:
c.t.t.create_index({"x": pymongo.ASCENDING})
except Exception:
self.fail("passing a dictionary to create_index failed!")
self.db.t.create_index({"x": pymongo.ASCENDING})
class TestExhaustCursor(IntegrationTest):