Merge branch 'master' into 0.8
Conflicts: tests/test_document.py
This commit is contained in:
commit
a68529fba8
@ -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.
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user