diff options
author | andymccurdy <andy@andymccurdy.com> | 2010-02-19 00:18:35 -0800 |
---|---|---|
committer | andymccurdy <andy@andymccurdy.com> | 2010-02-19 00:18:35 -0800 |
commit | 5f59153a94ed77157747feb2214b82515bf4ca04 (patch) | |
tree | 8b53ab281229aa4e452dfaae2c0b0b6bfe8ec304 /tests/server_commands.py | |
parent | 88cf4942c78ea1a08bdcffb4f902a682efd7b7f7 (diff) | |
download | redis-py-5f59153a94ed77157747feb2214b82515bf4ca04.tar.gz |
zrange/zrevrange/zrangebyscore should always return None if the key is insvalid, even if withscores=True is passed
Diffstat (limited to 'tests/server_commands.py')
-rw-r--r-- | tests/server_commands.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/server_commands.py b/tests/server_commands.py index 434cc4f..ecd8823 100644 --- a/tests/server_commands.py +++ b/tests/server_commands.py @@ -569,6 +569,9 @@ class ServerCommandsTestCase(unittest.TestCase): [('a1', 1.0), ('a2', 2.0)]) self.assertEquals(self.client.zrange('a', 1, 2, withscores=True), [('a2', 2.0), ('a3', 3.0)]) + # a non existant key should return an empty list + self.assertEquals(self.client.zrange('b', 0, 1, withscores=True), None) + def test_zrangebyscore(self): # key is not a zset @@ -584,6 +587,8 @@ class ServerCommandsTestCase(unittest.TestCase): ['a3', 'a4']) self.assertEquals(self.client.zrangebyscore('a', 2, 4, withscores=True), [('a2', 2.0), ('a3', 3.0), ('a4', 4.0)]) + # a non existant key should return an empty list + self.assertEquals(self.client.zrangebyscore('b', 0, 1, withscores=True), None) def test_zrem(self): # key is not a zset @@ -624,6 +629,9 @@ class ServerCommandsTestCase(unittest.TestCase): [('a3', 3.0), ('a2', 2.0)]) self.assertEquals(self.client.zrevrange('a', 1, 2, withscores=True), [('a2', 2.0), ('a1', 1.0)]) + # a non existant key should return None + self.assertEquals(self.client.zrange('b', 0, 1, withscores=True), None) + def test_zscore(self): # key is not a zset |