diff --git a/coolamqp/objects.py b/coolamqp/objects.py index 837ac4f270ba6817b6ad53cc51f365fca4c4cd41..1c71e39b906981e7e4856983f534adc402fa73f0 100644 --- a/coolamqp/objects.py +++ b/coolamqp/objects.py @@ -128,7 +128,7 @@ class Exchange(object): 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 - :param type: exchange type. Please pass a binary type. + :param type: exchange type. binary/unicode """ if isinstance(name, six.binary_type): @@ -136,10 +136,7 @@ class Exchange(object): self.name = name - if isinstance(type, six.text_type): - type = type.encode('utf8') - warnings.warn(u'type should be a binary type') - self.type = type # must be bytes + self.type = type.encode('utf8') if isinstance(type, six.text_type) else type # must be bytes self.durable = durable self.auto_delete = auto_delete diff --git a/tests/test_clustering/test_things.py b/tests/test_clustering/test_things.py index 03526836cfda4a10b8c42cdfecc06c508b46ba95..3db360cbc7d77678e6a62262edd3b33cf554c815 100644 --- a/tests/test_clustering/test_things.py +++ b/tests/test_clustering/test_things.py @@ -24,12 +24,6 @@ class TestConnecting(unittest.TestCase): c = Cluster([NODE]) 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): q1 = Queue(u'lolwut') q2 = Queue(b'lolwut')