summaryrefslogtreecommitdiff
path: root/tests/server_commands.py
diff options
context:
space:
mode:
authorGustavo Picon <tabo@tabo.pe>2010-03-04 13:32:17 -0500
committerGustavo Picon <tabo@tabo.pe>2010-03-04 13:32:17 -0500
commitc3b3c1bc93849b4c3fc23dc7105984411b20c4d8 (patch)
tree862dffd11814904f17ab7eb6eb18f95da1f5ba82 /tests/server_commands.py
parenta2bfd2f0f83c1129910348111fe856f677401a08 (diff)
downloadredis-py-c3b3c1bc93849b4c3fc23dc7105984411b20c4d8.tar.gz
adding support for the new lpush/rpush returning the list length
Diffstat (limited to 'tests/server_commands.py')
-rw-r--r--tests/server_commands.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/server_commands.py b/tests/server_commands.py
index 2d9c707..a245856 100644
--- a/tests/server_commands.py
+++ b/tests/server_commands.py
@@ -1,6 +1,7 @@
import redis
import unittest
import datetime
+from distutils.version import StrictVersion
class ServerCommandsTestCase(unittest.TestCase):
@@ -237,8 +238,13 @@ class ServerCommandsTestCase(unittest.TestCase):
self.assertRaises(redis.ResponseError, self.client.lpush, 'a', 'a')
del self.client['a']
# real logic
- self.assert_(self.client.lpush('a', 'b'))
- self.assert_(self.client.lpush('a', 'a'))
+ version = self.client.info()['redis_version']
+ if StrictVersion(version) >= StrictVersion('1.3.4'):
+ self.assertEqual(1, self.client.lpush('a', 'b'))
+ self.assertEqual(2, self.client.lpush('a', 'a'))
+ else:
+ self.assert_(self.client.lpush('a', 'b'))
+ self.assert_(self.client.lpush('a', 'a'))
self.assertEquals(self.client.lindex('a', 0), 'a')
self.assertEquals(self.client.lindex('a', 1), 'b')
@@ -715,4 +721,4 @@ class ServerCommandsTestCase(unittest.TestCase):
self.assertEquals(num, 4)
self.assertEquals(self.client.lrange('sorted', 0, 10),
['vodka', 'milk', 'gin', 'apple juice'])
- \ No newline at end of file
+