You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/08/29 17:12:05 UTC
tinkerpop git commit: [x:y] range() in Python uses longs to ensure
proper GraphSON 2.0 serialization. Added a test case to
test_driver_remote_connection around lambda usage and side-effects that are
'non' aggregateTo. CTR.
Repository: tinkerpop
Updated Branches:
refs/heads/master b49c21d46 -> 4d1b0277f
[x:y] range() in Python uses longs to ensure proper GraphSON 2.0 serialization. Added a test case to test_driver_remote_connection around lambda usage and side-effects that are 'non' aggregateTo. CTR.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/4d1b0277
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/4d1b0277
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/4d1b0277
Branch: refs/heads/master
Commit: 4d1b0277fa12b6f7e047b2d4617a9947c93357ab
Parents: b49c21d
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Aug 29 11:12:01 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Aug 29 11:12:01 2016 -0600
----------------------------------------------------------------------
.../python/GraphTraversalSourceGenerator.groovy | 4 ++--
.../gremlin_python/process/graph_traversal.py | 4 ++--
.../tests/driver/test_driver_remote_connection.py | 16 ++++++++--------
3 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4d1b0277/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
index aaaa5b6..9187302 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
@@ -126,9 +126,9 @@ under the License.
Traversal.__init__(self, graph, traversal_strategies, bytecode)
def __getitem__(self, index):
if isinstance(index, int):
- return self.range(index, index + 1)
+ return self.range(long(index), long(index + 1))
elif isinstance(index, slice):
- return self.range(0 if index.start is None else index.start, sys.maxint if index.stop is None else index.stop)
+ return self.range(0L if index.start is None else long(index.start), long(sys.maxint) if index.stop is None else long(index.stop))
else:
raise TypeError("Index must be int or slice")
def __getattr__(self, key):
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4d1b0277/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index a9a1e8f..13d2629 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -89,9 +89,9 @@ class GraphTraversal(Traversal):
Traversal.__init__(self, graph, traversal_strategies, bytecode)
def __getitem__(self, index):
if isinstance(index, int):
- return self.range(index, index + 1)
+ return self.range(long(index), long(index + 1))
elif isinstance(index, slice):
- return self.range(0 if index.start is None else index.start, sys.maxint if index.stop is None else index.stop)
+ return self.range(0L if index.start is None else long(index.start), long(sys.maxint) if index.stop is None else long(index.stop))
else:
raise TypeError("Index must be int or slice")
def __getattr__(self, key):
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4d1b0277/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
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 3838dae..7855c74 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
@@ -53,14 +53,7 @@ class TestDriverRemoteConnection(TestCase):
assert 10 == g.V().repeat(both()).times(5)[0:10].count().next()
assert 1 == g.V().repeat(both()).times(5)[0].count().next()
assert 0 == g.V().repeat(both()).times(5)[0:0].count().next()
-
- #
- # Fails because max long is typed to Int32:
- # {"@type":"g:Bytecode","@value":{"step":[["V"],["range",{"@type":"g:Int32","@value":2},{"@type":"g:Int32","@value":9223372036854775807}],["count"]]}}
- #
- # assert 4 == g.V()[2:].count().next()
- #
-
+ assert 4 == g.V()[2:].count().next()
assert 2 == g.V()[:2].count().next()
# todo: need a traversal metrics deserializer
g.V().out().profile().next()
@@ -110,6 +103,13 @@ class TestDriverRemoteConnection(TestCase):
assert "ripple" in n.keys()
assert 3 == n["lop"]
assert 1 == n["ripple"]
+ #
+ t = g.withSideEffect('m',32).V().map(lambda: "x: x.sideEffects('m')")
+ results = t.toSet()
+ assert 1 == len(results)
+ assert 32 == list(results)[0]
+ assert 32 == t.side_effects['m']
+ assert 1 == len(t.side_effects.keys())
try:
x = t.side_effects["x"]
raise Exception("Accessing a non-existent key should throw an error")