Пример #1
0
 def test_manyFrames(self):
     """
     A C{_Traceback} object constructed with multiple frames should be able
     to be passed to L{traceback.extract_tb}, and we should get a list
     containing a tuple for each frame.
     """
     tb = _Traceback([
         ['method1', 'filename.py', 123, {}, {}],
         ['method2', 'filename.py', 235, {}, {}]])
     self.assertEqual(traceback.extract_tb(tb),
                      [('filename.py', 123, 'method1', None),
                       ('filename.py', 235, 'method2', None)])
Пример #2
0
 def test_singleFrame(self):
     """
     A C{_Traceback} object constructed with a single frame should be able
     to be passed to L{traceback.extract_tb}, and we should get a singleton
     list containing a (filename, lineno, methodname, line) tuple.
     """
     tb = _Traceback([['method', 'filename.py', 123, {}, {}]])
     # Note that we don't need to test that extract_tb correctly extracts
     # the line's contents. In this case, since filename.py doesn't exist,
     # it will just use None.
     self.assertEqual(traceback.extract_tb(tb),
                      [('filename.py', 123, 'method', None)])