1
0
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:
Luke Plant
2012-06-22 13:28:15 +01:00
parent f08fa5b555
commit a54a8bab0c
2 changed files with 43 additions and 6 deletions

View File

@@ -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)