summaryrefslogtreecommitdiff
path: root/tests/regressiontests/queryset_pickle/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/regressiontests/queryset_pickle/tests.py')
-rw-r--r--tests/regressiontests/queryset_pickle/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/queryset_pickle/tests.py b/tests/regressiontests/queryset_pickle/tests.py
index 19519b2db9..b1be30d91f 100644
--- a/tests/regressiontests/queryset_pickle/tests.py
+++ b/tests/regressiontests/queryset_pickle/tests.py
@@ -73,3 +73,15 @@ class PickleabilityTestCase(TestCase):
empty = pickle.loads(dumped)
self.assertQuerysetEqual(
empty, [])
+
+ def test_pickle_prefetch_related_idempotence(self):
+ p = Post.objects.create()
+ posts = Post.objects.prefetch_related('materials')
+
+ # First pickling
+ posts = pickle.loads(pickle.dumps(posts))
+ self.assertQuerysetEqual(posts, [p], lambda x: x)
+
+ # Second pickling
+ posts = pickle.loads(pickle.dumps(posts))
+ self.assertQuerysetEqual(posts, [p], lambda x: x)