Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added tests for double-pickling a QuerySet

Refs #21102.
  • Loading branch information...
commit 74b91b3888383fca28dea00e0e1ffb5aecec7c0f 1 parent c89d80e
@akaariai akaariai authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 tests/queryset_pickle/tests.py
View
12 tests/queryset_pickle/tests.py
@@ -94,3 +94,15 @@ class Meta:
def test_specialized_queryset(self):
self.assert_pickles(Happening.objects.values('name'))
self.assert_pickles(Happening.objects.values('name').dates('when', 'year'))
+
+ def test_pickle_prefetch_related_idempotence(self):
+ g = Group.objects.create(name='foo')
+ groups = Group.objects.prefetch_related('event_set')
+
+ # First pickling
+ groups = pickle.loads(pickle.dumps(groups))
+ self.assertQuerysetEqual(groups, [g], lambda x: x)
+
+ # Second pickling
+ groups = pickle.loads(pickle.dumps(groups))
+ self.assertQuerysetEqual(groups, [g], lambda x: x)
Please sign in to comment.
Something went wrong with that request. Please try again.