Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderedDict replaced by custom dict subclass for the sake of py26 #87

Merged
merged 2 commits into from
May 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/test_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def test_Aggregate(self):

res = yield self.coll.aggregate([{"$match": {"oh": "hai"}}], full_response=True)

self.assertIn("ok", res)
self.assertIn("result", res)
self.assertTrue("ok" in res)
self.assertTrue("result" in res)
self.assertEqual(len(res["result"]), 2)

@defer.inlineCallbacks
Expand Down
2 changes: 1 addition & 1 deletion tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def make_col(base, name):
self.assertEqual(self.db.test.test, self.db.test("test"))

options = yield self.db.test.options()
self.assertIsInstance(options, dict)
self.assertTrue(isinstance(options, dict))

yield self.db.drop_collection("test")
collection_names = yield self.db.collection_names()
Expand Down
9 changes: 5 additions & 4 deletions tests/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from twisted.trial import unittest
import txmongo
from txmongo.protocol import MongoClientProtocol
from collections import OrderedDict

mongo_host = "localhost"
mongo_port = 27017
Expand Down Expand Up @@ -211,10 +210,12 @@ def test_AsClass(self):
yield self.coll.insert({'x': 42})

doc = yield self.coll.find_one({})
self.assertIs(type(doc), dict)
self.assertTrue(type(doc) is dict)

doc = yield self.coll.find_one({}, as_class=OrderedDict)
self.assertIs(type(doc), OrderedDict)
class CustomDict(dict): pass

doc = yield self.coll.find_one({}, as_class=CustomDict)
self.assertTrue(type(doc) is CustomDict)

@defer.inlineCallbacks
def tearDown(self):
Expand Down