TINKERPOP-1784 Added support for numeric keys in glv tests

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

Branch: refs/heads/TINKERPOP-1784
Commit: 769e8ae2f6a4fd6c84872ee858b91c46a2a25836
Parents: 2881ace
Author: Stephen Mallette <[email protected]>
Authored: Fri Sep 22 14:43:13 2017 -0400
Committer: Stephen Mallette <[email protected]>
Committed: Mon Oct 16 11:19:30 2017 -0400

----------------------------------------------------------------------
 gremlin-python/src/main/jython/radish/feature_steps.py | 10 ++++++----
 gremlin-test/features/sideEffect/GroupCount.feature    | 10 ++++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/769e8ae2/gremlin-python/src/main/jython/radish/feature_steps.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/feature_steps.py 
b/gremlin-python/src/main/jython/radish/feature_steps.py
index 19da3ec..35103f3 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -25,8 +25,6 @@ from gremlin_python.process.traversal import P, Scope, Column
 from radish import given, when, then
 from hamcrest import *
 
-out = __.out
-
 
 @given("the {graph_name:w} graph")
 def choose_graph(step, graph_name):
@@ -40,7 +38,8 @@ def translate_traversal(step):
     step.context.traversal = eval(step.text, {"g": g,
                                               "Column": Column,
                                               "P": P,
-                                              "Scope": Scope})
+                                              "Scope": Scope,
+                                              "bothE": __.bothE})
 
 
 @when("iterated to list")
@@ -49,9 +48,12 @@ def iterate_the_traversal(step):
 
 
 def __convert(m, ctx):
+    # transform string map keys from the test spec to numbers when it 
encounters the appropriate patterns
     n = {}
     for key, value in m.items():
-        if isinstance(key, str) and re.match("v\[.*\]", key):
+        if re.match("d\[.*\]", key):
+            n[long(key[2:-1])] = value
+        elif re.match("v\[.*\]", key):
             n[ctx.lookup["modern"][key[2:-1]]] = value
         else:
             n[key] = value

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/769e8ae2/gremlin-test/features/sideEffect/GroupCount.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/GroupCount.feature 
b/gremlin-test/features/sideEffect/GroupCount.feature
index d8d5b51..7b4a0a6 100644
--- a/gremlin-test/features/sideEffect/GroupCount.feature
+++ b/gremlin-test/features/sideEffect/GroupCount.feature
@@ -27,6 +27,16 @@ Feature: Step - groupCount()
     Then the result should be ordered
       | map | {"ripple": 1, "lop": 3} |
 
+  Scenario: Edge count distribution
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().groupCount().by(bothE().count())
+      """
+    When iterated to list
+    Then the result should be ordered
+      | map | {"d[1]": 3, "d[3]": 3} |
+
   Scenario: Group count vertices, cap to retrieve the map and unfold it to 
group count again
     Given the modern graph
     And the traversal of

Reply via email to