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,21 +1332,22 @@ def test_ruok(): ...@@ -1332,21 +1332,22 @@ 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'active_txns': 0, {u'aborts': 0,
u'commits': 1, u'active_txns': 0,
u'conflicts': 0, u'commits': 1,
u'conflicts_resolved': 0, u'conflicts': 0,
u'connections': 1, u'conflicts_resolved': 0,
u'last-transaction': u'03ac11cd11372499', u'connections': 1,
u'loads': 1, u'last-transaction': u'03ac11cd11372499',
u'lock_time': None, u'loads': 1,
u'start': u'Sun Jan 4 09:37:03 2015', u'lock_time': None,
u'stores': 1, u'start': u'Sun Jan 4 09:37:03 2015',
u'timeout-thread-is-alive': True, u'stores': 1,
u'verifying_clients': 0, u'timeout-thread-is-alive': True,
u'waiting': 0}} u'verifying_clients': 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