<commit_before>=========
 Helpers
=========

.. currentmodule:: mock

.. testsetup::

    mock.FILTER_DIR = True
    from pprint import pprint as pp
    original_dir = dir
    def dir(obj):
        print pp(original_dir(obj))

    import urllib2
    __main__.urllib2 = urllib2

.. testcleanup::

    dir = original_dir
    mock.FILTER_DIR = True



call
====

.. function:: call(*args, **kwargs)

    `call` is a helper object for making simpler assertions, for comparing
    with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`,
    :attr:`~Mock.mock_calls` and:attr: `~Mock.method_calls`. `call` can also be
    used with :meth:`~Mock.assert_has_calls`.

    .. doctest::

        >>> m = MagicMock(return_value=None)
        >>> m(1, 2, a='foo', b='bar')
        >>> m()
        >>> m.call_args_list == [call(1, 2, a='foo', b='bar'), call()]
        True

.. method:: call.call_list()

    For a call object that represents multiple calls, `call_list`
    returns a list of all the intermediate calls as well as the
    final call.

`call_list` is particularly useful for making assertions on "chained calls". A
chained call is multiple calls on a single line of code. This results in
multiple entries in :attr:`~Mock.mock_calls` on a mock. Manually constructing
the sequence of calls can be tedious.

:meth:`~call.call_list` can construct the sequence of calls from the same
chained call:<commit_msg>Doc typo fix<commit_after>=========
 Helpers
=========

.. currentmodule:: mock

.. testsetup::

    mock.FILTER_DIR = True
    from pprint import pprint as pp
    original_dir = dir
    def dir(obj):
        print pp(original_dir(obj))

    import urllib2
    __main__.urllib2 = urllib2

.. testcleanup::

    dir = original_dir
    mock.FILTER_DIR = True



call
====

.. function:: call(*args, **kwargs)

    `call` is a helper object for making simpler assertions, for comparing
    with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`,
    :attr:`~Mock.mock_calls` and :attr: `~Mock.method_calls`. `call` can also be
    used with :meth:`~Mock.assert_has_calls`.

    .. doctest::

        >>> m = MagicMock(return_value=None)
        >>> m(1, 2, a='foo', b='bar')
        >>> m()
        >>> m.call_args_list == [call(1, 2, a='foo', b='bar'), call()]
        True

.. method:: call.call_list()

    For a call object that represents multiple calls, `call_list`
    returns a list of all the intermediate calls as well as the
    final call.

`call_list` is particularly useful for making assertions on "chained calls". A
chained call is multiple calls on a single line of code. This results in
multiple entries in :attr:`~Mock.mock_calls` on a mock. Manually constructing
the sequence of calls can be tedious.

:meth:`~call.call_list` can construct the sequence of calls from the same
chained call:
{'fraction_non_alphanumeric': 0.13120567375886524, 'fraction_numerical': 0.004964539007092199, 'mean_word_length': 3.2742424242424244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '5853032', 'n_tokens_mistral': 906, 'n_tokens_neox': 873, 'n_words': 300}