MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_extract_stack

Method test_extract_stack

Lib/test/test_traceback.py:3260–3286  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3258
3259 @unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 1 not greater than 5
3260 def test_extract_stack(self):
3261 frame = self.last_returns_frame5()
3262 def extract(**kwargs):
3263 return traceback.extract_stack(frame, **kwargs)
3264 def assertEqualExcept(actual, expected, ignore):
3265 self.assertEqual(actual[:ignore], expected[:ignore])
3266 self.assertEqual(actual[ignore+1:], expected[ignore+1:])
3267 self.assertEqual(len(actual), len(expected))
3268
3269 with support.swap_attr(sys, 'tracebacklimit', 1000):
3270 nolim = extract()
3271 self.assertGreater(len(nolim), 5)
3272 self.assertEqual(extract(limit=2), nolim[-2:])
3273 assertEqualExcept(extract(limit=100), nolim[-100:], -5-1)
3274 self.assertEqual(extract(limit=-2), nolim[:2])
3275 assertEqualExcept(extract(limit=-100), nolim[:100], len(nolim)-5-1)
3276 self.assertEqual(extract(limit=0), [])
3277 del sys.tracebacklimit
3278 assertEqualExcept(extract(), nolim, -5-1)
3279 sys.tracebacklimit = 2
3280 self.assertEqual(extract(), nolim[-2:])
3281 self.assertEqual(extract(limit=3), nolim[-3:])
3282 self.assertEqual(extract(limit=-3), nolim[:3])
3283 sys.tracebacklimit = 0
3284 self.assertEqual(extract(), [])
3285 sys.tracebacklimit = -1
3286 self.assertEqual(extract(), [])
3287
3288 def test_extract_tb(self):
3289 try:

Callers

nothing calls this directly

Calls 5

last_returns_frame5Method · 0.95
extractFunction · 0.85
lenFunction · 0.85
assertGreaterMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected