diff options
author | andy <andy@whiskeymedia.com> | 2013-05-23 10:35:45 -0400 |
---|---|---|
committer | andy <andy@whiskeymedia.com> | 2013-05-23 10:35:45 -0400 |
commit | b51f22d5b72d33eea4026a4cb0a283d639d8c451 (patch) | |
tree | 4e0529014397e1f986421cad5d5ec733881340a7 /tests/server_commands.py | |
parent | b5214ab814b6c35aa8f880ef61c0719b851e60e0 (diff) | |
download | redis-py-b51f22d5b72d33eea4026a4cb0a283d639d8c451.tar.gz |
use iterators for dict traversal in both python 2 and 3
Diffstat (limited to 'tests/server_commands.py')
-rw-r--r-- | tests/server_commands.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/server_commands.py b/tests/server_commands.py index c4b0fc9..1ae8f80 100644 --- a/tests/server_commands.py +++ b/tests/server_commands.py @@ -4,8 +4,8 @@ import datetime import time import binascii -from redis._compat import (unichr, u, b, ascii_letters, iteritems, dictkeys, - dictvalues) +from redis._compat import (unichr, u, b, ascii_letters, iteritems, iterkeys, + itervalues) from redis.client import parse_info import redis @@ -1522,7 +1522,7 @@ class ServerCommandsTestCase(unittest.TestCase): # real logic h = {b('a1'): b('1'), b('a2'): b('2'), b('a3'): b('3')} self.make_hash('a', h) - keys = dictkeys(h) + keys = list(iterkeys(h)) keys.sort() remote_keys = self.client.hkeys('a') remote_keys.sort() @@ -1551,7 +1551,7 @@ class ServerCommandsTestCase(unittest.TestCase): # real logic h = {b('a1'): b('1'), b('a2'): b('2'), b('a3'): b('3')} self.make_hash('a', h) - vals = dictvalues(h) + vals = list(itervalues(h)) vals.sort() remote_vals = self.client.hvals('a') remote_vals.sort() @@ -1782,10 +1782,10 @@ class ServerCommandsTestCase(unittest.TestCase): # check that KEYS returns all the keys as they are self.assertEqual(sorted(self.client.keys('*')), - sorted(dictkeys(mapping))) + sorted(list(iterkeys(mapping)))) # check that it is possible to get list content by key name - for key in dictkeys(mapping): + for key in iterkeys(mapping): self.assertEqual(self.client.lrange(key, 0, -1), mapping[key]) |