Permalink
Browse files

ResponseError.__init__ default values for cmd_line is None

  • Loading branch information...
1 parent 1605c75 commit 57f81034eb4817357117efb2909ea09feb90944c @evilkost committed Apr 14, 2011
Showing with 11 additions and 3 deletions.
  1. +2 −2 brukva/client.py
  2. +4 −1 brukva/exceptions.py
  3. +5 −0 tests/server_commands.py
View
@@ -424,7 +424,7 @@ def consume_bulk(self, length, callback):
if isinstance(data, Exception):
raise data
if not data:
- raise ResponseError('EmptyResponse', None)
+ raise ResponseError('EmptyResponse')
else:
data = data[:-2]
callback(data)
@@ -890,7 +890,7 @@ def execute(self, callbacks):
while len(responses) < total:
data = yield async(self.connection.readline)()
if not data:
- raise ResponseError('Not enough data after EXEC', None)
+ raise ResponseError('Not enough data after EXEC')
try:
cmd_line = cmds.next()
View
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
class RedisError(Exception):
pass
@@ -7,7 +10,7 @@ class ConnectionError(RedisError):
class ResponseError(RedisError):
- def __init__(self, message, cmd_line):
+ def __init__(self, message, cmd_line=None):
self.message = message
self.cmd_line = cmd_line
View
@@ -661,6 +661,11 @@ def test_pipe_hsets2(self):
])
self.start()
+ def test_response_error(self):
+ self.client.set('foo', 'bar', self.expect(True))
+ self.client.llen('foo', [self.expect(ResponseError), self.finish])
+ self.start()
+
class PubSubTestCase(TornadoTestCase):
def setUp(self, *args, **kwargs):
super(PubSubTestCase, self).setUp(*args, **kwargs)

0 comments on commit 57f8103

Please sign in to comment.