コード例 #1
0
 def test_list_exc_info_handling_multiple_exceptions(self):
     a = make_exception(RuntimeError, 'a')
     b = make_exception(ValueError, 'b')
     c = make_exception(TypeError, 'c')
     multi = make_exception(testtools.MultipleExceptions, a, b, c)
     result = tobiko.list_exc_infos(exc_info=multi)
     self.assertEqual([a, b, c], result)
コード例 #2
0
 def test_list_exc_info_handling_nested_multiple_exceptions(self):
     a = make_exception(RuntimeError, 'a')
     b = make_exception(ValueError, 'b')
     c = make_exception(TypeError, 'c')
     d = make_exception(IndexError, 'd')
     inner = make_exception(testtools.MultipleExceptions, b, c)
     multi = make_exception(testtools.MultipleExceptions, a, inner, d)
     result = tobiko.list_exc_infos(exc_info=multi)
     self.assertEqual([a, b, c, d], result)
コード例 #3
0
 def test_list_exc_info_handling_empty_multiple_exceptions(self):
     error = make_exception(testtools.MultipleExceptions)
     result = tobiko.list_exc_infos(exc_info=error)
     self.assertEqual([], result)
コード例 #4
0
 def test_list_exc_info_handling_exception(self):
     try:
         raise RuntimeError('error')
     except RuntimeError:
         result = tobiko.list_exc_infos()
         self.assertEqual([sys.exc_info()], result)
コード例 #5
0
 def test_list_exc_info_with_info(self):
     error = make_exception(RuntimeError, 'error')
     result = tobiko.list_exc_infos(exc_info=error)
     self.assertEqual([error], result)
コード例 #6
0
 def test_list_exc_info(self):
     result = tobiko.list_exc_infos()
     self.assertEqual([], result)