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/20b10c44
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/20b10c44
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/20b10c44

Branch: refs/heads/tp32
Commit: 20b10c445b84fc775487d8b288208a4b7b8df252
Parents: e74747d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Dec 28 16:42:30 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Feb 14 15:34:09 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/20b10c44/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

Reply via email to