fix-#842: Fix ignored chained options

This commit is contained in:
David Bordeynik
2015-06-28 20:33:35 +03:00
parent 222e929b2d
commit 5334ea393e
4 changed files with 8 additions and 9 deletions

View File

@@ -577,11 +577,11 @@ class IndexesTest(unittest.TestCase):
self.assertEqual(BlogPost.objects.hint('tags').count(), 10)
else:
def invalid_index():
BlogPost.objects.hint('tags')
BlogPost.objects.hint('tags').next()
self.assertRaises(TypeError, invalid_index)
def invalid_index_2():
return BlogPost.objects.hint(('tags', 1))
return BlogPost.objects.hint(('tags', 1)).next()
self.assertRaises(Exception, invalid_index_2)
def test_unique(self):

View File

@@ -188,6 +188,10 @@ class QuerySetTest(unittest.TestCase):
"[<Person: Person object>, <Person: Person object>]", "%s" % self.Person.objects[1:3])
self.assertEqual(
"[<Person: Person object>, <Person: Person object>]", "%s" % self.Person.objects[51:53])
# Test only after limit
self.assertEqual(self.Person.objects().limit(2).only('name')[0].age, None)
# Test only after skip
self.assertEqual(self.Person.objects().skip(2).only('name')[0].age, None)
def test_find_one(self):
"""Ensure that a query using find_one returns a valid result.