<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from nose2.tools import such

from tests.common.compat import mock
from mockingbird import fake, TestDoubleConfigurationError, get_qualified_name
from tests.common.layers import UnitTestsLayer
from tests.unit.fakes.support import RealObject


with such.A('Fake Object') as it:
    it.uses(UnitTestsLayer)

    @it.should('raise a TypeError when the configuration does not exist')
    def test_should_raise_type_error_when_configuration_does_not_exist(case):
        with case.assertRaisesRegexp(TypeError, 'A fake testdouble must have a Configuration class.'):
            fake(object)

    @it.should('raise a TestDoubleConfigurationError when the configuration does not contain the type to be faked')
    def test_should_raise_test_double_configuration_error_when_configuration_does_contain_spec(case):
        class FakeObject(object):
            class Configuration(object):
                pass

        with case.assertRaisesRegexp(TestDoubleConfigurationError, 'The type to be faked was not specified.'):
            fake(FakeObject)

    it.createTests(globals())
<commit_msg>Optimized imports.<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from nose2.tools import such

from mockingbird import fake, TestDoubleConfigurationError
from tests.common.layers import UnitTestsLayer


with such.A('Fake Object') as it:
    it.uses(UnitTestsLayer)

    @it.should('raise a TypeError when the configuration does not exist')
    def test_should_raise_type_error_when_configuration_does_not_exist(case):
        with case.assertRaisesRegexp(TypeError, 'A fake testdouble must have a Configuration class.'):
            fake(object)

    @it.should('raise a TestDoubleConfigurationError when the configuration does not contain the type to be faked')
    def test_should_raise_test_double_configuration_error_when_configuration_does_contain_spec(case):
        class FakeObject(object):
            class Configuration(object):
                pass

        with case.assertRaisesRegexp(TestDoubleConfigurationError, 'The type to be faked was not specified.'):
            fake(FakeObject)

    it.createTests(globals())

{'fraction_non_alphanumeric': 0.07520510483135825, 'fraction_numerical': 0.0018231540565177757, 'mean_word_length': 4.045977011494253, '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': '4126239', 'n_tokens_mistral': 601, 'n_tokens_neox': 583, 'n_words': 166}