TINKERPOP-1857 select() GLV tests
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/43519778 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/43519778 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/43519778 Branch: refs/heads/TINKERPOP-1857 Commit: 43519778b0f0c71a93ff0d91efc153995e1ebec6 Parents: 314481e Author: Stephen Mallette <sp...@genoprime.com> Authored: Tue Feb 6 09:08:55 2018 -0500 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Wed Feb 14 15:34:10 2018 -0500 ---------------------------------------------------------------------- .../src/main/jython/radish/feature_steps.py | 3 +- gremlin-test/features/map/Properties.feature | 16 +- gremlin-test/features/map/Select.feature | 209 ++++++++++++++++++- .../process/traversal/step/map/SelectTest.java | 2 +- .../gremlin/process/FeatureCoverageTest.java | 13 +- 5 files changed, 224 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/43519778/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 e6392d5..7c0525f 100644 --- a/gremlin-python/src/main/jython/radish/feature_steps.py +++ b/gremlin-python/src/main/jython/radish/feature_steps.py @@ -21,7 +21,7 @@ import json import re from gremlin_python.structure.graph import Graph, Path from gremlin_python.process.graph_traversal import __ -from gremlin_python.process.traversal import Cardinality, P, Scope, Column, Order, Direction, T, Pick, Operator +from gremlin_python.process.traversal import Cardinality, P, Pop, Scope, Column, Order, Direction, T, Pick, Operator from radish import given, when, then from hamcrest import * @@ -259,6 +259,7 @@ def _make_traversal(g, traversal_string, params): "Order": Order, "P": P, "Pick": Pick, + "Pop": Pop, "Scope": Scope, "Operator": Operator, "T": T} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/43519778/gremlin-test/features/map/Properties.feature ---------------------------------------------------------------------- diff --git a/gremlin-test/features/map/Properties.feature b/gremlin-test/features/map/Properties.feature index 58a5531..3c926fa 100644 --- a/gremlin-test/features/map/Properties.feature +++ b/gremlin-test/features/map/Properties.feature @@ -51,18 +51,4 @@ Feature: Step - properties() | josh | | d[32].i | | peter | - | d[35].i | - - Scenario: g_V_hasXageX_properties_hasXid_nameIdX_value - Given an unsupported test - Then nothing should happen because - """ - There is no way to currently get property identifiers on elements. - """ - - Scenario: g_V_hasXageX_propertiesXnameX - Given an unsupported test - Then nothing should happen because - """ - There is no way to currently assert property elements in the test logic. - """ + | d[35].i | \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/43519778/gremlin-test/features/map/Select.feature ---------------------------------------------------------------------- diff --git a/gremlin-test/features/map/Select.feature b/gremlin-test/features/map/Select.feature index 06f00d2..94c4f22 100644 --- a/gremlin-test/features/map/Select.feature +++ b/gremlin-test/features/map/Select.feature @@ -321,4 +321,211 @@ Feature: Step - select() When iterated to list Then the result should be unordered | result | - | m[{"ripple":"d[1].l", "lop":"d[6].l"}] | \ No newline at end of file + | m[{"ripple":"d[1].l", "lop":"d[6].l"}] | + + Scenario: g_V_untilXout_outX_repeatXin_asXaXX_selectXaX_byXtailXlocalX_nameX + Given the modern graph + And the traversal of + """ + g.V().until(__.out().out()).repeat(__.in().as("a")).select("a").by(__.tail(Scope.local).values("name")) + """ + When iterated to list + Then the result should be unordered + | result | + | marko | + | marko | + | marko | + | marko | + | marko | + + Scenario: get_g_V_outE_weight_groupCount_selectXkeysX_unfold + Given the modern graph + And the traversal of + """ + g.V().outE().values("weight").groupCount().select(Column.keys).unfold() + """ + When iterated to list + Then the result should be unordered + | result | + | d[0.5].f | + | d[1.0].f | + | d[0.4].f | + | d[0.2].f | + + Scenario: g_V_hasLabelXsoftwareX_asXnameX_asXlanguageX_asXcreatorsX_selectXname_language_creatorsX_byXnameX_byXlangX_byXinXcreatedX_name_fold_orderXlocalXX + Given the modern graph + And the traversal of + """ + g.V().hasLabel("software").as("name").as("language").as("creators").select("name", "language", "creators").by("name").by("lang"). + by(__.in("created").values("name").fold().order(Scope.local)) + """ + When iterated to list + Then the result should be unordered + | result | + | m[{"name":"lop","language":"java","creators":["josh","marko","peter"]}] | + | m[{"name":"ripple","language":"java","creators":["josh"]}] | + + Scenario: g_V_outE_weight_groupCount_unfold_selectXkeysX_unfold + Given the modern graph + And the traversal of + """ + g.V().outE().values("weight").groupCount().unfold().select(Column.keys).unfold() + """ + When iterated to list + Then the result should be unordered + | result | + | d[0.5].f | + | d[1.0].f | + | d[0.4].f | + | d[0.2].f | + + Scenario: g_V_outE_weight_groupCount_unfold_selectXvaluesX_unfold + Given the modern graph + And the traversal of + """ + g.V().outE().values("weight").groupCount().unfold().select(Column.values).unfold() + """ + When iterated to list + Then the result should be unordered + | result | + | d[1].l | + | d[2].l | + | d[2].l | + | d[1].l | + + Scenario: g_V_untilXout_outX_repeatXin_asXaX_in_asXbXX_selectXa_bX_byXnameX + Given the modern graph + And the traversal of + """ + g.V().until(__.out().out()).repeat(__.in().as("a").in().as("b")).select("a", "b").by("name") + """ + When iterated to list + Then the result should be unordered + | result | + | m[{"a":"josh","b":"marko"}] | + | m[{"a":"josh","b":"marko"}] | + + Scenario: g_V_outE_weight_groupCount_selectXvaluesX_unfold + Given the modern graph + And the traversal of + """ + g.V().outE().values("weight").groupCount().select(Column.values).unfold() + """ + When iterated to list + Then the result should be unordered + | result | + | d[1].l | + | d[2].l | + | d[2].l | + | d[1].l | + + Scenario: g_VX1X_asXaX_outXknowsX_asXbX_selectXa_bX + Given the modern graph + And using the parameter v1Id defined as "v[marko].id" + And the traversal of + """ + g.V(v1Id).as("a").out("knows").as("b").select("a", "b") + """ + When iterated to list + Then the result should be unordered + | result | + | m[{"a":"v[marko]","b":"v[vadas]"}] | + | m[{"a":"v[marko]","b":"v[josh]"}] | + + Scenario: g_V_asXaX_whereXoutXknowsXX_selectXaX + Given the modern graph + And the traversal of + """ + g.V().as("a").where(__.out("knows")).select("a") + """ + When iterated to list + Then the result should be unordered + | result | + | v[marko] | + + Scenario: g_VX1X_asXaX_repeatXout_asXaXX_timesX2X_selectXfirst_aX + Given the modern graph + And using the parameter v1Id defined as "v[marko].id" + And the traversal of + """ + g.V(v1Id).as("a").repeat(__.out().as("a")).times(2).select(Pop.first, "a") + """ + When iterated to list + Then the result should be unordered + | result | + | v[marko] | + | v[marko] | + + Scenario: g_V_asXaX_outXknowsX_asXbX_localXselectXa_bX_byXnameXX + Given the modern graph + And the traversal of + """ + g.V().as("a").out("knows").as("b").local(__.select("a", "b").by("name")) + """ + When iterated to list + Then the result should be unordered + | result | + | m[{"a":"marko","b":"vadas"}] | + | m[{"a":"marko","b":"josh"}] | + + Scenario: g_VX1X_asXaX_repeatXout_asXaXX_timesX2X_selectXlast_aX + Given the modern graph + And using the parameter v1Id defined as "v[marko].id" + And the traversal of + """ + g.V(v1Id).as("a").repeat(__.out().as("a")).times(2).select(Pop.last, "a") + """ + When iterated to list + Then the result should be unordered + | result | + | v[ripple] | + | v[lop] | + + Scenario: g_VX1X_outEXknowsX_asXhereX_hasXweight_1X_inV_hasXname_joshX_selectXhereX + Given the modern graph + And using the parameter v1Id defined as "v[marko].id" + And the traversal of + """ + g.V(v1Id).outE("knows").as("here").has("weight", 1.0).inV().has("name", "josh").select("here") + """ + When iterated to list + Then the result should be unordered + | result | + | e[marko-knows->josh] | + + Scenario: g_V_asXaX_hasXname_markoX_asXbX_asXcX_selectXa_b_cX_by_byXnameX_byXageX + Given the modern graph + And the traversal of + """ + g.V().as("a").has("name", "marko").as("b").as("c").select("a", "b", "c").by().by("name").by("age") + """ + When iterated to list + Then the result should be unordered + | result | + | m[{"a":"v[marko]","b":"marko","c":"d[29].i"}] | + + Scenario: g_V_outE_weight_groupCount_selectXvaluesX_unfold_groupCount_selectXvaluesX_unfold + Given the modern graph + And the traversal of + """ + g.V().outE().values("weight").groupCount().select(Column.values).unfold().groupCount().select(Column.values).unfold() + """ + When iterated to list + Then the result should be unordered + | result | + | d[2].l | + | d[2].l | + + Scenario: g_V_outE_weight_groupCount_selectXkeysX_unfold + Given the modern graph + And the traversal of + """ + g.V().outE().values("weight").groupCount().select(Column.keys).unfold() + """ + When iterated to list + Then the result should be unordered + | result | + | d[0.5].f | + | d[1.0].f | + | d[0.4].f | + | d[0.2].f | \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/43519778/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectTest.java index 6d07edf..c0486d0 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectTest.java @@ -567,7 +567,7 @@ public abstract class SelectTest extends AbstractGremlinProcessTest { @Test @LoadGraphWith(MODERN) - public void g_V_asXaX_whereXoutXknowsXX_selectXaX_byXnameX() { + public void g_V_asXaX_whereXoutXknowsXX_selectXaX() { final Traversal<Vertex, Vertex> traversal = get_g_V_asXaX_whereXoutXknowsXX_selectXaX(); printTraversalForm(traversal); assertEquals(convertToVertex(graph, "marko"), traversal.next()); http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/43519778/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 b2a83d7..9e6ca72 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 @@ -104,6 +104,10 @@ public class FeatureCoverageTest { // deprecated tests "g_V_addVXlabel_animal_age_0X", "g_addVXlabel_person_name_stephenX", + // GLV suite doesn't support property identifiers and related assertions + "g_V_hasXageX_properties_hasXid_nameIdX_value", + "g_V_hasXageX_properties_hasXid_nameIdAsStringX_value", + "g_V_hasXageX_propertiesXnameX", // grateful dead graph not supported in GLV suite "g_V_matchXa_0sungBy_b__a_0writtenBy_c__b_writtenBy_d__c_sungBy_d__d_hasXname_GarciaXX", "g_V_matchXa_hasXsong_name_sunshineX__a_mapX0followedBy_weight_meanX_b__a_0followedBy_c__c_filterXweight_whereXgteXbXXX_outV_dX_selectXdX_byXnameX", @@ -115,7 +119,14 @@ public class FeatureCoverageTest { "get_g_V_matchXa_followedBy_count_isXgtX10XX_b__a_0followedBy_count_isXgtX10XX_bX_count", "g_V_matchXa_followedBy_count_isXgtX10XX_b__a_0followedBy_count_isXgtX10XX_bX_count", "g_V_hasXsong_name_OHBOYX_outXfollowedByX_outXfollowedByX_order_byXperformancesX_byXsongType_incrX", - "g_V_hasLabelXsongX_order_byXperfomances_decrX_byXnameX_rangeX110_120X_name"); + "g_V_hasLabelXsongX_order_byXperfomances_decrX_byXnameX_rangeX110_120X_name", + // Pop tests not organized right for GLVs + "g_V_valueMap_selectXpop_aX", + "g_V_selectXa_bX", + "g_V_valueMap_selectXpop_a_bX", + "g_V_selectXaX", + // assertion doesn't seem to want to work right for embedded lists + "g_V_asXa_bX_out_asXcX_path_selectXkeysX"); @Test // @Ignore("As it stands we won't have all of these tests migrated initially so there is no point to running this in full - it can be flipped on later")