This is an automated email from the ASF dual-hosted git repository.
xiazcy pushed a commit to branch master-http
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/master-http by this push:
new 592d431901 update tests in docker and enable feature tests in
gremlin-python over HTTP (#2756)
592d431901 is described below
commit 592d43190141c10d540148f76ad78773f4ad74eb
Author: Yang Xia <[email protected]>
AuthorDate: Tue Sep 3 14:08:03 2024 -0700
update tests in docker and enable feature tests in gremlin-python over HTTP
(#2756)
---
CHANGELOG.asciidoc | 1 +
docker/gremlin-server/docker-entrypoint.sh | 9 +-
.../gremlin-server-integration-secure.yaml | 8 +-
.../gremlin-server/gremlin-server-integration.yaml | 8 +-
gremlin-python/build/generate.groovy | 2 +-
gremlin-python/docker-compose.yml | 32 +-
.../python/gremlin_python/process/translator.py | 298 -------------
.../python/gremlin_python/process/traversal.py | 52 ++-
.../src/main/python/gremlin_python/statics.py | 1 +
.../src/main/python/radish/feature_steps.py | 13 +-
gremlin-python/src/main/python/radish/gremlin.py | 6 +-
gremlin-python/src/main/python/radish/terrain.py | 8 +-
gremlin-python/src/main/python/radish/utils.py | 49 ++-
gremlin-python/src/main/python/setup.py | 4 +-
gremlin-python/src/main/python/tests/conftest.py | 4 +-
.../src/main/python/tests/driver/test_client.py | 5 +-
.../tests/driver/test_driver_remote_connection.py | 103 ++---
.../test_driver_remote_connection_threaded.py | 7 +-
.../driver/test_web_socket_client_behavior.py | 3 +
.../src/main/python/tests/process/test_dsl.py | 16 +-
.../main/python/tests/process/test_gremlin_lang.py | 120 +++---
.../main/python/tests/process/test_strategies.py | 134 +++---
.../main/python/tests/process/test_translator.py | 459 ---------------------
.../main/python/tests/process/test_traversal.py | 8 +-
.../tests/structure/io/test_functionalityio.py | 51 +--
.../gremlin/test/features/map/MergeEdge.feature | 4 +
.../gremlin/test/features/map/MergeVertex.feature | 8 +
.../test/features/semantics/Comparability.feature | 24 +-
.../test/features/semantics/Equality.feature | 4 +-
.../test/features/semantics/Orderability.feature | 4 +-
.../test/features/sideEffect/Aggregate.feature | 2 +
.../test/features/sideEffect/Inject.feature | 8 +-
.../gremlin/test/features/sideEffect/Store.feature | 2 +
33 files changed, 342 insertions(+), 1115 deletions(-)
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 7af6405b09..e866a96bbf 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -60,6 +60,7 @@
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
* Removed usage of `Bytecode` from `gremlin-python`.
* Added `auth` module in `gremlin-python` for pluggable authentication.
* Fixed `GremlinLangScriptEngine` handling for some strategies.
+* Updated Docker test suite set-up in `gremlin-python` to work with HTTP
driver/server.
* Modified the `split()` step to split a string into a list of its characters
if the given separator is an empty string.
== TinkerPop 3.7.0 (Gremfir Master of the Pan Flute)
diff --git a/docker/gremlin-server/docker-entrypoint.sh
b/docker/gremlin-server/docker-entrypoint.sh
index fa87baf212..fc412f736c 100644
--- a/docker/gremlin-server/docker-entrypoint.sh
+++ b/docker/gremlin-server/docker-entrypoint.sh
@@ -59,14 +59,7 @@ dos2unix /opt/gremlin-server/bin/gremlin-server.conf
/opt/gremlin-server/bin/gremlin-server.sh
${TINKERPOP_HOME}/conf/gremlin-server-integration.yaml &
-/opt/gremlin-server/bin/gremlin-server.sh
${TINKERPOP_HOME}/conf/gremlin-server-integration-secure.yaml &
-
-java -cp
/opt/gremlin-test/apache-tinkerpop-gremlin-test-${GREMLIN_SERVER_VERSION}-jar-with-dependencies.jar
\
- -Dlogback.configurationFile="file:/opt/gremlin-server/conf/logback.xml" \
- org.apache.tinkerpop.gremlin.server.KdcFixture /opt/gremlin-server &
-
-export JAVA_OPTIONS="-Xms512m -Xmx4096m
-Djava.security.krb5.conf=/opt/gremlin-server/target/kdc/krb5.conf"
-/opt/gremlin-server/bin/gremlin-server.sh
${TINKERPOP_HOME}/conf/gremlin-server-integration-krb5.yaml
+/opt/gremlin-server/bin/gremlin-server.sh
${TINKERPOP_HOME}/conf/gremlin-server-integration-secure.yaml
#######################################################################
diff --git a/docker/gremlin-server/gremlin-server-integration-secure.yaml
b/docker/gremlin-server/gremlin-server-integration-secure.yaml
index 5523518231..42447f5ac3 100644
--- a/docker/gremlin-server/gremlin-server-integration-secure.yaml
+++ b/docker/gremlin-server/gremlin-server-integration-secure.yaml
@@ -36,11 +36,9 @@ scriptEngines: {
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin:
{classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin:
{files: [scripts/generate-all.groovy]}}}}
serializers:
- - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV3, config: {
ioRegistries:
[org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3] }}
- - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV2, config: {
ioRegistries:
[org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2] }}
- - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV1, config: {
ioRegistries:
[org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1] }}
- - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1 }
- - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1, config: {
serializeResultToString: true }}
+ - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV4, config: {
ioRegistries:
[org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3] }}
# application/json
+ - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4 }
# application/vnd.graphbinary-v1.0
+ - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4, config: {
serializeResultToString: true }}
metrics: {
slf4jReporter: {enabled: true, interval: 180000}}
gremlinPool: 8
diff --git a/docker/gremlin-server/gremlin-server-integration.yaml
b/docker/gremlin-server/gremlin-server-integration.yaml
index 9a277cdaa3..f6d9b437e4 100644
--- a/docker/gremlin-server/gremlin-server-integration.yaml
+++ b/docker/gremlin-server/gremlin-server-integration.yaml
@@ -38,11 +38,9 @@ scriptEngines: {
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin:
{classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin:
{files: [scripts/generate-all.groovy]}}}}
serializers:
- - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV3, config: {
ioRegistries:
[org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3] }}
- - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV2, config: {
ioRegistries:
[org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2] }}
- - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV1, config: {
ioRegistries:
[org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV1] }}
- - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1 }
- - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1, config: {
serializeResultToString: true }}
+ - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV4, config: {
ioRegistries:
[org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3] }}
# application/json
+ - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4 }
# application/vnd.graphbinary-v1.0
+ - { className:
org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4, config: {
serializeResultToString: true }}
metrics: {
slf4jReporter: {enabled: true, interval: 180000}}
gremlinPool: 8
diff --git a/gremlin-python/build/generate.groovy
b/gremlin-python/build/generate.groovy
index 9a35651765..5672b55add 100644
--- a/gremlin-python/build/generate.groovy
+++ b/gremlin-python/build/generate.groovy
@@ -71,7 +71,7 @@ radishGremlinFile.withWriter('UTF-8') { Writer writer ->
writer.writeLine('world.gremlins = {')
gremlins.each { k,v ->
// skipping lambdas until we decide for sure that they are out in 4.x
- if (v.any { it.contains('l1')} || v.any { it.contains('pred1')} ||
v.any { it.contains('Lambda')}) {
+ if (v.any { it.contains('l1')} || v.any { it.contains('l2')} || v.any
{ it.contains('c1')} || v.any { it.contains('c2')} || v.any {
it.contains('pred1')} || v.any { it.contains('Lambda')}) {
writer.writeLine(" '${k}': [], # skipping as it contains a
lambda")
} else if (staticTranslate.containsKey(k)) {
writer.writeLine(staticTranslate[k])
diff --git a/gremlin-python/docker-compose.yml
b/gremlin-python/docker-compose.yml
index b03ec9cf89..22c5965bb3 100644
--- a/gremlin-python/docker-compose.yml
+++ b/gremlin-python/docker-compose.yml
@@ -29,20 +29,17 @@ services:
ports:
- "45940:45940"
- "45941:45941"
- - "45942:45942"
- "4588:4588"
volumes:
- ${HOME}/.groovy:/root/.groovy
- ${HOME}/.m2:/root/.m2
- ${ABS_PROJECT_HOME}/gremlin-test/target:/opt/gremlin-test
healthcheck:
- test: [ "CMD-SHELL", "apk add curl && curl -f
http://localhost:45940?gremlin=100-1" ]
+ test: [ "CMD-SHELL", "apk add curl && curl -X POST -d
{\"gremlin\":\"100-1\"} http://localhost:45940" ]
interval: 30s
timeout: 10s
retries: 30
start_period: 30s
- depends_on:
- - gremlin-socket-server
gremlin-python-integration-tests:
container_name: gremlin-python-integration-tests
@@ -51,31 +48,18 @@ services:
- ${BUILD_DIR:-./src/main/python}:/python_app
-
../gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features:/python_app/gremlin-test/features
- ../docker/gremlin-test-server:/python_app/gremlin-test-server
- -
../gremlin-tools/gremlin-socket-server/conf:/python_app/gremlin-socket-server/conf/
-
environment:
- DEBIAN_FRONTEND=noninteractive
- - KRB5_CONFIG=./gremlin-test-server/krb5.conf
- - KRB5CCNAME=./test-tkt.cc
- - GREMLIN_SERVER_URL=ws://gremlin-server-test-python:{}/gremlin
- -
GREMLIN_SERVER_BASIC_AUTH_URL=wss://gremlin-server-test-python:{}/gremlin
- - GREMLIN_SERVER_URL_HTTP=http://gremlin-server-test-python:{}/
- -
GREMLIN_SERVER_BASIC_AUTH_URL_HTTP=https://gremlin-server-test-python:{}/
- - KRB_HOSTNAME=${KRB_HOSTNAME:-gremlin-server-test}
+ - GREMLIN_SERVER_URL=http://gremlin-server-test-python:{}/gremlin
+ -
GREMLIN_SERVER_BASIC_AUTH_URL=https://gremlin-server-test-python:{}/gremlin
- VERSION=${VERSION}
- - GREMLIN_SOCKET_SERVER_URL=ws://gremlin-socket-server-python:{}/gremlin
- -
GREMLIN_SOCKET_SERVER_CONFIG_PATH=/python_app/gremlin-socket-server/conf/test-ws-gremlin.yaml
working_dir: /python_app
command: >
- bash -c "apt-get update && apt-get -y install libkrb5-dev krb5-user
- && echo 'password' | kinit stephen
- && klist
- && pip install wheel radish-bdd PyHamcrest aenum isodate kerberos
+ bash -c "pip install wheel radish-bdd PyHamcrest aenum isodate
&& python3 ./setup.py build
&& python3 ./setup.py test
&& python3 ./setup.py install
- && radish -f dots -e -t -b ./radish ./gremlin-test
--user-data='serializer=application/vnd.gremlin-v3.0+json'
- && radish -f dots -e -t -b ./radish ./gremlin-test
--user-data='serializer=application/vnd.graphbinary-v1.0';
+ && radish -f dots -e -t -b ./radish ./gremlin-test
--user-data='serializer=application/vnd.graphbinary-v4.0';
EXIT_CODE=$$?; chown -R `stat -c "%u:%g" .` .; exit $$EXIT_CODE"
depends_on:
gremlin-server-test-python:
@@ -92,9 +76,3 @@ services:
command: >
bash -c "python3 setup.py sdist bdist_wheel;
EXIT_CODE=$$?; chown -R `stat -c "%u:%g" .` .; exit $$EXIT_CODE"
-
- gremlin-socket-server:
- container_name: gremlin-socket-server-python
- image: tinkerpop/gremlin-socket-server:${GREMLIN_SERVER}
- ports:
- - "45943:45943"
diff --git
a/gremlin-python/src/main/python/gremlin_python/process/translator.py
b/gremlin-python/src/main/python/gremlin_python/process/translator.py
deleted file mode 100755
index 95feab6d52..0000000000
--- a/gremlin-python/src/main/python/gremlin_python/process/translator.py
+++ /dev/null
@@ -1,298 +0,0 @@
-#
-# 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.
-#
-
-"""
-Class that can turn traversals back into Gremlin Groovy format text queries.
-Those queries can then be run in the Gremlin console or using the GLV
submit(<String>) API or
-sent to any TinkerPop compliant HTTP endpoint.
-"""
-__author__ = 'Kelvin R. Lawrence (gfxman)'
-
-import math
-import numbers
-import re
-
-from gremlin_python.process.traversal import *
-from gremlin_python.process.strategies import *
-from gremlin_python.structure.graph import Vertex, Edge, VertexProperty
-from datetime import datetime
-
-
-# TODO to be removed as bytecode and groovy are replaced by gremlin lang
scripts
-class Translator:
- """
- Turn a bytecode object back into a textual query (Gremlin Groovy script).
- """
-
- # Dictionary used to reverse-map token IDs to strings
- options = {
- WithOptions.tokens: 'tokens',
- WithOptions.none: 'none',
- WithOptions.ids: 'ids',
- WithOptions.labels: 'labels',
- WithOptions.keys: 'keys',
- WithOptions.values: 'values',
- WithOptions.all: 'all',
- WithOptions.indexer: 'indexer',
- WithOptions.list: 'list',
- WithOptions.map: 'map'
- }
-
- conn_p = ['and', 'or']
-
- def __init__(self, traversal_source=None):
- self.traversal_source = traversal_source
-
- def get_traversal_source(self):
- return self.traversal_source
-
- def get_target_language(self):
- return "gremlin-groovy"
-
- def of(self, traversal_source):
- self.traversal_source = traversal_source
- return self
-
- # Do any needed special processing for the representation
- # of strings and dates and boolean.
- def fixup(self, v):
- if isinstance(v, str):
- return f'{v!r}' # use repr() format for canonical string rep
- elif type(v) == datetime:
- return self.process_date(v)
- elif type(v) == bool:
- return 'true' if v else 'false'
- elif isinstance(v, numbers.Number):
- return self.process_number(v)
- elif isinstance(v, set):
- return f'[{str(v)[1:-1]}]'
- elif isinstance(v, P):
- return self.process_predicate(v)
- elif type(v) == Vertex:
- return self.process_vertex(v)
- elif type(v) == Edge:
- return self.process_edge(v)
- elif type(v) in [Merge]: # on_create on_match out_v in_v
- tmp = str(v)
- return f'{tmp.split("_")[0]}{tmp.split("_")[1].capitalize()}' if
tmp.find('_') else tmp
- elif v is None:
- return 'null'
- else:
- return str(v)
-
- # Turn a Python datetime into the equivalent new Date(...)
- def process_date(self, date):
- y = date.year - 1900
- mo = date.month
- d = date.day
- h = date.hour
- mi = date.minute
- s = date.second
- return f'new Date({y},{mo},{d},{h},{mi},{s})'
-
- # Do special processing needed to format predicates that come in
- # such as "gt(a)" correctly.
- def process_predicate(self, p):
- res = ''
- if p.operator in self.conn_p:
- res +=
f'{self.process_predicate(p.value)}.{p.operator}({self.process_predicate(p.other)})'
- else:
- res += f'{self.process_p_value(p)}'
- return res
-
- # process the value of the predicates
- def process_p_value(self, p):
- res = str(p).split('(')[0] + '('
- if type(p.value) == list:
- res += '['
- for v in p.value:
- res += self.fixup(v) + ','
- res = (res[0:-1] + ']') if len(p.value) > 0 else (res + ']')
- else:
- res += self.fixup(p.value)
- if p.other is not None:
- res += f',{self.fixup(p.other)}'
- res += ')'
- return res
-
- # Special processing to handle strategies
- def process_strategy(self, s):
- c = 0
- res = ''
- # if parameter is empty, only pass class name (referenced
GroovyTranslator.java)
- if not s.configuration:
- res += s.strategy_name
- else:
- res = f'new {str(s)}('
- for key in s.configuration:
- res += ',' if c > 0 else ''
- res += key + ':'
- val = s.configuration[key]
- if isinstance(val, Traversal):
- res += self.translate(val.bytecode, child=True)
- else:
- res += self.fixup(val)
- c += 1
- res += ')'
- return res
- pass
-
- # Special processing to handle vertices
- def process_vertex(self, vertex):
- return f'new
ReferenceVertex({self.fixup(vertex.id)},\'{vertex.label}\')'
-
- # Special processing to handle edges
- def process_edge(self, edge):
- return f'new ReferenceEdge({str(edge.id)},\'{edge.label}\',' \
- f'new
ReferenceVertex({str(edge.inV.id)},\'{edge.inV.label}\'),' \
- f'new
ReferenceVertex({str(edge.outV.id)},\'{edge.outV.label}\'))'
-
- # Special processing to handle vertex property
- def process_vertex_property(self, vp):
- return f'new
ReferenceVertexProperty({str(vp.id)},\'{vp.label}\',{self.fixup(vp.value)})'
-
- # Special processing to handle lambda
- def process_lambda(self, lam):
- lambda_result = lam()
- script = lambda_result if isinstance(lambda_result, str) else
lambda_result[0]
- return f'{script}' if re.match(r"^\{.*\}$", script, flags=re.DOTALL)
else f'{{{script}}}'
-
- def process_dict(self, d):
- c = 0
- res = '['
- if len(d) == 0:
- res += ':'
- else:
- for k, v in d.items():
- wrap = not isinstance(k, str)
- res += ',' if c > 0 else ''
- res += '(' if wrap else ''
- res += self.fixup(k)
- res += ')' if wrap else ''
- res += f':{self.fixup(v)}'
- c += 1
- res += ']'
- return res
-
- def process_number(self, n):
- if isinstance(n, float):
- # converting floats into doubles for script since python doesn't
distinguish and java defaults to double
- if math.isnan(n):
- return "Double.NaN"
- elif math.isinf(n) and n > 0:
- return "Double.POSITIVE_INFINITY"
- elif math.isinf(n) and n < 0:
- return "Double.NEGATIVE_INFINITY"
- else:
- return f'{n}d'
- return f'{n}'
-
- def process_list(self, l):
- c = 0
- res = '['
- for i in l:
- res += ',' if c > 0 else ''
- res += self.fixup(i)
- c += 1
- res += ']'
- return res
-
- # Special processing to handle bindings inside of traversals
- def process_binding(self, binding):
- return f'Bindings.instance().of(\'{binding.key}\',
{str(binding.value)})'
-
- # Main driver of the translation. Different parts of
- # a Traversal are handled appropriately.
- def do_translation(self, step):
- script = ''
- params = step[1:]
- script += '.' + step[0] + '('
- if len(params) > 0:
- c = 0
- with_opts = False
- is_merge_op = (step[0] == 'mergeV') or (step[0] == 'mergeE')
- for p in params:
- script += ',' if c > 0 else ''
- if with_opts:
- script += f'WithOptions.{self.options[p]}'
- elif type(p) == Bytecode:
- script += self.translate(p, True)
- elif isinstance(p, P):
- script += self.process_predicate(p)
- elif type(p) == Vertex:
- script += self.process_vertex(p)
- elif type(p) == Edge:
- script += self.process_edge(p)
- elif type(p) == VertexProperty:
- script += self.process_vertex_property(p)
- elif type(p) in [Cardinality, Pop, Operator, Scope, T]:
- tmp = str(p)
- script += tmp[0:-1] if tmp.endswith('_') else tmp
- elif type(p) in [Merge]: # on_create on_match out_v in_v
- is_merge_op = True
- tmp = str(p)
- script +=
f'{tmp.split("_")[0]}{tmp.split("_")[1].capitalize()}' if tmp.find('_') else tmp
- elif isinstance(p, TraversalStrategy): # this will capture
all strategies
- script += self.process_strategy(p)
- elif type(p) == datetime:
- script += self.process_date(p)
- elif p == WithOptions.tokens:
- script += 'WithOptions.tokens'
- with_opts = True
- elif isinstance(p, str):
- script += f'{p!r}' # use repr() format for canonical
string rep
- elif type(p) == bool:
- script += 'true' if p else 'false'
- elif isinstance(p, type(lambda: None)) and p.__name__ ==
(lambda: None).__name__:
- script += self.process_lambda(p)
- elif type(p) == Binding:
- script += self.process_binding(p)
- elif p is None:
- script += '(Traversal) null' if is_merge_op else 'null'
- elif isinstance(p, type):
- script += p.__name__
- elif isinstance(p, dict):
- script += self.process_dict(p)
- elif isinstance(p, numbers.Number):
- script += self.process_number(p)
- elif isinstance(p, set):
- script += f'[{str(p)[1:-1]}] as Set' if len(p) > 0 else
'[] as Set'
- elif isinstance(p, list):
- script += self.process_list(p)
- else:
- script += str(p)
- c += 1
- script += ')'
- return script
-
- # Translation starts here. There are two main parts to a
- # traversal. Source instructions such as "withSideEffect"
- # and "withStrategies", and step instructions such as
- # "addV" and "repeat". If child is True we will generate
- # anonymous traversal style syntax.
- def translate(self, bytecode, child=False):
- script = '__' if child else self.traversal_source
-
- for step in bytecode.source_instructions:
- script += self.do_translation(step)
-
- for step in bytecode.step_instructions:
- script += self.do_translation(step)
-
- return script
diff --git a/gremlin-python/src/main/python/gremlin_python/process/traversal.py
b/gremlin-python/src/main/python/gremlin_python/process/traversal.py
index 5e03235e3b..453a7ec6c0 100644
--- a/gremlin-python/src/main/python/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/python/gremlin_python/process/traversal.py
@@ -843,24 +843,6 @@ class Bytecode(object):
return Bytecode._create_graph_op("tx", "rollback")
-class CardinalityValue(Bytecode):
- def __init__(self, cardinality, val):
- super().__init__()
- self.add_source("CardinalityValueTraversal", cardinality, val)
-
- @classmethod
- def single(cls, val):
- return CardinalityValue(Cardinality.single, val)
-
- @classmethod
- def list_(cls, val):
- return CardinalityValue(Cardinality.list_, val)
-
- @classmethod
- def set_(cls, val):
- return CardinalityValue(Cardinality.set_, val)
-
-
'''
BINDINGS
'''
@@ -944,7 +926,7 @@ class GremlinLang(object):
if string_name == 'CardinalityValueTraversal':
self.gremlin.append(
-
f'Cardinality.{self._convert_argument(args[0][0])}({self._convert_argument(args[0][1])})')
+
f'{self._arg_as_string(args[0][0])}({self._arg_as_string(args[0][1])})')
return
self.gremlin.extend(['.', string_name, '('])
@@ -990,15 +972,23 @@ class GremlinLang(object):
else:
return f'{arg}D'
if isinstance(arg, BigDecimal):
- # TODO double check implementation when revisiting types definition
- return f'{arg.unscaled_value}M'
+ # TODO double check implementation when revisiting types
definition.
+ if arg.scale > 0:
+ return f'{arg.unscaled_value:.{arg.scale}f}M'
+ else:
+ return f'{arg.unscaled_value}M'
if isinstance(arg, datetime):
return f'datetime("{arg.isoformat()}")'
if isinstance(arg, Enum):
tmp = str(arg)
- return tmp[0:-1] if tmp.endswith('_') else tmp
+ if tmp.endswith('_'):
+ return tmp[0:-1]
+ elif '_' in tmp:
+ return f'{tmp.split("_")[0]}{tmp.split("_")[1].capitalize()}'
+ else:
+ return tmp
if isinstance(arg, Vertex):
return f'new
ReferenceVertex({self._arg_as_string(arg.id)},\'{arg.label}\')'
@@ -1259,6 +1249,24 @@ class Parameter:
return Parameter(None, value)
+class CardinalityValue(GremlinLang):
+ def __init__(self, cardinality, val):
+ super().__init__()
+ self.add_source("CardinalityValueTraversal", cardinality, val)
+
+ @classmethod
+ def single(cls, val):
+ return CardinalityValue(Cardinality.single, val)
+
+ @classmethod
+ def list_(cls, val):
+ return CardinalityValue(Cardinality.list_, val)
+
+ @classmethod
+ def set_(cls, val):
+ return CardinalityValue(Cardinality.set_, val)
+
+
class AtomicInteger:
def __init__(self):
self._value = 0
diff --git a/gremlin-python/src/main/python/gremlin_python/statics.py
b/gremlin-python/src/main/python/gremlin_python/statics.py
index 598b15d0a7..fbd5422e3f 100644
--- a/gremlin-python/src/main/python/gremlin_python/statics.py
+++ b/gremlin-python/src/main/python/gremlin_python/statics.py
@@ -83,6 +83,7 @@ class GremlinType(object):
self.gremlin_type = gremlin_type
+# TODO scale and unscaled value implementations are not following definition,
need to revisit
class BigDecimal(object):
def __init__(self, scale, unscaled_value):
self.scale = scale
diff --git a/gremlin-python/src/main/python/radish/feature_steps.py
b/gremlin-python/src/main/python/radish/feature_steps.py
index 1dc09f9364..53bdd0e240 100644
--- a/gremlin-python/src/main/python/radish/feature_steps.py
+++ b/gremlin-python/src/main/python/radish/feature_steps.py
@@ -29,9 +29,9 @@ from gremlin_python.process.traversal import Barrier,
Cardinality, P, TextP, Pop
from radish import given, when, then, world
from hamcrest import *
-outV = __.outV
+outV = __.out_v
label = __.label
-inV = __.inV
+inV = __.in_v
project = __.project
tail = __.tail
@@ -67,7 +67,7 @@ def initialize_graph(step):
# just be sure that the traversal returns something to prove that it
worked to some degree. probably
# is overkill to try to assert the complete success of this init
operation. presumably the test
# suite would fail elsewhere if this didn't work which would help identify
a problem.
- result = t.toList()
+ result = t.to_list()
assert len(result) > 0
@@ -111,7 +111,10 @@ def translate_traversal(step):
tagset = [tag.name for tag in step.all_tags]
if "GraphComputerOnly" in tagset:
- localg = step.context.g.withComputer()
+ localg = step.context.g.with_computer()
+ if "GremlinLangScriptOnly" in tagset:
+ # temporary tag used for tests that need gremlin-lang script
processing before groovy script is removed
+ localg = step.context.g.with_('language', 'gremlin-lang')
p['g'] = localg
step.context.traversal = step.context.traversals.pop(0)(**p)
@@ -122,7 +125,7 @@ def iterate_the_traversal(step):
return
try:
- step.context.result = list(map(lambda x: _convert_results(x),
step.context.traversal.toList()))
+ step.context.result = list(map(lambda x: _convert_results(x),
step.context.traversal.to_list()))
step.context.failed = False
step.context.failed_message = ''
except Exception as e:
diff --git a/gremlin-python/src/main/python/radish/gremlin.py
b/gremlin-python/src/main/python/radish/gremlin.py
index c7361542a2..e743770e98 100644
--- a/gremlin-python/src/main/python/radish/gremlin.py
+++ b/gremlin-python/src/main/python/radish/gremlin.py
@@ -150,7 +150,7 @@ world.gremlins = {
'g_V_out_asXxX_in_asXyX_selectXx_yX_byXnameX_fold_dedupXlocal_x_yX_unfold':
[(lambda g:g.V().out().as_('x').in_().as_('y').select('x',
'y').by('name').fold().dedup(Scope.local, 'x', 'y').unfold())],
'g_V_both_dedup_name': [(lambda g:g.V().both().dedup().values('name'))],
'g_V_both_hasXlabel_softwareX_dedup_byXlangX_name': [(lambda
g:g.V().both().has(T.label, 'software').dedup().by('lang').values('name'))],
- 'g_V_both_name_order_byXa_bX_dedup_value': [(lambda g,
c1=None:g.V().both().properties('name').order().by(c1).dedup().value())],
+ 'g_V_both_name_order_byXa_bX_dedup_value': [], # skipping as it contains
a lambda
'g_V_both_both_name_dedup': [(lambda
g:g.V().both().both().values('name').dedup())],
'g_V_both_both_dedup': [(lambda g:g.V().both().both().dedup())],
'g_V_both_both_dedup_byXlabelX': [(lambda
g:g.V().both().both().dedup().by(T.label))],
@@ -991,11 +991,11 @@ world.gremlins = {
'g_VX1X_valuesXageX_minXlocalX': [(lambda g,
vid1=None:g.V(vid1).values('age').min_(Scope.local))],
'g_V_localXunionXvaluesXageX_outE_valuesXweightXX_foldX_minXlocalX':
[(lambda g:g.V().local(__.union(__.values('age'),
__.out_e().values('weight')).fold()).min_(Scope.local))],
'g_V_name_order': [(lambda g:g.V().values('name').order())],
- 'g_V_name_order_byXa1_b1X_byXb2_a2X': [(lambda g,
c1=None,c2=None:g.V().values('name').order().by(c1).by(c2))],
+ 'g_V_name_order_byXa1_b1X_byXb2_a2X': [], # skipping as it contains a
lambda
'g_V_order_byXname_ascX_name': [(lambda g:g.V().order().by('name',
Order.asc).values('name'))],
'g_V_order_byXnameX_name': [(lambda
g:g.V().order().by('name').values('name'))],
'g_V_outE_order_byXweight_descX_weight': [(lambda
g:g.V().out_e().order().by('weight', Order.desc).values('weight'))],
- 'g_V_order_byXname_a1_b1X_byXname_b2_a2X_name': [(lambda g,
c1=None,c2=None:g.V().order().by('name', c1).by('name', c2).values('name'))],
+ 'g_V_order_byXname_a1_b1X_byXname_b2_a2X_name': [], # skipping as it
contains a lambda
'g_V_asXaX_outXcreatedX_asXbX_order_byXshuffleX_selectXa_bX': [(lambda
g:g.V().as_('a').out('created').as_('b').order().by(Order.shuffle).select('a',
'b'))],
'g_V_both_hasLabelXpersonX_order_byXage_descX_limitX5X_name': [(lambda
g:g.V().both().has_label('person').order().by('age',
Order.desc).limit(5).values('name'))],
'g_V_properties_order_byXkey_descX_key': [(lambda
g:g.V().properties().order().by(T.key, Order.desc).key())],
diff --git a/gremlin-python/src/main/python/radish/terrain.py
b/gremlin-python/src/main/python/radish/terrain.py
index 27a804a00f..51935d1bf9 100644
--- a/gremlin-python/src/main/python/radish/terrain.py
+++ b/gremlin-python/src/main/python/radish/terrain.py
@@ -29,7 +29,7 @@ label = __.label
inV = __.in_v
project = __.project
tail = __.tail
-gremlin_server_url = os.environ.get('GREMLIN_SERVER_URL',
'ws://localhost:{}/gremlin')
+gremlin_server_url = os.environ.get('GREMLIN_SERVER_URL',
'http://localhost:{}/gremlin')
test_no_auth_url = gremlin_server_url.format(45940)
@before.all
@@ -94,10 +94,8 @@ def __create_remote(server_graph_name):
if not("serializer" in world.config.user_data):
raise ValueError('test configuration requires setting of
--user-data="serializer={mime-type}"')
- if world.config.user_data["serializer"] ==
"application/vnd.gremlin-v3.0+json":
- s = serializer.GraphSONSerializersV3d0()
- elif world.config.user_data["serializer"] ==
"application/vnd.graphbinary-v1.0":
- s = serializer.GraphBinarySerializersV1()
+ if world.config.user_data["serializer"] ==
"application/vnd.graphbinary-v4.0":
+ s = serializer.GraphBinarySerializersV4()
else:
raise ValueError('serializer not found - ' +
world.config.user_data["serializer"])
diff --git a/gremlin-python/src/main/python/radish/utils.py
b/gremlin-python/src/main/python/radish/utils.py
index a820a41b32..fdbd2c6b31 100644
--- a/gremlin-python/src/main/python/radish/utils.py
+++ b/gremlin-python/src/main/python/radish/utils.py
@@ -36,10 +36,23 @@ def create_lookup_e(remote):
# hold a map of the "name"/edge for use in asserting results - "name" in
this context is in the form of
# outgoingV-label->incomingV
- return g.E().group(). \
- by(lambda: ("it.outVertex().value('name') + '-' + it.label() + '->' +
it.inVertex().value('name')", "gremlin-groovy")). \
+ edges = {}
+ edge_map = g.E().group(). \
+ by(__.project('o', 'l',
'i').by(__.out_v().values('name')).by(__.label()).by(__.in_v().values('name'))).
\
by(__.tail()).next()
+ for key, value in edge_map.items():
+ edges[_get_edge_keys(key)] = value
+
+ return edges
+
+
+def _get_edge_keys(key_map):
+ outV = key_map.get('o')
+ label = key_map.get('l')
+ inV = key_map.get('i')
+ return f'{outV}-{label}->{inV}'
+
@pick
def create_lookup_vp(remote):
@@ -48,15 +61,25 @@ def create_lookup_vp(remote):
# hold a map of the "name"/vertexproperty for use in asserting results -
"name" in this context is in the form of
# vertexName-propName->propVal where the propVal must be typed according
to the gherkin spec. note that the toy
# graphs only deal in String/Int/Float/Double types so none of the other
types are accounted for here.
- return g.V().properties().group(). \
- by(lambda: ("{ it -> \n" +
- " def val = it.value()\n" +
- " if (val instanceof Integer)\n" +
- " val = 'd[' + val + '].i'\n" +
- " else if (val instanceof Float)\n" +
- " val = 'd[' + val + '].f'\n" +
- " else if (val instanceof Double)\n" +
- " val = 'd[' + val + '].d'\n" +
- " return it.element().value('name') + '-' + it.key() +
'->' + val\n" +
- "}", "gremlin-groovy")). \
+ vps = {}
+ props = g.V().properties().group(). \
+ by(__.project('n', 'k',
'v').by(__.element().values('name')).by(__.key()).by(__.value())). \
by(__.tail()).next()
+
+ for key, value in props.items():
+ vps[_get_v_keys(key)] = value
+
+ return vps
+
+
+# since gremlin-lang doesn't allow lambdas, we are using the same logic as
javascript to construct the keys
+def _get_v_keys(key_map):
+ k = key_map.get('k')
+ val = key_map.get('v')
+ if k == 'weight':
+ val = f'd[{val}].d'
+ elif k == 'age' or k == 'since' or k == 'skill':
+ val = f'd[{val}].i'
+ name = key_map.get('n')
+
+ return f'{name}-{k}->{val}'
diff --git a/gremlin-python/src/main/python/setup.py
b/gremlin-python/src/main/python/setup.py
index 88d4d8c861..0be9a132ab 100644
--- a/gremlin-python/src/main/python/setup.py
+++ b/gremlin-python/src/main/python/setup.py
@@ -48,7 +48,9 @@ install_requires = [
'nest_asyncio',
'aiohttp>=3.8.0,<4.0.0',
'aenum>=1.4.5,<4.0.0',
- 'isodate>=0.6.0,<1.0.0'
+ 'isodate>=0.6.0,<1.0.0',
+ 'boto3',
+ 'botocore'
]
setup(
diff --git a/gremlin-python/src/main/python/tests/conftest.py
b/gremlin-python/src/main/python/tests/conftest.py
index 9e353c3d17..059600f32c 100644
--- a/gremlin-python/src/main/python/tests/conftest.py
+++ b/gremlin-python/src/main/python/tests/conftest.py
@@ -33,8 +33,8 @@ from gremlin_python.driver.aiohttp.transport import
AiohttpHTTPTransport
from gremlin_python.driver.auth import basic, sigv4
"""HTTP server testing variables"""
-gremlin_server_url = os.environ.get('GREMLIN_SERVER_URL_HTTP',
'http://localhost:{}/gremlin')
-gremlin_basic_auth_url = os.environ.get('GREMLIN_SERVER_BASIC_AUTH_URL_HTTP',
'https://localhost:{}/gremlin')
+gremlin_server_url = os.environ.get('GREMLIN_SERVER_URL',
'http://localhost:{}/gremlin')
+gremlin_basic_auth_url = os.environ.get('GREMLIN_SERVER_BASIC_AUTH_URL',
'https://localhost:{}/gremlin')
anonymous_url = gremlin_server_url.format(45940)
basic_url = gremlin_basic_auth_url.format(45941)
diff --git a/gremlin-python/src/main/python/tests/driver/test_client.py
b/gremlin-python/src/main/python/tests/driver/test_client.py
index 41b8a87a7a..74f07f51f6 100644
--- a/gremlin-python/src/main/python/tests/driver/test_client.py
+++ b/gremlin-python/src/main/python/tests/driver/test_client.py
@@ -36,7 +36,7 @@ from asyncio import TimeoutError
__author__ = 'David M. Brown ([email protected])'
-gremlin_server_url = os.environ.get('GREMLIN_SERVER_URL_HTTP',
'http://localhost:{}/')
+gremlin_server_url = os.environ.get('GREMLIN_SERVER_URL',
'http://localhost:{}/gremlin')
test_no_auth_url = gremlin_server_url.format(45940)
@@ -55,7 +55,7 @@ def test_connection(connection):
assert isinstance(results, list)
assert results_set.done.done()
-
+# TODO: revisit after max_content_length definition/implementation is updated
def test_client_message_too_big(client):
try:
client = Client(test_no_auth_url, 'g', max_content_length=4096)
@@ -443,7 +443,6 @@ def test_big_result_set(client):
assert len(results) == 10000
[email protected](reason="enable after making sure authenticated testing
server is set up in docker")
def test_big_result_set_secure(authenticated_client):
g = GraphTraversalSource(Graph(), TraversalStrategies())
t = g.inject(1).repeat(__.add_v('person').property('name',
__.loops())).times(20000).count()
diff --git
a/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py
b/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py
index 5f09de6c48..35f3c63130 100644
---
a/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py
+++
b/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py
@@ -58,16 +58,16 @@ class TestDriverRemoteConnection(object):
statics.load_statics(globals())
g = traversal().with_(remote_connection)
- assert long(6) == g.V().count().toList()[0]
+ assert long(6) == g.V().count().to_list()[0]
# #
assert Vertex(1) == g.V(1).next()
assert Vertex(1) == g.V(Vertex(1)).next()
assert 1 == g.V(1).id_().next()
# assert Traverser(Vertex(1)) == g.V(1).nextTraverser() # TODO check
back after bulking added back
- assert 1 == len(g.V(1).toList())
- assert isinstance(g.V(1).toList(), list)
+ assert 1 == len(g.V(1).to_list())
+ assert isinstance(g.V(1).to_list(), list)
results = g.V().repeat(__.out()).times(2).name
- results = results.toList()
+ results = results.to_list()
assert 2 == len(results)
assert "lop" in results
assert "ripple" in results
@@ -78,19 +78,19 @@ class TestDriverRemoteConnection(object):
assert 4 == g.V()[2:].count().next()
assert 2 == g.V()[:2].count().next()
# #
- results = g.withSideEffect('a', ['josh',
'peter']).V(1).out('created').in_('created').values('name').where(
- P.within('a')).toList()
+ results = g.with_side_effect('a', ['josh',
'peter']).V(1).out('created').in_('created').values('name').where(
+ P.within('a')).to_list()
assert 2 == len(results)
assert 'josh' in results
assert 'peter' in results
# #
- results = g.V().out().profile().toList()
+ results = g.V().out().profile().to_list()
assert 1 == len(results)
assert 'metrics' in results[0]
assert 'dur' in results[0]
# #
results = g.V().has('name',
'peter').as_('a').out('created').as_('b').select('a', 'b').by(
- __.value_map()).toList()
+ __.value_map()).to_list()
assert 1 == len(results)
assert 'peter' == results[0]['a']['name'][0]
assert 35 == results[0]['a']['age'][0]
@@ -99,7 +99,7 @@ class TestDriverRemoteConnection(object):
assert 2 == len(results[0]['a'])
assert 2 == len(results[0]['b'])
# #
- results = g.V(1).inject(g.V(2).next()).values('name').toList()
+ results = g.V(1).inject(g.V(2).next()).values('name').to_list()
assert 2 == len(results)
assert 'marko' in results
assert 'vadas' in results
@@ -112,9 +112,9 @@ class TestDriverRemoteConnection(object):
# #
# test dict keys
# types for dict
- results = g.V().has('person', 'name',
'marko').elementMap("name").groupCount().next()
+ results = g.V().has('person', 'name',
'marko').element_map("name").group_count().next()
assert {HashableDict.of({T.id: 1, T.label: 'person', 'name':
'marko'}): 1} == results
- results = g.V().has('person', 'name',
'marko').both('knows').groupCount().by(__.values('name').fold()).next()
+ results = g.V().has('person', 'name',
'marko').both('knows').group_count().by(__.values('name').fold()).next()
assert {tuple(['vadas']): 1, tuple(['josh']): 1} == results
def test_iteration(self, remote_connection):
@@ -122,31 +122,31 @@ class TestDriverRemoteConnection(object):
g = traversal().with_(remote_connection)
t = g.V().count()
- assert t.hasNext()
- assert t.hasNext()
- assert t.hasNext()
- assert t.hasNext()
- assert t.hasNext()
+ assert t.has_next()
+ assert t.has_next()
+ assert t.has_next()
+ assert t.has_next()
+ assert t.has_next()
assert 6 == t.next()
- assert not (t.hasNext())
- assert not (t.hasNext())
- assert not (t.hasNext())
- assert not (t.hasNext())
- assert not (t.hasNext())
+ assert not (t.has_next())
+ assert not (t.has_next())
+ assert not (t.has_next())
+ assert not (t.has_next())
+ assert not (t.has_next())
t = g.V().has('name', P.within('marko',
'peter')).values('name').order()
assert "marko" == t.next()
- assert t.hasNext()
- assert t.hasNext()
- assert t.hasNext()
- assert t.hasNext()
- assert t.hasNext()
+ assert t.has_next()
+ assert t.has_next()
+ assert t.has_next()
+ assert t.has_next()
+ assert t.has_next()
assert "peter" == t.next()
- assert not (t.hasNext())
- assert not (t.hasNext())
- assert not (t.hasNext())
- assert not (t.hasNext())
- assert not (t.hasNext())
+ assert not (t.has_next())
+ assert not (t.has_next())
+ assert not (t.has_next())
+ assert not (t.has_next())
+ assert not (t.has_next())
try:
t.next()
@@ -154,24 +154,10 @@ class TestDriverRemoteConnection(object):
except StopIteration:
assert True
- @pytest.mark.skip(reason="to be removed, lambda disabled in gremlin lang")
- def test_lambda_traversals(self, remote_connection):
- statics.load_statics(globals())
- assert "remoteconnection[{},gmodern]".format(test_no_auth_url) ==
str(remote_connection)
- g = traversal().with_(remote_connection)
-
- assert 24.0 == g.withSack(1.0, lambda: ("x -> x + 1",
"gremlin-groovy")).V().both().sack().sum_().next()
- assert 24.0 == g.withSack(lambda: ("{1.0d}", "gremlin-groovy"),
- lambda: ("x -> x + 1",
"gremlin-groovy")).V().both().sack().sum_().next()
-
- assert 48.0 == g.withSack(1.0, lambda: ("x, y -> x + y + 1",
"gremlin-groovy")).V().both().sack().sum_().next()
- assert 48.0 == g.withSack(lambda: ("{1.0d}", "gremlin-groovy"),
- lambda: ("x, y -> x + y + 1",
"gremlin-groovy")).V().both().sack().sum_().next()
-
def test_strategies(self, remote_connection):
statics.load_statics(globals())
g = traversal().with_(remote_connection). \
- withStrategies(TraversalStrategy("SubgraphStrategy",
+ with_strategies(TraversalStrategy("SubgraphStrategy",
{"vertices":
__.has_label("person"),
"edges":
__.has_label("created")},
"org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy"))
@@ -181,40 +167,40 @@ class TestDriverRemoteConnection(object):
assert "person" == g.V().label().dedup().next()
#
g = traversal().with_(remote_connection). \
- withStrategies(SubgraphStrategy(vertices=__.has_label("person"),
edges=__.has_label("created")))
+ with_strategies(SubgraphStrategy(vertices=__.has_label("person"),
edges=__.has_label("created")))
assert 4 == g.V().count().next()
assert 0 == g.E().count().next()
assert 1 == g.V().label().dedup().count().next()
assert "person" == g.V().label().dedup().next()
#
g = traversal().with_(remote_connection). \
- withStrategies(SubgraphStrategy(edges=__.has_label("created")))
+ with_strategies(SubgraphStrategy(edges=__.has_label("created")))
assert 6 == g.V().count().next()
assert 4 == g.E().count().next()
assert 1 == g.E().label().dedup().count().next()
assert "created" == g.E().label().dedup().next()
#
- g = g.withoutStrategies(SubgraphStrategy). \
- withComputer(vertices=__.has("name", "marko"), edges=__.limit(0))
+ g = g.without_strategies(SubgraphStrategy). \
+ with_computer(vertices=__.has("name", "marko"), edges=__.limit(0))
assert 1 == g.V().count().next()
assert 0 == g.E().count().next()
assert "person" == g.V().label().next()
assert "marko" == g.V().name.next()
#
- g = traversal().with_(remote_connection).withComputer()
+ g = traversal().with_(remote_connection).with_computer()
assert 6 == g.V().count().next()
assert 6 == g.E().count().next()
#
- g =
traversal().with_(remote_connection).withStrategies(SeedStrategy(12345))
- shuffledResult =
g.V().values("name").order().by(Order.shuffle).toList()
- assert shuffledResult ==
g.V().values("name").order().by(Order.shuffle).toList()
- assert shuffledResult ==
g.V().values("name").order().by(Order.shuffle).toList()
- assert shuffledResult ==
g.V().values("name").order().by(Order.shuffle).toList()
+ g =
traversal().with_(remote_connection).with_strategies(SeedStrategy(12345))
+ shuffledResult =
g.V().values("name").order().by(Order.shuffle).to_list()
+ assert shuffledResult ==
g.V().values("name").order().by(Order.shuffle).to_list()
+ assert shuffledResult ==
g.V().values("name").order().by(Order.shuffle).to_list()
+ assert shuffledResult ==
g.V().values("name").order().by(Order.shuffle).to_list()
def test_clone(self, remote_connection):
g = traversal().with_(remote_connection)
t = g.V().both()
- assert 12 == len(t.toList())
+ assert 12 == len(t.to_list())
assert 5 == t.clone().limit(5).count().next()
assert 10 == t.clone().limit(10).count().next()
@@ -229,9 +215,8 @@ class TestDriverRemoteConnection(object):
assert ('Could not alias [g] to [does_not_exist] as
[does_not_exist] not in the Graph or TraversalSource '
'global bindings') in err.status_message
- @pytest.mark.skip(reason="enable after making sure authenticated testing
server is set up in docker")
def test_authenticated(self, remote_connection_authenticated):
statics.load_statics(globals())
g = traversal().with_(remote_connection_authenticated)
- assert long(6) == g.V().count().toList()[0]
+ assert long(6) == g.V().count().to_list()[0]
diff --git
a/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection_threaded.py
b/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection_threaded.py
index 3f016a739d..4f9afab16b 100644
---
a/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection_threaded.py
+++
b/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection_threaded.py
@@ -17,6 +17,7 @@
# under the License.
#
import concurrent.futures
+import os
import sys
import queue
from threading import Thread
@@ -27,7 +28,7 @@ from gremlin_python.process.anonymous_traversal import
traversal
__author__ = 'David M. Brown ([email protected])'
-gremlin_server_url = 'http://localhost:{}'
+gremlin_server_url = os.environ.get('GREMLIN_SERVER_URL',
'http://localhost:{}/gremlin')
test_no_auth_url = gremlin_server_url.format(45940)
@@ -67,7 +68,7 @@ def _executor(q, conn):
g = traversal().with_(conn)
future = g.V().promise()
t = future.result()
- assert len(t.toList()) == 6
+ assert len(t.to_list()) == 6
except:
q.put(sys.exc_info()[0])
else:
@@ -81,7 +82,7 @@ def handle_request():
try:
remote_connection = DriverRemoteConnection(test_no_auth_url, "gmodern")
g = traversal().with_(remote_connection)
- g.V().limit(1).toList()
+ g.V().limit(1).to_list()
remote_connection.close()
return True
except RuntimeError:
diff --git
a/gremlin-python/src/main/python/tests/driver/test_web_socket_client_behavior.py
b/gremlin-python/src/main/python/tests/driver/test_web_socket_client_behavior.py
index 0126229c02..d237d16f6b 100644
---
a/gremlin-python/src/main/python/tests/driver/test_web_socket_client_behavior.py
+++
b/gremlin-python/src/main/python/tests/driver/test_web_socket_client_behavior.py
@@ -55,6 +55,7 @@ def
test_does_not_create_new_connection_if_closed_by_server(socket_server_client
# Tests that client is correctly sending user agent during web socket
handshake by having the server return
# the captured user agent.
[email protected](reason="not implemented in HTTP & need to check on server
side")
def test_should_include_user_agent_in_handshake_request(socket_server_client,
socket_server_settings):
user_agent_response = socket_server_client.submit(
"1", request_options={'requestId':
socket_server_settings["USER_AGENT_REQUEST_ID"]}).one()[0]
@@ -64,6 +65,7 @@ def
test_should_include_user_agent_in_handshake_request(socket_server_client, so
# Tests that no user agent (other than the default one provided by aiohttp) is
sent to server when that
# behaviour is disabled.
[email protected](reason="not implemented in HTTP & need to check on server
side")
def
test_should_not_include_user_agent_in_handshake_request_if_disabled(socket_server_client_no_user_agent,
socket_server_settings):
user_agent_response = socket_server_client_no_user_agent.submit(
@@ -75,6 +77,7 @@ def
test_should_not_include_user_agent_in_handshake_request_if_disabled(socket_s
# Tests that client is correctly sending all overridable per request settings
(requestId, batchSize,
# evaluationTimeout, and userAgent) to the server.
[email protected](reason="not implemented in HTTP & need to check on server
side")
def test_should_send_per_request_settings_to_server(socket_server_client,
socket_server_settings):
result = socket_server_client.submit(
diff --git a/gremlin-python/src/main/python/tests/process/test_dsl.py
b/gremlin-python/src/main/python/tests/process/test_dsl.py
index c2a28100d9..76625f3041 100644
--- a/gremlin-python/src/main/python/tests/process/test_dsl.py
+++ b/gremlin-python/src/main/python/tests/process/test_dsl.py
@@ -18,7 +18,7 @@
#
import pytest
-from gremlin_python.process.traversal import Bytecode, P
+from gremlin_python.process.traversal import GremlinLang, P
from gremlin_python.process.graph_traversal import (
GraphTraversalSource, GraphTraversal)
from gremlin_python.process.graph_traversal import __ as AnonymousTraversal
@@ -30,13 +30,13 @@ __author__ = 'David M. Brown ([email protected])'
class SocialTraversal(GraphTraversal):
def knows(self, person_name):
- return self.out("knows").hasLabel("person").has("name", person_name)
+ return self.out("knows").has_label("person").has("name", person_name)
def youngestFriendsAge(self):
- return self.out("knows").hasLabel("person").values("age").min_()
+ return self.out("knows").has_label("person").values("age").min_()
def createdAtLeast(self, number):
- return self.outE("created").count().is_(P.gte(number))
+ return self.out_e("created").count().is_(P.gte(number))
class __(AnonymousTraversal):
@@ -44,15 +44,15 @@ class __(AnonymousTraversal):
@classmethod
def knows(cls, *args):
- return cls.graph_traversal(None, None, Bytecode()).knows(*args)
+ return cls.graph_traversal(None, None, GremlinLang()).knows(*args)
@classmethod
def youngestFriendsAge(cls, *args):
- return cls.graph_traversal(None, None,
Bytecode()).youngestFriendsAge(*args)
+ return cls.graph_traversal(None, None,
GremlinLang()).youngestFriendsAge(*args)
@classmethod
def createdAtLeast(cls, *args):
- return cls.graph_traversal(None, None,
Bytecode()).createdAtLeast(*args)
+ return cls.graph_traversal(None, None,
GremlinLang()).createdAtLeast(*args)
class SocialTraversalSource(GraphTraversalSource):
@@ -62,7 +62,7 @@ class SocialTraversalSource(GraphTraversalSource):
self.graph_traversal = SocialTraversal
def persons(self, *args):
- traversal = self.get_graph_traversal().V().hasLabel("person")
+ traversal = self.get_graph_traversal().V().has_label("person")
if len(args) > 0:
traversal = traversal.has("name", P.within(*args))
diff --git a/gremlin-python/src/main/python/tests/process/test_gremlin_lang.py
b/gremlin-python/src/main/python/tests/process/test_gremlin_lang.py
index 13cce18c01..0457bfe00c 100644
--- a/gremlin-python/src/main/python/tests/process/test_gremlin_lang.py
+++ b/gremlin-python/src/main/python/tests/process/test_gremlin_lang.py
@@ -42,7 +42,7 @@ class TestGremlinLang(object):
tests.append([g.V('1', '2', '3', '4'),
"g.V('1','2','3','4')"])
# 2
- tests.append([g.V('3').valueMap(True),
+ tests.append([g.V('3').value_map(True),
"g.V('3').valueMap(true)"])
# 3
tests.append([g.V().constant(5),
@@ -54,28 +54,28 @@ class TestGremlinLang(object):
tests.append([g.V().constant('Hello'),
"g.V().constant('Hello')"])
# 6
- tests.append([g.V().hasLabel('airport').limit(5),
+ tests.append([g.V().has_label('airport').limit(5),
"g.V().hasLabel('airport').limit(5)"])
# 7
- tests.append([g.V().hasLabel(within('a', 'b', 'c')),
+ tests.append([g.V().has_label(within('a', 'b', 'c')),
"g.V().hasLabel(within(['a','b','c']))"])
# 8
- tests.append([g.V().hasLabel('airport', 'continent').out().limit(5),
+ tests.append([g.V().has_label('airport', 'continent').out().limit(5),
"g.V().hasLabel('airport','continent').out().limit(5)"])
# 9
- tests.append([g.V().hasLabel('airport').out().values('code').limit(5),
+ tests.append([g.V().has_label('airport').out().values('code').limit(5),
"g.V().hasLabel('airport').out().values('code').limit(5)"])
# 10
tests.append([g.V('3').as_('a').out('route').limit(10).where(eq('a')).by('region'),
"g.V('3').as('a').out('route').limit(10).where(eq('a')).by('region')"])
# 11
-
tests.append([g.V('3').repeat(__.out('route').simplePath()).times(2).path().by('code'),
+
tests.append([g.V('3').repeat(__.out('route').simple_path()).times(2).path().by('code'),
"g.V('3').repeat(__.out('route').simplePath()).times(2).path().by('code')"])
# 12
- tests.append([g.V().hasLabel('airport').out().has('region',
'US-TX').values('code').limit(5),
+ tests.append([g.V().has_label('airport').out().has('region',
'US-TX').values('code').limit(5),
"g.V().hasLabel('airport').out().has('region','US-TX').values('code').limit(5)"])
# 13
- tests.append([g.V().hasLabel('airport').union(__.values('city'),
__.values('region')).limit(5),
+ tests.append([g.V().has_label('airport').union(__.values('city'),
__.values('region')).limit(5),
"g.V().hasLabel('airport').union(__.values('city'),__.values('region')).limit(5)"])
# 14
tests.append([g.V('3').as_('a').out('route', 'routes'),
@@ -84,19 +84,19 @@ class TestGremlinLang(object):
tests.append([g.V().where(__.values('runways').is_(5)),
"g.V().where(__.values('runways').is(5))"])
# 16
-
tests.append([g.V('3').repeat(__.out().simplePath()).until(__.has('code',
'AGR')).path().by('code').limit(5),
+
tests.append([g.V('3').repeat(__.out().simple_path()).until(__.has('code',
'AGR')).path().by('code').limit(5),
"g.V('3').repeat(__.out().simplePath()).until(__.has('code','AGR')).path().by('code').limit(5)"])
# 17
- tests.append([g.V().hasLabel('airport').order().by(__.id_()),
+ tests.append([g.V().has_label('airport').order().by(__.id_()),
"g.V().hasLabel('airport').order().by(__.id())"])
# 18
- tests.append([g.V().hasLabel('airport').order().by(T.id),
+ tests.append([g.V().has_label('airport').order().by(T.id),
"g.V().hasLabel('airport').order().by(T.id)"])
# 19
- tests.append([g.V().hasLabel('airport').order().by(__.id_(),
Order.desc),
+ tests.append([g.V().has_label('airport').order().by(__.id_(),
Order.desc),
"g.V().hasLabel('airport').order().by(__.id(),Order.desc)"])
# 20
- tests.append([g.V().hasLabel('airport').order().by('code', Order.desc),
+ tests.append([g.V().has_label('airport').order().by('code',
Order.desc),
"g.V().hasLabel('airport').order().by('code',Order.desc)"])
# 21
tests.append([g.V('1', '2', '3').local(__.out().out().dedup().fold()),
@@ -108,19 +108,19 @@ class TestGremlinLang(object):
tests.append([g.E().count(),
"g.E().count()"])
# 24
- tests.append([g.V('5').outE('route').inV().path().limit(10),
+ tests.append([g.V('5').out_e('route').in_v().path().limit(10),
"g.V('5').outE('route').inV().path().limit(10)"])
# 25
- tests.append([g.V('5').propertyMap().select(Column.keys),
+ tests.append([g.V('5').property_map().select(Column.keys),
"g.V('5').propertyMap().select(Column.keys)"])
# 26
- tests.append([g.V('5').propertyMap().select(Column.values),
+ tests.append([g.V('5').property_map().select(Column.values),
"g.V('5').propertyMap().select(Column.values)"])
# 27
tests.append([g.V('3').values('runways').math('_ + 1'),
"g.V('3').values('runways').math('_ + 1')"])
# 28
-
tests.append([g.V('3').emit().repeat(__.out().simplePath()).times(3).limit(5).path(),
+
tests.append([g.V('3').emit().repeat(__.out().simple_path()).times(3).limit(5).path(),
"g.V('3').emit().repeat(__.out().simplePath()).times(3).limit(5).path()"])
# 29
tests.append([g.V().match(__.as_('a').has('code',
'LHR').as_('b')).select('b').by('code'),
@@ -129,7 +129,7 @@ class TestGremlinLang(object):
tests.append([g.V().has('test-using-keyword-as-property', 'repeat'),
"g.V().has('test-using-keyword-as-property','repeat')"])
# 31
- tests.append([g.V('1').addE('test').to(__.V('4')),
+ tests.append([g.V('1').add_e('test').to(__.V('4')),
"g.V('1').addE('test').to(__.V('4'))"])
# 32
tests.append([g.V().values('runways').max_(),
@@ -197,24 +197,24 @@ class TestGremlinLang(object):
tests.append([g.V('3').choose(__.values('runways')).option(1.5,
__.constant('one and a half')).option(2, __.constant('not three')),
"g.V('3').choose(__.values('runways')).option(1.5D,__.constant('one and a
half')).option(2,__.constant('not three'))"])
# 53
-
tests.append([g.V('3').repeat(__.out().simplePath()).until(__.loops().is_(1)).count(),
+
tests.append([g.V('3').repeat(__.out().simple_path()).until(__.loops().is_(1)).count(),
"g.V('3').repeat(__.out().simplePath()).until(__.loops().is(1)).count()"])
# 54
tests.append(
-
[g.V().hasLabel('airport').limit(20).group().by('region').by('code').order(Scope.local).by(Column.keys),
+
[g.V().has_label('airport').limit(20).group().by('region').by('code').order(Scope.local).by(Column.keys),
"g.V().hasLabel('airport').limit(20).group().by('region').by('code').order(Scope.local).by(Column.keys)"])
# 55
tests.append([g.V('1').as_('a').V('2').as_('a').select(Pop.all_, 'a'),
"g.V('1').as('a').V('2').as('a').select(Pop.all,'a')"])
# 56
- tests.append([g.addV('test').property(Cardinality.set_, 'p1', 10),
+ tests.append([g.add_v('test').property(Cardinality.set_, 'p1', 10),
"g.addV('test').property(Cardinality.set,'p1',10)"])
# 57
- tests.append([g.addV('test').property(Cardinality.list_, 'p1', 10),
+ tests.append([g.add_v('test').property(Cardinality.list_, 'p1', 10),
"g.addV('test').property(Cardinality.list,'p1',10)"])
# 58
- tests.append([g.addV('test').property(Cardinality.single, 'p1', 10),
+ tests.append([g.add_v('test').property(Cardinality.single, 'p1', 10),
"g.addV('test').property(Cardinality.single,'p1',10)"])
# 59
tests.append([g.V().limit(5).order().by(T.label),
@@ -225,49 +225,49 @@ class TestGremlinLang(object):
"g.V().range(1,5)"])
# 61
- tests.append([g.addV('test').property('p1', 123),
+ tests.append([g.add_v('test').property('p1', 123),
"g.addV('test').property('p1',123)"])
# 62
- tests.append([g.addV('test').property('date', datetime(2021, 2, 1, 9,
30)),
+ tests.append([g.add_v('test').property('date', datetime(2021, 2, 1, 9,
30)),
"g.addV('test').property('date',datetime(\"2021-02-01T09:30:00\"))"])
# 63
- tests.append([g.addV('test').property('date', datetime(2021, 2, 1)),
+ tests.append([g.add_v('test').property('date', datetime(2021, 2, 1)),
"g.addV('test').property('date',datetime(\"2021-02-01T00:00:00\"))"])
# 64
- tests.append([g.addE('route').from_(__.V('1')).to(__.V('2')),
+ tests.append([g.add_e('route').from_(__.V('1')).to(__.V('2')),
"g.addE('route').from(__.V('1')).to(__.V('2'))"])
# 65
- tests.append([g.withSideEffect('a', [1, 2]).V('3').select('a'),
+ tests.append([g.with_side_effect('a', [1, 2]).V('3').select('a'),
"g.withSideEffect('a',[1,2]).V('3').select('a')"])
# 66
- tests.append([g.withSideEffect('a', 1).V('3').select('a'),
+ tests.append([g.with_side_effect('a', 1).V('3').select('a'),
"g.withSideEffect('a',1).V('3').select('a')"])
# 67
- tests.append([g.withSideEffect('a', 'abc').V('3').select('a'),
+ tests.append([g.with_side_effect('a', 'abc').V('3').select('a'),
"g.withSideEffect('a','abc').V('3').select('a')"])
# 68
tests.append([g.V().has('airport', 'region',
'US-NM').limit(3).values('elev').fold().index(),
"g.V().has('airport','region','US-NM').limit(3).values('elev').fold().index()"])
# 69
-
tests.append([g.V('3').repeat(__.timeLimit(1000).out().simplePath()).until(__.has('code',
'AGR')).path(),
+
tests.append([g.V('3').repeat(__.time_limit(1000).out().simple_path()).until(__.has('code',
'AGR')).path(),
"g.V('3').repeat(__.timeLimit(1000).out().simplePath()).until(__.has('code','AGR')).path()"])
# 70
-
tests.append([g.V().hasLabel('airport').where(__.values('elev').is_(gt(14000))),
+
tests.append([g.V().has_label('airport').where(__.values('elev').is_(gt(14000))),
"g.V().hasLabel('airport').where(__.values('elev').is(gt(14000)))"])
# 71
-
tests.append([g.V().hasLabel('airport').where(__.out().count().is_(gt(250))).values('code'),
+
tests.append([g.V().has_label('airport').where(__.out().count().is_(gt(250))).values('code'),
"g.V().hasLabel('airport').where(__.out().count().is(gt(250))).values('code')"])
# 72
-
tests.append([g.V().hasLabel('airport').filter_(__.out().count().is_(gt(250))).values('code'),
+
tests.append([g.V().has_label('airport').filter_(__.out().count().is_(gt(250))).values('code'),
"g.V().hasLabel('airport').filter(__.out().count().is(gt(250))).values('code')"])
# 73
- tests.append([g.withSack(0).
+ tests.append([g.with_sack(0).
V('3').
-
repeat(__.outE('route').sack(Operator.sum_).by('dist').inV()).
+
repeat(__.out_e('route').sack(Operator.sum_).by('dist').in_v()).
until(__.has('code', 'AGR').or_().loops().is_(4)).
has('code', 'AGR').
local(__.union(__.path().by('code').by('dist'),
__.sack()).fold()).
@@ -275,11 +275,11 @@ class TestGremlinLang(object):
"g.withSack(0).V('3').repeat(__.outE('route').sack(Operator.sum).by('dist').inV()).until(__.has('code','AGR').or().loops().is(4)).has('code','AGR').local(__.union(__.path().by('code').by('dist'),__.sack()).fold()).limit(10)"])
# 74
-
tests.append([g.addV().as_('a').addV().as_('b').addE('knows').from_('a').to('b'),
+
tests.append([g.add_v().as_('a').add_v().as_('b').add_e('knows').from_('a').to('b'),
"g.addV().as('a').addV().as('b').addE('knows').from('a').to('b')"])
# 75
-
tests.append([g.addV('Person').as_('a').addV('Person').as_('b').addE('knows').from_('a').to('b'),
+
tests.append([g.add_v('Person').as_('a').add_v('Person').as_('b').add_e('knows').from_('a').to('b'),
"g.addV('Person').as('a').addV('Person').as('b').addE('knows').from('a').to('b')"])
# 76
@@ -319,47 +319,47 @@ class TestGremlinLang(object):
"g.V().has('runways',inside(3,5))"])
# 85
- tests.append([g.V('44').outE().elementMap(),
+ tests.append([g.V('44').out_e().element_map(),
"g.V('44').outE().elementMap()"])
# 86
- tests.append([g.V('44').valueMap().by(__.unfold()),
+ tests.append([g.V('44').value_map().by(__.unfold()),
"g.V('44').valueMap().by(__.unfold())"])
# 87
- tests.append([g.V('44').valueMap().with_(WithOptions.tokens,
WithOptions.labels),
+ tests.append([g.V('44').value_map().with_(WithOptions.tokens,
WithOptions.labels),
"g.V('44').valueMap().with('~tinkerpop.valueMap.tokens',2)"])
# 88
- tests.append([g.V('44').valueMap().with_(WithOptions.tokens),
+ tests.append([g.V('44').value_map().with_(WithOptions.tokens),
"g.V('44').valueMap().with('~tinkerpop.valueMap.tokens')"])
# 89
- tests.append([g.withStrategies(ReadOnlyStrategy()).addV('test'),
+ tests.append([g.with_strategies(ReadOnlyStrategy()).add_v('test'),
"g.withStrategies(ReadOnlyStrategy).addV('test')"])
# 90
- strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'),
edges=__.hasLabel('route'))
- tests.append([g.withStrategies(strategy).V().count(),
+ strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'),
edges=__.has_label('route'))
+ tests.append([g.with_strategies(strategy).V().count(),
"g.withStrategies(new
SubgraphStrategy(vertices:__.has('region','US-TX'),edges:__.hasLabel('route'))).V().count()"])
# 91
- strategy = SubgraphStrategy(vertex_properties=__.hasNot('runways'))
- tests.append([g.withStrategies(strategy).V().count(),
+ strategy = SubgraphStrategy(vertex_properties=__.has_not('runways'))
+ tests.append([g.with_strategies(strategy).V().count(),
"g.withStrategies(new
SubgraphStrategy(vertexProperties:__.hasNot('runways'))).V().count()"])
# 92
- strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'),
vertex_properties=__.hasNot('runways'))
- tests.append([g.withStrategies(strategy).V().count(),
+ strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'),
vertex_properties=__.has_not('runways'))
+ tests.append([g.with_strategies(strategy).V().count(),
"g.withStrategies(new
SubgraphStrategy(vertices:__.has('region','US-TX'),vertexProperties:__.hasNot('runways'))).V().count()"])
# 93
- strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'),
edges=__.hasLabel('route'))
- tests.append([g.withStrategies(ReadOnlyStrategy(),
strategy).V().count(),
+ strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'),
edges=__.has_label('route'))
+ tests.append([g.with_strategies(ReadOnlyStrategy(),
strategy).V().count(),
"g.withStrategies(ReadOnlyStrategy,new
SubgraphStrategy(vertices:__.has('region','US-TX'),edges:__.hasLabel('route'))).V().count()"])
# 94
strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'))
- tests.append([g.withStrategies(ReadOnlyStrategy(),
strategy).V().count(),
+ tests.append([g.with_strategies(ReadOnlyStrategy(),
strategy).V().count(),
"g.withStrategies(ReadOnlyStrategy,new
SubgraphStrategy(vertices:__.has('region','US-TX'))).V().count()"])
# 95 Note with_() options are now extracted into request message and
is no longer sent with the script
@@ -367,20 +367,20 @@ class TestGremlinLang(object):
"g.V().count()"])
# 96 Note OptionsStrategy are now extracted into request message and
is no longer sent with the script
- tests.append([g.withStrategies(OptionsStrategy({'evaluationTimeout':
500})).V().count(),
+ tests.append([g.with_strategies(OptionsStrategy({'evaluationTimeout':
500})).V().count(),
"g.V().count()"])
# 97
- tests.append([g.withStrategies(
- PartitionStrategy(partition_key="partition", write_partition="a",
read_partitions=["a"])).addV('test'),
+ tests.append([g.with_strategies(
+ PartitionStrategy(partition_key="partition", write_partition="a",
read_partitions=["a"])).add_v('test'),
"g.withStrategies(new
PartitionStrategy(partitionKey:'partition',writePartition:'a',readPartitions:['a'])).addV('test')"])
# 98
-
tests.append([g.withComputer().V().shortestPath().with_(ShortestPath.target,
__.has('name', 'peter')),
+
tests.append([g.with_computer().V().shortest_path().with_(ShortestPath.target,
__.has('name', 'peter')),
"g.withStrategies(VertexProgramStrategy).V().shortestPath().with('~tinkerpop.shortestPath.target',__.has('name','peter'))"])
# 99
- tests.append([g.V().coalesce(__.E(), __.addE('person')),
+ tests.append([g.V().coalesce(__.E(), __.add_e('person')),
"g.V().coalesce(__.E(),__.addE('person'))"])
# 100
@@ -438,7 +438,7 @@ class TestGremlinLang(object):
"g.inject(1.0D).is(eq(1).or(gt(2)).or(lte(3)).or(gte(4)))"])
# 111
- tests.append([g.V().hasLabel('person').has('age',
P.gt(10).or_(P.gte(11).and_(P.lt(20))).and_(
+ tests.append([g.V().has_label('person').has('age',
P.gt(10).or_(P.gte(11).and_(P.lt(20))).and_(
P.lt(29).or_(P.eq(35)))).name,
"g.V().hasLabel('person').has('age',gt(10).or(gte(11).and(lt(20))).and(lt(29).or(eq(35)))).values('name')"])
@@ -455,11 +455,11 @@ class TestGremlinLang(object):
"g.mergeE(null)"])
# 115
- tests.append([g.addV('\"test\"'),
+ tests.append([g.add_v('\"test\"'),
"g.addV('\"test\"')"])
# 116
- tests.append([g.addV('t\'"est'),
+ tests.append([g.add_v('t\'"est'),
"g.addV('t\\'\"est')"])
# 117
diff --git a/gremlin-python/src/main/python/tests/process/test_strategies.py
b/gremlin-python/src/main/python/tests/process/test_strategies.py
index 4379b08d10..b6fd0e3015 100644
--- a/gremlin-python/src/main/python/tests/process/test_strategies.py
+++ b/gremlin-python/src/main/python/tests/process/test_strategies.py
@@ -27,95 +27,69 @@ from gremlin_python.process.graph_traversal import __
class TestTraversalStrategies(object):
def test_singletons(self):
g = traversal().with_(None)
- bytecode = g.withStrategies(ReadOnlyStrategy()).bytecode
- assert 1 == len(bytecode.source_instructions)
- assert 2 == len(bytecode.source_instructions[0])
- assert "withStrategies" == bytecode.source_instructions[0][0]
- assert ReadOnlyStrategy() == bytecode.source_instructions[0][1]
- assert "ReadOnlyStrategy" == str(bytecode.source_instructions[0][1])
- assert hash(ReadOnlyStrategy()) ==
hash(bytecode.source_instructions[0][1])
+ gremlin_script = g.with_strategies(ReadOnlyStrategy()).gremlin_lang
+ gremlin_instr = gremlin_script.gremlin
+ assert "withStrategies" in str(gremlin_script)
+ assert "ReadOnlyStrategy" in str(gremlin_script)
+ assert "withStrategies(ReadOnlyStrategy)" == gremlin_instr[1]
assert 0 == len(g.traversal_strategies.traversal_strategies) # these
strategies are proxies
##
- g = g.withStrategies(ReadOnlyStrategy(), IncidentToAdjacentStrategy())
- bytecode = g.bytecode
- assert 1 == len(bytecode.source_instructions)
- assert 3 == len(bytecode.source_instructions[0])
- assert "withStrategies" == bytecode.source_instructions[0][0]
- assert ReadOnlyStrategy() == bytecode.source_instructions[0][1]
- assert IncidentToAdjacentStrategy() ==
bytecode.source_instructions[0][2]
+ g = g.with_strategies(ReadOnlyStrategy(), IncidentToAdjacentStrategy())
+ gremlin_script = g.gremlin_lang
+ gremlin_instr = gremlin_script.gremlin
+ assert "withStrategies" in str(gremlin_script)
+ assert "ReadOnlyStrategy" in str(gremlin_script)
+ assert "withStrategies(ReadOnlyStrategy,IncidentToAdjacentStrategy)"
== gremlin_instr[1]
##
- bytecode = g.V().bytecode
- assert 1 == len(bytecode.source_instructions)
- assert 3 == len(bytecode.source_instructions[0])
- assert "withStrategies" == bytecode.source_instructions[0][0]
- assert ReadOnlyStrategy() == bytecode.source_instructions[0][1]
- assert IncidentToAdjacentStrategy() ==
bytecode.source_instructions[0][2]
- assert 1 == len(bytecode.step_instructions)
- assert "V" == bytecode.step_instructions[0][0]
+ gremlin_script = g.V().gremlin_lang
+ gremlin_instr = gremlin_script.gremlin
+ assert "withStrategies" in str(gremlin_script)
+ assert "ReadOnlyStrategy" in str(gremlin_script)
+ assert "IncidentToAdjacentStrategy" in str(gremlin_script)
+ assert "V()" in str(gremlin_script)
+ assert "withStrategies(ReadOnlyStrategy,IncidentToAdjacentStrategy)"
== gremlin_instr[1]
+ assert 'V' == gremlin_instr[3]
##
- bytecode = g.withoutStrategies(ReadOnlyStrategy()).V().bytecode
- assert 2 == len(bytecode.source_instructions)
- assert 3 == len(bytecode.source_instructions[0])
- assert 2 == len(bytecode.source_instructions[1])
- assert "withStrategies" == bytecode.source_instructions[0][0]
- assert ReadOnlyStrategy() == bytecode.source_instructions[0][1]
- assert IncidentToAdjacentStrategy() ==
bytecode.source_instructions[0][2]
- assert "withoutStrategies" == bytecode.source_instructions[1][0]
- assert ReadOnlyStrategy() == bytecode.source_instructions[1][1]
- assert 1 == len(bytecode.step_instructions)
- assert "V" == bytecode.step_instructions[0][0]
+ gremlin_script =
g.without_strategies(ReadOnlyStrategy()).V().gremlin_lang
+ gremlin_instr = gremlin_script.gremlin
+ gremlin_params = gremlin_script.parameters
+ assert "withStrategies" in str(gremlin_script)
+ assert "ReadOnlyStrategy" in str(gremlin_script)
+ assert "IncidentToAdjacentStrategy" in str(gremlin_script)
+ assert "withoutStrategies" in str(gremlin_script)
+ assert "V()" in str(gremlin_script)
+ assert "withStrategies(ReadOnlyStrategy,IncidentToAdjacentStrategy)"
== gremlin_instr[1]
+ assert ReadOnlyStrategy() == gremlin_params["_0"]
##
- bytecode = g.withoutStrategies(ReadOnlyStrategy(),
LazyBarrierStrategy()).V().bytecode
- assert 2 == len(bytecode.source_instructions)
- assert 3 == len(bytecode.source_instructions[0])
- assert 3 == len(bytecode.source_instructions[1])
- assert "withStrategies" == bytecode.source_instructions[0][0]
- assert ReadOnlyStrategy() == bytecode.source_instructions[0][1]
- assert IncidentToAdjacentStrategy() ==
bytecode.source_instructions[0][2]
- assert "withoutStrategies" == bytecode.source_instructions[1][0]
- assert ReadOnlyStrategy() == bytecode.source_instructions[1][1]
- assert LazyBarrierStrategy() == bytecode.source_instructions[1][2]
- assert 1 == len(bytecode.step_instructions)
- assert "V" == bytecode.step_instructions[0][0]
+ gremlin_script = g.without_strategies(ReadOnlyStrategy(),
LazyBarrierStrategy()).V().gremlin_lang
+ gremlin_params = gremlin_script.parameters
+ assert "withStrategies" in str(gremlin_script)
+ assert "ReadOnlyStrategy" in str(gremlin_script)
+ assert "IncidentToAdjacentStrategy" in str(gremlin_script)
+ assert "withoutStrategies" in str(gremlin_script)
+ assert "V()" in str(gremlin_script)
+ assert ReadOnlyStrategy() == gremlin_params["_1"]
+ assert LazyBarrierStrategy() == gremlin_params["_2"]
###
g = traversal().with_(None)
- bytecode = g.with_("x", "test").with_("y").bytecode
- assert 1 == len(bytecode.source_instructions)
- assert 2 == len(bytecode.source_instructions[0])
- assert "withStrategies" == bytecode.source_instructions[0][0]
- assert OptionsStrategy() == bytecode.source_instructions[0][1]
- strategy = bytecode.source_instructions[0][1]
- assert 2 == len(strategy.configuration)
- assert "test" == strategy.configuration["x"]
- assert strategy.configuration["y"]
+ gremlin_script = g.with_("x", "test").with_("y").gremlin_lang
+ options = gremlin_script.options_strategies
+ assert "test" == options[0].configuration["x"]
+ assert options[1].configuration["y"]
def test_configurable(self):
g = traversal().with_(None)
- bytecode = g.withStrategies(MatchAlgorithmStrategy("greedy")).bytecode
- assert 1 == len(bytecode.source_instructions)
- assert 2 == len(bytecode.source_instructions[0])
- assert "withStrategies" == bytecode.source_instructions[0][0]
- assert MatchAlgorithmStrategy() == bytecode.source_instructions[0][1]
- assert "MatchAlgorithmStrategy" ==
str(bytecode.source_instructions[0][1])
- assert hash(MatchAlgorithmStrategy()) == hash(
- bytecode.source_instructions[0][1]) # even though different
confs, same strategy
- assert 0 == len(g.traversal_strategies.traversal_strategies) # these
strategies are proxies
+ gremlin_script =
g.with_strategies(MatchAlgorithmStrategy("greedy")).gremlin_lang
+ assert "withStrategies" in str(gremlin_script)
+ assert "MatchAlgorithmStrategy" in str(gremlin_script)
+ assert "greedy" in str(gremlin_script)
###
- bytecode = g.withStrategies(SubgraphStrategy(vertices=__.has("name",
"marko"))).bytecode
- assert 1 == len(bytecode.source_instructions)
- assert 2 == len(bytecode.source_instructions[0])
- assert "withStrategies" == bytecode.source_instructions[0][0]
- assert SubgraphStrategy() == bytecode.source_instructions[0][1]
- strategy = bytecode.source_instructions[0][1]
- assert 1 == len(strategy.configuration)
- assert __.has("name","marko") == strategy.configuration["vertices"]
+ gremlin_script =
g.with_strategies(SubgraphStrategy(vertices=__.has("name",
"marko"))).gremlin_lang
+ assert "withStrategies" in str(gremlin_script)
+ assert "SubgraphStrategy" in str(gremlin_script)
+ assert "__.has('name','marko')" in str(gremlin_script)
###
- bytecode = g.withStrategies(OptionsStrategy(options={"x": "test", "y":
True})).bytecode
- assert 1 == len(bytecode.source_instructions)
- assert 2 == len(bytecode.source_instructions[0])
- assert "withStrategies" == bytecode.source_instructions[0][0]
- assert OptionsStrategy() == bytecode.source_instructions[0][1]
- strategy = bytecode.source_instructions[0][1]
- assert 2 == len(strategy.configuration)
- assert "test" == strategy.configuration["x"]
- assert strategy.configuration["y"]
+ gremlin_script = g.with_strategies(OptionsStrategy(options={"x":
"test", "y": True})).gremlin_lang
+ options = gremlin_script.options_strategies
+ assert "test" == options[0].configuration["x"]
+ assert options[0].configuration["y"]
diff --git a/gremlin-python/src/main/python/tests/process/test_translator.py
b/gremlin-python/src/main/python/tests/process/test_translator.py
deleted file mode 100644
index 8a33f16a76..0000000000
--- a/gremlin-python/src/main/python/tests/process/test_translator.py
+++ /dev/null
@@ -1,459 +0,0 @@
-# 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.
-#
-
-"""
-Unit tests for the Translator Class.
-"""
-__author__ = 'Kelvin R. Lawrence (gfxman)'
-
-from gremlin_python.structure.graph import Graph, Vertex, Edge, VertexProperty
-from gremlin_python.process.anonymous_traversal import traversal
-from gremlin_python.process.graph_traversal import __
-from gremlin_python.process.translator import *
-from datetime import datetime
-
-
-# TODO to be removed as bytecode and groovy are replaced by gremlin lang
scripts
-class TestTranslator(object):
-
- def test_translations(self):
- g = traversal().with_(None)
-
- tests = list()
- # 0
- tests.append([g.V(),
- "g.V()"])
- # 1
- tests.append([g.V('1', '2', '3', '4'),
- "g.V('1','2','3','4')"])
- # 2
- tests.append([g.V('3').valueMap(True),
- "g.V('3').valueMap(true)"])
- # 3
- tests.append([g.V().constant(5),
- "g.V().constant(5)"])
- # 4
- tests.append([g.V().constant(1.5),
- "g.V().constant(1.5d)"])
- # 5
- tests.append([g.V().constant('Hello'),
- "g.V().constant('Hello')"])
- # 6
- tests.append([g.V().hasLabel('airport').limit(5),
- "g.V().hasLabel('airport').limit(5)"])
- # 7
- tests.append([g.V().hasLabel(within('a', 'b', 'c')),
- "g.V().hasLabel(within(['a','b','c']))"])
- # 8
- tests.append([g.V().hasLabel('airport', 'continent').out().limit(5),
- "g.V().hasLabel('airport','continent').out().limit(5)"])
- # 9
- tests.append([g.V().hasLabel('airport').out().values('code').limit(5),
-
"g.V().hasLabel('airport').out().values('code').limit(5)"])
- # 10
-
tests.append([g.V('3').as_('a').out('route').limit(10).where(eq('a')).by('region'),
-
"g.V('3').as('a').out('route').limit(10).where(eq('a')).by('region')"])
- # 11
-
tests.append([g.V('3').repeat(__.out('route').simplePath()).times(2).path().by('code'),
-
"g.V('3').repeat(__.out('route').simplePath()).times(2).path().by('code')"])
- # 12
- tests.append([g.V().hasLabel('airport').out().has('region',
'US-TX').values('code').limit(5),
-
"g.V().hasLabel('airport').out().has('region','US-TX').values('code').limit(5)"])
- # 13
- tests.append([g.V().hasLabel('airport').union(__.values('city'),
__.values('region')).limit(5),
-
"g.V().hasLabel('airport').union(__.values('city'),__.values('region')).limit(5)"])
- # 14
- tests.append([g.V('3').as_('a').out('route', 'routes'),
- "g.V('3').as('a').out('route','routes')"])
- # 15
- tests.append([g.V().where(__.values('runways').is_(5)),
- "g.V().where(__.values('runways').is(5))"])
- # 16
-
tests.append([g.V('3').repeat(__.out().simplePath()).until(__.has('code',
'AGR')).path().by('code').limit(5),
-
"g.V('3').repeat(__.out().simplePath()).until(__.has('code','AGR')).path().by('code').limit(5)"])
- # 17
- tests.append([g.V().hasLabel('airport').order().by(__.id_()),
- "g.V().hasLabel('airport').order().by(__.id())"])
- # 18
- tests.append([g.V().hasLabel('airport').order().by(T.id),
- "g.V().hasLabel('airport').order().by(T.id)"])
- # 19
- tests.append([g.V().hasLabel('airport').order().by(__.id_(),
Order.desc),
-
"g.V().hasLabel('airport').order().by(__.id(),Order.desc)"])
- # 20
- tests.append([g.V().hasLabel('airport').order().by('code', Order.desc),
-
"g.V().hasLabel('airport').order().by('code',Order.desc)"])
- # 21
- tests.append([g.V('1', '2', '3').local(__.out().out().dedup().fold()),
- "g.V('1','2','3').local(__.out().out().dedup().fold())"])
- # 22
- tests.append([g.V('3').out().path().count(Scope.local),
- "g.V('3').out().path().count(Scope.local)"])
- # 23
- tests.append([g.E().count(),
- "g.E().count()"])
- # 24
- tests.append([g.V('5').outE('route').inV().path().limit(10),
- "g.V('5').outE('route').inV().path().limit(10)"])
- # 25
- tests.append([g.V('5').propertyMap().select(Column.keys),
- "g.V('5').propertyMap().select(Column.keys)"])
- # 26
- tests.append([g.V('5').propertyMap().select(Column.values),
- "g.V('5').propertyMap().select(Column.values)"])
- # 27
- tests.append([g.V('3').values('runways').math('_ + 1'),
- "g.V('3').values('runways').math('_ + 1')"])
- # 28
-
tests.append([g.V('3').emit().repeat(__.out().simplePath()).times(3).limit(5).path(),
-
"g.V('3').emit().repeat(__.out().simplePath()).times(3).limit(5).path()"])
- # 29
- tests.append([g.V().match(__.as_('a').has('code',
'LHR').as_('b')).select('b').by('code'),
-
"g.V().match(__.as('a').has('code','LHR').as('b')).select('b').by('code')"])
- # 30
- tests.append([g.V().has('test-using-keyword-as-property', 'repeat'),
- "g.V().has('test-using-keyword-as-property','repeat')"])
- # 31
- tests.append([g.V('1').addE('test').to(__.V('4')),
- "g.V('1').addE('test').to(__.V('4'))"])
- # 32
- tests.append([g.V().values('runways').max_(),
- "g.V().values('runways').max()"])
- # 33
- tests.append([g.V().values('runways').min_(),
- "g.V().values('runways').min()"])
- # 34
- tests.append([g.V().values('runways').sum_(),
- "g.V().values('runways').sum()"])
- # 35
- tests.append([g.V().values('runways').mean(),
- "g.V().values('runways').mean()"])
- # 36
- tests.append([g.withSack(0).V('3',
'5').sack(Operator.sum_).by('runways').sack(),
-
"g.withSack(0).V('3','5').sack(Operator.sum).by('runways').sack()"])
- # 37
-
tests.append([g.V('3').values('runways').store('x').V('4').values('runways').store('x').by(__.constant(1)).V(
- '6').store('x').by(__.constant(1)).select('x').unfold().sum_(),
-
"g.V('3').values('runways').store('x').V('4').values('runways').store('x').by(__.constant(1)).V('6').store('x').by(__.constant(1)).select('x').unfold().sum()"])
- # 38
- tests.append([g.inject(3, 4, 5),
- "g.inject(3,4,5)"])
- # 39
- tests.append([g.inject([3, 4, 5]),
- "g.inject([3,4,5])"])
- # 40
- tests.append([g.inject(3, 4, 5).count(),
- "g.inject(3,4,5).count()"])
- # 41
- tests.append([g.V().has('runways', gt(5)).count(),
- "g.V().has('runways',gt(5)).count()"])
- # 42
- tests.append([g.V().has('runways', lte(5.3)).count(),
- "g.V().has('runways',lte(5.3d)).count()"])
- # 43
- tests.append([g.V().has('code', within(123, 124)),
- "g.V().has('code',within([123,124]))"])
- # 44
- tests.append([g.V().has('code', within(123, 'abc')),
- "g.V().has('code',within([123,'abc']))"])
- # 45
- tests.append([g.V().has('code', within('abc', 123)),
- "g.V().has('code',within(['abc',123]))"])
- # 46
- tests.append([g.V().has('code', within('abc', 'xyz')),
- "g.V().has('code',within(['abc','xyz']))"])
- # 47
- tests.append([g.V('1', '2').has('region', P.within('US-TX', 'US-GA')),
- "g.V('1','2').has('region',within(['US-TX','US-GA']))"])
- # 48
- tests.append([g.V().and_(__.has('runways', P.gt(5)), __.has('region',
'US-TX')),
-
"g.V().and(__.has('runways',gt(5)),__.has('region','US-TX'))"])
- # 49
- tests.append([g.V().union(__.has('runways', gt(5)), __.has('region',
'US-TX')),
-
"g.V().union(__.has('runways',gt(5)),__.has('region','US-TX'))"])
- # 50
- tests.append([g.V('3').choose(__.values('runways').is_(3),
__.constant('three'), __.constant('not three')),
-
"g.V('3').choose(__.values('runways').is(3),__.constant('three'),__.constant('not
three'))"])
- # 51
- tests.append(
- [g.V('3').choose(__.values('runways')).option(1,
__.constant('three')).option(2, __.constant('not three')),
-
"g.V('3').choose(__.values('runways')).option(1,__.constant('three')).option(2,__.constant('not
three'))"])
- # 52
- tests.append([g.V('3').choose(__.values('runways')).option(1.5,
__.constant('one and a half')).option(2,
-
__.constant(
-
'not three')),
-
"g.V('3').choose(__.values('runways')).option(1.5d,__.constant('one and a
half')).option(2,__.constant('not three'))"])
- # 53
-
tests.append([g.V('3').repeat(__.out().simplePath()).until(__.loops().is_(1)).count(),
-
"g.V('3').repeat(__.out().simplePath()).until(__.loops().is(1)).count()"])
- # 54
- tests.append(
-
[g.V().hasLabel('airport').limit(20).group().by('region').by('code').order(Scope.local).by(Column.keys),
-
"g.V().hasLabel('airport').limit(20).group().by('region').by('code').order(Scope.local).by(Column.keys)"])
- # 55
- tests.append([g.V('1').as_('a').V('2').as_('a').select(Pop.all_, 'a'),
- "g.V('1').as('a').V('2').as('a').select(Pop.all,'a')"])
- # 56
- tests.append([g.addV('test').property(Cardinality.set_, 'p1', 10),
- "g.addV('test').property(Cardinality.set,'p1',10)"])
- # 57
- tests.append([g.addV('test').property(Cardinality.list_, 'p1', 10),
- "g.addV('test').property(Cardinality.list,'p1',10)"])
-
- # 58
- tests.append([g.addV('test').property(Cardinality.single, 'p1', 10),
- "g.addV('test').property(Cardinality.single,'p1',10)"])
- # 59
- tests.append([g.V().limit(5).order().by(T.label),
- "g.V().limit(5).order().by(T.label)"])
-
- # 60
- tests.append([g.V().range_(1, 5),
- "g.V().range(1,5)"])
-
- # 61
- tests.append([g.addV('test').property('p1', 123),
- "g.addV('test').property('p1',123)"])
-
- # 62
- tests.append([g.addV('test').property('date', datetime(2021, 2, 1, 9,
30)),
- "g.addV('test').property('date',new
Date(121,2,1,9,30,0))"])
- # 63
- tests.append([g.addV('test').property('date', datetime(2021, 2, 1)),
- "g.addV('test').property('date',new
Date(121,2,1,0,0,0))"])
- # 64
- tests.append([g.addE('route').from_(__.V('1')).to(__.V('2')),
- "g.addE('route').from(__.V('1')).to(__.V('2'))"])
- # 65
- tests.append([g.withSideEffect('a', [1, 2]).V('3').select('a'),
- "g.withSideEffect('a',[1,2]).V('3').select('a')"])
- # 66
- tests.append([g.withSideEffect('a', 1).V('3').select('a'),
- "g.withSideEffect('a',1).V('3').select('a')"])
- # 67
- tests.append([g.withSideEffect('a', 'abc').V('3').select('a'),
- "g.withSideEffect('a','abc').V('3').select('a')"])
- # 68
- tests.append([g.V().has('airport', 'region',
'US-NM').limit(3).values('elev').fold().index(),
-
"g.V().has('airport','region','US-NM').limit(3).values('elev').fold().index()"])
- # 69
-
tests.append([g.V('3').repeat(__.timeLimit(1000).out().simplePath()).until(__.has('code',
'AGR')).path(),
-
"g.V('3').repeat(__.timeLimit(1000).out().simplePath()).until(__.has('code','AGR')).path()"])
-
- # 70
-
tests.append([g.V().hasLabel('airport').where(__.values('elev').is_(gt(14000))),
-
"g.V().hasLabel('airport').where(__.values('elev').is(gt(14000)))"])
-
- # 71
-
tests.append([g.V().hasLabel('airport').where(__.out().count().is_(gt(250))).values('code'),
-
"g.V().hasLabel('airport').where(__.out().count().is(gt(250))).values('code')"])
-
- # 72
-
tests.append([g.V().hasLabel('airport').filter_(__.out().count().is_(gt(250))).values('code'),
-
"g.V().hasLabel('airport').filter(__.out().count().is(gt(250))).values('code')"])
- # 73
- tests.append([g.withSack(0).
- V('3').
-
repeat(__.outE('route').sack(Operator.sum_).by('dist').inV()).
- until(__.has('code', 'AGR').or_().loops().is_(4)).
- has('code', 'AGR').
- local(__.union(__.path().by('code').by('dist'),
__.sack()).fold()).
- limit(10),
-
"g.withSack(0).V('3').repeat(__.outE('route').sack(Operator.sum).by('dist').inV()).until(__.has('code','AGR').or().loops().is(4)).has('code','AGR').local(__.union(__.path().by('code').by('dist'),__.sack()).fold()).limit(10)"])
-
- # 74
-
tests.append([g.addV().as_('a').addV().as_('b').addE('knows').from_('a').to('b'),
-
"g.addV().as('a').addV().as('b').addE('knows').from('a').to('b')"])
-
- # 75
-
tests.append([g.addV('Person').as_('a').addV('Person').as_('b').addE('knows').from_('a').to('b'),
-
"g.addV('Person').as('a').addV('Person').as('b').addE('knows').from('a').to('b')"])
- # 76
- tests.append([g.V('3').project('Out',
'In').by(__.out().count()).by(__.in_().count()),
-
"g.V('3').project('Out','In').by(__.out().count()).by(__.in().count())"])
- # 77
-
tests.append([g.V('44').out().aggregate('a').out().where(within('a')).path(),
-
"g.V('44').out().aggregate('a').out().where(within(['a'])).path()"])
- # 78
- tests.append([g.V().has('date', datetime(2021, 2, 22)),
- "g.V().has('date',new Date(121,2,22,0,0,0))"])
- # 79
- tests.append([g.V().has('date', within(datetime(2021, 2, 22),
datetime(2021, 1, 1))),
- "g.V().has('date',within([new Date(121,2,22,0,0,0),new
Date(121,1,1,0,0,0)]))"])
- # 80
- tests.append([g.V().has('date', between(datetime(2021, 1, 1),
datetime(2021, 2, 22))),
- "g.V().has('date',between(new Date(121,1,1,0,0,0),new
Date(121,2,22,0,0,0)))"])
- # 81
- tests.append([g.V().has('date', inside(datetime(2021, 1, 1),
datetime(2021, 2, 22))),
- "g.V().has('date',inside(new Date(121,1,1,0,0,0),new
Date(121,2,22,0,0,0)))"])
- # 82
- tests.append([g.V().has('date', P.gt(datetime(2021, 1, 1, 9, 30))),
- "g.V().has('date',gt(new Date(121,1,1,9,30,0)))"])
- # 83
- tests.append([g.V().has('runways', between(3, 5)),
- "g.V().has('runways',between(3,5))"])
- # 84
- tests.append([g.V().has('runways', inside(3, 5)),
- "g.V().has('runways',inside(3,5))"])
- # 85
- tests.append([g.V('44').outE().elementMap(),
- "g.V('44').outE().elementMap()"])
- # 86
- tests.append([g.V('44').valueMap().by(__.unfold()),
- "g.V('44').valueMap().by(__.unfold())"])
- # 87
- tests.append([g.V('44').valueMap().with_(WithOptions.tokens,
WithOptions.labels),
-
"g.V('44').valueMap().with(WithOptions.tokens,WithOptions.labels)"])
- # 88
- tests.append([g.V('44').valueMap().with_(WithOptions.tokens),
- "g.V('44').valueMap().with(WithOptions.tokens)"])
- # 89
- tests.append([g.withStrategies(ReadOnlyStrategy()).addV('test'),
- "g.withStrategies(ReadOnlyStrategy).addV('test')"])
- # 90
- strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'),
edges=__.hasLabel('route'))
- tests.append([g.withStrategies(strategy).V().count(),
- "g.withStrategies(new
SubgraphStrategy(vertices:__.has('region','US-TX'),edges:__.hasLabel('route'))).V().count()"])
- # 91
- strategy = SubgraphStrategy(vertex_properties=__.hasNot('runways'))
- tests.append([g.withStrategies(strategy).V().count(),
- "g.withStrategies(new
SubgraphStrategy(vertexProperties:__.hasNot('runways'))).V().count()"])
- # 92
- strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'),
vertex_properties=__.hasNot('runways'))
- tests.append([g.withStrategies(strategy).V().count(),
- "g.withStrategies(new
SubgraphStrategy(vertices:__.has('region','US-TX'),vertexProperties:__.hasNot('runways'))).V().count()"])
- # 93
- strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'),
edges=__.hasLabel('route'))
- tests.append([g.withStrategies(ReadOnlyStrategy(),
strategy).V().count(),
- "g.withStrategies(ReadOnlyStrategy,new
SubgraphStrategy(vertices:__.has('region','US-TX'),edges:__.hasLabel('route'))).V().count()"])
- # 94
- strategy = SubgraphStrategy(vertices=__.has('region', 'US-TX'))
- tests.append([g.withStrategies(ReadOnlyStrategy(),
strategy).V().count(),
- "g.withStrategies(ReadOnlyStrategy,new
SubgraphStrategy(vertices:__.has('region','US-TX'))).V().count()"])
- # 95
- tests.append([g.with_('evaluationTimeout', 500).V().count(),
- "g.withStrategies(new
OptionsStrategy(evaluationTimeout:500)).V().count()"])
- # 96
- tests.append([g.withStrategies(OptionsStrategy({'evaluationTimeout':
500})).V().count(),
- "g.withStrategies(new
OptionsStrategy(evaluationTimeout:500)).V().count()"])
- # 97
- tests.append([g.withStrategies(
- PartitionStrategy(partition_key="partition", write_partition="a",
read_partitions=["a"])).addV('test'),
- "g.withStrategies(new
PartitionStrategy(partitionKey:'partition',writePartition:'a',readPartitions:['a'])).addV('test')"])
- # 98
-
tests.append([g.withComputer().V().shortestPath().with_(ShortestPath.target,
__.has('name', 'peter')),
-
"g.withStrategies(VertexProgramStrategy).V().shortestPath().with('~tinkerpop.shortestPath.target',__.has('name','peter'))"])
-
- # 99
- tests.append([g.V().coalesce(__.E(),__.addE('person')),
- "g.V().coalesce(__.E(),__.addE('person'))"])
- # 100
- tests.append([g.inject(1).E(),
- "g.inject(1).E()"])
-
- # 99
- tests.append([g.V().has("p1", starting_with("foo")),
- "g.V().has('p1',startingWith('foo'))"])
-
- # 100
- tests.append([g.V().has("p1", ending_with("foo")),
- "g.V().has('p1',endingWith('foo'))"])
-
- # 101
- class SuperStr(str):
- pass
-
- tests.append([g.V(SuperStr("foo_id")),
- "g.V('foo_id')"])
-
- # 102
- tests.append([g.V().has("p1", containing(SuperStr("foo"))),
- "g.V().has('p1',containing('foo'))"])
-
- # 103
- tests.append([g.V().has("p1", None),
- "g.V().has('p1',null)"])
-
- # 104
- vertex = Vertex(0, "person")
- tests.append([g.V(vertex),
- "g.V(new ReferenceVertex(0,'person'))"])
-
- # 105
- outVertex = Vertex(0, "person")
- inVertex = Vertex(1, "person")
- edge = Edge(2, outVertex, "knows", inVertex)
- tests.append([g.inject(edge),
- "g.inject(new ReferenceEdge(2,'knows',new
ReferenceVertex(1,'person'),new ReferenceVertex(0,'person')))"])
-
- # 106
- vp = VertexProperty(3, "time", "18:00", None)
- tests.append([g.inject(vp),
- "g.inject(new
ReferenceVertexProperty(3,'time','18:00'))"])
-
- # 107
- tests.append([g.V().has('person', 'name', 'marko').map(lambda:
("it.get().value('name')", "gremlin-groovy")),
-
"g.V().has('person','name','marko').map({it.get().value('name')})"])
-
- # 108
- tests.append([g.V().has('person', 'age', Bindings.of('x',
P.lt(30))).count(),
- "g.V().has('person','age',Bindings.instance().of('x',
lt(30))).count()"])
-
- # 109
- tests.append([g.inject({'name': 'java'}, {T.id: 0}, {},
- {'age': float(10), 'pos_inf': float("inf"),
'neg_inf': float("-inf"), 'nan': float("nan")}),
-
"g.inject(['name':'java'],[(T.id):0],[:],['age':10.0d,'pos_inf':Double.POSITIVE_INFINITY,'neg_inf':Double.NEGATIVE_INFINITY,'nan':Double.NaN])"])
-
- # 110
-
tests.append([g.inject(float(1)).is_(P.eq(1).or_(P.gt(2)).or_(P.lte(3)).or_(P.gte(4))),
-
"g.inject(1.0d).is(eq(1).or(gt(2)).or(lte(3)).or(gte(4)))"])
-
- # 111
-
tests.append([g.V().hasLabel('person').has('age',P.gt(10).or_(P.gte(11).and_(P.lt(20))).and_(P.lt(29).or_(P.eq(35)))).name,
-
"g.V().hasLabel('person').has('age',gt(10).or(gte(11).and(lt(20))).and(lt(29).or(eq(35)))).values('name')"])
-
- # 112
- tests.append([g.inject(set(('a'))),
- "g.inject(['a'] as Set)"])
-
- # 113
- tests.append([g.merge_v(None),
- "g.mergeV((Traversal) null)"])
-
- # 114
- tests.append([g.merge_e(None),
- "g.mergeE((Traversal) null)"])
-
- tlr = Translator().of('g')
-
- for t in range(len(tests)):
- a = tlr.translate(tests[t][0].bytecode)
- assert a == tests[t][1]
-
- def test_target_language(self):
- tlr = Translator().of('g')
- assert tlr.get_target_language() == 'gremlin-groovy'
-
- def test_constructor(self):
- tlr = Translator().of('g')
- g = traversal().with_(None)
- assert tlr.translate(g.V().bytecode) == "g.V()"
-
- def test_source_name(self):
- tlr = Translator().of('g')
- assert tlr.get_traversal_source() == 'g'
diff --git a/gremlin-python/src/main/python/tests/process/test_traversal.py
b/gremlin-python/src/main/python/tests/process/test_traversal.py
index d30f0683c4..a87f465e00 100644
--- a/gremlin-python/src/main/python/tests/process/test_traversal.py
+++ b/gremlin-python/src/main/python/tests/process/test_traversal.py
@@ -85,10 +85,10 @@ class TestTraversal(object):
def test_enforce_anonymous_child_traversal(self):
g = traversal().with_(None)
- g.V(0).addE("self").to(__.V(1))
+ g.V(0).add_e("self").to(__.V(1))
try:
- g.V(0).addE("self").to(g.V(1))
+ g.V(0).add_e("self").to(g.V(1))
assert False
except TypeError:
pass
@@ -367,7 +367,7 @@ def create_connection_to_gtx():
def add_node_validate_transaction_state(g, g_add_to, g_start_count,
g_add_to_start_count, tx_verify_list):
# Add a single node to g_add_to, but not g.
# Check that vertex count in g is g_start_count and vertex count in
g_add_to is g_add_to_start_count + 1.
- g_add_to.addV("person").property("name", "lyndon").iterate()
+ g_add_to.add_v("person").property("name", "lyndon").iterate()
assert g_add_to.V().count().next() == g_add_to_start_count + 1
assert g.V().count().next() == g_start_count
verify_tx_state(tx_verify_list, True)
@@ -387,7 +387,7 @@ def verify_gtx_closed(gtx):
try:
# Attempt to add an additional vertex to the transaction. This should
throw an exception since it
# has been rolled back.
- gtx().addV("failure").iterate()
+ gtx().add_v("failure").iterate()
assert False
except Exception as e:
pass
diff --git
a/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py
b/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py
index 7c0be29c1d..8ca18f1652 100644
--- a/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py
+++ b/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py
@@ -20,6 +20,7 @@ under the License.
import datetime
import uuid
+import pytest
from gremlin_python.driver.serializer import GraphBinarySerializersV4
from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.statics import *
@@ -80,14 +81,15 @@ def test_vertex_vertex_properties(remote_connection_crew):
assert vertex.properties[1].properties[1].value == 2000
[email protected](reason="proposing to be removed in GraphBinaryV4")
def test_timestamp(remote_connection):
g = traversal().with_(remote_connection)
ts = timestamp(1481750076295 / 1000)
- resp = g.addV('test_vertex').property('ts', ts)
- resp = resp.toList()
+ resp = g.add_v('test_vertex').property('ts', ts)
+ resp = resp.to_list()
vid = resp[0].id
try:
- ts_prop = g.V(vid).properties('ts').toList()[0]
+ ts_prop = g.V(vid).properties('ts').to_list()[0]
assert isinstance(ts_prop.value, timestamp)
assert ts_prop.value == ts
finally:
@@ -97,10 +99,10 @@ def test_timestamp(remote_connection):
def test_datetime(remote_connection):
g = traversal().with_(remote_connection)
dt = datetime.datetime.utcfromtimestamp(1481750076295 / 1000)
- resp = g.addV('test_vertex').property('dt', dt).toList()
+ resp = g.add_v('test_vertex').property('dt', dt).to_list()
vid = resp[0].id
try:
- dt_prop = g.V(vid).properties('dt').toList()[0]
+ dt_prop = g.V(vid).properties('dt').to_list()[0]
assert isinstance(dt_prop.value, datetime.datetime)
assert dt_prop.value == dt
finally:
@@ -110,10 +112,10 @@ def test_datetime(remote_connection):
def test_uuid(remote_connection):
g = traversal().with_(remote_connection)
uid = uuid.UUID("41d2e28a-20a4-4ab0-b379-d810dede3786")
- resp = g.addV('test_vertex').property('uuid', uid).toList()
+ resp = g.add_v('test_vertex').property('uuid', uid).to_list()
vid = resp[0].id
try:
- uid_prop = g.V(vid).properties('uuid').toList()[0]
+ uid_prop = g.V(vid).properties('uuid').to_list()[0]
assert isinstance(uid_prop.value, uuid.UUID)
assert uid_prop.value == uid
finally:
@@ -126,12 +128,12 @@ def test_short(remote_connection):
g = traversal().with_(remote_connection)
num = short(1111)
- resp = g.addV('test_vertex').property('short', num).toList()
+ resp = g.with_('language',
'gremlin-lang').add_v('test_vertex').property('short', num).to_list()
vid = resp[0].id
try:
- bigint_prop = g.V(vid).properties('short').toList()[0]
- assert isinstance(bigint_prop.value, int)
- assert bigint_prop.value == num
+ short_prop = g.with_('language',
'gremlin-lang').V(vid).properties('short').to_list()[0]
+ assert isinstance(short_prop.value, int)
+ assert short_prop.value == num
finally:
g.V(vid).drop().iterate()
@@ -142,10 +144,10 @@ def test_bigint_positive(remote_connection):
g = traversal().with_(remote_connection)
big = bigint(0x1000_0000_0000_0000_0000)
- resp = g.addV('test_vertex').property('bigint', big).toList()
+ resp = g.with_('language',
'gremlin-lang').add_v('test_vertex').property('bigint', big).to_list()
vid = resp[0].id
try:
- bigint_prop = g.V(vid).properties('bigint').toList()[0]
+ bigint_prop = g.with_('language',
'gremlin-lang').V(vid).properties('bigint').to_list()[0]
assert isinstance(bigint_prop.value, int)
assert bigint_prop.value == big
finally:
@@ -158,26 +160,27 @@ def test_bigint_negative(remote_connection):
g = traversal().with_(remote_connection)
big = bigint(-0x1000_0000_0000_0000_0000)
- resp = g.addV('test_vertex').property('bigint', big).toList()
+ resp = g.with_('language',
'gremlin-lang').add_v('test_vertex').property('bigint', big).to_list()
vid = resp[0].id
try:
- bigint_prop = g.V(vid).properties('bigint').toList()[0]
+ bigint_prop = g.with_('language',
'gremlin-lang').V(vid).properties('bigint').to_list()[0]
assert isinstance(bigint_prop.value, int)
assert bigint_prop.value == big
finally:
g.V(vid).drop().iterate()
[email protected](reason="BigDecimal implementation needs revisiting")
def test_bigdecimal(remote_connection):
if not isinstance(remote_connection._client._message_serializer,
GraphBinarySerializersV4):
return
g = traversal().with_(remote_connection)
- bigdecimal = BigDecimal(101, 235)
- resp = g.addV('test_vertex').property('bigdecimal', bigdecimal).toList()
+ bigdecimal = BigDecimal(10, 235)
+ resp = g.with_('language',
'gremlin-lang').add_v('test_vertex').property('bigdecimal',
bigdecimal).to_list()
vid = resp[0].id
try:
- bigdecimal_prop = g.V(vid).properties('bigdecimal').toList()[0]
+ bigdecimal_prop = g.with_('language',
'gremlin-lang').V(vid).properties('bigdecimal').next()
assert isinstance(bigdecimal_prop.value, BigDecimal)
assert bigdecimal_prop.value.scale == bigdecimal.scale
assert bigdecimal_prop.value.unscaled_value ==
bigdecimal.unscaled_value
@@ -188,28 +191,28 @@ def test_bigdecimal(remote_connection):
def test_odd_bits(remote_connection):
g = traversal().with_(remote_connection)
char_lower = str.__new__(SingleChar, chr(78))
- resp = g.addV('test_vertex').property('char_lower', char_lower).toList()
+ resp = g.add_v('test_vertex').property('char_lower', char_lower).to_list()
vid = resp[0].id
try:
- v = g.V(vid).values('char_lower').toList()[0]
+ v = g.V(vid).values('char_lower').to_list()[0]
assert v == char_lower
finally:
g.V(vid).drop().iterate()
char_upper = str.__new__(SingleChar, chr(57344))
- resp = g.addV('test_vertex').property('char_upper', char_upper).toList()
+ resp = g.add_v('test_vertex').property('char_upper', char_upper).to_list()
vid = resp[0].id
try:
- v = g.V(vid).values('char_upper').toList()[0]
+ v = g.V(vid).values('char_upper').to_list()[0]
assert v == char_upper
finally:
g.V(vid).drop().iterate()
dur = datetime.timedelta(seconds=1000, microseconds=1000)
- resp = g.addV('test_vertex').property('dur', dur).toList()
+ resp = g.add_v('test_vertex').property('dur', dur).to_list()
vid = resp[0].id
try:
- v = g.V(vid).values('dur').toList()[0]
+ v = g.V(vid).values('dur').to_list()[0]
assert v == dur
finally:
g.V(vid).drop().iterate()
diff --git
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeEdge.feature
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeEdge.feature
index 79878717fa..1c82d000e8 100644
---
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeEdge.feature
+++
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeEdge.feature
@@ -145,6 +145,7 @@ Feature: Step - mergeE()
And the graph should return 0 for count of "g.E().properties()"
And the graph should return 1 for count of "g.V()"
+ @GremlinLangScriptOnly
Scenario: g_V_mergeEXlabel_selfX_optionXonMatch_nullX
Given the empty graph
And the graph initializer of
@@ -163,6 +164,7 @@ Feature: Step - mergeE()
And the graph should return 0 for count of "g.E().properties()"
And the graph should return 1 for count of "g.V()"
+ @GremlinLangScriptOnly
Scenario: g_V_mergeEXemptyX_optionXonCreate_nullX
Given the empty graph
And the graph initializer of
@@ -225,6 +227,7 @@ Feature: Step - mergeE()
And the graph should return 2 for count of "g.E()"
And the graph should return 2 for count of "g.V()"
+ @GremlinLangScriptOnly
Scenario: g_mergeEXnullX
Given the empty graph
And the graph initializer of
@@ -239,6 +242,7 @@ Feature: Step - mergeE()
Then the traversal will raise an error with message containing text of
"Out Vertex not specified"
# Directions not specified
+ @GremlinLangScriptOnly
Scenario: g_V_mergeEXnullX
Given the empty graph
And the graph initializer of
diff --git
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeVertex.feature
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeVertex.feature
index 4d678ea1af..5cd3670e86 100644
---
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeVertex.feature
+++
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeVertex.feature
@@ -102,6 +102,7 @@ Feature: Step - mergeV()
# - mergeV() that has a match to a vertex with multiproperties
# - results in all multiproperties removed to be replaced with one property
+ @GremlinLangScriptOnly
Scenario: g_mergeVXemptyX_optionXonMatch_nullX
Given the empty graph
And the graph initializer of
@@ -116,6 +117,7 @@ Feature: Step - mergeV()
Then the result should have a count of 1
And the graph should return 1 for count of
"g.V().has(\"person\",\"name\",\"marko\").has(\"age\",29)"
+ @GremlinLangScriptOnly
Scenario: g_V_mergeVXemptyX_optionXonMatch_nullX
Given the empty graph
And the graph initializer of
@@ -158,6 +160,7 @@ Feature: Step - mergeV()
When iterated to list
Then the traversal will raise an error
+ @GremlinLangScriptOnly
Scenario: g_mergeVXlabel_person_name_stephenX_optionXonCreate_nullX
Given the empty graph
And the graph initializer of
@@ -175,6 +178,7 @@ Feature: Step - mergeV()
And the graph should return 1 for count of
"g.V().has(\"person\",\"name\",\"marko\")"
And the graph should return 1 for count of
"g.V().has(\"person\",\"name\",\"stephen\")"
+ @GremlinLangScriptOnly
Scenario: g_V_mergeVXlabel_person_name_stephenX_optionXonCreate_nullX
Given the empty graph
And the graph initializer of
@@ -192,6 +196,7 @@ Feature: Step - mergeV()
And the graph should return 1 for count of
"g.V().has(\"person\",\"name\",\"marko\")"
And the graph should return 1 for count of
"g.V().has(\"person\",\"name\",\"stephen\")"
+ @GremlinLangScriptOnly
Scenario: g_mergeVXnullX_optionXonCreate_emptyX
Given the empty graph
And the graph initializer of
@@ -206,6 +211,7 @@ Feature: Step - mergeV()
Then the result should have a count of 1
And the graph should return 1 for count of "g.V()"
+ @GremlinLangScriptOnly
Scenario: g_V_mergeVXnullX_optionXonCreate_emptyX
Given the empty graph
And the graph initializer of
@@ -271,6 +277,7 @@ Feature: Step - mergeV()
And the graph should return 1 for count of
"g.V().has(\"person\",\"name\",\"marko\").has(\"age\",29)"
And the graph should return 1 for count of
"g.V().has(\"person\",\"name\",\"vadas\").has(\"age\",27)"
+ @GremlinLangScriptOnly
Scenario: g_mergeVXnullX
Given the empty graph
And the graph initializer of
@@ -285,6 +292,7 @@ Feature: Step - mergeV()
Then the result should have a count of 1
And the graph should return 1 for count of "g.V()"
+ @GremlinLangScriptOnly
Scenario: g_V_mergeVXnullX
Given the empty graph
And the graph initializer of
diff --git
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Comparability.feature
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Comparability.feature
index ed44775b77..f687311d29 100644
---
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Comparability.feature
+++
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Comparability.feature
@@ -865,7 +865,7 @@ Feature: Comparability
## Infinity vs. Infinity
######################################################
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXInfX_eqXInfX
Given the empty graph
And the traversal of
@@ -877,7 +877,7 @@ Feature: Comparability
| result |
| d[Infinity] |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXInfArgX_eqXInfX
Given the empty graph
And using the parameter xx1 defined as "d[Infinity]"
@@ -890,7 +890,7 @@ Feature: Comparability
| result |
| d[Infinity] |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXInfX_neqXInfX
Given the empty graph
And the traversal of
@@ -900,7 +900,7 @@ Feature: Comparability
When iterated to list
Then the result should be empty
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXInfArgX_neqXInfX
Given the empty graph
And using the parameter xx1 defined as "d[Infinity]"
@@ -911,7 +911,7 @@ Feature: Comparability
When iterated to list
Then the result should be empty
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXNegInfX_eqXNegInfX
Given the empty graph
And the traversal of
@@ -923,7 +923,7 @@ Feature: Comparability
| result |
| d[-Infinity] |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXNegInfArgX_eqXNegInfX
Given the empty graph
And using the parameter xx1 defined as "d[-Infinity]"
@@ -936,7 +936,7 @@ Feature: Comparability
| result |
| d[-Infinity] |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXNegInfX_neqXNegInfX
Given the empty graph
And the traversal of
@@ -946,7 +946,7 @@ Feature: Comparability
When iterated to list
Then the result should be empty
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXNegInfArgX_neqXNegInfX
Given the empty graph
And using the parameter xx1 defined as "d[-Infinity]"
@@ -957,7 +957,7 @@ Feature: Comparability
When iterated to list
Then the result should be empty
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXInfX_gtXNegInfX
Given the empty graph
And the traversal of
@@ -969,7 +969,7 @@ Feature: Comparability
| result |
| d[Infinity] |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXInfX_ltXNegInfX
Given the empty graph
And the traversal of
@@ -979,7 +979,7 @@ Feature: Comparability
When iterated to list
Then the result should be empty
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXNegInfX_ltXInfX
Given the empty graph
And the traversal of
@@ -991,7 +991,7 @@ Feature: Comparability
| result |
| d[-Infinity] |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: InjectXNegInfX_gtXInfX
Given the empty graph
And the traversal of
diff --git
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Equality.feature
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Equality.feature
index 58a1439266..a7eee482a6 100644
---
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Equality.feature
+++
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Equality.feature
@@ -102,7 +102,7 @@ Feature: Equality
| d[1].m |
| d[1].b |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: Primitives_Number_eqXbigintX
Given the empty graph
And using the parameter xx1 defined as
"l[d[1].b,d[1].s,d[1].i,d[1].l,d[1].f,d[1].d,d[1000].i,d[1].m,d[1].n]"
@@ -165,7 +165,7 @@ Feature: Equality
| d[1].m |
| d[1].b |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: Primitives_Number_eqXbigdecimalX
Given the empty graph
And using the parameter xx1 defined as
"l[d[1].b,d[1].s,d[1].i,d[1].l,d[1].f,d[1].d,d[1000].i,d[1].m,d[1].n]"
diff --git
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Orderability.feature
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Orderability.feature
index 2d86759aba..025ad8c30b 100644
---
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Orderability.feature
+++
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/semantics/Orderability.feature
@@ -118,7 +118,7 @@ Feature: Orderability
| d[0.4].d |
| d[0.2].d |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: g_inject_order
Given the empty graph
And using the parameter xx1 defined as "null"
@@ -161,7 +161,7 @@ Feature: Orderability
| m[{"a":"a", "b":false, "c":"c"}] |
| m[{"a":"a", "b":"b"}] |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: g_inject_order_byXdescX
Given the empty graph
And using the parameter xx1 defined as "null"
diff --git
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Aggregate.feature
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Aggregate.feature
index 5729709a89..2caef1840f 100644
---
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Aggregate.feature
+++
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Aggregate.feature
@@ -172,6 +172,7 @@ Feature: Step - aggregate()
| lop |
| josh |
+ @GremlinLangScriptOnly
Scenario: g_withSideEffectXa_setX_V_both_name_aggregateXlocal_aX_capXaX
Given the modern graph
And using the parameter xx1 defined as "s[]"
@@ -184,6 +185,7 @@ Feature: Step - aggregate()
| result |
| s[marko,vadas,lop,josh,ripple,peter] |
+ @GremlinLangScriptOnly
Scenario:
g_withSideEffectXa_set_inlineX_V_both_name_aggregateXlocal_aX_capXaX
Given the modern graph
And the traversal of
diff --git
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Inject.feature
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Inject.feature
index 762f9cff5d..e0ee920bef 100644
---
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Inject.feature
+++
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Inject.feature
@@ -112,7 +112,7 @@ Feature: Step - inject()
| result |
| m[{"name":"marko", "age":null}] |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: g_injectXnull_nullX
Given the modern graph
And the traversal of
@@ -147,7 +147,7 @@ Feature: Step - inject()
When iterated to list
Then the result should be empty
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: g_VX1X_valuesXageX_injectXnull_nullX
Given the modern graph
And using the parameter xx1 defined as "v[marko].id"
@@ -231,7 +231,7 @@ Feature: Step - inject()
| result |
| l[d[1].i,d[3].i,d[100].i,d[300].i] |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: g_injectX1_3_100_300X_set
Given the modern graph
And the traversal of
@@ -243,7 +243,7 @@ Feature: Step - inject()
| result |
| s[d[100].i,d[300].i,d[1].i,d[3].i] |
- @GraphComputerVerificationInjectionNotSupported
+ @GraphComputerVerificationInjectionNotSupported @GremlinLangScriptOnly
Scenario: g_injectX1_1X_set
Given the modern graph
And the traversal of
diff --git
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Store.feature
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Store.feature
index 00961ba703..892f5ec3c7 100644
---
a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Store.feature
+++
b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Store.feature
@@ -49,6 +49,7 @@ Feature: Step - store()
| lop |
| josh |
+ @GremlinLangScriptOnly
Scenario: g_withSideEffectXa_setX_V_both_name_storeXaX_capXaX
Given the modern graph
And using the parameter xx1 defined as "s[]"
@@ -61,6 +62,7 @@ Feature: Step - store()
| result |
| s[marko,vadas,lop,josh,ripple,peter] |
+ @GremlinLangScriptOnly
Scenario: g_withSideEffectXa_set_inlineX_V_both_name_storeXaX_capXaX
Given the modern graph
And the traversal of