summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2017-08-14 12:55:58 -0400
committerGitHub <noreply@github.com>2017-08-14 12:55:58 -0400
commitfbd1e46864b3734744ef2aa7bc3ddb93ed91075b (patch)
tree6b5c77ed757d8764372cac5799336d5cde5a5b84
parent8a186ebd9cecf466624803bdf215030158c7c776 (diff)
parent61a439793bc8c2f416628c45db128f4d25d25b0c (diff)
downloadredis-py-fbd1e46864b3734744ef2aa7bc3ddb93ed91075b.tar.gz
Merge pull request #888 from categulario/bugfix/geopos-empty-pos
fix problem when using geopos on unexistent hash member
-rwxr-xr-xredis/client.py3
-rw-r--r--tests/test_commands.py4
2 files changed, 6 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py
index cf17201..d852998 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -448,7 +448,8 @@ class StrictRedis(object):
'CLUSTER SETSLOT': bool_ok,
'CLUSTER SLAVES': parse_cluster_nodes,
'GEOPOS': lambda r: list(map(lambda ll: (float(ll[0]),
- float(ll[1])), r)),
+ float(ll[1]))
+ if ll is not None else None, r)),
'GEOHASH': lambda r: list(map(nativestr, r)),
'GEORADIUS': parse_georadius_generic,
'GEORADIUSBYMEMBER': parse_georadius_generic,
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 3eaa046..8b64c8a 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -1460,6 +1460,10 @@ class TestRedisCommands(object):
(2.18737632036209106, 41.40634178640635099)]
@skip_if_server_version_lt('3.2.0')
+ def test_geopos_no_value(self, r):
+ assert r.geopos('barcelona', 'place1', 'place2') == [None, None]
+
+ @skip_if_server_version_lt('3.2.0')
def test_georadius(self, r):
values = (2.1909389952632, 41.433791470673, 'place1') +\
(2.1873744593677, 41.406342043777, 'place2')