Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1784 94cca010a -> 2486326fc


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/bb6171f2
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/bb6171f2
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/bb6171f2

Branch: refs/heads/TINKERPOP-1784
Commit: bb6171f2a53a186986634dda87904734f74eb1df
Parents: 94cca01
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 20 13:32:54 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 20 13:32:54 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/bb6171f2/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")

Reply via email to