def test_traceback_list(self): ex = Exception("Boo") ex.__traceback__ = traceback.extract_stack() tbk = _format_traceback(ex) self.assertTrue(isinstance(tbk, (list, tuple))) self.assertTrue(len(tbk) > 0) self.assertTrue('test_traceback_list' in tbk[-1])
def test_no_traceback(self): tbk = _format_traceback(Exception()) self.assertTrue(isinstance(tbk, (list, tuple))) self.assertTrue(len(tbk) == 1) self.assertTrue(tbk == ["No traceback available"])