File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 2
2
import re
3
3
import json
4
4
import unittest
5
- import warnings
6
5
from io import BytesIO
7
6
from six .moves import cPickle as pickle
8
7
9
8
import lxml .etree
9
+ import six
10
10
11
11
from scrapy .item import Item , Field
12
12
from scrapy .utils .python import to_unicode
@@ -66,6 +66,11 @@ def test_fields_to_export(self):
66
66
ie = self ._get_exporter (fields_to_export = ['name' ])
67
67
self .assertEqual (list (ie ._get_serialized_fields (self .i )), [('name' , u'John\xa3 ' )])
68
68
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
+
69
74
def test_field_custom_serializer (self ):
70
75
def custom_serializer (value ):
71
76
return str (int (value ) + 2 )
You can’t perform that action at this time.
0 commit comments