position support singular value #1565

This commit is contained in:
Erdenezul Batmunkh
2017-07-31 05:15:23 +00:00
parent 3dcc9bc143
commit 433f10ef93
2 changed files with 15 additions and 7 deletions

View File

@@ -1925,6 +1925,11 @@ class QuerySetTest(unittest.TestCase):
post.reload()
self.assertEqual(post.tags, ['mongodb', 'python', 'java'])
#test push with singular value
BlogPost.objects.filter(id=post.id).update(push__tags__0='scala')
post.reload()
self.assertEqual(post.tags, ['scala', 'mongodb', 'python', 'java'])
def test_update_push_and_pull_add_to_set(self):
"""Ensure that the 'pull' update operation works correctly.
"""