<commit_before>from __future__ import absolute_import, unicode_literals

import pytest

from case import Mock

from kombu import Connection, Consumer, Exchange, Producer, Queue
from kombu.five import text_t
from kombu.message import Message
from kombu.transport.base import (
    StdChannel, Transport, Management, to_rabbitmq_queue_arguments,
)


@pytest.mark.parametrize('args,input,expected', [
    ({}, {'message_ttl': 20}, {'x-message-ttl': 20000}),
    ({}, {'message_ttl': None}, {}),
    ({'foo': 'bar'}, {'expires': 30.3}, {'x-expires': 30300, 'foo': 'bar'}),
    ({'x-expires': 3}, {'expires': 4}, {'x-expires': 4000}),
    ({}, {'max_length': 10}, {'x-max-length': 10}),
    ({}, {'max_length_bytes': 1033}, {'x-max-length-bytes': 1033}),
    ({}, {'max_priority': 303}, {'x-max-priority': 303}),
])
def test_rabbitmq_queue_arguments(args, input, expected):
    assert to_rabbitmq_queue_arguments(args, **input) == expected


class test_StdChannel:

    def setup(self):
        self.conn = Connection('memory://')
        self.channel = self.conn.channel()
        self.channel.queues.clear()
        self.conn.connection.state.clear()

    def test_Consumer(self):
        q = Queue('foo', Exchange('foo'))
        print(self.channel.queues)
        cons = self.channel.Consumer(q)
        assert isinstance(cons, Consumer)
        assert cons.channel is self.channel

    def test_Producer(self):
        prod = self.channel.Producer()
        assert isinstance(prod, Producer)<commit_msg>Remove print from tests; looks like it was left in from debugging (#719)<commit_after>from __future__ import absolute_import, unicode_literals

import pytest

from case import Mock

from kombu import Connection, Consumer, Exchange, Producer, Queue
from kombu.five import text_t
from kombu.message import Message
from kombu.transport.base import (
    StdChannel, Transport, Management, to_rabbitmq_queue_arguments,
)


@pytest.mark.parametrize('args,input,expected', [
    ({}, {'message_ttl': 20}, {'x-message-ttl': 20000}),
    ({}, {'message_ttl': None}, {}),
    ({'foo': 'bar'}, {'expires': 30.3}, {'x-expires': 30300, 'foo': 'bar'}),
    ({'x-expires': 3}, {'expires': 4}, {'x-expires': 4000}),
    ({}, {'max_length': 10}, {'x-max-length': 10}),
    ({}, {'max_length_bytes': 1033}, {'x-max-length-bytes': 1033}),
    ({}, {'max_priority': 303}, {'x-max-priority': 303}),
])
def test_rabbitmq_queue_arguments(args, input, expected):
    assert to_rabbitmq_queue_arguments(args, **input) == expected


class test_StdChannel:

    def setup(self):
        self.conn = Connection('memory://')
        self.channel = self.conn.channel()
        self.channel.queues.clear()
        self.conn.connection.state.clear()

    def test_Consumer(self):
        q = Queue('foo', Exchange('foo'))
        cons = self.channel.Consumer(q)
        assert isinstance(cons, Consumer)
        assert cons.channel is self.channel

    def test_Producer(self):
        prod = self.channel.Producer()
        assert isinstance(prod, Producer)
{'fraction_non_alphanumeric': 0.166996699669967, 'fraction_numerical': 0.026732673267326732, 'mean_word_length': 3.9045307443365695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5154651', 'n_tokens_mistral': 1053, 'n_tokens_neox': 959, 'n_words': 224}