diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2019-01-27 11:02:43 -0800 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2019-01-27 11:02:43 -0800 |
commit | 6cea5260b6138b91233008f7e690f1eec2b7988e (patch) | |
tree | 5d4fca76f83b9cfbb98d225ea71a4fc2e6aafcb1 | |
parent | dde0a48b670bd5bfc43eb8eb814d2a0cb9162b88 (diff) | |
download | redis-py-6cea5260b6138b91233008f7e690f1eec2b7988e.tar.gz |
Added a test for #1126
-rw-r--r-- | CHANGES | 2 | ||||
-rwxr-xr-x | redis/client.py | 4 | ||||
-rw-r--r-- | tests/test_commands.py | 4 |
3 files changed, 6 insertions, 4 deletions
@@ -1,4 +1,6 @@ * 3.1.0 (in development) + * Fixed GEOHASH to return a None value when specifying a place that + doesn't exist on the server. Thanks @guybe7. #1126 * Fixed XREADGROUP to return an empty dictionary for messages that have been deleted but still exist in the unacknowledged queue. Thanks @xeizmendi. #1116 diff --git a/redis/client.py b/redis/client.py index 1e7dfc4..94b1baa 100755 --- a/redis/client.py +++ b/redis/client.py @@ -246,7 +246,7 @@ def int_or_none(response): return int(response) -def string_or_none(response): +def nativestr_or_none(response): if response is None: return None return nativestr(response) @@ -516,7 +516,7 @@ class Redis(object): 'CONFIG RESETSTAT': bool_ok, 'CONFIG SET': bool_ok, 'DEBUG OBJECT': parse_debug_object, - 'GEOHASH': lambda r: list(map(string_or_none, r)), + 'GEOHASH': lambda r: list(map(nativestr_or_none, r)), 'GEOPOS': lambda r: list(map(lambda ll: (float(ll[0]), float(ll[1])) if ll is not None else None, r)), diff --git a/tests/test_commands.py b/tests/test_commands.py index db7f4ad..0c9430d 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1686,8 +1686,8 @@ class TestRedisCommands(object): (2.1873744593677, 41.406342043777, 'place2') r.geoadd('barcelona', *values) - assert r.geohash('barcelona', 'place1', 'place2') ==\ - ['sp3e9yg3kd0', 'sp3e9cbc3t0'] + assert r.geohash('barcelona', 'place1', 'place2', 'place3') ==\ + ['sp3e9yg3kd0', 'sp3e9cbc3t0', None] @skip_if_server_version_lt('3.2.0') def test_geopos(self, r): |