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

fix by code deletion

parent 3cf33ece
No related branches found
No related tags found
No related merge requests found
...@@ -128,7 +128,7 @@ class Exchange(object): ...@@ -128,7 +128,7 @@ class Exchange(object):
def __init__(self, name=u'', type=b'direct', durable=True, auto_delete=False): def __init__(self, name=u'', type=b'direct', durable=True, auto_delete=False):
""" """
:type name: unicode is preferred, binary type will get decoded to unicode with utf8 :type name: unicode is preferred, binary type will get decoded to unicode with utf8
:param type: exchange type. Please pass a binary type. :param type: exchange type. binary/unicode
""" """
if isinstance(name, six.binary_type): if isinstance(name, six.binary_type):
...@@ -136,10 +136,7 @@ class Exchange(object): ...@@ -136,10 +136,7 @@ class Exchange(object):
self.name = name self.name = name
if isinstance(type, six.text_type): self.type = type.encode('utf8') if isinstance(type, six.text_type) else type # must be bytes
type = type.encode('utf8')
warnings.warn(u'type should be a binary type')
self.type = type # must be bytes
self.durable = durable self.durable = durable
self.auto_delete = auto_delete self.auto_delete = auto_delete
......
...@@ -24,12 +24,6 @@ class TestConnecting(unittest.TestCase): ...@@ -24,12 +24,6 @@ class TestConnecting(unittest.TestCase):
c = Cluster([NODE]) c = Cluster([NODE])
self.assertRaises(RuntimeError, lambda: c.shutdown()) self.assertRaises(RuntimeError, lambda: c.shutdown())
def test_exchange_with_unicode_type_warnings(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
Exchange(u'lol', type=u'wtf')
self.assertGreater(len(w), 0)
def test_queues_equal_and_hashable(self): def test_queues_equal_and_hashable(self):
q1 = Queue(u'lolwut') q1 = Queue(u'lolwut')
q2 = Queue(b'lolwut') q2 = Queue(b'lolwut')
......
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