mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
Refs #29249 -- Added tests for serializing Unicode data with XML serializer.
This commit is contained in:
parent
9ef4a18dbe
commit
8970bb4cfd
@ -4,6 +4,7 @@ from django.core import serializers
|
|||||||
from django.core.serializers.xml_serializer import DTDForbidden
|
from django.core.serializers.xml_serializer import DTDForbidden
|
||||||
from django.test import TestCase, TransactionTestCase
|
from django.test import TestCase, TransactionTestCase
|
||||||
|
|
||||||
|
from .models import Author
|
||||||
from .tests import SerializersTestBase, SerializersTransactionTestBase
|
from .tests import SerializersTestBase, SerializersTransactionTestBase
|
||||||
|
|
||||||
|
|
||||||
@ -86,6 +87,13 @@ class XmlSerializerTestCase(SerializersTestBase, TestCase):
|
|||||||
with self.assertRaises(DTDForbidden):
|
with self.assertRaises(DTDForbidden):
|
||||||
next(serializers.deserialize('xml', xml))
|
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):
|
class XmlSerializerTransactionTestCase(SerializersTransactionTestBase, TransactionTestCase):
|
||||||
serializer_name = "xml"
|
serializer_name = "xml"
|
||||||
|
Loading…
Reference in New Issue
Block a user