def test_exception_is_None(self):
NONE_EXC_STRING = 'NoneType: None\n'
+ excfile = StringIO()
+ traceback.print_exception(None, file=excfile)
+ self.assertEqual(excfile.getvalue(), NONE_EXC_STRING)
+
excfile = StringIO()
traceback.print_exception(None, None, None, file=excfile)
self.assertEqual(excfile.getvalue(), NONE_EXC_STRING)
self.assertEqual(excfile.getvalue(), NONE_EXC_STRING)
self.assertEqual(traceback.format_exc(None), NONE_EXC_STRING)
+ self.assertEqual(traceback.format_exception(None), [NONE_EXC_STRING])
self.assertEqual(
traceback.format_exception(None, None, None), [NONE_EXC_STRING])
self.assertEqual(
if (value is _sentinel) != (tb is _sentinel):
raise ValueError("Both or neither of value and tb must be given")
if value is tb is _sentinel:
- return exc, exc.__traceback__
+ if exc is not None:
+ return exc, exc.__traceback__
+ else:
+ return None, None
return value, tb