You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ly...@apache.org on 2022/06/09 18:40:08 UTC

[tinkerpop] branch 3.5-dev updated (945e588baf -> f610363358)

This is an automated email from the ASF dual-hosted git repository.

lyndonb pushed a change to branch 3.5-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


    from 945e588baf Updating changelog for TINKERPOP-2740 (DNS lookup removal)
     new 297ec03f81 Valentyn/an 1165 python graphbinary (#121)
     new f610363358 revert creating default message_serializer

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/python/gremlin_python/driver/client.py    |  1 +
 .../python/gremlin_python/driver/serializer.py     |  2 +-
 .../src/main/python/gremlin_python/statics.py      | 18 ++++-
 .../gremlin_python/structure/io/graphbinaryV1.py   | 89 +++++++++++++++++++---
 .../src/main/python/tests/driver/test_client.py    | 45 +++++++----
 .../tests/driver/test_driver_remote_connection.py  |  2 +-
 .../tests/structure/io/test_functionalityio.py     | 69 ++++++++++++++++-
 .../tests/structure/io/test_graphbinaryV1.py       | 13 +++-
 8 files changed, 209 insertions(+), 30 deletions(-)


[tinkerpop] 01/02: Valentyn/an 1165 python graphbinary (#121)

Posted by ly...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lyndonb pushed a commit to branch 3.5-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 297ec03f814a574fcb66efc92256f43952d1de89
Author: Valentyn Kahamlyk <vk...@users.noreply.github.com>
AuthorDate: Thu Jun 2 11:15:18 2022 -0700

    Valentyn/an 1165 python graphbinary (#121)
    
    Finish graphbinary support in gremlin-python
---
 .../main/python/gremlin_python/driver/client.py    |  1 +
 .../driver/driver_remote_connection.py             |  2 +-
 .../python/gremlin_python/driver/serializer.py     |  2 +-
 .../src/main/python/gremlin_python/statics.py      | 18 ++++-
 .../gremlin_python/structure/io/graphbinaryV1.py   | 89 +++++++++++++++++++---
 .../src/main/python/tests/driver/test_client.py    | 45 +++++++----
 .../tests/driver/test_driver_remote_connection.py  |  2 +-
 .../tests/structure/io/test_functionalityio.py     | 69 ++++++++++++++++-
 .../tests/structure/io/test_graphbinaryV1.py       | 13 +++-
 9 files changed, 210 insertions(+), 31 deletions(-)

diff --git a/gremlin-python/src/main/python/gremlin_python/driver/client.py b/gremlin-python/src/main/python/gremlin_python/driver/client.py
index 4696ce807d..7c4d02a098 100644
--- a/gremlin-python/src/main/python/gremlin_python/driver/client.py
+++ b/gremlin-python/src/main/python/gremlin_python/driver/client.py
@@ -51,6 +51,7 @@ class Client:
             transport_kwargs["max_content_length"] = 10 * 1024 * 1024
         if message_serializer is None:
             message_serializer = serializer.GraphSONSerializersV3d0()
+
         self._message_serializer = message_serializer
         self._username = username
         self._password = password
diff --git a/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py b/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
index dc8310023b..a24a05ab57 100644
--- a/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
+++ b/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
@@ -59,7 +59,7 @@ class DriverRemoteConnection(RemoteConnection):
         # so that they can be closed if this parent session is closed.
         self.__spawned_sessions = []
 
-        if message_serializer is None:
+        if message_serializer is None and graphson_reader is not None and graphson_writer is not None:
             message_serializer = serializer.GraphSONMessageSerializer(
                 reader=graphson_reader,
                 writer=graphson_writer)
diff --git a/gremlin-python/src/main/python/gremlin_python/driver/serializer.py b/gremlin-python/src/main/python/gremlin_python/driver/serializer.py
index 42e1aebaaf..7ab537258a 100644
--- a/gremlin-python/src/main/python/gremlin_python/driver/serializer.py
+++ b/gremlin-python/src/main/python/gremlin_python/driver/serializer.py
@@ -256,7 +256,7 @@ class GraphBinarySerializersV1(object):
             # just works but python 2 bytearray is bound to ByteBufferType so it writes DataType.bytebuffer
             # rather than DataType.bytecode and the server gets confused. special casing this for now until
             # it can be refactored
-            if k == "gremlin":
+            if k == "gremlin" and isinstance(v, bytearray):
                 ba.extend(v)
             else:
                 self._graphbinary_writer.toDict(v, ba)
diff --git a/gremlin-python/src/main/python/gremlin_python/statics.py b/gremlin-python/src/main/python/gremlin_python/statics.py
index 567a7a33d0..e6dfb35e29 100644
--- a/gremlin-python/src/main/python/gremlin_python/statics.py
+++ b/gremlin-python/src/main/python/gremlin_python/statics.py
@@ -25,9 +25,19 @@ class long(int):
     pass
 
 
+class bigint(int):
+    pass
+
+
+class short(int):
+    pass
+
+
 FloatType = float
+ShortType = short
 IntType = int
 LongType = long
+BigIntType = bigint
 TypeType = type
 ListType = list
 DictType = dict
@@ -71,7 +81,13 @@ class GremlinType(object):
     """
     def __init__(self, gremlin_type):
         self.gremlin_type = gremlin_type
-        
+
+
+class BigDecimal(object):
+    def __init__(self, scale, unscaled_value):
+        self.scale = scale
+        self.unscaled_value = unscaled_value
+
 
 staticMethods = {}
 staticEnums = {}
diff --git a/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV1.py b/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV1.py
index a5a258a642..602bd759cb 100644
--- a/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV1.py
+++ b/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV1.py
@@ -31,10 +31,11 @@ from struct import pack, unpack
 from aenum import Enum
 from datetime import timedelta
 from gremlin_python import statics
-from gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType, DictType, ListType, SetType, \
-                                   SingleByte, ByteBufferType, GremlinType, SingleChar
-from gremlin_python.process.traversal import Barrier, Binding, Bytecode, Cardinality, Column, Direction, Operator, \
-                                             Order, Pick, Pop, P, Scope, TextP, Traversal, Traverser, \
+from gremlin_python.statics import FloatType, BigDecimal, FunctionType, ShortType, IntType, LongType, BigIntType, \
+                                   TypeType, DictType, ListType, SetType, SingleByte, ByteBufferType, GremlinType, \
+                                   SingleChar
+from gremlin_python.process.traversal import Barrier, Binding, Bytecode, Cardinality, Column, Direction, \
+                                             Operator, Order, Pick, Pop, P, Scope, TextP, Traversal, Traverser, \
                                              TraversalStrategy, T
 from gremlin_python.process.graph_traversal import GraphTraversal
 from gremlin_python.structure.graph import Graph, Edge, Property, Vertex, VertexProperty, Path
@@ -84,11 +85,11 @@ class DataType(Enum):
     scope = 0x1f
     t = 0x20
     traverser = 0x21
-    bigdecimal = 0x22             # todo
-    biginteger = 0x23             # todo
+    bigdecimal = 0x22
+    biginteger = 0x23
     byte = 0x24
     bytebuffer = 0x25
-    short = 0x26                  # todo
+    short = 0x26
     boolean = 0x27
     textp = 0x28
     traversalstrategy = 0x29
@@ -126,6 +127,7 @@ def _make_packer(format_string):
 
 int64_pack, int64_unpack = _make_packer('>q')
 int32_pack, int32_unpack = _make_packer('>i')
+int16_pack, int16_unpack = _make_packer('>h')
 int8_pack, int8_unpack = _make_packer('>b')
 uint64_pack, uint64_unpack = _make_packer('>Q')
 uint8_pack, uint8_unpack = _make_packer('>B')
@@ -255,7 +257,7 @@ class LongIO(_GraphBinaryTypeIO):
     @classmethod
     def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True):
         if obj < -9223372036854775808 or obj > 9223372036854775807:
-            raise Exception("TODO: don't forget bigint")
+            raise Exception("Value too big, please use bigint Gremlin type")
         else:
             cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend)
             to_extend.extend(cls.byte_format_pack(obj))
@@ -263,7 +265,7 @@ class LongIO(_GraphBinaryTypeIO):
 
     @classmethod
     def objectify(cls, buff, reader, nullable=True):
-            return cls.is_null(buff, reader, lambda b, r: int64_unpack(buff.read(8)), nullable)
+        return cls.is_null(buff, reader, lambda b, r: int64_unpack(buff.read(8)), nullable)
 
 
 class IntIO(LongIO):
@@ -278,6 +280,53 @@ class IntIO(LongIO):
         return cls.is_null(buff, reader, lambda b, r: cls.read_int(b), nullable)
 
 
+class ShortIO(LongIO):
+
+    python_type = ShortType
+    graphbinary_type = DataType.short
+    byte_format_pack = int16_pack
+    byte_format_unpack = int16_unpack
+
+    @classmethod
+    def objectify(cls, buff, reader, nullable=True):
+        return cls.is_null(buff, reader, lambda b, r: int16_unpack(buff.read(2)), nullable)
+
+
+class BigIntIO(_GraphBinaryTypeIO):
+
+    python_type = BigIntType
+    graphbinary_type = DataType.biginteger
+
+    @classmethod
+    def write_bigint(cls, obj, to_extend):
+        length = (obj.bit_length() + 7) // 8
+        if obj > 0:
+            b = obj.to_bytes(length, byteorder='big')
+            to_extend.extend(int32_pack(length + 1))
+            to_extend.extend(int8_pack(0))
+            to_extend.extend(b)
+        else:
+            # handle negative
+            b = obj.to_bytes(length, byteorder='big', signed=True)
+            to_extend.extend(int32_pack(length))
+            to_extend.extend(b)
+        return to_extend
+
+    @classmethod
+    def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True):
+        cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend)
+        return cls.write_bigint(obj, to_extend)
+
+    @classmethod
+    def read_bigint(cls, buff):
+        size = cls.read_int(buff)
+        return int.from_bytes(buff.read(size), byteorder='big', signed=True)
+
+    @classmethod
+    def objectify(cls, buff, reader, nullable=False):
+        return cls.is_null(buff, reader, lambda b, r: cls.read_bigint(b), nullable)
+
+
 class DateIO(_GraphBinaryTypeIO):
 
     python_type = datetime.datetime
@@ -378,6 +427,28 @@ class DoubleIO(FloatIO):
         return cls.is_null(buff, reader, lambda b, r: double_unpack(b.read(8)), nullable)
 
 
+class BigDecimalIO(_GraphBinaryTypeIO):
+
+    python_type = BigDecimal
+    graphbinary_type = DataType.bigdecimal
+
+    @classmethod
+    def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True):
+        cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend)
+        to_extend.extend(int32_pack(obj.scale))
+        return BigIntIO.write_bigint(obj.unscaled_value, to_extend)
+
+    @classmethod
+    def _read(cls, buff):
+        scale = int32_unpack(buff.read(4))
+        unscaled_value = BigIntIO.read_bigint(buff)
+        return BigDecimal(scale, unscaled_value)
+
+    @classmethod
+    def objectify(cls, buff, reader, nullable=False):
+        return cls.is_null(buff, reader, lambda b, r: cls._read(b), nullable)
+
+
 class CharIO(_GraphBinaryTypeIO):
     python_type = SingleChar
     graphbinary_type = DataType.char
diff --git a/gremlin-python/src/main/python/tests/driver/test_client.py b/gremlin-python/src/main/python/tests/driver/test_client.py
index 34b3841f88..f140c5a088 100644
--- a/gremlin-python/src/main/python/tests/driver/test_client.py
+++ b/gremlin-python/src/main/python/tests/driver/test_client.py
@@ -27,10 +27,13 @@ from gremlin_python.process.graph_traversal import __
 from gremlin_python.process.strategies import OptionsStrategy
 from gremlin_python.structure.graph import Graph
 from gremlin_python.driver.aiohttp.transport import AiohttpTransport
+from gremlin_python.statics import *
 from asyncio import TimeoutError
 
 __author__ = 'David M. Brown (davebshow@gmail.com)'
 
+test_no_auth_url = 'ws://localhost:45940/gremlin'
+
 
 def test_connection(connection):
     g = Graph().traversal()
@@ -47,11 +50,12 @@ def test_connection(connection):
 
 def test_client_message_too_big(client):
     try:
-        client = Client("http://localhost", 'g', max_content_length=1024)
-        client.submit("1+1").all().result()
+        client = Client(test_no_auth_url, 'g', max_content_length=1024)
+        client.submit("\" \".repeat(2000)").all().result()
         assert False
-    except Exception:
-        assert True
+    except Exception as ex:
+        assert ex.args[0].startswith("Received error on read: 'Message size") \
+               and ex.args[0].endswith("exceeds limit 1024'")
     finally:
         client.close()
 
@@ -80,7 +84,7 @@ def test_client_error(client):
 
 def test_client_connection_pool_after_error(client):
     # Overwrite fixture with pool_size=1 client
-    client = Client('ws://localhost:45940/gremlin', 'gmodern', pool_size=1)
+    client = Client(test_no_auth_url, 'gmodern', pool_size=1)
 
     try:
         # should fire an exception
@@ -93,12 +97,12 @@ def test_client_connection_pool_after_error(client):
 
 
 def test_client_side_timeout_set_for_aiohttp(client):
-    client = Client('ws://localhost:45940/gremlin', 'gmodern',
+    client = Client(test_no_auth_url, 'gmodern',
                     transport_factory=lambda: AiohttpTransport(read_timeout=1, write_timeout=1))
 
     try:
         # should fire an exception
-        client.submit('Thread.sleep(2000);1').all().result()
+        client.submit('Thread.sleep(1000);1').all().result()
         assert False
     except TimeoutError as err:
         # asyncio TimeoutError has no message.
@@ -108,7 +112,7 @@ def test_client_side_timeout_set_for_aiohttp(client):
 async def async_connect(enable):
     try:
         transport = AiohttpTransport(call_from_event_loop=enable)
-        transport.connect('ws://localhost:45940/gremlin')
+        transport.connect(test_no_auth_url)
         transport.close()
         return True
     except RuntimeError:
@@ -165,7 +169,7 @@ def test_client_async(client):
 
 def test_connection_share(client):
     # Overwrite fixture with pool_size=1 client
-    client = Client('ws://localhost:45940/gremlin', 'gmodern', pool_size=1)
+    client = Client(test_no_auth_url, 'gmodern', pool_size=1)
     g = Graph().traversal()
     t = g.V()
     message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'gmodern'}})
@@ -187,7 +191,7 @@ def test_multi_conn_pool(client):
     t = g.V()
     message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'gmodern'}})
     message2 = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'gmodern'}})
-    client = Client('ws://localhost:45940/gremlin', 'g', pool_size=1)
+    client = Client(test_no_auth_url, 'g', pool_size=1)
     future = client.submit_async(message)
     future2 = client.submit_async(message2)
 
@@ -240,9 +244,20 @@ def test_multi_thread_pool(client):
     assert results[3][0][0].object == 6
 
 
-def test_client_bytecode_with_int(client):
+def test_client_bytecode_with_long(client):
+    g = Graph().traversal()
+    t = g.V().has('age', long(851401972585122)).count()
+    message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'gmodern'}})
+    result_set = client.submit(message)
+    results = []
+    for result in result_set:
+        results += result
+    assert len(results) == 1
+
+
+def test_client_bytecode_with_bigint(client):
     g = Graph().traversal()
-    t = g.V().has('age', 851401972585122).count()
+    t = g.V().has('age', bigint(0x1000_0000_0000_0000_0000)).count()
     message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'gmodern'}})
     result_set = client.submit(message)
     results = []
@@ -254,7 +269,7 @@ def test_client_bytecode_with_int(client):
 def test_multi_request_in_session(client):
     # Overwrite fixture with session client
     session_id = str(uuid.uuid4())
-    client = Client('ws://localhost:45940/gremlin', 'g', session=session_id)
+    client = Client(test_no_auth_url, 'g', session=session_id)
 
     assert client.submit('x = 1').all().result()[0] == 1
     assert client.submit('x + 2').all().result()[0] == 3
@@ -262,7 +277,7 @@ def test_multi_request_in_session(client):
     client.close()
 
     # attempt reconnect to session and make sure "x" is no longer a thing
-    client = Client('ws://localhost:45940/gremlin', 'g', session=session_id)
+    client = Client(test_no_auth_url, 'g', session=session_id)
     try:
         # should fire an exception
         client.submit('x').all().result()
@@ -275,7 +290,7 @@ def test_client_pool_in_session(client):
     # Overwrite fixture with pool_size=2 client
     try:
         # should fire an exception
-        client = Client('ws://localhost:45940/gremlin', 'g', session=str(uuid.uuid4()), pool_size=2)
+        client = Client(test_no_auth_url, 'g', session=str(uuid.uuid4()), pool_size=2)
         assert False
     except Exception:
         assert True
diff --git a/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py
index b06753ddd5..ff4d3618b5 100644
--- a/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py
@@ -208,7 +208,7 @@ class TestDriverRemoteConnection(object):
         #
         g = traversal().withRemote(remote_connection).with_("x", True).with_('evaluationTimeout', 10)
         try:
-            g.inject(1).sideEffect(lambda: ("Thread.sleep(5000)", "gremlin-groovy")).iterate()
+            g.inject(1).sideEffect(lambda: ("Thread.sleep(1000)", "gremlin-groovy")).iterate()
             assert False
         except GremlinServerError as gse:
             assert gse.status_code == 598
diff --git a/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py b/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py
index d221b181a7..c0c8dc9730 100644
--- a/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py
+++ b/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py
@@ -20,7 +20,7 @@ under the License.
 import datetime
 import uuid
 
-from gremlin_python.driver.serializer import GraphSONSerializersV2d0
+from gremlin_python.driver.serializer import GraphSONSerializersV2d0, GraphBinarySerializersV1
 from gremlin_python.structure.graph import Graph
 from gremlin_python.statics import *
 
@@ -65,6 +65,71 @@ def test_uuid(remote_connection):
         g.V(vid).drop().iterate()
 
 
+def test_short(remote_connection):
+    if not isinstance(remote_connection._client._message_serializer, GraphBinarySerializersV1):
+        return
+
+    g = Graph().traversal().withRemote(remote_connection)
+    num = short(1111)
+    resp = g.addV('test_vertex').property('short', num).toList()
+    vid = resp[0].id
+    try:
+        bigint_prop = g.V(vid).properties('short').toList()[0]
+        assert isinstance(bigint_prop.value, int)
+        assert bigint_prop.value == num
+    finally:
+        g.V(vid).drop().iterate()
+
+
+def test_bigint_positive(remote_connection):
+    if not isinstance(remote_connection._client._message_serializer, GraphBinarySerializersV1):
+        return
+
+    g = Graph().traversal().withRemote(remote_connection)
+    big = bigint(0x1000_0000_0000_0000_0000)
+    resp = g.addV('test_vertex').property('bigint', big).toList()
+    vid = resp[0].id
+    try:
+        bigint_prop = g.V(vid).properties('bigint').toList()[0]
+        assert isinstance(bigint_prop.value, int)
+        assert bigint_prop.value == big
+    finally:
+        g.V(vid).drop().iterate()
+
+
+def test_bigint_negative(remote_connection):
+    if not isinstance(remote_connection._client._message_serializer, GraphBinarySerializersV1):
+        return
+
+    g = Graph().traversal().withRemote(remote_connection)
+    big = bigint(-0x1000_0000_0000_0000_0000)
+    resp = g.addV('test_vertex').property('bigint', big).toList()
+    vid = resp[0].id
+    try:
+        bigint_prop = g.V(vid).properties('bigint').toList()[0]
+        assert isinstance(bigint_prop.value, int)
+        assert bigint_prop.value == big
+    finally:
+        g.V(vid).drop().iterate()
+
+
+def test_bigdecimal(remote_connection):
+    if not isinstance(remote_connection._client._message_serializer, GraphBinarySerializersV1):
+        return
+
+    g = Graph().traversal().withRemote(remote_connection)
+    bigdecimal = BigDecimal(101, 235)
+    resp = g.addV('test_vertex').property('bigdecimal', bigdecimal).toList()
+    vid = resp[0].id
+    try:
+        bigdecimal_prop = g.V(vid).properties('bigdecimal').toList()[0]
+        assert isinstance(bigdecimal_prop.value, BigDecimal)
+        assert bigdecimal_prop.value.scale == bigdecimal.scale
+        assert bigdecimal_prop.value.unscaled_value == bigdecimal.unscaled_value
+    finally:
+        g.V(vid).drop().iterate()
+
+
 def test_odd_bits(remote_connection):
     if not isinstance(remote_connection._client._message_serializer, GraphSONSerializersV2d0):
         g = Graph().traversal().withRemote(remote_connection)
@@ -85,7 +150,7 @@ def test_odd_bits(remote_connection):
             assert v == char_upper
         finally:
             g.V(vid).drop().iterate()
-                
+
         dur = datetime.timedelta(seconds=1000, microseconds=1000)
         resp = g.addV('test_vertex').property('dur', dur).toList()
         vid = resp[0].id
diff --git a/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryV1.py b/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryV1.py
index 2f2b2117ec..2007cda430 100644
--- a/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryV1.py
+++ b/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryV1.py
@@ -21,7 +21,7 @@ import datetime
 import uuid
 import math
 
-from gremlin_python.statics import timestamp, long, SingleByte, SingleChar, ByteBufferType
+from gremlin_python.statics import timestamp, long, bigint, BigDecimal, SingleByte, SingleChar, ByteBufferType
 from gremlin_python.structure.graph import Vertex, Edge, Property, VertexProperty, Path
 from gremlin_python.structure.io.graphbinaryV1 import GraphBinaryWriter, GraphBinaryReader
 from gremlin_python.process.traversal import Barrier, Binding, Bytecode
@@ -49,6 +49,11 @@ class TestGraphSONWriter(object):
         output = self.graphbinary_reader.readObject(self.graphbinary_writer.writeObject(x))
         assert x == output
 
+    def test_bigint(self):
+        x = bigint(0x1000_0000_0000_0000_0000)
+        output = self.graphbinary_reader.readObject(self.graphbinary_writer.writeObject(x))
+        assert x == output
+
     def test_float(self):
         x = float(100.001)
         output = self.graphbinary_reader.readObject(self.graphbinary_writer.writeObject(x))
@@ -71,6 +76,12 @@ class TestGraphSONWriter(object):
         output = self.graphbinary_reader.readObject(self.graphbinary_writer.writeObject(x))
         assert x == output
 
+    def test_bigdecimal(self):
+        x = BigDecimal(100, 234)
+        output = self.graphbinary_reader.readObject(self.graphbinary_writer.writeObject(x))
+        assert x.scale == output.scale
+        assert x.unscaled_value == output.unscaled_value
+
     def test_date(self):
         x = datetime.datetime(2016, 12, 14, 16, 14, 36, 295000)
         output = self.graphbinary_reader.readObject(self.graphbinary_writer.writeObject(x))


[tinkerpop] 02/02: revert creating default message_serializer

Posted by ly...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lyndonb pushed a commit to branch 3.5-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit f6103633585e00d0e36f5ee0980148d5d921125d
Author: valentynk <va...@bitquilltech.com>
AuthorDate: Fri Jun 3 11:43:50 2022 -0700

    revert creating default message_serializer
---
 .../src/main/python/gremlin_python/driver/driver_remote_connection.py   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py b/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
index a24a05ab57..dc8310023b 100644
--- a/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
+++ b/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
@@ -59,7 +59,7 @@ class DriverRemoteConnection(RemoteConnection):
         # so that they can be closed if this parent session is closed.
         self.__spawned_sessions = []
 
-        if message_serializer is None and graphson_reader is not None and graphson_writer is not None:
+        if message_serializer is None:
             message_serializer = serializer.GraphSONMessageSerializer(
                 reader=graphson_reader,
                 writer=graphson_writer)