This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch TINKERPOP-2279 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 1813625de500f9b2fcd6bbc0fbb2e0190b504dfd Author: Stephen Mallette <[email protected]> AuthorDate: Tue Aug 13 14:58:49 2019 -0400 Fixed handling of the null type in python graphbinary --- .../src/main/jython/gremlin_python/structure/io/graphbinaryV1.py | 8 +++++--- gremlin-python/src/main/jython/tests/conftest.py | 3 ++- .../src/main/jython/tests/driver/test_driver_remote_connection.py | 5 ++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py index e730c8e..a8eb853 100644 --- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py +++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphbinaryV1.py @@ -157,10 +157,12 @@ class GraphBinaryReader(object): def toObject(self, buff, data_type=None, nullable=True): if data_type is None: - bt = buff.read(1) - if bt[0] == DataType.null.value: + bt = struct.unpack('>B', buff.read(1))[0] + if bt == DataType.null.value: + if nullable: + buff.read(1) return None - return self.deserializers[DataType(struct.unpack('>b', bt)[0])].objectify(buff, self, nullable) + return self.deserializers[DataType(bt)].objectify(buff, self, nullable) else: return self.deserializers[data_type].objectify(buff, self, nullable) diff --git a/gremlin-python/src/main/jython/tests/conftest.py b/gremlin-python/src/main/jython/tests/conftest.py index a1224ac..7d10109 100644 --- a/gremlin-python/src/main/jython/tests/conftest.py +++ b/gremlin-python/src/main/jython/tests/conftest.py @@ -74,7 +74,8 @@ def client(request): @pytest.fixture def secure_client(request): try: - client = Client('ws://' + gremlin_server_host + ':45941/gremlin', 'gmodern', username='stephen', password='password') + client = Client('ws://' + gremlin_server_host + ':45941/gremlin', 'gmodern', + username='stephen', password='password') except OSError: pytest.skip('Gremlin Server is not running') else: diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py index b2b4a7d..1c689d9 100644 --- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py +++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py @@ -154,12 +154,11 @@ class TestDriverRemoteConnection(object): assert 6 == g.E().count().next() -def test_in_tornado_app(remote_connection): +def test_in_tornado_app(): # Make sure nothing weird with loops @gen.coroutine def go(): - conn = DriverRemoteConnection( - 'ws://localhost:45940/gremlin', 'gmodern', pool_size=4) + conn = DriverRemoteConnection('ws://localhost:45940/gremlin', 'gmodern', pool_size=4) g = traversal().withRemote(conn) yield gen.sleep(0) assert len(g.V().toList()) == 6
