Skip to content

Commit 4fa6056

Browse files
authored
PYTHON-2878 Allow passing dict to sort/create_index/hint performance … (#1396)
1 parent fbf2937 commit 4fa6056

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

test/test_client.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,26 +1837,16 @@ def test_handshake_08_invalid_aws_ec2(self):
18371837
)
18381838

18391839
def test_dict_hints(self):
1840-
c = rs_or_single_client()
1841-
try:
1842-
c.t.t.find(hint={"x": 1})
1843-
except Exception:
1844-
self.fail("passing a dictionary hint to find failed!")
1840+
self.db.t.find(hint={"x": 1})
18451841

18461842
def test_dict_hints_sort(self):
1847-
c = rs_or_single_client()
1848-
try:
1849-
result = c.t.t.find()
1850-
result.sort({"x": 1})
1851-
except Exception:
1852-
self.fail("passing a dictionary to sort failed!")
1843+
result = self.db.t.find()
1844+
result.sort({"x": 1})
1845+
1846+
self.db.t.find(sort={"x": 1})
18531847

18541848
def test_dict_hints_create_index(self):
1855-
c = rs_or_single_client()
1856-
try:
1857-
c.t.t.create_index({"x": pymongo.ASCENDING})
1858-
except Exception:
1859-
self.fail("passing a dictionary to create_index failed!")
1849+
self.db.t.create_index({"x": pymongo.ASCENDING})
18601850

18611851

18621852
class TestExhaustCursor(IntegrationTest):

0 commit comments

Comments
 (0)