Skip to content
Snippets Groups Projects
Commit 8e64238e authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

a minor bug

parent 19a2c1e9
No related branches found
No related tags found
No related merge requests found
...@@ -13,9 +13,7 @@ class Message(object): ...@@ -13,9 +13,7 @@ class Message(object):
:type body: str (py2) or bytes (py3) :type body: str (py2) or bytes (py3)
:param properties: AMQP properties to be sent along :param properties: AMQP properties to be sent along
""" """
if not isinstance(body, six.binary_type): self.body = six.binary_type(body)
raise TypeError('Message body must be binary!')
self.body = body
self.properties = {} if properties is None else properties self.properties = {} if properties is None else properties
......
...@@ -45,6 +45,9 @@ class TestBasics(unittest.TestCase): ...@@ -45,6 +45,9 @@ class TestBasics(unittest.TestCase):
def test_send_bullshit(self): def test_send_bullshit(self):
self.assertRaises(TypeError, lambda: Message(u'what the fuck')) self.assertRaises(TypeError, lambda: Message(u'what the fuck'))
def test_send_nonobvious_bullshit(self):
self.assertEquals(Message(bytearray(b'what the fuck')).body, b'what the fuck')
def test_nacknowledge(self): def test_nacknowledge(self):
myq = Queue('myqueue', exclusive=True) myq = Queue('myqueue', exclusive=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment