From 46e61f33b820075a367bcaa28316d10a3ee1a8cc Mon Sep 17 00:00:00 2001 From: AdamISZ Date: Thu, 29 Nov 2018 16:22:37 +0100 Subject: [PATCH] Fix bugs in bigstring and test_commands The keys created in the bigstring.py module in case of message length greater than 65535 were unicode and this was unsupported by amp.py, this fixes the key to be ascii. Additionally the tests in test_commands.py were failing silently due to an unupgraded command syntax in JM_SETUP, it's now upgraded and now tests, as originally, the large orderbook case, which now passes due to the previously mentioned bugfix in bigstring for the new Py3 compatibilty mode (builtins). --- jmbase/jmbase/bigstring.py | 2 +- jmbase/test/test_commands.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jmbase/jmbase/bigstring.py b/jmbase/jmbase/bigstring.py index f7135ad..dcc90a1 100644 --- a/jmbase/jmbase/bigstring.py +++ b/jmbase/jmbase/bigstring.py @@ -43,7 +43,7 @@ class BigString(amp.Argument): nextChunk = value.read(CHUNK_MAX) if not nextChunk: break - strings["%s.%d" % (name, counter)] = nextChunk + strings["{}.{}".format(name, counter).encode('ascii')] = nextChunk counter += 1 def fromvalue(self, value): diff --git a/jmbase/test/test_commands.py b/jmbase/test/test_commands.py index 7bde889..70dac85 100644 --- a/jmbase/test/test_commands.py +++ b/jmbase/test/test_commands.py @@ -66,8 +66,8 @@ class JMTestServerProtocol(JMBaseProtocol): return {'accepted': True} @JMSetup.responder - def on_JM_SETUP(self, role, n_counterparties): - show_receipt("JMSETUP", role,n_counterparties) + def on_JM_SETUP(self, role, initdata): + show_receipt("JMSETUP", role, initdata) d = self.callRemote(JMSetupDone) self.defaultCallbacks(d) return {'accepted': True} @@ -157,7 +157,7 @@ class JMTestClientProtocol(JMBaseProtocol): show_receipt("JMUP") d = self.callRemote(JMSetup, role="TAKER", - n_counterparties=4) #TODO this number should be set + initdata="none") self.defaultCallbacks(d) return {'accepted': True}