[1.6.x] Added tests for double-pickling a QuerySet
Refs #21102.
Backpatch of 74b91b3888
This commit is contained in:
parent
097fb98f81
commit
4c4954a3c1
|
@ -90,3 +90,15 @@ class PickleabilityTestCase(TestCase):
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue