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/09/29 14:30:50 UTC

[21/28] tinkerpop git commit: TINKERPOP-1784 Added support for numeric keys in glv tests

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

Branch: refs/heads/TINKERPOP-1784
Commit: c51bbb55c2623363cfef81212bfb1c088543a4ef
Parents: 522d1ba
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 22 14:43:13 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Sep 29 07:21:24 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/c51bbb55/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/c51bbb55/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