<commit_before>import fudge
from unittest import TestCase
from fakery.fudge_test_case import FudgeTestCase

class FudgeTestCaseTest(TestCase):

    class MyTest(FudgeTestCase):
        def test_foo(self):
            pass
        def tearDown(self):
            pass

    def tearDown(self):
        fudge.clear_expectations()

    @fudge.with_fakes
    def test_patches_test_method_to_clear_calls(self):
        self.setup_fudge_mocks()

        self.clear_calls_mock.expects_call()

        test_case = FudgeTestCaseTest.MyTest('test_foo')
        test_case.test_foo()
        self.restore_fudge_patches()

    @fudge.with_fakes
    def test_patches_test_method_to_verify(self):
        self.setup_fudge_mocks()

        self.verify_mock.expects_call()

        test_case = FudgeTestCaseTest.MyTest('test_foo')
        test_case.test_foo()
        self.restore_fudge_patches()

    @fudge.with_fakes
    def test_clears_expectations_in_tear_down(self):
        self.setup_fudge_mocks()

        self.clear_expectations_mock.expects_call()

        test_case = FudgeTestCaseTest.MyTest('test_foo')
        test_case.tearDown()
        self.restore_fudge_patches()

    @fudge.with_fakes
    def test_patches_test_method_to_clear_calls_only_once(self):
        self.setup_fudge_mocks()

        self.verify_mock.expects_call().times_called(1)
        self.clear_calls_mock.expects_call().times_called(1)
<commit_msg>FudgeTestCase should call clear_expectations on class without tearDown<commit_after>import fudge
from unittest import TestCase
from fakery.fudge_test_case import FudgeTestCase

class FudgeTestCaseTest(TestCase):

    class MyTest(FudgeTestCase):
        def test_foo(self):
            pass
        def tearDown(self):
            pass

    def tearDown(self):
        fudge.clear_expectations()

    @fudge.with_fakes
    def test_patches_test_method_to_clear_calls(self):
        self.setup_fudge_mocks()

        self.clear_calls_mock.expects_call()

        test_case = FudgeTestCaseTest.MyTest('test_foo')
        test_case.test_foo()
        self.restore_fudge_patches()

    @fudge.with_fakes
    def test_patches_test_method_to_verify(self):
        self.setup_fudge_mocks()

        self.verify_mock.expects_call()

        test_case = FudgeTestCaseTest.MyTest('test_foo')
        test_case.test_foo()
        self.restore_fudge_patches()

    @fudge.with_fakes
    def test_clears_expectations_in_tear_down(self):
        self.setup_fudge_mocks()

        self.clear_expectations_mock.expects_call()

        test_case = FudgeTestCaseTest.MyTest('test_foo')
        test_case.tearDown()
        self.restore_fudge_patches()

    @fudge.with_fakes
    def test_clears_expectations_in_class_without_tear_down(self):
        self.setup_fudge_mocks()
        class TestWithoutTearDown(FudgeTestCase):
            def test_foo(self):
                pass

        self.clear_expectations_mock.expects_call()

        test_case = TestWithoutTearDown('test_foo')
        test_case.tearDown()
        self.restore_fudge_patches()

    @fudge.with_fakes
    def test_patches_test_method_to_clear_calls_only_once(self):
        self.setup_fudge_mocks()

        self.verify_mock.expects_call().times_called(1)
        self.clear_calls_mock.expects_call().times_called(1)

{'fraction_non_alphanumeric': 0.07940371159111652, 'fraction_numerical': 0.001216915120170368, 'mean_word_length': 3.1725888324873095, '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': '351565', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1086, 'n_words': 133}