mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed the exception handling when deserializing via generators on Python 2.5 that was introduced in r17469. Also only test the YAML serializer if PyYAML is installed.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17487 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -17,12 +17,18 @@ try:
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
|
||||
try:
|
||||
import yaml
|
||||
except ImportError:
|
||||
yaml = None
|
||||
|
||||
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
|
||||
from django.utils.unittest import skipUnless
|
||||
|
||||
from .models import (BooleanData, CharData, DateData, DateTimeData, EmailData,
|
||||
FileData, FilePathData, DecimalData, FloatData, IntegerData, IPAddressData,
|
||||
@@ -396,6 +402,7 @@ class SerializerTests(TestCase):
|
||||
for obj in serializers.deserialize("json", """[{"pk":1}"""):
|
||||
pass
|
||||
|
||||
@skipUnless(yaml, "PyYAML not installed")
|
||||
def test_yaml_deserializer_exception(self):
|
||||
with self.assertRaises(DeserializationError):
|
||||
for obj in serializers.deserialize("yaml", "{"):
|
||||
|
||||
Reference in New Issue
Block a user