mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #28389 -- Added release note and test for pickling of LazyObject when wrapped object doesn't have __reduce__().
Forwardport of 30f334cc58 from stable/1.11.x
This commit is contained in:
committed by
Tim Graham
parent
59a4b12a23
commit
83440a1258
@@ -184,11 +184,13 @@ class LazyObjectTestCase(TestCase):
|
||||
def test_pickle(self):
|
||||
# See ticket #16563
|
||||
obj = self.lazy_wrap(Foo())
|
||||
obj.bar = 'baz'
|
||||
pickled = pickle.dumps(obj)
|
||||
unpickled = pickle.loads(pickled)
|
||||
self.assertIsInstance(unpickled, Foo)
|
||||
self.assertEqual(unpickled, obj)
|
||||
self.assertEqual(unpickled.foo, obj.foo)
|
||||
self.assertEqual(unpickled.bar, obj.bar)
|
||||
|
||||
# Test copying lazy objects wrapping both builtin types and user-defined
|
||||
# classes since a lot of the relevant code does __dict__ manipulation and
|
||||
|
||||
Reference in New Issue
Block a user