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:56 UTC
[27/50] tinkerpop git commit: TINKERPOP-1784 Added feature tests for
addV()
TINKERPOP-1784 Added feature tests for addV()
Included Cardinality in imports for test logic
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/99105194
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/99105194
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/99105194
Branch: refs/heads/tp32
Commit: 9910519423bbf89f05f48ec83986ea9e6cec0e4f
Parents: 9c93fd7
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Nov 10 12:55:01 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Nov 21 15:52:53 2017 -0500
----------------------------------------------------------------------
.../src/main/jython/radish/feature_steps.py | 3 +-
gremlin-test/features/map/AddVertex.feature | 147 +++++++++++++++++++
2 files changed, 149 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/99105194/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 6c72bf1..90b0120 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 P, Scope, Column, Order, Direction, T, Pick, Operator
+from gremlin_python.process.traversal import Cardinality, P, Scope, Column, Order, Direction, T, Pick, Operator
from radish import given, when, then
from hamcrest import *
@@ -215,6 +215,7 @@ def _translate(traversal):
def _make_traversal(g, traversal_string, params):
b = {"g": g,
"__": __,
+ "Cardinality": Cardinality,
"Column": Column,
"Direction": Direction,
"Order": Order,
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/99105194/gremlin-test/features/map/AddVertex.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/AddVertex.feature b/gremlin-test/features/map/AddVertex.feature
new file mode 100644
index 0000000..3335e29
--- /dev/null
+++ b/gremlin-test/features/map/AddVertex.feature
@@ -0,0 +1,147 @@
+# 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 - addV()
+
+ Scenario: g_VX1X_addVXanimalX_propertyXage_selectXaX_byXageXX_propertyXname_puppyX
+ Given the empty graph
+ And the graph initializer of
+ """
+ g.addV("person").property(T.id, 1).property("name", "marko").property("age", 29).as("marko").
+ addV("person").property(T.id, 2).property("name", "vadas").property("age", 27).as("vadas").
+ addV("software").property(T.id, 3).property("name", "lop").property("lang", "java").as("lop").
+ addV("person").property(T.id, 4).property("name","josh").property("age", 32).as("josh").
+ addV("software").property(T.id, 5).property("name", "ripple").property("lang", "java").as("ripple").
+ addV("person").property(T.id, 6).property("name", "peter").property("age", 35).as('peter').
+ addE("knows").from("marko").to("vadas").property(T.id, 7).property("weight", 0.5).
+ addE("knows").from("marko").to("josh").property(T.id, 8).property("weight", 1.0).
+ addE("created").from("marko").to("lop").property(T.id, 9).property("weight", 0.4).
+ addE("created").from("josh").to("ripple").property(T.id, 10).property("weight", 1.0).
+ addE("created").from("josh").to("lop").property(T.id, 11).property("weight", 0.4).
+ addE("created").from("peter").to("lop").property(T.id, 12).property("weight", 0.2)
+ """
+ And using the parameter v1Id defined as "v[marko].id"
+ And the traversal of
+ """
+ g.V(v1Id).as("a").addV("animal").property("age", __.select("a").by("age")).property("name", "puppy")
+ """
+ When iterated to list
+ Then the result should have a count of 1
+ And the graph should return 1 for count of "g.V().has(\"animal\",\"age\",29)"
+
+ Scenario: g_V_addVXanimalX_propertyXage_0X
+ Given the empty graph
+ And the graph initializer of
+ """
+ g.addV("person").property(T.id, 1).property("name", "marko").property("age", 29).as("marko").
+ addV("person").property(T.id, 2).property("name", "vadas").property("age", 27).as("vadas").
+ addV("software").property(T.id, 3).property("name", "lop").property("lang", "java").as("lop").
+ addV("person").property(T.id, 4).property("name","josh").property("age", 32).as("josh").
+ addV("software").property(T.id, 5).property("name", "ripple").property("lang", "java").as("ripple").
+ addV("person").property(T.id, 6).property("name", "peter").property("age", 35).as('peter').
+ addE("knows").from("marko").to("vadas").property(T.id, 7).property("weight", 0.5).
+ addE("knows").from("marko").to("josh").property(T.id, 8).property("weight", 1.0).
+ addE("created").from("marko").to("lop").property(T.id, 9).property("weight", 0.4).
+ addE("created").from("josh").to("ripple").property(T.id, 10).property("weight", 1.0).
+ addE("created").from("josh").to("lop").property(T.id, 11).property("weight", 0.4).
+ addE("created").from("peter").to("lop").property(T.id, 12).property("weight", 0.2)
+ """
+ And the traversal of
+ """
+ g.V().addV("animal").property("age", 0)
+ """
+ When iterated to list
+ Then the result should have a count of 6
+ And the graph should return 6 for count of "g.V().has(\"animal\",\"age\",0)"
+
+ Scenario: g_addVXpersonX_propertyXname_stephenX
+ Given the empty graph
+ And the graph initializer of
+ """
+ g.addV("person").property(T.id, 1).property("name", "marko").property("age", 29).as("marko").
+ addV("person").property(T.id, 2).property("name", "vadas").property("age", 27).as("vadas").
+ addV("software").property(T.id, 3).property("name", "lop").property("lang", "java").as("lop").
+ addV("person").property(T.id, 4).property("name","josh").property("age", 32).as("josh").
+ addV("software").property(T.id, 5).property("name", "ripple").property("lang", "java").as("ripple").
+ addV("person").property(T.id, 6).property("name", "peter").property("age", 35).as('peter').
+ addE("knows").from("marko").to("vadas").property(T.id, 7).property("weight", 0.5).
+ addE("knows").from("marko").to("josh").property(T.id, 8).property("weight", 1.0).
+ addE("created").from("marko").to("lop").property(T.id, 9).property("weight", 0.4).
+ addE("created").from("josh").to("ripple").property(T.id, 10).property("weight", 1.0).
+ addE("created").from("josh").to("lop").property(T.id, 11).property("weight", 0.4).
+ addE("created").from("peter").to("lop").property(T.id, 12).property("weight", 0.2)
+ """
+ And the traversal of
+ """
+ g.addV("person").property("name", "stephen")
+ """
+ When iterated to list
+ Then the result should have a count of 1
+ And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"stephen\")"
+
+ Scenario: g_addVXpersonX_propertyXsingle_name_stephenX_propertyXsingle_name_stephenmX
+ Given the empty graph
+ And the graph initializer of
+ """
+ g.addV("person").property(T.id, 1).property("name", "marko").property("age", 29).as("marko").
+ addV("person").property(T.id, 2).property("name", "vadas").property("age", 27).as("vadas").
+ addV("software").property(T.id, 3).property("name", "lop").property("lang", "java").as("lop").
+ addV("person").property(T.id, 4).property("name","josh").property("age", 32).as("josh").
+ addV("software").property(T.id, 5).property("name", "ripple").property("lang", "java").as("ripple").
+ addV("person").property(T.id, 6).property("name", "peter").property("age", 35).as('peter').
+ addE("knows").from("marko").to("vadas").property(T.id, 7).property("weight", 0.5).
+ addE("knows").from("marko").to("josh").property(T.id, 8).property("weight", 1.0).
+ addE("created").from("marko").to("lop").property(T.id, 9).property("weight", 0.4).
+ addE("created").from("josh").to("ripple").property(T.id, 10).property("weight", 1.0).
+ addE("created").from("josh").to("lop").property(T.id, 11).property("weight", 0.4).
+ addE("created").from("peter").to("lop").property(T.id, 12).property("weight", 0.2)
+ """
+ And the traversal of
+ """
+ g.addV("person").property(Cardinality.single, "name", "stephen").property(Cardinality.single, "name", "stephenm")
+ """
+ When iterated to list
+ Then the result should have a count of 1
+ And the graph should return 0 for count of "g.V().has(\"person\",\"name\",\"stephen\")"
+ And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"stephenm\")"
+
+ Scenario: get_g_addVXpersonX_propertyXsingle_name_stephenX_propertyXsingle_name_stephenm_since_2010X
+ Given the empty graph
+ And the graph initializer of
+ """
+ g.addV("person").property(T.id, 1).property("name", "marko").property("age", 29).as("marko").
+ addV("person").property(T.id, 2).property("name", "vadas").property("age", 27).as("vadas").
+ addV("software").property(T.id, 3).property("name", "lop").property("lang", "java").as("lop").
+ addV("person").property(T.id, 4).property("name","josh").property("age", 32).as("josh").
+ addV("software").property(T.id, 5).property("name", "ripple").property("lang", "java").as("ripple").
+ addV("person").property(T.id, 6).property("name", "peter").property("age", 35).as('peter').
+ addE("knows").from("marko").to("vadas").property(T.id, 7).property("weight", 0.5).
+ addE("knows").from("marko").to("josh").property(T.id, 8).property("weight", 1.0).
+ addE("created").from("marko").to("lop").property(T.id, 9).property("weight", 0.4).
+ addE("created").from("josh").to("ripple").property(T.id, 10).property("weight", 1.0).
+ addE("created").from("josh").to("lop").property(T.id, 11).property("weight", 0.4).
+ addE("created").from("peter").to("lop").property(T.id, 12).property("weight", 0.2)
+ """
+ And the traversal of
+ """
+ g.addV("person").property(Cardinality.single, "name", "stephen").property(Cardinality.single, "name", "stephenm", "since", 2010)
+ """
+ When iterated to list
+ Then the result should have a count of 1
+ And the graph should return 0 for count of "g.V().has(\"person\",\"name\",\"stephen\")"
+ And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"stephenm\")"
+ And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"stephenm\").properties(\"name\").has(\"since\",2010)"
\ No newline at end of file