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/11/22 18:48:23 UTC
[08/50] tinkerpop git commit: TINKERPOP-1784 Added tail() feature
tests
TINKERPOP-1784 Added tail() feature tests
Added fixes to python test logic for the reserved global keyword and fixed ordering test logic a bit.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e67cbdb8
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e67cbdb8
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e67cbdb8
Branch: refs/heads/master
Commit: e67cbdb86241dd7d2baa42cb9a6e1458788839ee
Parents: 7896264
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Nov 10 12:05:57 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Nov 21 15:52:52 2017 -0500
----------------------------------------------------------------------
.../src/main/jython/radish/feature_steps.py | 7 +-
gremlin-test/features/filter/Tail.feature | 166 +++++++++++++++++++
2 files changed, 171 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e67cbdb8/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 dae6361a..6c72bf1 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -28,6 +28,7 @@ from hamcrest import *
regex_and = re.compile(r"([(.,\s])and\(")
regex_as = re.compile(r"([(.,\s])as\(")
regex_from = re.compile(r"([(.,\s])from\(")
+regex_global = re.compile(r"([(.,\s])global")
regex_in = re.compile(r"([(.,\s])in\(")
regex_is = re.compile(r"([(.,\s])is\(")
regex_not = re.compile(r"([(.,\s])not\(")
@@ -193,15 +194,17 @@ def _table_assertion(data, result, ctx, ordered):
assert_that(results_to_test[ix], equal_to(val))
else:
assert_that(val, is_in(results_to_test))
- results_to_test.remove(val)
+ results_to_test.remove(val)
- assert_that(len(results_to_test), is_(0))
+ if not ordered:
+ assert_that(len(results_to_test), is_(0))
def _translate(traversal):
replaced = traversal.replace("\n", "")
replaced = regex_and.sub(r"\1and_(", replaced)
replaced = regex_from.sub(r"\1from_(", replaced)
+ replaced = regex_global.sub(r"\1global_", replaced)
replaced = regex_as.sub(r"\1as_(", replaced)
replaced = regex_is.sub(r"\1is_(", replaced)
replaced = regex_not.sub(r"\1not_(", replaced)
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e67cbdb8/gremlin-test/features/filter/Tail.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Tail.feature b/gremlin-test/features/filter/Tail.feature
new file mode 100644
index 0000000..35083ef
--- /dev/null
+++ b/gremlin-test/features/filter/Tail.feature
@@ -0,0 +1,166 @@
+# 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 - tail()
+
+ Scenario: g_V_valuesXnameX_order_tailXglobal_2X
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().values("name").order().tail(Scope.global, 2)
+ """
+ When iterated to list
+ Then the result should be ordered
+ | result |
+ | ripple |
+ | vadas |
+
+ Scenario: g_V_valuesXnameX_order_tailX2X
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().values("name").order().tail(2)
+ """
+ When iterated to list
+ Then the result should be ordered
+ | result |
+ | ripple |
+ | vadas |
+
+ Scenario: g_V_valuesXnameX_order_tail
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().values("name").order().tail()
+ """
+ When iterated to list
+ Then the result should be ordered
+ | result |
+ | vadas |
+
+ Scenario: g_V_valuesXnameX_order_tailX7X
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().values("name").order().tail(7)
+ """
+ When iterated to list
+ Then the result should be ordered
+ | result |
+ | josh |
+ | lop |
+ | marko |
+ | peter |
+ | ripple |
+ | vadas |
+
+ Scenario: g_V_repeatXbothX_timesX3X_tailX7X
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().repeat(__.both()).times(3).tail(7)
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | v[peter] |
+ | v[peter] |
+ | v[peter] |
+ | v[peter] |
+ | v[marko] |
+ | v[marko] |
+ | v[marko] |
+
+ Scenario: g_V_repeatXin_outX_timesX3X_tailX7X_count
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().repeat(__.in().out()).times(3).tail(7).count()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | d[7] |
+
+ Scenario: g_V_asXaX_out_asXaX_out_asXaX_selectXaX_byXunfold_valuesXnameX_foldX_tailXlocal_2X
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().as("a").out().as("a").out().as("a").select("a").by(__.unfold().values("name").fold()).tail(Scope.local, 2)
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | l[josh,ripple] |
+ | l[josh,lop] |
+
+ Scenario: g_V_asXaX_out_asXaX_out_asXaX_selectXaX_byXunfold_valuesXnameX_foldX_tailXlocal_1X
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().as("a").out().as("a").out().as("a").select("a").by(__.unfold().values("name").fold()).tail(Scope.local, 1)
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | ripple |
+ | lop |
+
+ Scenario: g_V_asXaX_out_asXaX_out_asXaX_selectXaX_byXunfold_valuesXnameX_foldX_tailXlocalX
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().as("a").out().as("a").out().as("a").select("a").by(__.unfold().values("name").fold()).tail(Scope.local)
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | ripple |
+ | lop |
+
+ Scenario: g_V_asXaX_out_asXaX_out_asXaX_selectXaX_byXlimitXlocal_0XX_tailXlocal_1X
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().as("a").out().as("a").out().as("a").select("a").by(__.limit(Scope.local, 0)).tail(Scope.local, 1)
+ """
+ When iterated to list
+ Then the result should be empty
+
+ Scenario: g_V_asXaX_out_asXbX_out_asXcX_selectXa_b_cX_byXnameX_tailXlocal_2X
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().as("a").out().as("b").out().as("c").select("a","b","c").by("name").tail(Scope.local, 2)
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | m[{"b":"josh","c":"ripple"}] |
+ | m[{"b":"josh","c":"lop"}] |
+
+ Scenario: g_V_asXaX_out_asXbX_out_asXcX_selectXa_b_cX_byXnameX_tailXlocal_1X
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().as("a").out().as("b").out().as("c").select("a","b","c").by("name").tail(Scope.local, 1)
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | m[{"c":"ripple"}] |
+ | m[{"c":"lop"}] |
\ No newline at end of file