Commit ad9fc8db authored by Tres Seaver's avatar Tres Seaver

Py3k compat: unicode literals.

parent 5a508227
......@@ -17,6 +17,12 @@ import sys
if sys.version_info[0] > 2: #pragma NO COVER
import copyreg as copy_reg
def _u(s):
return s
else: #pragma NO COVER
import copy_reg
def _u(s):
return unicode(s, 'unicode_escape')
......@@ -191,6 +191,7 @@ class PersistenceTest(unittest.TestCase):
def test_setting_serial_w_invalid_types_raises(self):
# Serial must be an 8-digit string
from persistent._compat import _u
obj = self._makeOne()
def set(val):
......@@ -199,7 +200,7 @@ class PersistenceTest(unittest.TestCase):
self.assertRaises(ValueError, set, 1)
self.assertRaises(ValueError, set, "0123")
self.assertRaises(ValueError, set, "012345678")
self.assertRaises(ValueError, set, u"01234567")
self.assertRaises(ValueError, set, _u("01234567"))
def test_del_serial_returns_to_initial(self):
NOSERIAL = "\000" * 8
......
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