Skip to content

Commit

Permalink
Merge pull request #888 from categulario/bugfix/geopos-empty-pos
Browse files Browse the repository at this point in the history
fix problem when using geopos on unexistent hash member
  • Loading branch information
andymccurdy committed Aug 14, 2017
2 parents 8a186eb + 61a4397 commit fbd1e46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,10 @@ def test_geopos(self, r):
[(2.19093829393386841, 41.43379028184083523),
(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') +\
Expand Down

0 comments on commit fbd1e46

Please sign in to comment.