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 19:42:50 UTC
[tinkerpop] 01/01: graph binary 3.5-dev -> 3.6-dev conflict fixes
This is an automated email from the ASF dual-hosted git repository.
lyndonb pushed a commit to branch 3.6-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit cd9592229fc74c343f23aac1b74fbb20382d0932
Merge: 38e66f26bb f610363358
Author: Lyndon Bauto <ly...@bitquilltech.com>
AuthorDate: Thu Jun 9 11:45:27 2022 -0700
graph binary 3.5-dev -> 3.6-dev conflict fixes
.../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 | 85 ++++++++++++++++++++--
.../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, 207 insertions(+), 28 deletions(-)
diff --cc gremlin-python/src/main/python/gremlin_python/driver/serializer.py
index 4a6ecadd82,7ab537258a..d210614927
--- a/gremlin-python/src/main/python/gremlin_python/driver/serializer.py
+++ b/gremlin-python/src/main/python/gremlin_python/driver/serializer.py
@@@ -256,10 -256,10 +256,10 @@@ 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)
+ self._graphbinary_writer.to_dict(v, ba)
return bytes(ba)
diff --cc gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV1.py
index 75006593ea,602bd759cb..47a777e038
--- a/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV1.py
+++ b/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV1.py
@@@ -30,9 -31,10 +30,10 @@@ from struct import pack, unpac
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.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, \
+from gremlin_python.process.traversal import Barrier, Binding, Bytecode, Cardinality, Column, Direction, Merge, \
Operator, Order, Pick, Pop, P, Scope, TextP, Traversal, Traverser, \
TraversalStrategy, T
from gremlin_python.process.graph_traversal import GraphTraversal
diff --cc gremlin-python/src/main/python/tests/structure/io/test_graphbinaryV1.py
index 3aab7d29ef,2007cda430..12b50db4b6
--- 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,12 -21,10 +21,12 @@@ import datetim
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
+from gremlin_python.process.traversal import Barrier, Binding, Bytecode, Merge, Direction
+
+from_ = Direction.OUT
class TestGraphBinaryReader(object):
@@@ -48,12 -46,17 +48,17 @@@ class TestGraphSONWriter(object)
def test_long(self):
x = long(100)
- output = self.graphbinary_reader.readObject(self.graphbinary_writer.writeObject(x))
+ output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(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))
+ output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x))
assert x == output
x = float('nan')
@@@ -70,12 -73,18 +75,18 @@@
def test_double(self):
x = 100.001
- output = self.graphbinary_reader.readObject(self.graphbinary_writer.writeObject(x))
+ output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(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))
+ output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x))
assert x == output
def test_timestamp(self):