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

Branch: refs/heads/TINKERPOP-1857
Commit: 2ee639bc14f80bcadd806385d6e11983609f763f
Parents: 155e399
Author: Stephen Mallette <[email protected]>
Authored: Thu Dec 28 16:42:30 2017 -0500
Committer: Stephen Mallette <[email protected]>
Committed: Wed Jan 24 09:46:06 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/2ee639bc/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