Fixed DecimalField bug
This commit is contained in:
@@ -623,6 +623,27 @@ class QuerySetTest(unittest.TestCase):
|
||||
|
||||
BlogPost.drop_collection()
|
||||
|
||||
def test_update_pull(self):
|
||||
"""Ensure that the 'pull' update operation works correctly.
|
||||
"""
|
||||
class Comment(EmbeddedDocument):
|
||||
content = StringField()
|
||||
|
||||
class BlogPost(Document):
|
||||
slug = StringField()
|
||||
comments = ListField(EmbeddedDocumentField(Comment))
|
||||
|
||||
comment1 = Comment(content="test1")
|
||||
comment2 = Comment(content="test2")
|
||||
|
||||
post = BlogPost(slug="test", comments=[comment1, comment2])
|
||||
post.save()
|
||||
self.assertTrue(comment2 in post.comments)
|
||||
|
||||
BlogPost.objects(slug="test").update(pull__comments__content="test2")
|
||||
post.reload()
|
||||
self.assertTrue(comment2 not in post.comments)
|
||||
|
||||
def test_order_by(self):
|
||||
"""Ensure that QuerySets may be ordered.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user