tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [24/50] tinkerpop git commit: TINKERPOP-1784 Add tests for inject() and provide method for ignoring tests
Date Thu, 02 Nov 2017 17:38:21 GMT
TINKERPOP-1784 Add tests for inject() and provide method for ignoring tests


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

Branch: refs/heads/TINKERPOP-1784
Commit: 1b3bb15a49409ded00aa6fe1fd2bf164149d3044
Parents: e9c14a1
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Wed Oct 18 14:36:25 2017 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Thu Nov 2 13:37:23 2017 -0400

----------------------------------------------------------------------
 .../src/main/jython/radish/feature_steps.py     | 11 +++++
 gremlin-test/features/filter/Coin.feature       |  1 -
 gremlin-test/features/sideEffect/Inject.feature | 49 ++++++++++++++++++++
 .../gremlin/process/FeatureCoverageTest.java    |  4 +-
 4 files changed, 63 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1b3bb15a/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 a0fcd9b..f348ccb 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -34,6 +34,9 @@ regex_not = re.compile(r"([(.,\s])not\(")
 regex_or = re.compile(r"([(.,\s])or\(")
 
 
+ignores = ["g.V(v1Id).out().inject(v2).values(\"name\")"]
+
+
 @given("the {graph_name:w} graph")
 def choose_graph(step, graph_name):
     step.context.g = Graph().traversal().withRemote(step.context.remote_conn[graph_name])
@@ -65,6 +68,7 @@ def add_parameter(step, param_name, param):
 
 @given("the traversal of")
 def translate_traversal(step):
+    step.context.ignore = ignores.__contains__(step.text)
     step.context.traversal = _make_traversal(
         step.context.g, step.text,
         step.context.traversal_params if hasattr(step.context, "traversal_params") else {})
@@ -72,6 +76,7 @@ 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())
 
 
@@ -82,6 +87,9 @@ def next_the_traversal(step):
 
 @then("the result should be {characterized_as:w}")
 def assert_result(step, characterized_as):
+    if step.context.ignore:
+        return
+
     if characterized_as == "empty":
         assert_that(len(step.context.result), equal_to(0))
     elif characterized_as == "ordered":
@@ -94,6 +102,9 @@ def assert_result(step, characterized_as):
 
 @then("the graph should return {count:d} for count of {traversal_string:QuotedString}")
 def assert_side_effects(step, count, traversal_string):
+    if step.context.ignore:
+        return
+
     t = _make_traversal(step.context.g, traversal_string, {})
     assert_that(count, equal_to(t.count().next()))
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1b3bb15a/gremlin-test/features/filter/Coin.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Coin.feature b/gremlin-test/features/filter/Coin.feature
index d1acc46..569f1db 100644
--- a/gremlin-test/features/filter/Coin.feature
+++ b/gremlin-test/features/filter/Coin.feature
@@ -32,7 +32,6 @@ Feature: Step - coin()
       | v[ripple] |
       | v[peter]  |
 
-
   Scenario: g_V_coinX0X
     Given the modern graph
     And the traversal of

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1b3bb15a/gremlin-test/features/sideEffect/Inject.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/sideEffect/Inject.feature b/gremlin-test/features/sideEffect/Inject.feature
new file mode 100644
index 0000000..fcb5ff4
--- /dev/null
+++ b/gremlin-test/features/sideEffect/Inject.feature
@@ -0,0 +1,49 @@
+# 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 - inject()
+
+  Scenario: g_VX1X_out_injectXv2X_name
+    Given the modern graph
+    And using the parameter v1Id defined as "v[marko].id"
+    And using the parameter v2 defined as "v[vadas]"
+    And the traversal of
+      """
+      g.V(v1Id).out().inject(v2).values("name")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | vadas |
+      | lop   |
+      | vadas |
+      | josh  |
+
+
+  Scenario: g_VX1X_out_name_injectXdanielX_asXaX_mapXlengthX_path
+    Given the modern graph
+    And using the parameter v1Id defined as "v[marko].id"
+    And using the parameter c defined as "c[it.get().length()]"
+    And the traversal of
+      """
+      g.V(v1Id).out().values("name").inject("daniel").as("a").map(c).path()
+      """
+    When iterated to list
+    Then the result should be unordered
+      | p[daniel,d[6]] |
+      | p[v[marko],v[lop],lop,d[3]] |
+      | p[v[marko],v[vadas],vadas,d[5]] |
+      | p[v[marko],v[josh],josh,d[4]] |

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1b3bb15a/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 bb2c483..d8ffc53 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
@@ -29,6 +29,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.PathTest;
 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;
+import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.InjectTest;
 import org.junit.Test;
 
 import java.io.BufferedReader;
@@ -77,7 +78,8 @@ public class FeatureCoverageTest {
                 VertexTest.class,
                 // sideEffect
                 AggregateTest.class,
-                GroupCountTest.class);
+                GroupCountTest.class,
+                InjectTest.class);
 
         final Field field = ProcessStandardSuite.class.getDeclaredField("testsToEnforce");
         field.setAccessible(true);


Mime
View raw message