From 49288f838809d797fa7b8b2e6a2cb2f65d6cf8bd Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Thu, 9 Feb 2012 18:56:58 +0000 Subject: Fixed #11970 -- Wrapped the exception happening during deserialization in DeserializationError exceptions. Thanks, Claude Paroz. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17469 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/serializers_regress/tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/regressiontests/serializers_regress/tests.py b/tests/regressiontests/serializers_regress/tests.py index 9c9022dcb8..efad176eaa 100644 --- a/tests/regressiontests/serializers_regress/tests.py +++ b/tests/regressiontests/serializers_regress/tests.py @@ -19,6 +19,7 @@ except ImportError: from django.core import serializers from django.core.serializers import SerializerDoesNotExist +from django.core.serializers.base import DeserializationError from django.db import connection, models from django.test import TestCase from django.utils.functional import curry @@ -390,6 +391,17 @@ class SerializerTests(TestCase): with self.assertRaises(SerializerDoesNotExist): serializers.get_deserializer("nonsense") + def test_json_deserializer_exception(self): + with self.assertRaises(DeserializationError): + for obj in serializers.deserialize("json", """[{"pk":1}"""): + pass + + def test_yaml_deserializer_exception(self): + with self.assertRaises(DeserializationError): + for obj in serializers.deserialize("yaml", "{"): + pass + + def serializerTest(format, self): # Create all the objects defined in the test data -- cgit v1.3