<commit_before>==================
 Further Examples
==================

.. currentmodule:: mock

.. testsetup::

    import sys, unittest2
    from mock import MagicMock, Mock, patch
    from datetime import date

    BackendProvider = Mock()
    sys.modules['mymodule'] = mymodule = Mock(name='mymodule')

    def grob(val):
        "First frob and then clear val"
        mymodule.frob(val)
        val.clear()

    mymodule.frob = lambda val: val
    mymodule.grob = grob
    mymodule.date = date

    class TestCase(unittest2.TestCase):
        def run(self):
            result = unittest2.TestResult()
            out = unittest2.TestCase.run(self, result)
            assert result.wasSuccessful()
            return out

    def configure_mock(mock, **kwargs):
        if mock is None:
            mock = Mock()
        for arg, val in sorted(kwargs.items(), key=lambda entry: len(entry[0].split('.'))):
            args = arg.split('.')
            final = args.pop()
            obj = mock
            for entry in args:<commit_msg>Fix examples.txt for recent versions of unittest2<commit_after>==================
 Further Examples
==================

.. currentmodule:: mock

.. testsetup::

    import sys, unittest2
    from mock import MagicMock, Mock, patch
    from datetime import date

    BackendProvider = Mock()
    sys.modules['mymodule'] = mymodule = Mock(name='mymodule')

    def grob(val):
        "First frob and then clear val"
        mymodule.frob(val)
        val.clear()

    mymodule.frob = lambda val: val
    mymodule.grob = grob
    mymodule.date = date

    class TestCase(unittest2.TestCase):
        def run(self):
            result = unittest2.TestResult()
            out = unittest2.TestCase.run(self, result)
            assert result.wasSuccessful()

    def configure_mock(mock, **kwargs):
        if mock is None:
            mock = Mock()
        for arg, val in sorted(kwargs.items(), key=lambda entry: len(entry[0].split('.'))):
            args = arg.split('.')
            final = args.pop()
            obj = mock
            for entry in args:
{'fraction_non_alphanumeric': 0.139723414401526, 'fraction_numerical': 0.005245588936576061, 'mean_word_length': 2.2476780185758516, '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': '6492593', 'n_tokens_mistral': 605, 'n_tokens_neox': 606, 'n_words': 167}