コード例 #1
0
 def test_tracebackFromFailure(self):
     """
     Errors added through the L{PyUnitResultAdapter} have the same traceback
     information as if there were no adapter at all.
     """
     try:
         1 / 0
     except ZeroDivisionError:
         exc_info = sys.exc_info()
         f = Failure()
     pyresult = pyunit.TestResult()
     result = PyUnitResultAdapter(pyresult)
     result.addError(self, f)
     self.assertEqual(pyresult.errors[0][1], "".join(traceback.format_exception(*exc_info)))
コード例 #2
0
 def test_tracebackFromFailure(self):
     """
     Errors added through the L{PyUnitResultAdapter} have the same traceback
     information as if there were no adapter at all.
     """
     try:
         1/0
     except ZeroDivisionError:
         exc_info = sys.exc_info()
         f = Failure()
     pyresult = pyunit.TestResult()
     result = PyUnitResultAdapter(pyresult)
     result.addError(self, f)
     self.assertEqual(pyresult.errors[0][1],
                      ''.join(traceback.format_exception(*exc_info)))