Added a test for using an `__in` lookup with a ValueListQueryset from a none() call. Refs #14622.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14568 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2010-11-16 02:33:51 +00:00
parent e69bc74351
commit 8da8d6c586
1 changed files with 7 additions and 1 deletions

View File

@ -1437,13 +1437,19 @@ class EmptyQuerySetTests(TestCase):
def test_emptyqueryset_values(self): def test_emptyqueryset_values(self):
# #14366 -- Calling .values() on an EmptyQuerySet and then cloning that # #14366 -- Calling .values() on an EmptyQuerySet and then cloning that
# should not cause an error" # should not cause an error"
self.assertEqual(list(Number.objects.none().values('num').order_by('num')), []) self.assertQuerysetEqual(
Number.objects.none().values('num').order_by('num'), []
)
def test_values_subquery(self): def test_values_subquery(self):
self.assertQuerysetEqual( self.assertQuerysetEqual(
Number.objects.filter(pk__in=Number.objects.none().values("pk")), Number.objects.filter(pk__in=Number.objects.none().values("pk")),
[] []
) )
self.assertQuerysetEqual(
Number.objects.filter(pk__in=Number.objects.none().values_list("pk")),
[]
)
class WeirdQuerysetSlicingTests(BaseQuerysetTest): class WeirdQuerysetSlicingTests(BaseQuerysetTest):