TINKERPOP-1784 Added tests for project()
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e747e9f1 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e747e9f1 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e747e9f1 Branch: refs/heads/TINKERPOP-1784 Commit: e747e9f19e516f8479c1a734d805794e4b34c308 Parents: 048a009 Author: Stephen Mallette <sp...@genoprime.com> Authored: Fri Oct 20 13:29:41 2017 -0400 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Thu Nov 2 13:37:23 2017 -0400 ---------------------------------------------------------------------- .../src/main/jython/radish/feature_steps.py | 1 - gremlin-test/features/map/Project.feature | 53 ++++++++++++++++++++ .../gremlin/process/FeatureCoverageTest.java | 2 + 3 files changed, 55 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e747e9f1/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 0d71f78..f58f0da 100644 --- a/gremlin-python/src/main/jython/radish/feature_steps.py +++ b/gremlin-python/src/main/jython/radish/feature_steps.py @@ -76,7 +76,6 @@ def translate_traversal(step): @when("iterated to list") def iterate_the_traversal(step): - print str(step.context.traversal.bytecode) step.context.result = map(lambda x: _convert_results(x), step.context.traversal.toList()) http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e747e9f1/gremlin-test/features/map/Project.feature ---------------------------------------------------------------------- diff --git a/gremlin-test/features/map/Project.feature b/gremlin-test/features/map/Project.feature new file mode 100644 index 0000000..3d8b9cc --- /dev/null +++ b/gremlin-test/features/map/Project.feature @@ -0,0 +1,53 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +Feature: Step - project() + + Scenario: g_V_hasLabelXpersonX_projectXa_bX_byXoutE_countX_byXageX + Given the modern graph + And the traversal of + """ + g.V().hasLabel("person"). + project("a", "b"). + by(__.outE().count()). + by("age") + """ + When iterated to list + Then the result should be unordered + | m[{"a":3, "b":29}] | + | m[{"a":0, "b":27}] | + | m[{"a":2, "b":32}] | + | m[{"a":1, "b":35}] | + + Scenario: g_V_outXcreatedX_projectXa_bX_byXnameX_byXinXcreatedX_countX_order_byXselectXbX__decrX_selectXaX + Given the modern graph + And the traversal of + """ + g.V().out("created"). + project("a", "b"). + by("name"). + by(__.in("created").count()). + order(). + by(__.select("b"), Order.decr). + select("a") + """ + When iterated to list + Then the result should be unordered + | lop | + | lop | + | lop | + | ripple | \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e747e9f1/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java index 09344b4..eb62f77 100644 --- a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java +++ b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java @@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DropTest; import org.apache.tinkerpop.gremlin.process.traversal.step.filter.IsTest; import org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest; import org.apache.tinkerpop.gremlin.process.traversal.step.map.PathTest; +import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProjectTest; import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest; import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateTest; import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupCountTest; @@ -76,6 +77,7 @@ public class FeatureCoverageTest { // map CountTest.class, PathTest.class, + ProjectTest.class, VertexTest.class, // sideEffect AggregateTest.class,