def test_throwExceptionIntoGenerator(self):
    '\n        It should be possible to throw the exception that a Failure\n        represents into a generator.\n        '
    stuff = []

    def generator():
        try:
            (yield)
        except:
            stuff.append(sys.exc_info())
        else:
            self.fail('Yield should have yielded exception.')
    g = generator()
    f = getDivisionFailure()
    next(g)
    self._throwIntoGenerator(f, g)
    self.assertEqual(stuff[0][0], ZeroDivisionError)
    self.assertIsInstance(stuff[0][1], ZeroDivisionError)
    self.assertEqual(traceback.extract_tb(stuff[0][2])[(- 1)][(- 1)], '1/0')
It should be possible to throw the exception that a Failure
represents into a generator.
def test_throwExceptionIntoGenerator(self):
    '\n        It should be possible to throw the exception that a Failure\n        represents into a generator.\n        '
    stuff = []

    def generator():
        try:
            (yield)
        except:
            stuff.append(sys.exc_info())
        else:
            self.fail('Yield should have yielded exception.')
    g = generator()
    f = getDivisionFailure()
    next(g)
    self._throwIntoGenerator(f, g)
    self.assertEqual(stuff[0][0], ZeroDivisionError)
    self.assertIsInstance(stuff[0][1], ZeroDivisionError)
    self.assertEqual(traceback.extract_tb(stuff[0][2])[(- 1)][(- 1)], '1/0')