Commit a3bcd5c5 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

py3: use py2 compatible pickle protocol in testXMLPickle.

parent 94adc0cb
...@@ -31,6 +31,7 @@ import pickle ...@@ -31,6 +31,7 @@ import pickle
import re import re
import xml.sax import xml.sax
from six.moves import cStringIO as StringIO from six.moves import cStringIO as StringIO
from io import BytesIO
from Products.ERP5Type.XMLExportImport import ppml from Products.ERP5Type.XMLExportImport import ppml
...@@ -58,8 +59,8 @@ class TestXMLPickle(unittest.TestCase): ...@@ -58,8 +59,8 @@ class TestXMLPickle(unittest.TestCase):
pattern = re.compile('WAA') # regex pattern object uses reduce.(See sre.py) pattern = re.compile('WAA') # regex pattern object uses reduce.(See sre.py)
obj.data.append(pattern) obj.data.append(pattern)
pickled_string = pickle.dumps(obj) pickled_string = pickle.dumps(obj, protocol=2)
f = StringIO(pickled_string) f = BytesIO(pickled_string)
xmldata = str(ppml.ToXMLUnpickler(f).load()) xmldata = str(ppml.ToXMLUnpickler(f).load())
output = StringIO() output = StringIO()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment