Skip to content

Commit

Permalink
update hint test since db is getting smarter...
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Dirolf committed Feb 12, 2009
1 parent 599efff commit 9502726
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions test/test_cursor.py
Expand Up @@ -55,18 +55,16 @@ def test_hint(self):

index = db.test.create_index("num", ASCENDING)

self.assertEqual(db.test.find({"num": 17}).explain()["nscanned"], 1)
self.assertEqual(db.test.find({"num": 17, "foo": 17}
).explain()["nscanned"], 100)
self.assertEqual(db.test.find({"num": 17, "foo": 17}
).hint(index).explain()["nscanned"], 1)
self.assertEqual(db.test.find({"num": 17, "foo": 17}
).hint(index
).hint(None
).explain()["nscanned"], 100)
self.assertEqual(db.test.find({"num": 17, "foo": 17}
).hint([("num", ASCENDING)]
).explain()["nscanned"], 1)
self.assertEqual(db.test.find({}).explain()["cursor"], "BasicCursor")
self.assertEqual(db.test.find({}).hint(index).explain()["cursor"],
"BtreeCursor %s" % index)
self.assertEqual(db.test.find({}).hint(index
).hint(None
).explain()["cursor"],
"BasicCursor")
self.assertEqual(db.test.find({}).hint([("num", ASCENDING)]
).explain()["cursor"],
"BtreeCursor %s" % index)
self.assertRaises(OperationFailure,
db.test.find({"num": 17, "foo": 17}
).hint([("foo", ASCENDING)]).explain)
Expand Down

0 comments on commit 9502726

Please sign in to comment.