def some_inner(k, v): a = 1 b = 2 return traceback.StackSummary.extract(traceback.walk_stack(None), capture_locals=True, limit=1)
def test_extract_stack(self): s = traceback.StackSummary.extract(traceback.walk_stack(None)) self.assertIsInstance(s, traceback.StackSummary)
def test_extract_stack_limit(self): s = traceback.StackSummary.extract(traceback.walk_stack(None), limit=5) self.assertEqual(len(s), 5)
def test_walk_stack(self): s = list(traceback.walk_stack(None)) self.assertGreater(len(s), 10)
def some_inner(k, v): a = 1 b = 2 return traceback.StackSummary.extract( traceback.walk_stack(None), capture_locals=True, limit=1)