Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added tests for double-pickling a QuerySet

Refs #21102.
  • Loading branch information...
commit 74b91b3888383fca28dea00e0e1ffb5aecec7c0f 1 parent c89d80e
Anssi Kääriäinen authored September 14, 2013

Showing 1 changed file with 12 additions and 0 deletions. Show diff stats Hide diff stats

  1. 12  tests/queryset_pickle/tests.py
12  tests/queryset_pickle/tests.py
@@ -94,3 +94,15 @@ class Meta:
94 94
     def test_specialized_queryset(self):
95 95
         self.assert_pickles(Happening.objects.values('name'))
96 96
         self.assert_pickles(Happening.objects.values('name').dates('when', 'year'))
  97
+
  98
+    def test_pickle_prefetch_related_idempotence(self):
  99
+        g = Group.objects.create(name='foo')
  100
+        groups = Group.objects.prefetch_related('event_set')
  101
+
  102
+        # First pickling
  103
+        groups = pickle.loads(pickle.dumps(groups))
  104
+        self.assertQuerysetEqual(groups, [g], lambda x: x)
  105
+
  106
+        # Second pickling
  107
+        groups = pickle.loads(pickle.dumps(groups))
  108
+        self.assertQuerysetEqual(groups, [g], lambda x: x)

0 notes on commit 74b91b3

Please sign in to comment.
Something went wrong with that request. Please try again.