mirror of
https://github.com/django/django.git
synced 2025-03-12 18:30:48 +00:00
[1.6.x] Added tests for double-pickling a QuerySet
Refs #21102. Backpatch of 74b91b3888383fca28dea00e0e1ffb5aecec7c0f
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…
x
Reference in New Issue
Block a user