MCPcopy Index your code
hub / github.com/python/cpython / test_get_traces

Method test_get_traces

Lib/test/test_tracemalloc.py:189–202  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

187 self.fail("trace not found")
188
189 def test_get_traces(self):
190 tracemalloc.clear_traces()
191 obj_size = 12345
192 obj, obj_traceback = allocate_bytes(obj_size)
193
194 traces = tracemalloc._get_traces()
195 trace = self.find_trace(traces, obj_traceback, obj_size)
196
197 self.assertIsInstance(trace, tuple)
198 domain, size, traceback, length = trace
199 self.assertEqual(traceback, obj_traceback._frames)
200
201 tracemalloc.stop()
202 self.assertEqual(tracemalloc._get_traces(), [])
203
204 def test_get_traces_intern_traceback(self):
205 # dummy wrappers to get more useful and identical frames in the traceback

Callers

nothing calls this directly

Calls 5

find_traceMethod · 0.95
allocate_bytesFunction · 0.85
assertIsInstanceMethod · 0.80
assertEqualMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected