<commit_before>from unittest.case import TestCase

from eventsourcing.domain.model.decorators import mutator, retry


class TestDecorators(TestCase):

    def test_retry_without_arg(self):
        def func(*args):
            """func docstring"""
            return 1

        def func_raises(exc=Exception):
            """func_raises docstring"""
            raise exc

        # Check docstrings of decorated functions.<commit_msg>Finished retry decorator test, to check TypeError is raised if exc is not an exception class.<commit_after>from unittest.case import TestCase

from eventsourcing.domain.model.decorators import mutator, retry


class TestDecorators(TestCase):

    def test_retry_without_arg(self):
        # Check the exc arg must be an exception class.
        with self.assertRaises(TypeError):
            self.assertEqual(retry(exc=TestCase), 1)

        # Check docstrings of decorated functions.
        def func(*args):
            """func docstring"""
            return 1

        def func_raises(exc=Exception):
            """func_raises docstring"""
            raise exc

{'fraction_non_alphanumeric': 0.07901907356948229, 'fraction_numerical': 0.0027247956403269754, 'mean_word_length': 2.7104377104377106, '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': '1363764', 'n_tokens_mistral': 292, 'n_tokens_neox': 281, 'n_words': 87}