<commit_before>from mock import patch, call, Mock
import pytest
import six


try:
    from bravado.fido_client import FidoClient
except ImportError:
    FidoClient = Mock()


@pytest.mark.skipif(six.PY3, reason="twisted doesnt support py3 yet")
def test_no_timeouts_passed_to_fido(fetch):
    with patch('bravado.fido_client.fido.fetch') as fetch:
        fido_client = FidoClient()
        request_params = dict(url='http://foo.com/')
        fido_client.request(request_params, response_callback=None)
        assert fetch.call_args == call(
            'http://foo.com/?', body='', headers={}, method='GET')


@pytest.mark.skipif(six.PY3, reason="twisted doesnt support py3 yet")
def test_timeout_passed_to_fido(fetch):
    with patch('bravado.fido_client.fido.fetch') as fetch:
        fido_client = FidoClient()
        request_params = dict(url='http://foo.com/', timeout=1)
        fido_client.request(request_params, response_callback=None)
        assert fetch.call_args == call(
            'http://foo.com/?', body='', headers={}, method='GET', timeout=1)


@pytest.mark.skipif(six.PY3, reason="twisted doesnt support py3 yet")
def test_connect_timeout_passed_to_fido(fetch):
    with patch('bravado.fido_client.fido.fetch') as fetch:
        fido_client = FidoClient()
        request_params = dict(url='http://foo.com/', connect_timeout=1)
        fido_client.request(request_params, response_callback=None)
        assert fetch.call_args == call(
            'http://foo.com/?', body='', headers={}, method='GET',
            connect_timeout=1)


@pytest.mark.skipif(six.PY3, reason="twisted doesnt support py3 yet")
def test_connect_timeout_and_timeout_passed_to_fido(fetch):
    with patch('bravado.fido_client.fido.fetch') as fetch:
        fido_client = FidoClient()
        request_params = dict(url='http://foo.com/', connect_timeout=1,
                              timeout=2)
        fido_client.request(request_params, response_callback=None)
        assert fetch.call_args == call(
            'http://foo.com/?', body='', headers={}, method='GET',
            connect_timeout=1, timeout=2)<commit_msg>py3 compatibility is the pits<commit_after>from mock import patch, call, Mock
import pytest
import six


try:
    from bravado.fido_client import FidoClient
except ImportError:
    FidoClient = Mock()


@pytest.mark.skipif(six.PY3, reason="twisted doesnt support py3 yet")
def test_no_timeouts_passed_to_fido():
    with patch('bravado.fido_client.fido.fetch') as fetch:
        fido_client = FidoClient()
        request_params = dict(url='http://foo.com/')
        fido_client.request(request_params, response_callback=None)
        assert fetch.call_args == call(
            'http://foo.com/?', body='', headers={}, method='GET')


@pytest.mark.skipif(six.PY3, reason="twisted doesnt support py3 yet")
def test_timeout_passed_to_fido():
    with patch('bravado.fido_client.fido.fetch') as fetch:
        fido_client = FidoClient()
        request_params = dict(url='http://foo.com/', timeout=1)
        fido_client.request(request_params, response_callback=None)
        assert fetch.call_args == call(
            'http://foo.com/?', body='', headers={}, method='GET', timeout=1)


@pytest.mark.skipif(six.PY3, reason="twisted doesnt support py3 yet")
def test_connect_timeout_passed_to_fido():
    with patch('bravado.fido_client.fido.fetch') as fetch:
        fido_client = FidoClient()
        request_params = dict(url='http://foo.com/', connect_timeout=1)
        fido_client.request(request_params, response_callback=None)
        assert fetch.call_args == call(
            'http://foo.com/?', body='', headers={}, method='GET',
            connect_timeout=1)


@pytest.mark.skipif(six.PY3, reason="twisted doesnt support py3 yet")
def test_connect_timeout_and_timeout_passed_to_fido():
    with patch('bravado.fido_client.fido.fetch') as fetch:
        fido_client = FidoClient()
        request_params = dict(url='http://foo.com/', connect_timeout=1,
                              timeout=2)
        fido_client.request(request_params, response_callback=None)
        assert fetch.call_args == call(
            'http://foo.com/?', body='', headers={}, method='GET',
            connect_timeout=1, timeout=2)
{'fraction_non_alphanumeric': 0.13512241054613935, 'fraction_numerical': 0.007768361581920904, 'mean_word_length': 3.5154091392136024, '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': '3391111', 'n_tokens_mistral': 1387, 'n_tokens_neox': 1358, 'n_words': 257}