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

Method test_linear_methods

Lib/test/test_trace.py:220–234  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

218 self.assertEqual(self.tracer.results().counts, expected)
219
220 def test_linear_methods(self):
221 # XXX todo: later add 'static_method_linear' and 'class_method_linear'
222 # here, once issue1764286 is resolved
223 #
224 for methname in ['inst_method_linear',]:
225 tracer = Trace(count=1, trace=0, countfuncs=0, countcallers=0)
226 traced_obj = TracedClass(25)
227 method = getattr(traced_obj, methname)
228 tracer.runfunc(method, 20)
229
230 firstlineno = get_firstlineno(method)
231 expected = {
232 (self.my_py_filename, firstlineno + 1): 1,
233 }
234 self.assertEqual(tracer.results().counts, expected)
235
236
237class TestRunExecCounts(unittest.TestCase):

Callers

nothing calls this directly

Calls 6

runfuncMethod · 0.95
resultsMethod · 0.95
TraceClass · 0.90
TracedClassClass · 0.85
get_firstlinenoFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected