You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2018/02/01 15:30:50 UTC
[39/50] [abbrv] tinkerpop git commit: TINKERPOP-1857 Added support
for empty lists and sets in python GLV test runner
TINKERPOP-1857 Added support for empty lists and sets in python GLV test runner
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/6cf359d8
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/6cf359d8
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/6cf359d8
Branch: refs/heads/TINKERPOP-1857
Commit: 6cf359d83f28ff1a77989ce3954c435c77cd04a1
Parents: a050b65
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 28 16:42:30 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Feb 1 08:14:57 2018 -0500
----------------------------------------------------------------------
gremlin-python/src/main/jython/radish/feature_steps.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6cf359d8/gremlin-python/src/main/jython/radish/feature_steps.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/feature_steps.py b/gremlin-python/src/main/jython/radish/feature_steps.py
index b61d5e0..c0574d0 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -154,9 +154,9 @@ def _convert(val, ctx):
elif isinstance(val, unicode): # convert annoying python 2.x unicode nonsense
return _convert(val.encode('utf-8'), ctx)
elif isinstance(val, str) and re.match("^l\[.*\]$", val): # parse list
- return list(map((lambda x: _convert(x, ctx)), val[2:-1].split(",")))
+ return [] if val == "l[]" else list(map((lambda x: _convert(x, ctx)), val[2:-1].split(",")))
elif isinstance(val, str) and re.match("^s\[.*\]$", val): # parse set
- return set(map((lambda x: _convert(x, ctx)), val[2:-1].split(",")))
+ return set() if val == "s[]" else set(map((lambda x: _convert(x, ctx)), val[2:-1].split(",")))
elif isinstance(val, str) and re.match("^d\[.*\]\.[ilfdm]$", val): # parse numeric
return float(val[2:-3]) if val[2:-3].__contains__(".") else long(val[2:-3])
elif isinstance(val, str) and re.match("^v\[.*\]\.id$", val): # parse vertex id