Merge branch 'master' of git://github.com/flosch/mongoengine into v0.4

Conflicts:
	tests/fields.py
This commit is contained in:
Harry Marr
2010-08-30 13:21:10 +01:00
6 changed files with 27 additions and 7 deletions

View File

@@ -674,7 +674,12 @@ class FieldTest(unittest.TestCase):
PutFile.drop_collection()
StreamFile.drop_collection()
SetFile.drop_collection()
# Make sure FileField is optional and not required
class DemoFile(Document):
file = FileField()
d = DemoFile.objects.create()
def test_geo_indexes(self):
"""Ensure that indexes are created automatically for GeoPointFields.
"""
@@ -694,7 +699,7 @@ class FieldTest(unittest.TestCase):
Event.drop_collection()
def test_ensure_unique_default_instances(self):
"""Ensure that every document has it's own unique default instance."""
"""Ensure that every field has it's own unique default instance."""
class D(Document):
data = DictField()
data2 = DictField(default=lambda: {})

View File

@@ -288,6 +288,13 @@ class QuerySetTest(unittest.TestCase):
self.assertEqual(obj, person)
obj = self.Person.objects(Q(name__iexact='gUIDO VAN rOSSU')).first()
self.assertEqual(obj, None)
# Test unsafe expressions
person = self.Person(name='Guido van Rossum [.\'Geek\']')
person.save()
obj = self.Person.objects(Q(name__icontains='[.\'Geek')).first()
self.assertEqual(obj, person)
def test_filter_chaining(self):
"""Ensure filters can be chained together.