Fixed #29249 -- Made JSON and YAML serializers use Unicode by default.

This commit is contained in:
Hasan Ramezani 2020-04-23 22:14:32 +02:00 committed by Mariusz Felisiak
parent 8970bb4cfd
commit 68fc21b378
6 changed files with 25 additions and 9 deletions

View file

@ -4,7 +4,6 @@ from django.core import serializers
from django.core.serializers.xml_serializer import DTDForbidden
from django.test import TestCase, TransactionTestCase
from .models import Author
from .tests import SerializersTestBase, SerializersTransactionTestBase
@ -87,13 +86,6 @@ class XmlSerializerTestCase(SerializersTestBase, TestCase):
with self.assertRaises(DTDForbidden):
next(serializers.deserialize('xml', xml))
def test_unicode_serialization(self):
unicode_name = 'יוניקוד'
data = serializers.serialize('xml', [Author(name=unicode_name)])
self.assertIn(unicode_name, data)
objs = list(serializers.deserialize('xml', data))
self.assertEqual(objs[0].object.name, unicode_name)
class XmlSerializerTransactionTestCase(SerializersTransactionTestBase, TransactionTestCase):
serializer_name = "xml"