# Path: doubles/instance_double.py
# class InstanceDouble(ObjectDouble):
#     """A pure double representing an instance of the target class.
# 
#     Any kwargs supplied will be set as attributes on the instance that is
#     created.
# 
#     ::
# 
#         user = InstanceDouble('myapp.User', name='Bob Barker')
# 
#     :param str path: The absolute module path to the class.
#     """
# 
#     def __init__(self, path, **kwargs):
#         module_path, class_name = get_path_components(path)
#         module = get_module(module_path, path)
#         self._doubles_target = _get_doubles_target(module, class_name, path)
#         for k, v in kwargs.items():
#             setattr(self, k, v)
# 
# Path: doubles/targets/expectation_target.py
# def expect(target):
#     """
#     Prepares a target object for a method call expectation (mock). The name of the method to expect
#     should be called as a method on the return value of this function::
# 
#         expect(foo).bar
# 
#     Accessing the ``bar`` attribute will return an ``Expectation`` which provides additional methods
#     to configure the mock.
# 
#     :param object target: The object that will be mocked.
#     :return: An ``ExpectationTarget`` for the target object.
#     """
# 
#     return ExpectationTarget(target)
# 
# Path: doubles/unittest.py
# class TestCase(unittest.TestCase):
#     def __init__(self, methodName='runTest'):
#         super(TestCase, self).__init__(methodName)
# 
#         setattr(self, self._testMethodName, wrap_test(getattr(self, self._testMethodName)))
# 
#     def setUp(self):
#         self.addCleanup(teardown)


import unittest
    from StringIO import StringIO
    from io import StringIO
from doubles.instance_double import InstanceDouble
from doubles.targets.expectation_target import expect
from doubles.unittest import TestCase

try:
except ImportError:



def test_unittest_integration():
    class UnittestIntegration(TestCase):
        def runTest(self):
            subject = InstanceDouble('doubles.testing.User')

            expect(subject).instance_method

    test_loader = unittest.TestLoader()
    suite = test_loader.loadTestsFromTestCase(UnittestIntegration)
    stream = StringIO()
    runner = unittest.TextTestRunner(stream=stream)

# Path: doubles/instance_double.py
# class InstanceDouble(ObjectDouble):
#     """A pure double representing an instance of the target class.
# 
#     Any kwargs supplied will be set as attributes on the instance that is
#     created.
# 
#     ::
# 
#         user = InstanceDouble('myapp.User', name='Bob Barker')
# 
#     :param str path: The absolute module path to the class.
#     """
# 
#     def __init__(self, path, **kwargs):
#         module_path, class_name = get_path_components(path)
#         module = get_module(module_path, path)
#         self._doubles_target = _get_doubles_target(module, class_name, path)
#         for k, v in kwargs.items():
#             setattr(self, k, v)
# 
# Path: doubles/targets/expectation_target.py
# def expect(target):
#     """
#     Prepares a target object for a method call expectation (mock). The name of the method to expect
#     should be called as a method on the return value of this function::
# 
#         expect(foo).bar
# 
#     Accessing the ``bar`` attribute will return an ``Expectation`` which provides additional methods
#     to configure the mock.
# 
#     :param object target: The object that will be mocked.
#     :return: An ``ExpectationTarget`` for the target object.
#     """
# 
#     return ExpectationTarget(target)
# 
# Path: doubles/unittest.py
# class TestCase(unittest.TestCase):
#     def __init__(self, methodName='runTest'):
#         super(TestCase, self).__init__(methodName)
# 
#         setattr(self, self._testMethodName, wrap_test(getattr(self, self._testMethodName)))
# 
#     def setUp(self):
#         self.addCleanup(teardown)


# Path: test/unittest_test.py
import unittest
    from StringIO import StringIO
    from io import StringIO
from doubles.instance_double import InstanceDouble
from doubles.targets.expectation_target import expect
from doubles.unittest import TestCase


try:
except ImportError:



def test_unittest_integration():
    class UnittestIntegration(TestCase):
        def runTest(self):
            subject = InstanceDouble('doubles.testing.User')

            expect(subject).instance_method

    test_loader = unittest.TestLoader()
    suite = test_loader.loadTestsFromTestCase(UnittestIntegration)
    stream = StringIO()
    runner = unittest.TextTestRunner(stream=stream)

    result = runner.run(suite)