From d368329a956bce15652509ec086d9864dc1f30ef Mon Sep 17 00:00:00 2001 From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl> Date: Sun, 5 Feb 2017 06:30:35 +0100 Subject: [PATCH] fix by code deletion --- coolamqp/objects.py | 7 ++----- tests/test_clustering/test_things.py | 6 ------ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/coolamqp/objects.py b/coolamqp/objects.py index 837ac4f..1c71e39 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 0352683..3db360c 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') -- GitLab