Commit fc8ad180 authored by Jason Madden's avatar Jason Madden

Per @mgedmin, use a renormalizing pattern to fix the unicode string matchin in...

Per @mgedmin, use a renormalizing pattern to fix the unicode string matchin in Python3. Also just print the data for the storage we expect, because the missing u prefixes change the spacing when pprint nests dicts and things don't match under Python2.
parent d03566f0
...@@ -1332,8 +1332,9 @@ def test_ruok(): ...@@ -1332,8 +1332,9 @@ def test_ruok():
>>> _ = writer.write(struct.pack(">I", 4)+b"ruok") >>> _ = writer.write(struct.pack(">I", 4)+b"ruok")
>>> writer.close() >>> writer.close()
>>> proto = s.recv(struct.unpack(">I", s.recv(4))[0]) >>> proto = s.recv(struct.unpack(">I", s.recv(4))[0])
>>> pprint.pprint(json.loads(s.recv(struct.unpack(">I", s.recv(4))[0]).decode("ascii"))) >>> data = json.loads(s.recv(struct.unpack(">I", s.recv(4))[0]).decode("ascii"))
{u'1': {u'aborts': 0, >>> pprint.pprint(data['1'])
{u'aborts': 0,
u'active_txns': 0, u'active_txns': 0,
u'commits': 1, u'commits': 1,
u'conflicts': 0, u'conflicts': 0,
...@@ -1346,7 +1347,7 @@ def test_ruok(): ...@@ -1346,7 +1347,7 @@ def test_ruok():
u'stores': 1, u'stores': 1,
u'timeout-thread-is-alive': True, u'timeout-thread-is-alive': True,
u'verifying_clients': 0, u'verifying_clients': 0,
u'waiting': 0}} u'waiting': 0}
>>> db.close(); s.close() >>> db.close(); s.close()
""" """
...@@ -1794,6 +1795,9 @@ def test_suite(): ...@@ -1794,6 +1795,9 @@ def test_suite():
(re.compile("ZEO.Exceptions.ClientStorageError"), "ClientStorageError"), (re.compile("ZEO.Exceptions.ClientStorageError"), "ClientStorageError"),
(re.compile(r"\[Errno \d+\]"), '[Errno N]'), (re.compile(r"\[Errno \d+\]"), '[Errno N]'),
(re.compile(r"loads=\d+\.\d+"), 'loads=42.42'), (re.compile(r"loads=\d+\.\d+"), 'loads=42.42'),
# Python 3 drops the u prefix
(re.compile("u('.*?')"), r"\1"),
(re.compile('u(".*?")'), r"\1")
] ]
if not PY3: if not PY3:
patterns.append((re.compile("^'(blob[^']*)'"), r"b'\1'")) patterns.append((re.compile("^'(blob[^']*)'"), r"b'\1'"))
......
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