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/21 20:53:49 UTC
[15/50] tinkerpop git commit: TINKERPOP-1784 Added dedup() feature
tests
TINKERPOP-1784 Added dedup() feature tests
Reworked test language for asserting counts so that it works better as a standalone assertion.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a5d99774
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a5d99774
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a5d99774
Branch: refs/heads/TINKERPOP-1784
Commit: a5d99774e2f6b8dbe312062e99380b5a80873816
Parents: a9af53f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 24 11:37:18 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Nov 21 15:52:52 2017 -0500
----------------------------------------------------------------------
.../src/main/jython/radish/feature_steps.py | 2 +-
gremlin-test/features/branch/Local.feature | 12 +-
gremlin-test/features/branch/Repeat.feature | 2 +-
gremlin-test/features/filter/Dedup.feature | 222 +++++++++++++++++++
4 files changed, 230 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a5d99774/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 2d2ae8d..14a0153 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -112,7 +112,7 @@ def assert_side_effects(step, count, traversal_string):
assert_that(count, equal_to(t.count().next()))
-@then("only have a result count of {count:d}")
+@then("should have a result count of {count:d}")
def assert_count(step, count):
assert_that(count, equal_to(len(step.context.result)))
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a5d99774/gremlin-test/features/branch/Local.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/branch/Local.feature b/gremlin-test/features/branch/Local.feature
index 53ae3ab..fa12d8c 100644
--- a/gremlin-test/features/branch/Local.feature
+++ b/gremlin-test/features/branch/Local.feature
@@ -73,7 +73,7 @@ Feature: Step - local()
Then the result should be of
| vadas |
| josh |
- And only have a result count of 1
+ And should have a result count of 1
Scenario: g_V_localXbothEXcreatedX_limitX1XX_otherV_name
Given the modern graph
@@ -88,7 +88,7 @@ Feature: Step - local()
| ripple |
| josh |
| peter |
- And only have a result count of 5
+ And should have a result count of 5
Scenario: g_VX4X_localXbothEX1_createdX_limitX1XX
Given the modern graph
@@ -101,7 +101,7 @@ Feature: Step - local()
Then the result should be of
| e[josh-created->lop] |
| e[josh-created->ripple] |
- And only have a result count of 1
+ And should have a result count of 1
Scenario: g_VX4X_localXbothEXknows_createdX_limitX1XX
Given the modern graph
@@ -115,7 +115,7 @@ Feature: Step - local()
| e[marko-knows->josh] |
| e[josh-created->lop] |
| e[josh-created->ripple] |
- And only have a result count of 1
+ And should have a result count of 1
Scenario: g_VX4X_localXbothE_limitX1XX_otherV_name
Given the modern graph
@@ -129,7 +129,7 @@ Feature: Step - local()
| marko |
| ripple |
| lop |
- And only have a result count of 1
+ And should have a result count of 1
Scenario: g_VX4X_localXbothE_limitX2XX_otherV_name
Given the modern graph
@@ -143,7 +143,7 @@ Feature: Step - local()
| marko |
| ripple |
| lop |
- And only have a result count of 2
+ And should have a result count of 2
Scenario: g_V_localXinEXknowsX_limitX2XX_outV_name
Given the modern graph
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a5d99774/gremlin-test/features/branch/Repeat.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/branch/Repeat.feature b/gremlin-test/features/branch/Repeat.feature
index e6049b5..6d97fc0 100644
--- a/gremlin-test/features/branch/Repeat.feature
+++ b/gremlin-test/features/branch/Repeat.feature
@@ -68,7 +68,7 @@ Feature: Step - repeat()
| v[lop] |
| v[josh] |
| v[vadas] |
- And only have a result count of 8
+ And should have a result count of 8
Scenario: g_VX1X_timesX2X_repeatXoutX_name
Given the modern graph
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a5d99774/gremlin-test/features/filter/Dedup.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Dedup.feature b/gremlin-test/features/filter/Dedup.feature
new file mode 100644
index 0000000..7433da2
--- /dev/null
+++ b/gremlin-test/features/filter/Dedup.feature
@@ -0,0 +1,222 @@
+# 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 - dedup()
+
+ Scenario: g_V_out_in_valuesXnameX_fold_dedupXlocalX_unfold
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().out().in().values("name").fold().dedup(Scope.local).unfold()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | marko |
+ | josh |
+ | peter |
+
+ Scenario: g_V_out_asXxX_in_asXyX_selectXx_yX_byXnameX_fold_dedupXlocal_x_yX_unfold
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().out().as("x").in().as("y").select("x", "y").by("name").fold().dedup(Scope.local, "x", "y").unfold()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | m[{"x":"lop","y":"marko"}] |
+ | m[{"x":"lop","y":"josh"}] |
+ | m[{"x":"lop","y":"peter"}] |
+ | m[{"x":"vadas","y":"marko"}] |
+ | m[{"x":"josh","y":"marko"}] |
+ | m[{"x":"ripple","y":"josh"}] |
+
+ Scenario: g_V_both_dedup_name
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().both().dedup().values("name")
+ """
+ When iterated to list
+ Then the result should be unordered
+ | lop |
+ | vadas |
+ | josh |
+ | peter |
+ | marko |
+ | ripple |
+
+ Scenario: g_V_both_hasXlabel_softwareX_dedup_byXlangX_name
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().both().has(T.label, "software").dedup().by("lang").values("name")
+ """
+ When iterated to list
+ Then the result should be unordered
+ | lop |
+
+ Scenario: g_V_both_name_order_byXa_bX_dedup_value
+ Given the modern graph
+ And using the parameter l defined as "c[a,b -> a.value().compareTo(b.value())]"
+ And the traversal of
+ """
+ g.V().both().properties("name").order().by(l).dedup().value()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | josh |
+ | lop |
+ | marko |
+ | peter |
+ | ripple |
+ | vadas |
+
+ Scenario: g_V_both_both_name_dedup
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().both().both().values("name").dedup()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | josh |
+ | lop |
+ | marko |
+ | peter |
+ | ripple |
+ | vadas |
+
+ Scenario: g_V_both_both_dedup
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().both().both().dedup()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | v[josh] |
+ | v[lop] |
+ | v[marko] |
+ | v[peter] |
+ | v[ripple] |
+ | v[vadas] |
+
+ Scenario: g_V_both_both_dedup_byXlabelX
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().both().both().dedup().by(T.label)
+ """
+ When iterated to list
+ Then should have a result count of 2
+
+ Scenario: g_V_group_byXlabelX_byXbothE_weight_dedup_foldX
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().group().by(T.label).by(__.bothE().values("weight").dedup().fold())
+ """
+ When iterated to list
+ Then the result should be unordered
+ | m[{"software":[1.0,0.4,0.2],"person":[0.5,1.0,0.4,0.2]}] |
+
+ Scenario: g_V_asXaX_both_asXbX_dedupXa_bX_byXlabelX_selectXa_bX
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().as("a").both().as("b").dedup("a", "b").by(T.label).select("a", "b")
+ """
+ When iterated to list
+ Then the result should be unordered
+ | m[{"a":"v[marko]","b":"v[lop]"}] |
+ | m[{"a":"v[marko]","b":"v[vadas]"}] |
+ | m[{"a":"v[lop]","b":"v[marko]"}] |
+
+ Scenario: g_V_asXaX_outXcreatedX_asXbX_inXcreatedX_asXcX_dedupXa_bX_path
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().as("a").out("created").as("b").in("created").as("c").dedup("a", "b").path()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | p[v[marko],v[lop],v[marko]] |
+ | p[v[josh],v[ripple],v[josh]] |
+ | p[v[josh],v[lop],v[marko]] |
+ | p[v[peter],v[lop],v[marko]] |
+
+ Scenario: g_V_outE_asXeX_inV_asXvX_selectXeX_order_byXweight_incrX_selectXvX_valuesXnameX_dedup
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().outE().as("e").inV().as("v").select("e").order().by("weight", Order.incr).select("v").values("name").dedup()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | lop |
+ | vadas |
+ | josh |
+ | ripple |
+
+ Scenario: g_V_both_both_dedup_byXoutE_countX_name
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().both().both().dedup().by(__.outE().count()).values("name")
+ """
+ When iterated to list
+ Then the result should be unordered
+ | marko |
+ | josh |
+ | peter |
+ | ripple |
+
+ Scenario: g_V_groupCount_selectXvaluesX_unfold_dedup
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().groupCount().select(Column.values).unfold().dedup()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | d[1] |
+
+ Scenario: g_V_asXaX_repeatXbothX_timesX3X_emit_name_asXbX_group_byXselectXaXX_byXselectXbX_dedup_order_foldX_selectXvaluesX_unfold_dedup
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().as("a").repeat(__.both()).times(3).emit().values("name").as("b").group().by(__.select("a")).by(__.select("b").dedup().order().fold()).select(Column.values).unfold().dedup()
+ """
+ When iterated next
+ Then the result should be unordered
+ | josh |
+ | lop |
+ | marko |
+ | peter |
+ | ripple |
+ | vadas |
+
+ Scenario: g_V_repeatXdedupX_timesX2X_count
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().repeat(__.dedup()).times(2).count()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | d[0] |
+