You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/10/16 15:20:33 UTC

[20/47] tinkerpop git commit: TINKERPOP-1784 Use python eval() to setup test traversals

TINKERPOP-1784 Use python eval() to setup test traversals


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b835a609
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b835a609
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b835a609

Branch: refs/heads/TINKERPOP-1784
Commit: b835a6093c900030de23bdbfd088a22fcc5a8050
Parents: f4e4d55
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 20 13:32:54 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 16 11:19:29 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/count_features_step.py        | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b835a609/gremlin-python/src/main/jython/radish/count_features_step.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/count_features_step.py b/gremlin-python/src/main/jython/radish/count_features_step.py
index 324c29c..ec04551 100644
--- a/gremlin-python/src/main/jython/radish/count_features_step.py
+++ b/gremlin-python/src/main/jython/radish/count_features_step.py
@@ -34,16 +34,7 @@ def choose_graph(step, graphName):
 @given("the traversal of")
 def translate_traversal(step):
     g = step.context.g
-    if step.text == "g.V().count()":
-        step.context.traversal = g.V().count()
-    elif step.text == "g.V().both().both().count()":
-        step.context.traversal = g.V().both().both().count()
-    elif step.text == "g.V().fold().count(Scope.local)":
-        step.context.traversal = g.V().fold().count(Scope.local)
-    elif step.text == "g.V().has(\"no\").count()":
-        step.context.traversal = g.V().has("no").count()
-    else:
-        raise ValueError("Gremlin translation to python not found - missing: " + step.text)
+    step.context.traversal = eval(step.text, {"g": g, "Scope": Scope})
 
 
 @when("iterating")