mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #17776 - DoesNotExist is not picklable
Thanks to ambv for the report
This commit is contained in:
@@ -36,3 +36,13 @@ class PickleabilityTestCase(TestCase):
|
||||
|
||||
def test_membermethod_as_default(self):
|
||||
self.assert_pickles(Happening.objects.filter(number4=1))
|
||||
|
||||
def test_doesnotexist_exception(self):
|
||||
# Ticket #17776
|
||||
original = Event.DoesNotExist("Doesn't exist")
|
||||
unpickled = pickle.loads(pickle.dumps(original))
|
||||
|
||||
# Exceptions are not equal to equivalent instances of themselves, so
|
||||
# can't just use assertEqual(original, unpickled)
|
||||
self.assertEqual(original.__class__, unpickled.__class__)
|
||||
self.assertEqual(original.args, unpickled.args)
|
||||
|
||||
Reference in New Issue
Block a user