def test_patch_with_exception(self):
        foo = {}

        @patch.dict(foo, {'a': 'b'})
        def test():
            raise NameError('Konrad')
        try:
            test()
        except __HOLE__:
            pass
        else:
            self.fail('NameError not raised by test')

        self.assertEqual(foo, {})
dataset/ETHPy150Open calvinchengx/python-mock/tests/testpatch.py/PatchTest.test_patch_with_exception