Skip to content

Commit d0955fd

Browse files
committed
add back test for latin-1 encoding
1 parent e938752 commit d0955fd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/test_exporters.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import re
33
import json
44
import unittest
5-
import warnings
65
from io import BytesIO
76
from six.moves import cPickle as pickle
87

98
import lxml.etree
9+
import six
1010

1111
from scrapy.item import Item, Field
1212
from scrapy.utils.python import to_unicode
@@ -66,6 +66,11 @@ def test_fields_to_export(self):
6666
ie = self._get_exporter(fields_to_export=['name'])
6767
self.assertEqual(list(ie._get_serialized_fields(self.i)), [('name', u'John\xa3')])
6868

69+
ie = self._get_exporter(fields_to_export=['name'], encoding='latin-1')
70+
_, name = list(ie._get_serialized_fields(self.i))[0]
71+
assert isinstance(name, six.text_type)
72+
self.assertEqual(name, u'John\xa3')
73+
6974
def test_field_custom_serializer(self):
7075
def custom_serializer(value):
7176
return str(int(value) + 2)

0 commit comments

Comments
 (0)