diff --git a/tests/document/class_methods.py b/tests/document/class_methods.py index 8050998c..8e9a8776 100644 --- a/tests/document/class_methods.py +++ b/tests/document/class_methods.py @@ -35,9 +35,11 @@ class ClassMethodsTest(unittest.TestCase): def test_definition(self): """Ensure that document may be defined using fields. """ - self.assertEqual(['age', 'name', 'id'], self.Person._fields.keys()) - self.assertEqual([IntField, StringField, ObjectIdField], - [x.__class__ for x in self.Person._fields.values()]) + self.assertEqual(['age', 'id', 'name'], + sorted(self.Person._fields.keys())) + self.assertEqual(["IntField", "ObjectIdField", "StringField"], + sorted([x.__class__.__name__ for x in + self.Person._fields.values()])) def test_get_db(self): """Ensure that get_db returns the expected db. diff --git a/tests/document/indexes.py b/tests/document/indexes.py index 445cfe2b..cf25f61e 100644 --- a/tests/document/indexes.py +++ b/tests/document/indexes.py @@ -307,8 +307,8 @@ class IndexesTest(unittest.TestCase): self.assertEqual(1, Person.objects.count()) info = Person.objects._collection.index_information() - self.assertEqual(info.keys(), ['_cls_1_name_1', '_cls_1_user_guid_1', - '_id_']) + self.assertEqual(sorted(info.keys()), + ['_cls_1_name_1', '_cls_1_user_guid_1', '_id_']) def test_disable_index_creation(self): """Tests setting auto_create_index to False on the connection will @@ -350,7 +350,7 @@ class IndexesTest(unittest.TestCase): BlogPost.drop_collection() info = BlogPost.objects._collection.index_information() - self.assertEqual(info.keys(), ['date.yr_-1', '_id_']) + self.assertEqual(sorted(info.keys()), ['_id_', 'date.yr_-1']) BlogPost.drop_collection() def test_list_embedded_document_index(self): @@ -373,7 +373,7 @@ class IndexesTest(unittest.TestCase): info = BlogPost.objects._collection.index_information() # we don't use _cls in with list fields by default - self.assertEqual(info.keys(), ['_id_', 'tags.tag_1']) + self.assertEqual(sorted(info.keys()), ['_id_', 'tags.tag_1']) post1 = BlogPost(title="Embedded Indexes tests in place", tags=[Tag(name="about"), Tag(name="time")] @@ -392,7 +392,7 @@ class IndexesTest(unittest.TestCase): RecursiveDocument.ensure_indexes() info = RecursiveDocument._get_collection().index_information() - self.assertEqual(info.keys(), ['_id_', '_cls_1']) + self.assertEqual(sorted(info.keys()), ['_cls_1', '_id_']) def test_geo_indexes_recursion(self): diff --git a/tests/document/inheritance.py b/tests/document/inheritance.py index 08e29048..c5e1860b 100644 --- a/tests/document/inheritance.py +++ b/tests/document/inheritance.py @@ -161,8 +161,8 @@ class InheritanceTest(unittest.TestCase): class Employee(Person): salary = IntField() - self.assertEqual(['salary', 'age', 'name', 'id'], - Employee._fields.keys()) + self.assertEqual(['age', 'id', 'name', 'salary'], + sorted(Employee._fields.keys())) self.assertEqual(Employee._get_collection_name(), Person._get_collection_name())