Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.6.x] Added tests for double-pickling a QuerySet

Refs #21102.

Backpatch of 74b91b3
  • Loading branch information...
commit 4c4954a3c133e824390296f6bb444622a8b25331 1 parent 097fb98
@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
@@ -90,3 +90,15 @@ class Meta:
reloaded = pickle.loads(dumped)
self.assertEqual(original, reloaded)
self.assertIs(reloaded.__class__, dynclass)
+
+ 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.