@inlineCallbacks
    def test_delete_ifunused(self):
        channel = self.channel

        #create a queue and register a consumer:
        yield channel.queue_declare(queue="delete-me-3")
        yield channel.queue_declare(queue="delete-me-3", passive="True")
        reply = yield channel.basic_consume(queue="delete-me-3", no_ack=True)

        #need new channel now:    
        channel2 = yield self.client.channel(2)
        yield channel2.channel_open()
        #try to delete, but only if empty:
        try:
            yield channel2.queue_delete(queue="delete-me-3", if_unused="True")
            self.fail("Expected delete if_unused to fail for queue with existing consumer")
        except Closed, e:
            self.assertChannelException(406, e.args[0])


        yield channel.basic_cancel(consumer_tag=reply.consumer_tag)    
        yield channel.queue_delete(queue="delete-me-3", if_unused="True")
        #check that it has gone by declaring passively:
        try:
            yield channel.queue_declare(queue="delete-me-3", passive="True")
            self.fail("Queue has not been deleted")
        except Closed, e:
            self.assertChannelException(404, e.args[0])
Test that if_unused field of queue_delete is honoured
dataset/ETHPy150Open williamsjj/txamqp/src/txamqp/test/test_queue.py/QueueTests.test_delete_ifunused